diff options
Diffstat (limited to 'core/org.eclipse.cdt.ui/src')
347 files changed, 837 insertions, 837 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java index c9be45ef9aa..7e87a4f9350 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java @@ -439,7 +439,7 @@ public class StubUtility { IDocument doc = new Document(buffer.getString()); int nLines = doc.getNumberOfLines(); MultiTextEdit edit = new MultiTextEdit(); - HashSet<Integer> removedLines = new HashSet<Integer>(); + HashSet<Integer> removedLines = new HashSet<>(); for (int i = 0; i < variables.length; i++) { TemplateVariable position = findVariable(buffer, variables[i]); if (position == null) { @@ -762,7 +762,7 @@ public class StubUtility { } templateDatas = projectStore.getTemplateData(); } - List<Template> result = new ArrayList<Template>(); + List<Template> result = new ArrayList<>(); for (int j = 0; j < contentTypes.length; j++) { for (int i = 0; i < templateDatas.length; i++) { Template template = templateDatas[i].getTemplate(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalModel.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalModel.java index f435b0d82a6..087be3a3a59 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalModel.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalModel.java @@ -31,7 +31,7 @@ public class LinkedProposalModel { } if (fPositionGroups == null) { - fPositionGroups = new HashMap<String, LinkedProposalPositionGroup>(); + fPositionGroups = new HashMap<>(); } fPositionGroups.put(positionGroup.getGroupId(), positionGroup); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalPositionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalPositionGroup.java index ce56e364793..cb16dd6a767 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalPositionGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/fix/LinkedProposalPositionGroup.java @@ -113,8 +113,8 @@ public class LinkedProposalPositionGroup { public LinkedProposalPositionGroup(String groupID) { fGroupId = groupID; - fPositions = new ArrayList<PositionInformation>(); - fProposals = new ArrayList<Proposal>(); + fPositions = new ArrayList<>(); + fProposals = new ArrayList<>(); } public void addPosition(PositionInformation position) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/BranchFlowInfo.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/BranchFlowInfo.java index 8af3398e546..00186f662e2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/BranchFlowInfo.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/BranchFlowInfo.java @@ -22,7 +22,7 @@ class BranchFlowInfo extends FlowInfo { public BranchFlowInfo(IASTName label, FlowContext context) { super(NO_RETURN); - fBranches = new HashSet<String>(2); + fBranches = new HashSet<>(2); fBranches.add(makeString(label)); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowAnalyzer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowAnalyzer.java index 9b8e209df83..ec01bb42528 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowAnalyzer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowAnalyzer.java @@ -100,8 +100,8 @@ abstract class FlowAnalyzer extends ASTGenericVisitor { static protected class SwitchData { private boolean fHasDefaultCase; - private final List<IRegion> fRanges = new ArrayList<IRegion>(4); - private final List<FlowInfo> fInfos = new ArrayList<FlowInfo>(4); + private final List<IRegion> fRanges = new ArrayList<>(4); + private final List<FlowInfo> fInfos = new ArrayList<>(4); public void setHasDefaultCase() { fHasDefaultCase = true; @@ -129,7 +129,7 @@ abstract class FlowAnalyzer extends ASTGenericVisitor { } } - private final HashMap<IASTNode, FlowInfo> fData = new HashMap<IASTNode, FlowInfo>(100); + private final HashMap<IASTNode, FlowInfo> fData = new HashMap<>(100); FlowContext fFlowContext; public FlowAnalyzer(FlowContext context) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowContext.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowContext.java index cbba70d5c72..850ccefcd05 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowContext.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowContext.java @@ -44,7 +44,7 @@ public class FlowContext extends LocalVariableIndex { public FlowContext(IASTFunctionDefinition functionDefinition) { super(functionDefinition); - fExceptionStack = new ArrayList<ICPPASTCatchHandler[]>(3); + fExceptionStack = new ArrayList<>(3); } public void setConsiderAccessMode(boolean b) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowInfo.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowInfo.java index 3d0b7da93c8..be6e06a8e75 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowInfo.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/FlowInfo.java @@ -232,7 +232,7 @@ public abstract class FlowInfo { public Set<IVariable> get(FlowContext context, int mode) { if (fAccessModes == null) return Collections.emptySet(); - Set<IVariable> result = new HashSet<IVariable>(fAccessModes.length); + Set<IVariable> result = new HashSet<>(fAccessModes.length); for (int i = 0; i < fAccessModes.length; i++) { int accessMode = fAccessModes[i]; if ((accessMode & mode) != 0) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/LocalVariableIndex.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/LocalVariableIndex.java index 1083d36f9f1..a32070d330d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/LocalVariableIndex.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/refactoring/code/flow/LocalVariableIndex.java @@ -30,7 +30,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; * one. */ public class LocalVariableIndex { - private final Map<IVariable, Integer> variableMap = new HashMap<IVariable, Integer>(); + private final Map<IVariable, Integer> variableMap = new HashMap<>(); public LocalVariableIndex(IASTFunctionDefinition functionDefinition) { functionDefinition.accept(new ASTVisitor() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFormatter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFormatter.java index 4e4804c601b..fe65c123fb2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFormatter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/CFormatter.java @@ -354,10 +354,10 @@ public class CFormatter { private List<TypedPosition> createRangeMarkers(TemplateVariable[] variables, IDocument document) throws MalformedTreeException, BadLocationException { - Map<ReplaceEdit, String> markerToOriginal = new HashMap<ReplaceEdit, String>(); + Map<ReplaceEdit, String> markerToOriginal = new HashMap<>(); MultiTextEdit root = new MultiTextEdit(0, document.getLength()); - List<TextEdit> edits = new ArrayList<TextEdit>(); + List<TextEdit> edits = new ArrayList<>(); boolean hasModifications = false; for (int i = 0; i != variables.length; i++) { final TemplateVariable variable = variables[i]; @@ -388,7 +388,7 @@ public class CFormatter { root.apply(document, TextEdit.UPDATE_REGIONS); } - List<TypedPosition> positions = new ArrayList<TypedPosition>(); + List<TypedPosition> positions = new ArrayList<>(); for (Iterator<TextEdit> it = edits.iterator(); it.hasNext();) { TextEdit edit = it.next(); try { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java index c177f4afce0..a6de6963391 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/template/c/FileTemplateContextType.java @@ -196,7 +196,7 @@ public class FileTemplateContextType extends TemplateContextType { @Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { - ArrayList<String> required = new ArrayList<String>(5); + ArrayList<String> required = new ArrayList<>(5); for (int i = 0; i < variables.length; i++) { String type = variables[i].getType(); if (getResolver(type) == null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java index c88b797fad9..583368e9d39 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java @@ -101,7 +101,7 @@ public class Resources { * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object) */ public static IStatus makeCommittable(IResource[] resources, Object context) { - List<IResource> readOnlyFiles = new ArrayList<IResource>(); + List<IResource> readOnlyFiles = new ArrayList<>(); for (int i = 0; i < resources.length; i++) { IResource resource = resources[i]; if (resource.getType() == IResource.FILE) { @@ -133,7 +133,7 @@ public class Resources { } private static Map<IFile, Long> createModificationStampMap(List<IResource> files) { - Map<IFile, Long> map = new HashMap<IFile, Long>(); + Map<IFile, Long> map = new HashMap<>(); for (Iterator<IResource> iter = files.iterator(); iter.hasNext();) { IFile file = (IFile) iter.next(); map.put(file, Long.valueOf(file.getModificationStamp())); @@ -177,7 +177,7 @@ public class Resources { } public static String[] getLocationOSStrings(IResource[] resources) { - List<String> result = new ArrayList<String>(resources.length); + List<String> result = new ArrayList<>(resources.length); for (int i = 0; i < resources.length; i++) { IPath location = resources[i].getLocation(); if (location != null) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java index bc866c132b9..cc92fdd0203 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java @@ -425,7 +425,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { if (!cproject.getProject().isOpen()) return NO_CHILDREN; - List<ICElement> list = new ArrayList<ICElement>(); + List<ICElement> list = new ArrayList<>(); ICElement[] children = cproject.getChildren(); for (ICElement child : children) { if (child instanceof ISourceRoot && child.getResource().getType() == IResource.PROJECT) { @@ -454,7 +454,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { Object[] children = unit.getChildren(); if (fIncludesGrouping) { boolean hasInclude = false; - ArrayList<Object> list = new ArrayList<Object>(children.length); + ArrayList<Object> list = new ArrayList<>(children.length); for (int i = 0; i < children.length; i++) { if (!(children[i] instanceof IInclude)) { list.add(children[i]); @@ -467,10 +467,10 @@ public class BaseCElementContentProvider implements ITreeContentProvider { } children = list.toArray(); } - Map<String, NamespacesGrouping> nsmap = new HashMap<String, NamespacesGrouping>(); + Map<String, NamespacesGrouping> nsmap = new HashMap<>(); if (fNamespacesGrouping) { // check if there is another namespace with the same name for the same parent - List<Object> list = new ArrayList<Object>(children.length); + List<Object> list = new ArrayList<>(children.length); for (int i = 0; i < children.length; ++i) { if (children[i] instanceof INamespace) { INamespace n1 = (INamespace) children[i]; @@ -492,8 +492,8 @@ public class BaseCElementContentProvider implements ITreeContentProvider { } if (fMemberGrouping) { // check if there is another member with the same namespace for the same parent - List<Object> list = new ArrayList<Object>(children.length); - Map<String, MembersGrouping> map = new HashMap<String, MembersGrouping>(); + List<Object> list = new ArrayList<>(children.length); + Map<String, MembersGrouping> map = new HashMap<>(); for (int i = 0; i < children.length; ++i) { if (children[i] instanceof IMember) { final ICElement member = (ICElement) children[i]; @@ -515,7 +515,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { children = list.toArray(); } if (fMacroGrouping) { - ArrayList<Object> list = new ArrayList<Object>(children.length); + ArrayList<Object> list = new ArrayList<>(children.length); boolean hasMacros = false; for (int i = 0; i < children.length; i++) { if (!(children[i] instanceof IMacro)) @@ -542,8 +542,8 @@ public class BaseCElementContentProvider implements ITreeContentProvider { Object[] children = element.getChildren(); if (fMemberGrouping) { // check if there is another member with the same namespace for the same parent - List<Object> list = new ArrayList<Object>(children.length); - Map<String, MembersGrouping> map = new HashMap<String, MembersGrouping>(); + List<Object> list = new ArrayList<>(children.length); + Map<String, MembersGrouping> map = new HashMap<>(); for (int i = 0; i < children.length; ++i) { if (children[i] instanceof IMember) { final ICElement member = (ICElement) children[i]; @@ -602,9 +602,9 @@ public class BaseCElementContentProvider implements ITreeContentProvider { private List<ICElement> getMissingElements(ICContainer container, ICElement[] elements) { // nested source roots may be filtered out below the project root, // we need to find them to add them back in - List<ICElement> missingElements = new ArrayList<ICElement>(); + List<ICElement> missingElements = new ArrayList<>(); try { - List<IResource> missingContainers = new ArrayList<IResource>(); + List<IResource> missingContainers = new ArrayList<>(); IResource[] allChildren = container.getResource().members(); for (IResource child : allChildren) { if (!(child instanceof IContainer)) @@ -666,7 +666,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { } catch (CModelException e) { roots = new ISourceRoot[0]; } - List<Object> nonCResources = new ArrayList<Object>(objects.length); + List<Object> nonCResources = new ArrayList<>(objects.length); for (Object object : objects) { Object o = object; // A folder can also be a source root in the following case @@ -745,7 +745,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { protected IBinary[] getBinaries(IBinaryContainer container) throws CModelException { ICElement[] celements = container.getChildren(); - ArrayList<IBinary> list = new ArrayList<IBinary>(celements.length); + ArrayList<IBinary> list = new ArrayList<>(celements.length); for (ICElement celement : celements) { if (celement instanceof IBinary) { IBinary bin = (IBinary) celement; @@ -764,7 +764,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { protected IArchive[] getArchives(IArchiveContainer container) throws CModelException { ICElement[] celements = container.getChildren(); - ArrayList<IArchive> list = new ArrayList<IArchive>(celements.length); + ArrayList<IArchive> list = new ArrayList<>(celements.length); for (ICElement celement : celements) { if (celement instanceof IArchive) { IArchive ar = (IArchive) celement; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java index b2e759068e0..b62561b2f9b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java @@ -45,7 +45,7 @@ public class CPluginImages { public static final IPath ICONS_PATH = new Path("$nl$/icons"); //$NON-NLS-1$ /** Converter from CPluginImages key to CDTSharedImages key */ - private static Map<String, String> fPathMap = new HashMap<String, String>(); + private static Map<String, String> fPathMap = new HashMap<>(); private static final String NAME_PREFIX = CUIPlugin.PLUGIN_ID + '.'; private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/LineBackgroundPainter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/LineBackgroundPainter.java index a07e16e491c..f2d6520f5e7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/LineBackgroundPainter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/LineBackgroundPainter.java @@ -62,11 +62,11 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener { /** The viewer's widget */ private StyledText fTextWidget; /** Text positions (cursor line position is always at index 0 */ - private List<Position> fPositions = new ArrayList<Position>(); + private List<Position> fPositions = new ArrayList<>(); /** Cached text positions */ - private List<Position> fLastPositions = new ArrayList<Position>(); + private List<Position> fLastPositions = new ArrayList<>(); /** Temporary changed positions */ - private List<Position> fChangedPositions = new ArrayList<Position>(); + private List<Position> fChangedPositions = new ArrayList<>(); /** Cursor line position */ private Position fCursorLine = new TypedPosition(0, 0, CURSOR_LINE_TYPE); /** Saved cursor line position */ @@ -76,7 +76,7 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener { /** Whether cursor line highlighting is active */ private boolean fCursorLineActive; /** Map of position type to color */ - private Map<String, Color> fColorMap = new HashMap<String, Color>(); + private Map<String, Color> fColorMap = new HashMap<>(); /** * Creates a new painter for the given text viewer. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MembersGrouping.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MembersGrouping.java index d67b8f22a48..d5128d78db0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MembersGrouping.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MembersGrouping.java @@ -47,7 +47,7 @@ public class MembersGrouping extends CElementGrouping { @Override public Object[] getChildren(Object object) { - List<ICElement> nsMembers = new ArrayList<ICElement>(); + List<ICElement> nsMembers = new ArrayList<>(); if (fParent instanceof IParent) { try { nsMembers.addAll(getNamespaceChildren(((IParent) fParent).getChildren())); @@ -71,7 +71,7 @@ public class MembersGrouping extends CElementGrouping { * @return */ private Collection<? extends ICElement> getNamespaceChildren(ICElement[] icElements) { - List<ICElement> members = new ArrayList<ICElement>(icElements.length); + List<ICElement> members = new ArrayList<>(icElements.length); for (ICElement icElement : icElements) { if (icElement instanceof IMember) { String name = icElement.getElementName(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AbstractUpdateIndexAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AbstractUpdateIndexAction.java index 96165fb0f5c..5ed01bf26ec 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AbstractUpdateIndexAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AbstractUpdateIndexAction.java @@ -76,7 +76,7 @@ public abstract class AbstractUpdateIndexAction implements IObjectActionDelegate } protected ICElement[] getSelectedCElements() { - ArrayList<ICElement> tuSelection = new ArrayList<ICElement>(); + ArrayList<ICElement> tuSelection = new ArrayList<>(); if (fSelection instanceof IStructuredSelection) { IStructuredSelection resources = SelectionConverter.convertSelectionToResources(fSelection); for (Iterator<?> i = resources.iterator(); i.hasNext();) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java index be397742b37..b5a446fda55 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/AddBlockCommentAction.java @@ -57,7 +57,7 @@ public class AddBlockCommentAction extends BlockCommentAction { if (!(docExtension instanceof IDocument)) return; - List<Edit> edits = new LinkedList<Edit>(); + List<Edit> edits = new LinkedList<>(); ITypedRegion firstPartition = docExtension.getPartition(ICPartitions.C_PARTITIONING, selection.getOffset(), false); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java index 1dd57c36422..7f2cd706952 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java @@ -99,9 +99,9 @@ public class CreateParserLogAction implements IObjectActionDelegate { private static final String INDENT = " "; private static final class MyVisitor extends ASTVisitor { - List<IASTProblem> fProblems = new ArrayList<IASTProblem>(); - List<IProblemBinding> fProblemBindings = new ArrayList<IProblemBinding>(); - List<Exception> fExceptions = new ArrayList<Exception>(); + List<IASTProblem> fProblems = new ArrayList<>(); + List<IProblemBinding> fProblemBindings = new ArrayList<>(); + List<Exception> fExceptions = new ArrayList<>(); MyVisitor() { shouldVisitProblems = true; @@ -154,7 +154,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { return; } - List<IWorkingCopy> workingCopies = new ArrayList<IWorkingCopy>(); + List<IWorkingCopy> workingCopies = new ArrayList<>(); final IWorkbenchPage activePage = fSite.getWorkbenchWindow().getActivePage(); for (IEditorReference eref : activePage.getEditorReferences()) { IEditorPart editor = eref.getEditor(false); @@ -312,7 +312,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { output(out, "Preincluded files (option -include):", scfg.getIncludeFiles()); output(out, "Preincluded macro files (option -imacros):", scfg.getMacroFiles()); - HashSet<String> reported = new HashSet<String>(); + HashSet<String> reported = new HashSet<>(); output(out, "Macro definitions (option -D):", scfg.getDefinedSymbols(), reported); output(out, "Macro definitions (from language + headers in index):", ast.getBuiltinMacroDefinitions(), reported); @@ -374,7 +374,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { IASTPreprocessorIncludeStatement[] includeDirectives, int linkageID) throws CoreException { fWroteUnresolvedTitle = false; ASTFilePathResolver resolver = new ProjectIndexerInputAdapter(prj); - HashSet<IIndexFile> handled = new HashSet<IIndexFile>(); + HashSet<IIndexFile> handled = new HashSet<>(); for (IASTPreprocessorIncludeStatement include : includeDirectives) { if (include.isResolved()) { IIndexFileLocation ifl = resolver.resolveASTPath(include.getPath()); @@ -429,7 +429,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { if (!definedSymbols.isEmpty()) { out.println(label); - SortedMap<String, String> sorted = new TreeMap<String, String>(COMP_INSENSITIVE); + SortedMap<String, String> sorted = new TreeMap<>(COMP_INSENSITIVE); sorted.putAll(definedSymbols); for (Entry<String, String> entry : sorted.entrySet()) { final String macro = entry.getKey() + '=' + entry.getValue(); @@ -445,7 +445,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { HashSet<String> reported) { if (defs.length > 0) { out.println(label); - SortedSet<String> macros = new TreeSet<String>(COMP_INSENSITIVE); + SortedSet<String> macros = new TreeSet<>(COMP_INSENSITIVE); for (IASTPreprocessorMacroDefinition def : defs) { macros.add(def.toString()); } @@ -518,7 +518,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { } private ArrayList<ITranslationUnit> getSelectedTranslationUnits() { - ArrayList<ITranslationUnit> tuSelection = new ArrayList<ITranslationUnit>(); + ArrayList<ITranslationUnit> tuSelection = new ArrayList<>(); if (fSelection instanceof IStructuredSelection) { IStructuredSelection cElements = SelectionConverter.convertSelectionToCElements(fSelection); Iterator<?> i = cElements.iterator(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/DeleteResConfigsHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/DeleteResConfigsHandler.java index 0cff564ebfe..dcd186889a3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/DeleteResConfigsHandler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/DeleteResConfigsHandler.java @@ -117,7 +117,7 @@ public class DeleteResConfigsHandler extends AbstractHandler { ICResourceDescription rd = cfgd.getResourceDescription(path, true); if (rd != null) { if (objects == null) - objects = new ArrayList<IResource>(); + objects = new ArrayList<>(); objects.add(res); break; // stop configurations scanning } @@ -211,7 +211,7 @@ public class DeleteResConfigsHandler extends AbstractHandler { if (outData != null) return outData.toArray(); - outData = new ArrayList<ResCfgData>(); + outData = new ArrayList<>(); List<?> ls = (List<?>) inputElement; Iterator<?> it = ls.iterator(); IProject proj = null; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ExcludeFromBuildHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ExcludeFromBuildHandler.java index 19923aa1a4d..05d1c51ba41 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ExcludeFromBuildHandler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ExcludeFromBuildHandler.java @@ -115,10 +115,10 @@ public class ExcludeFromBuildHandler extends AbstractHandler { continue; if (objects == null) - objects = new ArrayList<IResource>(); + objects = new ArrayList<>(); objects.add(res); if (cfgNames == null) { - cfgNames = new ArrayList<String>(cfgds.length); + cfgNames = new ArrayList<>(cfgds.length); for (int j = 0; j < cfgds.length; j++) { if (!canExclude(res, cfgds[j])) { cfgNames = null; @@ -221,7 +221,7 @@ public class ExcludeFromBuildHandler extends AbstractHandler { status[i] = true; } } - ArrayList<String> lst = new ArrayList<String>(); + ArrayList<String> lst = new ArrayList<>(); for (int i = 0; i < status.length; i++) if (status[i]) lst.add(cfgNames.get(i)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/OpenActionUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/OpenActionUtil.java index 9ec5d1fe7bd..03b553a6a7d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/OpenActionUtil.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/OpenActionUtil.java @@ -67,7 +67,7 @@ public class OpenActionUtil { */ public static List<ISourceReference> filterResolveResults(ICElement[] codeResolveResults) { int nResults = codeResolveResults.length; - List<ISourceReference> refs = new ArrayList<ISourceReference>(nResults); + List<ISourceReference> refs = new ArrayList<>(nResults); for (int i = 0; i < nResults; i++) { if (codeResolveResults[i] instanceof ISourceReference) refs.add((ISourceReference) codeResolveResults[i]); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java index e6809dce6b5..8660627f0d9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/RemoveBlockCommentAction.java @@ -54,7 +54,7 @@ public class RemoveBlockCommentAction extends BlockCommentAction { if (!(docExtension instanceof IDocument)) return; - List<Edit> edits = new LinkedList<Edit>(); + List<Edit> edits = new LinkedList<>(); int partitionStart = -1; int partitionEnd = selection.getOffset(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java index a9265f0cf00..62d6a2919b0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java @@ -83,7 +83,7 @@ public class SelectionConverter { * @return The converted selection */ public static IStructuredSelection convertSelectionToCElements(ISelection s, boolean keepNonCElements) { - List<Object> converted = new ArrayList<Object>(); + List<Object> converted = new ArrayList<>(); if (s instanceof IStructuredSelection) { Object[] elements = ((IStructuredSelection) s).toArray(); for (int i = 0; i < elements.length; i++) { @@ -104,7 +104,7 @@ public class SelectionConverter { } public static IStructuredSelection convertSelectionToResources(ISelection s) { - List<Object> converted = new ArrayList<Object>(); + List<Object> converted = new ArrayList<>(); if (s instanceof StructuredSelection) { Object[] elements = ((StructuredSelection) s).toArray(); for (int i = 0; i < elements.length; i++) { @@ -156,7 +156,7 @@ public class SelectionConverter { */ public static IStructuredSelection allResources(IStructuredSelection selection, int resourceMask) { Iterator<?> adaptables = selection.iterator(); - List<IResource> result = new ArrayList<IResource>(); + List<IResource> result = new ArrayList<>(); while (adaptables.hasNext()) { Object next = adaptables.next(); if (next instanceof IAdaptable) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java index 6c9dd71ea5b..b015e44bae0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java @@ -70,7 +70,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang private ListenerList<IBuildConsoleListener> listeners = new ListenerList<>(); /** UI console object in which per-project consoles are shown */ private BuildConsole fConsole; - private Map<IProject, BuildConsolePartitioner> fConsoleMap = new HashMap<IProject, BuildConsolePartitioner>(); + private Map<IProject, BuildConsolePartitioner> fConsoleMap = new HashMap<>(); private Color infoColor; private Color outputColor; private Color errorColor; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java index 321abffe14e..51f33ba61c5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CElementSet.java @@ -23,7 +23,7 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI; public class CElementSet { - private Set<ICElement> fSet = new LinkedHashSet<ICElement>(); + private Set<ICElement> fSet = new LinkedHashSet<>(); private int fHashCode; CElementSet(ICElement[] elements) { @@ -76,7 +76,7 @@ public class CElementSet { } public ICElement[] getElements(WorkingSetFilterUI filter) { - ArrayList<ICElement> result = new ArrayList<ICElement>(fSet.size()); + ArrayList<ICElement> result = new ArrayList<>(fSet.size()); for (Iterator<ICElement> iter = fSet.iterator(); iter.hasNext();) { ICElement element = iter.next(); if (filter == null || filter.isPartOfWorkingSet(element)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java index cf3548aa8b2..42ebe62c902 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java @@ -211,7 +211,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { } CHNode[] createNodes(CHNode node, CalledByResult result) throws CoreException { - ArrayList<CHNode> nodes = new ArrayList<CHNode>(); + ArrayList<CHNode> nodes = new ArrayList<>(); ICElement[] elements = result.getElements(); for (ICElement element : elements) { if (element != null) { @@ -248,7 +248,7 @@ public class CHContentProvider extends AsyncTreeContentProvider { CHNode[] createNodes(CHNode node, CallsToResult callsTo) throws CoreException { ITranslationUnit tu = CModelUtil.getTranslationUnit(node.getRepresentedDeclaration()); - ArrayList<CHNode> result = new ArrayList<CHNode>(); + ArrayList<CHNode> result = new ArrayList<>(); CElementSet[] elementSets = callsTo.getElementSets(); for (CElementSet elementSet : elementSets) { CElementSet set = elementSet; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java index d664e2204ac..03779676190 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java @@ -42,8 +42,8 @@ public class CHEProviderSettings { static IStyledLabelProvider[] chLabelProviders = null; private static void loadExtensions() { - List<ICHEContentProvider> chCProviders = new ArrayList<ICHEContentProvider>(); - List<IStyledLabelProvider> chLProviders = new ArrayList<IStyledLabelProvider>(); + List<ICHEContentProvider> chCProviders = new ArrayList<>(); + List<IStyledLabelProvider> chLProviders = new ArrayList<>(); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); if (extensionPoint != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java index ed093e0ce40..298d3af4b6b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHHistoryListAction.java @@ -71,7 +71,7 @@ public class CHHistoryListAction extends Action { ILabelProvider labelProvider = new CUILabelProvider(CHHistoryAction.LABEL_OPTIONS, CElementImageProvider.OVERLAY_ICONS); - fHistoryList = new ListDialogField<ICElement>(adapter, buttonLabels, labelProvider); + fHistoryList = new ListDialogField<>(adapter, buttonLabels, labelProvider); fHistoryList.setLabelText(CHMessages.CHHistoryListAction_HistoryList_label); fHistoryList.setElements(Arrays.asList(historyEntries)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java index ca548c5aa6b..38e14f60a1f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java @@ -45,7 +45,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { private CUILabelProvider fCLabelProvider = new CUILabelProvider(LABEL_OPTIONS_SIMPLE, CElementImageProvider.OVERLAY_ICONS); private CHContentProvider fContentProvider; - private HashMap<String, Image> fCachedImages = new HashMap<String, Image>(); + private HashMap<String, Image> fCachedImages = new HashMap<>(); private Color fColorInactive; private IStyledLabelProvider[] fProviders; private CHViewPart fView; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java index aea54b5691e..5ac3a2d9543 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHNode.java @@ -145,7 +145,7 @@ public class CHNode implements IAdaptable { fReferences = Collections.singletonList(info); return; case 1: - fReferences = new ArrayList<CHReferenceInfo>(fReferences); + fReferences = new ArrayList<>(fReferences); break; } fReferences.add(info); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHProviderManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHProviderManager.java index 501e3cff9f9..d4b4d53dcaf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHProviderManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHProviderManager.java @@ -43,7 +43,7 @@ public class CHProviderManager { public List<ICallHierarchyProvider> getCallHierarchyProviders() { if (callHierarchyProviders == null) { - callHierarchyProviders = new ArrayList<ICallHierarchyProvider>(); + callHierarchyProviders = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint indexProviderPoint = registry.getExtensionPoint(CALL_HIERARCHY_PROVIDERS); for (IExtension extension : indexProviderPoint.getExtensions()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java index 1289e87087b..d8079b4822c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java @@ -178,7 +178,7 @@ public class CHQueries { static ICElement[] findOverriders(IIndex index, ICPPMethod binding) throws CoreException { IBinding[] virtualOverriders = ClassTypeHelper.findOverriders(index, binding); if (virtualOverriders.length > 0) { - ArrayList<ICElementHandle> list = new ArrayList<ICElementHandle>(); + ArrayList<ICElementHandle> list = new ArrayList<>(); list.addAll(Arrays.asList(IndexUI.findRepresentative(index, binding))); for (IBinding overrider : virtualOverriders) { list.addAll(Arrays.asList(IndexUI.findRepresentative(index, overrider))); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java index 3cae498e4e4..0f624c11ddf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java @@ -68,11 +68,11 @@ public class CallHierarchyUI { /** * List of the Call Hierarchy views in LRU order, where the most recently used view is at index 0. */ - private static List<CHViewPart> fLRUCallHierarchyViews = new ArrayList<CHViewPart>(); + private static List<CHViewPart> fLRUCallHierarchyViews = new ArrayList<>(); private static int fViewCount; private static final int MAX_HISTORY_SIZE = 10; - private static List<ICElement> fHistoryEntries = new ArrayList<ICElement>(MAX_HISTORY_SIZE); + private static List<ICElement> fHistoryEntries = new ArrayList<>(MAX_HISTORY_SIZE); public static void setIsJUnitTest(boolean val) { sIsJUnitTest = val; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java index 26c618cd508..8e84b3a4327 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/ReferenceVisitor.java @@ -25,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName; * @since 4.0 */ class ReferenceVisitor extends ASTVisitor { - private ArrayList<IASTName> fReferences = new ArrayList<IASTName>(); + private ArrayList<IASTName> fReferences = new ArrayList<>(); private int fOffset; private int fEndOffset; private String fFileName; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreatorVisitor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreatorVisitor.java index df7c9abadb9..18da53cc7b9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreatorVisitor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreatorVisitor.java @@ -63,7 +63,7 @@ class CStructureCreatorVisitor extends ASTVisitor { private static final String TRANSLATION_UNIT_NAME = CUIMessages.CStructureCreatorVisitor_translationUnitName; private static final String ANONYMOUS_NAME = CoreModelMessages.getString("CElementLabels.anonymous"); //$NON-NLS-1$ - private Stack<DocumentRangeNode> fStack = new Stack<DocumentRangeNode>(); + private Stack<DocumentRangeNode> fStack = new Stack<>(); private IDocument fDocument; private String fTranslationUnitFileName; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/BuildGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/BuildGroup.java index 53aa87cc984..fdc505dba0d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/BuildGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/BuildGroup.java @@ -74,7 +74,7 @@ public class BuildGroup extends CViewActionGroup { @Override public void run() { // Ensure we correctly save files in all referenced projects before build - Set<IProject> prjs = new HashSet<IProject>(); + Set<IProject> prjs = new HashSet<>(); for (IResource resource : getSelectedResources()) { IProject project = resource.getProject(); if (project != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java index 2ecd51348a0..dd61e9432d2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java @@ -947,7 +947,7 @@ public class CView extends ViewPart IMemento childMem = memento.getChild(TAG_EXPANDED); if (childMem != null) { - ArrayList<ICElement> elements = new ArrayList<ICElement>(); + ArrayList<ICElement> elements = new ArrayList<>(); IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT); for (IMemento element2 : elementMem) { String p = element2.getString(TAG_PATH); @@ -963,7 +963,7 @@ public class CView extends ViewPart } childMem = memento.getChild(TAG_SELECTION); if (childMem != null) { - ArrayList<ICElement> list = new ArrayList<ICElement>(); + ArrayList<ICElement> list = new ArrayList<>(); IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT); for (IMemento element2 : elementMem) { String p = element2.getString(TAG_PATH); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java index 99c26431f88..0e58a5bf1c8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewContentProvider.java @@ -170,7 +170,7 @@ public class CViewContentProvider extends CElementContentProvider { protected IBinary[] getExecutables(IBinaryContainer container) throws CModelException { ICElement[] celements = container.getChildren(); - ArrayList<IBinary> list = new ArrayList<IBinary>(celements.length); + ArrayList<IBinary> list = new ArrayList<>(celements.length); for (int i = 0; i < celements.length; i++) { if (celements[i] instanceof IBinary) { IBinary bin = (IBinary) celements[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewMoveAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewMoveAction.java index 720708489e9..4f4154544e6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewMoveAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewMoveAction.java @@ -68,7 +68,7 @@ public class CViewMoveAction extends MoveResourceAction { List<?> destinations = getDestinations(); if (destinations != null && destinations.isEmpty() == false) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - List<IResource> resources = new ArrayList<IResource>(); + List<IResource> resources = new ArrayList<>(); Iterator<?> iterator = destinations.iterator(); while (iterator.hasNext()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/LibraryRefContainer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/LibraryRefContainer.java index 9cfe9b92ae8..2a79068500a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/LibraryRefContainer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/LibraryRefContainer.java @@ -61,7 +61,7 @@ public class LibraryRefContainer extends CElementGrouping { public Object[] getChildren(Object o) { try { ILibraryReference[] references = fCProject.getLibraryReferences(); - ArrayList<ILibraryReference> list = new ArrayList<ILibraryReference>(references.length); + ArrayList<ILibraryReference> list = new ArrayList<>(references.length); for (ILibraryReference reference : references) { IPath path = reference.getPath(); IFile file = reference.getCModel().getWorkspace().getRoot().getFileForLocation(path); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/SelectionTransferDropAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/SelectionTransferDropAdapter.java index 680df5dc04d..589a4129675 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/SelectionTransferDropAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/SelectionTransferDropAdapter.java @@ -338,7 +338,7 @@ public class SelectionTransferDropAdapter extends CDTViewerDropAdapter implement } public static ICElement[] getCElements(List<?> elements) { - List<ICElement> resources = new ArrayList<ICElement>(elements.size()); + List<ICElement> resources = new ArrayList<>(elements.size()); for (Iterator<?> iter = elements.iterator(); iter.hasNext();) { Object element = iter.next(); if (element instanceof ITranslationUnit) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/SelectionList.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/SelectionList.java index f6054525872..98e28bb61bd 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/SelectionList.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/SelectionList.java @@ -136,7 +136,7 @@ public class SelectionList extends Composite { if (fList == null || fList.isDisposed() || fList.getSelectionCount() == 0) return Collections.emptyList(); int[] listSelection = fList.getSelectionIndices(); - List<Object> selected = new ArrayList<Object>(listSelection.length); + List<Object> selected = new ArrayList<>(listSelection.length); for (int i = 0; i < listSelection.length; i++) { selected.add(fElements[fFilteredElements[listSelection[i]]]); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java index 263f5e017e7..7d864c159af 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/TextFieldNavigationHandler.java @@ -363,7 +363,7 @@ public class TextFieldNavigationHandler { if (fSubmissions != null) return fSubmissions; - fSubmissions = new ArrayList<Submission>(); + fSubmissions = new ArrayList<>(); ICommandService commandService = PlatformUI.getWorkbench().getAdapter(ICommandService.class); IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java index cf1af894ad4..49e30dd3aa2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java @@ -80,7 +80,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple List<CPElement> elements = getCPaths(); IPathEntry[] entries = getCProject().getRawPathEntries(); - List<IPathEntry> cpath = new ArrayList<IPathEntry>(elements.size() + entries.length); + List<IPathEntry> cpath = new ArrayList<>(elements.size() + entries.length); int[] applyTypes = getAppliedFilteredTypes(); // create and set the paths @@ -138,7 +138,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple if (cpathEntries != null) { newCPath = getFilteredElements(cpathEntries, getFilteredTypes()); } else { - newCPath = new ArrayList<CPElement>(); + newCPath = new ArrayList<>(); } initialize(element, newCPath); } @@ -150,7 +150,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple abstract protected void initialize(ICElement element, List<CPElement> cPaths); protected ArrayList<CPElement> getFilteredElements(IPathEntry[] cPathEntries, int[] types) { - ArrayList<CPElement> newCPath = new ArrayList<CPElement>(); + ArrayList<CPElement> newCPath = new ArrayList<>(); for (IPathEntry curr : cPathEntries) { if (contains(types, curr.getEntryKind())) { newCPath.add(CPElement.createFromExisting(curr, getCElement())); @@ -305,7 +305,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple IPathEntry[] entries = getCProject().getRawPathEntries(); - List<IPathEntry> cpath = new ArrayList<IPathEntry>(cPathEntries.size() + entries.length); + List<IPathEntry> cpath = new ArrayList<>(cPathEntries.size() + entries.length); int[] applyTypes = getAppliedFilteredTypes(); // create and set the paths diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java index 7dd7f2106d4..f3752a3685c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java @@ -59,7 +59,7 @@ public class CPElement { private final IPath fPath; private final ICProject fCProject; private final IResource fResource; - private final ArrayList<Object> fChildren = new ArrayList<Object>(1); + private final ArrayList<Object> fChildren = new ArrayList<>(1); private boolean fIsExported; @@ -490,7 +490,7 @@ public class CPElement { // return new Object[] { findAttributeElement(SOURCEATTACHMENT) }; case IPathEntry.CDT_CONTAINER: { - List<Object> list = new ArrayList<Object>(); + List<Object> list = new ArrayList<>(); for (int i = 0; i < fChildren.size(); i++) { Object curr = fChildren.get(i); if (curr instanceof CPElementGroup) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java index 1ceca40f13e..4481900de58 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementGroup.java @@ -35,13 +35,13 @@ public class CPElementGroup { public CPElementGroup(IResource resource) { this.kind = -1; this.resource = resource; - this.childrenListMap = new LinkedHashMap<Integer, List<CPElement>>(2); + this.childrenListMap = new LinkedHashMap<>(2); } public CPElementGroup(CPElement parent, int kind) { this.parent = parent; this.kind = kind; - this.childrenList = new ArrayList<CPElement>(); + this.childrenList = new ArrayList<>(); } public IResource getResource() { @@ -126,9 +126,9 @@ public class CPElementGroup { if (elements.length > 0) { if (childrenListMap != null) { childrenListMap.put(Integer.valueOf(elements[0].getEntryKind()), - new ArrayList<CPElement>(Arrays.asList(elements))); + new ArrayList<>(Arrays.asList(elements))); } else { - childrenList = new ArrayList<CPElement>(Arrays.asList(elements)); + childrenList = new ArrayList<>(Arrays.asList(elements)); } } } @@ -162,7 +162,7 @@ public class CPElementGroup { } Collection<List<CPElement>> lists = childrenListMap.values(); Iterator<List<CPElement>> iter = lists.iterator(); - List<CPElement> children = new ArrayList<CPElement>(); + List<CPElement> children = new ArrayList<>(); while (iter.hasNext()) { children.addAll(iter.next()); } @@ -196,7 +196,7 @@ public class CPElementGroup { } else { children = childrenListMap.get(Integer.valueOf(kind)); if (children == null && create) { - children = new ArrayList<CPElement>(); + children = new ArrayList<>(); childrenListMap.put(Integer.valueOf(kind), children); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java index dd37747eb48..fedda3aa109 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElementSorter.java @@ -72,9 +72,9 @@ public class CPElementSorter extends ViewerSorter { @Override public void sort(Viewer viewer, Object[] elements) { // include paths and symbol definitions must not be sorted - List<Object> sort = new ArrayList<Object>(elements.length); - List<CPElement> includes = new ArrayList<CPElement>(elements.length); - List<CPElement> syms = new ArrayList<CPElement>(elements.length); + List<Object> sort = new ArrayList<>(elements.length); + List<CPElement> includes = new ArrayList<>(elements.length); + List<CPElement> syms = new ArrayList<>(elements.length); for (Object element : elements) { if (element instanceof CPElement) { CPElement cpelement = (CPElement) element; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java index e770f2a0a62..8df8255e11f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathBasePage.java @@ -38,7 +38,7 @@ public abstract class CPathBasePage extends AbstractCOptionPage { protected void fixNestingConflicts(List<CPElement> newEntries, List<CPElement> existingList, Set<CPElement> modifiedSourceEntries) { - ArrayList<CPElement> existing = new ArrayList<CPElement>(existingList); + ArrayList<CPElement> existing = new ArrayList<>(existingList); for (int i = 0; i < newEntries.size(); i++) { CPElement curr = newEntries.get(i); addExclusionPatterns(curr, existing, modifiedSourceEntries); @@ -76,7 +76,7 @@ public abstract class CPathBasePage extends AbstractCOptionPage { public abstract boolean isEntryKind(int kind); protected List<CPElement> filterList(List<CPElement> cpelements) { - ArrayList<CPElement> filtered = new ArrayList<CPElement>(); + ArrayList<CPElement> filtered = new ArrayList<>(); for (int i = 0; i < cpelements.size(); i++) { CPElement cpe = cpelements.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java index 64e8036c30b..eb498e0b5d1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDefaultPage.java @@ -47,7 +47,7 @@ public class CPathContainerDefaultPage extends NewElementWizardPage implements I setDescription(CPathEntryMessages.CPathContainerDefaultPage_description); setImageDescriptor(CPluginImages.DESC_WIZBAN_ADD_LIBRARY); - fUsedPaths = new ArrayList<IPath>(); + fUsedPaths = new ArrayList<>(); fEntryField = new StringDialogField(); fEntryField.setLabelText(CPathEntryMessages.CPathContainerDefaultPage_path_label); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java index a7a7c3f2fff..7c1c0f0f817 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerDescriptor.java @@ -364,7 +364,7 @@ public class CPathContainerDescriptor implements IContainerDescriptor { } public static IContainerDescriptor[] getDescriptors() { - ArrayList<IContainerDescriptor> containers = new ArrayList<IContainerDescriptor>(); + ArrayList<IContainerDescriptor> containers = new ArrayList<>(); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, ATT_EXTENSION); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java index 91bc6479c51..ed3aed0b9df 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerEntryPage.java @@ -69,7 +69,7 @@ public class CPathContainerEntryPage extends CPathBasePage { ContainersAdapter adapter = new ContainersAdapter(); - fContainersList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider()); + fContainersList = new TreeListDialogField<>(adapter, buttonLabels, new CPElementLabelProvider()); fContainersList.setDialogFieldListener(adapter); fContainersList.setLabelText(CPathEntryMessages.ContainerEntryPage_libraries_label); @@ -89,7 +89,7 @@ public class CPathContainerEntryPage extends CPathBasePage { private void updateLibrariesList() { List<CPElement> cpelements = fCPathList.getElements(); - List<CPElement> libelements = new ArrayList<CPElement>(cpelements.size()); + List<CPElement> libelements = new ArrayList<>(cpelements.size()); int nElements = cpelements.size(); for (int i = 0; i < nElements; i++) { @@ -220,7 +220,7 @@ public class CPathContainerEntryPage extends CPathBasePage { int nElementsChosen = containers.length; // remove duplicates List<CPElement> cplist = fContainersList.getElements(); - List<CPElement> elementsToAdd = new ArrayList<CPElement>(nElementsChosen); + List<CPElement> elementsToAdd = new ArrayList<>(nElementsChosen); for (int i = 0; i < nElementsChosen; i++) { CPElement curr = containers[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java index 302e78025a9..e526212b5cf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathContainerWizard.java @@ -123,7 +123,7 @@ public class CPathContainerWizard extends Wizard { } else if (fEntryToEdit == null) { // new entry: show selection page as // first page IContainerDescriptor[] containers = CPathContainerDescriptor.getDescriptors(); - List<IContainerDescriptor> allContainers = new ArrayList<IContainerDescriptor>(Arrays.asList(containers)); + List<IContainerDescriptor> allContainers = new ArrayList<>(Arrays.asList(containers)); if (fFilterType != null) { allContainers.add(0, new ProjectContainerDescriptor(fFilterType)); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java index 4f8235eea16..24032a4aa4f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathFilterPage.java @@ -123,7 +123,7 @@ public class CPathFilterPage extends WizardPage { } private void createExlusions(boolean showExported) { - fExclusions = new ArrayList<Object>(); + fExclusions = new ArrayList<>(); if (filter != null) { viewer.removeFilter(filter); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java index cf17136734d..4cd08701591 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java @@ -277,7 +277,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage private List<CPElementGroup> createGroups(ICElement element, List<?> cPaths) { // create resource groups - List<CPElementGroup> resourceGroups = new ArrayList<CPElementGroup>(5); + List<CPElementGroup> resourceGroups = new ArrayList<>(5); fTopGroup = new CPElementGroup(element.getResource()); resourceGroups.add(fTopGroup); // add containers first so that they appear at top of list @@ -1116,7 +1116,7 @@ public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage @Override public List<CPElement> getCPaths() { - List<CPElement> cPaths = new ArrayList<CPElement>(); + List<CPElement> cPaths = new ArrayList<>(); List<CPElementGroup> groups = fIncludeSymPathsList.getElements(); for (int i = 0; i < groups.size(); i++) { CPElementGroup group = groups.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java index 9deedc2c957..adf63ce042d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java @@ -326,7 +326,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB private List<CPElementGroup> createGroups(ICElement element, List<CPElement> cPaths) { // create resource groups - List<CPElementGroup> resourceGroups = new ArrayList<CPElementGroup>(5); + List<CPElementGroup> resourceGroups = new ArrayList<>(5); fTopGroup = new CPElementGroup(element.getResource()); resourceGroups.add(fTopGroup); // add containers first so that they appear at top of list @@ -1171,7 +1171,7 @@ public class CPathIncludeSymbolEntryPerFilePage extends CPathIncludeSymbolEntryB @Override public List<CPElement> getCPaths() { - List<CPElement> cPaths = new ArrayList<CPElement>(); + List<CPElement> cPaths = new ArrayList<>(); List<CPElementGroup> groups = fIncludeSymPathsList.getElements(); for (int i = 0; i < groups.size(); i++) { CPElementGroup group = groups.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java index d2b834ff545..ebbe97dcee9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathLibraryEntryPage.java @@ -94,7 +94,7 @@ public class CPathLibraryEntryPage extends CPathBasePage { CPathEntryMessages.LibrariesEntryPage_libraries_remove_button, null, CPathEntryMessages.LibrariesEntryPage_libraries_export_button }; - fLibrariesList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider()); + fLibrariesList = new TreeListDialogField<>(adapter, buttonLabels, new CPElementLabelProvider()); fLibrariesList.setDialogFieldListener(adapter); fLibrariesList.setLabelText(CPathEntryMessages.LibrariesEntryPage_libraries_label); @@ -262,7 +262,7 @@ public class CPathLibraryEntryPage extends CPathBasePage { int nElementsChosen = libentries.length; // remove duplicates List<CPElement> cplist = fLibrariesList.getElements(); - List<CPElement> elementsToAdd = new ArrayList<CPElement>(nElementsChosen); + List<CPElement> elementsToAdd = new ArrayList<>(nElementsChosen); for (int i = 0; i < nElementsChosen; i++) { CPElement curr = libentries[i]; @@ -426,7 +426,7 @@ public class CPathLibraryEntryPage extends CPathBasePage { } private IFile[] getUsedLibFiles(CPElement existing) { - List<IResource> res = new ArrayList<IResource>(); + List<IResource> res = new ArrayList<>(); List<CPElement> cplist = fLibrariesList.getElements(); for (int i = 0; i < cplist.size(); i++) { CPElement elem = cplist.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java index fc8e9172890..cc6cf459232 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathOutputEntryPage.java @@ -94,7 +94,7 @@ public class CPathOutputEntryPage extends CPathBasePage { CPathEntryMessages.OutputPathEntryPage_folders_edit_button, CPathEntryMessages.OutputPathEntryPage_folders_remove_button }; - fOutputList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider()); + fOutputList = new TreeListDialogField<>(adapter, buttonLabels, new CPElementLabelProvider()); fOutputList.setDialogFieldListener(adapter); fOutputList.setLabelText(CPathEntryMessages.OutputPathEntryPage_folders_label); @@ -245,7 +245,7 @@ public class CPathOutputEntryPage extends CPathBasePage { protected void outputPageCustomButtonPressed(DialogField field, int index) { if (field == fOutputList) { if (index == IDX_ADD) { - List<CPElement> elementsToAdd = new ArrayList<CPElement>(10); + List<CPElement> elementsToAdd = new ArrayList<>(10); IProject project = fCurrCProject.getProject(); if (project.exists()) { if (hasFolders(project)) { @@ -268,7 +268,7 @@ public class CPathOutputEntryPage extends CPathBasePage { } } if (!elementsToAdd.isEmpty()) { - HashSet<CPElement> modifiedElements = new HashSet<CPElement>(); + HashSet<CPElement> modifiedElements = new HashSet<>(); askForAddingExclusionPatternsDialog(elementsToAdd, modifiedElements); fOutputList.addElements(elementsToAdd); @@ -472,7 +472,7 @@ public class CPathOutputEntryPage extends CPathBasePage { List<IContainer> existingContainers = getExistingContainers(null); IProject[] allProjects = fWorkspaceRoot.getProjects(); - ArrayList<IProject> rejectedElements = new ArrayList<IProject>(allProjects.length); + ArrayList<IProject> rejectedElements = new ArrayList<>(allProjects.length); IProject currProject = fCurrCProject.getProject(); for (int i = 0; i < allProjects.length; i++) { if (!allProjects[i].equals(currProject)) { @@ -515,7 +515,7 @@ public class CPathOutputEntryPage extends CPathBasePage { } private List<IContainer> getExistingContainers(CPElement existing) { - List<IContainer> res = new ArrayList<IContainer>(); + List<IContainer> res = new ArrayList<>(); List<CPElement> cplist = fOutputList.getElements(); for (int i = 0; i < cplist.size(); i++) { CPElement elem = cplist.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java index bf74026947d..f9e7d78664c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathProjectsEntryPage.java @@ -60,7 +60,7 @@ public class CPathProjectsEntryPage extends CPathBasePage { String[] buttonLabels = new String[] { CPathEntryMessages.ProjectsEntryPage_projects_checkall_button, CPathEntryMessages.ProjectsEntryWorkbookPage_projects_uncheckall_button }; - fProjectsList = new CheckedListDialogField<CPElement>(null, buttonLabels, new CPElementLabelProvider()); + fProjectsList = new CheckedListDialogField<>(null, buttonLabels, new CPElementLabelProvider()); fProjectsList.setDialogFieldListener(listener); fProjectsList.setLabelText(CPathEntryMessages.ProjectsEntryPage_projects_label); fProjectsList.setCheckAllButtonIndex(0); @@ -136,13 +136,13 @@ public class CPathProjectsEntryPage extends CPathBasePage { void updateProjectsList(ICProject currCProject) { ICModel cmodel = currCProject.getCModel(); - List<CPElement> projects = new ArrayList<CPElement>(); - final List<CPElement> checkedProjects = new ArrayList<CPElement>(); + List<CPElement> projects = new ArrayList<>(); + final List<CPElement> checkedProjects = new ArrayList<>(); try { ICProject[] cprojects = cmodel.getCProjects(); // a vector remembering all projects that dont have to be added anymore - List<IResource> existingProjects = new ArrayList<IResource>(cprojects.length); + List<IResource> existingProjects = new ArrayList<>(cprojects.length); existingProjects.add(currCProject.getProject()); // add the projects-cpentries that are already on the C Path diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java index f7ee0ff0b08..8ded3d9d596 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathSourceEntryPage.java @@ -93,7 +93,7 @@ public class CPathSourceEntryPage extends CPathBasePage { CPathEntryMessages.SourcePathEntryPath_folders_edit_button, CPathEntryMessages.SourcePathEntryPage_folders_remove_button }; - fFoldersList = new TreeListDialogField<CPElement>(adapter, buttonLabels, new CPElementLabelProvider()); + fFoldersList = new TreeListDialogField<>(adapter, buttonLabels, new CPElementLabelProvider()); fFoldersList.setDialogFieldListener(adapter); fFoldersList.setLabelText(CPathEntryMessages.SourcePathEntryPage_folders_label); @@ -229,7 +229,7 @@ public class CPathSourceEntryPage extends CPathBasePage { protected void sourcePageCustomButtonPressed(DialogField field, int index) { if (field == fFoldersList) { if (index == IDX_ADD) { - List<CPElement> elementsToAdd = new ArrayList<CPElement>(10); + List<CPElement> elementsToAdd = new ArrayList<>(10); IProject project = fCurrCProject.getProject(); if (project.exists()) { CPElement[] srcentries = openSourceContainerDialog(null); @@ -245,7 +245,7 @@ public class CPathSourceEntryPage extends CPathBasePage { } } if (!elementsToAdd.isEmpty()) { - HashSet<CPElement> modifiedElements = new HashSet<CPElement>(); + HashSet<CPElement> modifiedElements = new HashSet<>(); askForAddingExclusionPatternsDialog(elementsToAdd, modifiedElements); fFoldersList.addElements(elementsToAdd); @@ -449,7 +449,7 @@ public class CPathSourceEntryPage extends CPathBasePage { List<IContainer> existingContainers = getExistingContainers(null); IProject[] allProjects = fWorkspaceRoot.getProjects(); - ArrayList<IProject> rejectedElements = new ArrayList<IProject>(allProjects.length); + ArrayList<IProject> rejectedElements = new ArrayList<>(allProjects.length); IProject currProject = fCurrCProject.getProject(); for (int i = 0; i < allProjects.length; i++) { if (!allProjects[i].equals(currProject)) { @@ -492,7 +492,7 @@ public class CPathSourceEntryPage extends CPathBasePage { } private List<IContainer> getExistingContainers(CPElement existing) { - List<IContainer> res = new ArrayList<IContainer>(); + List<IContainer> res = new ArrayList<>(); List<CPElement> cplist = fFoldersList.getElements(); for (int i = 0; i < cplist.size(); i++) { CPElement elem = cplist.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java index f4530a0c713..7aedb1da5c9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathTabBlock.java @@ -74,7 +74,7 @@ public class CPathTabBlock extends AbstractPathOptionBlock { }; BuildPathAdapter adapter = new BuildPathAdapter(); - fCPathList = new ListDialogField<CPElement>(null, buttonLabels, null); + fCPathList = new ListDialogField<>(null, buttonLabels, null); fCPathList.setDialogFieldListener(adapter); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java index bc0c4bc7c14..4167f850764 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ExclusionPatternDialog.java @@ -96,7 +96,7 @@ public class ExclusionPatternDialog extends StatusDialog { ExclusionPatternAdapter adapter = new ExclusionPatternAdapter(); - fExclusionPatternList = new ListDialogField<String>(adapter, buttonLabels, new ExclusionPatternLabelProvider()); + fExclusionPatternList = new ListDialogField<>(adapter, buttonLabels, new ExclusionPatternLabelProvider()); fExclusionPatternList.setDialogFieldListener(adapter); fExclusionPatternList.setLabelText(label); fExclusionPatternList.setRemoveButtonIndex(IDX_REMOVE); @@ -111,7 +111,7 @@ public class ExclusionPatternDialog extends StatusDialog { IPath[] pattern = (IPath[]) entryToEdit.getAttribute(CPElement.EXCLUSION); - ArrayList<String> elements = new ArrayList<String>(pattern.length); + ArrayList<String> elements = new ArrayList<>(pattern.length); for (IPath element : pattern) { elements.add(element.toString()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java index 6ce6ce1c3ac..e0f626094f0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/MultipleFolderSelectionDialog.java @@ -85,7 +85,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme } public void setExisting(Object[] existing) { - fExisting = new HashSet<Object>(); + fExisting = new HashSet<>(); for (int i = 0; i < existing.length; i++) { fExisting.add(existing[i]); } @@ -109,7 +109,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme */ public void addFilter(ViewerFilter filter) { if (fFilters == null) - fFilters = new ArrayList<ViewerFilter>(4); + fFilters = new ArrayList<>(4); fFilters.add(filter); } @@ -134,7 +134,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme checked = null; } } else { - ArrayList<Object> res = new ArrayList<Object>(); + ArrayList<Object> res = new ArrayList<>(); for (int i = 0; i < checked.length; i++) { Object elem = checked[i]; if (!fExisting.contains(elem)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java index 30e670affd6..a9090dcb4e7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/ProjectContainerPage.java @@ -136,7 +136,7 @@ public class ProjectContainerPage extends WizardPage implements IPathEntryContai } private void initializeView() { - List<ICProject> list = new ArrayList<ICProject>(); + List<ICProject> list = new ArrayList<>(); List<IPathEntry> current; try { current = Arrays.asList(fCProject.getRawPathEntries()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java index f5ca91dca82..761d3e32b2b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java @@ -448,7 +448,7 @@ public class SourceAttachmentBlock { IProgressMonitor monitor) throws CModelException { IPathEntry[] oldClasspath = cproject.getRawPathEntries(); int nEntries = oldClasspath.length; - ArrayList<IPathEntry> newEntries = new ArrayList<IPathEntry>(nEntries + 1); + ArrayList<IPathEntry> newEntries = new ArrayList<>(nEntries + 1); int entryKind = newEntry.getEntryKind(); IPath jarPath = newEntry.getPath(); boolean found = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDragAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDragAdapter.java index 5f386b4879e..437e373dfce 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDragAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDragAdapter.java @@ -52,8 +52,8 @@ public class DelegatingDragAdapter implements DragSourceListener { boolean saveDoit = event.doit; Object saveData = event.data; boolean doIt = false; - List<Transfer> transfers = new ArrayList<Transfer>(fPossibleListeners.length); - fActiveListeners = new ArrayList<TransferDragSourceListener>(fPossibleListeners.length); + List<Transfer> transfers = new ArrayList<>(fPossibleListeners.length); + fActiveListeners = new ArrayList<>(fPossibleListeners.length); for (TransferDragSourceListener listener : fPossibleListeners) { event.doit = saveDoit; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDragAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDragAdapter.java index 595a0568e06..91fcdb40480 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDragAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/FileTransferDragAdapter.java @@ -89,7 +89,7 @@ public class FileTransferDragAdapter implements TransferDragSourceListener { public RefreshOperation(List<IResource> resources) { super(); - roots = new HashSet<IResource>(resources.size()); + roots = new HashSet<>(resources.size()); for (IResource resource : resources) { IResource parent = resource.getParent(); @@ -127,7 +127,7 @@ public class FileTransferDragAdapter implements TransferDragSourceListener { if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; - result = new ArrayList<IResource>(structured.size()); + result = new ArrayList<>(structured.size()); for (Iterator<?> iterator = structured.iterator(); iterator.hasNext();) { Object object = iterator.next(); @@ -150,7 +150,7 @@ public class FileTransferDragAdapter implements TransferDragSourceListener { private static String[] getResourceLocations(List<IResource> resources) { if (!resources.isEmpty()) { int count = resources.size(); - List<String> locations = new ArrayList<String>(count); + List<String> locations = new ArrayList<>(count); for (IResource resource : resources) { IPath location = resource.getLocation(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDragAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDragAdapter.java index eb2e572aa2f..d31ecbfaf00 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDragAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDragAdapter.java @@ -107,7 +107,7 @@ public class ResourceTransferDragAdapter implements TransferDragSourceListener { if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; - resources = new ArrayList<IResource>(structured.size()); + resources = new ArrayList<>(structured.size()); for (Iterator<?> iterator = structured.iterator(); iterator.hasNext();) { Object element = iterator.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDropAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDropAdapter.java index 9f06282b975..0c9b2e93bb4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDropAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/ResourceTransferDropAdapter.java @@ -133,7 +133,7 @@ public class ResourceTransferDropAdapter extends CDTViewerDropAdapter implements * @return the resource selection from the LocalSelectionTransfer */ private IResource[] getSelectedResources() { - ArrayList<IResource> selectedResources = new ArrayList<IResource>(); + ArrayList<IResource> selectedResources = new ArrayList<>(); ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); if (selection instanceof IStructuredSelection) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java index f1047ded1e7..eb35a768097 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java @@ -220,7 +220,7 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider { * @return Updated selection. */ protected ISelection updateSelection(ISelection sel) { - final ArrayList<ICElement> newSelection = new ArrayList<ICElement>(); + final ArrayList<ICElement> newSelection = new ArrayList<>(); if (sel instanceof IStructuredSelection) { final Iterator<?> iter = ((IStructuredSelection) sel).iterator(); while (iter.hasNext()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java index f1de61a02cc..00fbed3a19f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java @@ -664,7 +664,7 @@ public class CDocumentProvider extends TextFileDocumentProvider { private ListenerList<IAnnotationModelListener> fListenerList; public GlobalAnnotationModelListener() { - fListenerList = new ListenerList<IAnnotationModelListener>(ListenerList.IDENTITY); + fListenerList = new ListenerList<>(ListenerList.IDENTITY); } @Override @@ -942,7 +942,7 @@ public class CDocumentProvider extends TextFileDocumentProvider { TextEdit rootEdit = null; ICProject cProject = tu.getCProject(); - Map<String, Object> options = new HashMap<String, Object>(cProject.getOptions(true)); + Map<String, Object> options = new HashMap<>(cProject.getOptions(true)); options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu); CodeFormatter formatter = ToolFactory.createCodeFormatter(options); String code = document.get(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 67fc913798a..f0b7ce3b2c2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -395,9 +395,9 @@ public class CEditor extends TextEditor ICElement inputCElement = getInputCElement(); ICProject cProject = inputCElement != null ? inputCElement.getCProject() : null; if (cProject == null) { - preferences = new HashMap<String, Object>(CCorePlugin.getOptions()); + preferences = new HashMap<>(CCorePlugin.getOptions()); } else { - preferences = new HashMap<String, Object>(cProject.getOptions(true)); + preferences = new HashMap<>(cProject.getOptions(true)); } if (inputCElement instanceof ITranslationUnit) { @@ -1344,7 +1344,7 @@ public class CEditor extends TextEditor * AST reconciling listeners. * @since 4.0 */ - private final ListenerList<ICReconcilingListener> fReconcilingListeners = new ListenerList<ICReconcilingListener>( + private final ListenerList<ICReconcilingListener> fReconcilingListeners = new ListenerList<>( ListenerList.IDENTITY); /** @@ -1405,7 +1405,7 @@ public class CEditor extends TextEditor setOutlinerContextMenuId("#CEditorOutlinerContext"); //$NON-NLS-1$ fCEditorErrorTickUpdater = new CEditorErrorTickUpdater(this); - fPostSaveListeners = new ListenerList<IPostSaveListener>(); + fPostSaveListeners = new ListenerList<>(); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CElementIncludeResolver.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CElementIncludeResolver.java index 000315c2529..abebbdd70bb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CElementIncludeResolver.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CElementIncludeResolver.java @@ -45,7 +45,7 @@ import org.eclipse.core.runtime.Platform; public class CElementIncludeResolver { public static List<IPath> resolveInclude(IInclude include) throws CoreException { IResource res = include.getUnderlyingResource(); - ArrayList<IPath> filesFound = new ArrayList<IPath>(4); + ArrayList<IPath> filesFound = new ArrayList<>(4); String fullFileName = include.getFullFileName(); if (fullFileName != null) { IPath fullPath = new Path(fullFileName); @@ -114,7 +114,7 @@ public class CElementIncludeResolver { return; } } - HashSet<IPath> foundSet = new HashSet<IPath>(); + HashSet<IPath> foundSet = new HashSet<>(); for (String includePath : includePaths) { IPath path = PathUtil.getCanonicalPathWindows(new Path(includePath).append(includeFile)); File file = path.toFile(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java index 5ede0b64d32..adc2798de70 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java @@ -423,7 +423,7 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi List<ITextPresentationListener> textPresentationListeners = fTextPresentationListeners; if (textPresentationListeners == null) - fTextPresentationListeners = textPresentationListeners = new ArrayList<ITextPresentationListener>(); + fTextPresentationListeners = textPresentationListeners = new ArrayList<>(); textPresentationListeners.remove(listener); textPresentationListeners.add(0, listener); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java index 254fa95aeea..8b400022fba 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java @@ -216,7 +216,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener, IAdaptable { private Set<String> fLegalLineDelimiters; - private List<IBufferChangedListener> fBufferListeners = new ArrayList<IBufferChangedListener>(3); + private List<IBufferChangedListener> fBufferListeners = new ArrayList<>(3); private IStatus fStatus; final private IPath fLocation; @@ -528,7 +528,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener, IAdaptable { if (fLegalLineDelimiters == null) { // collect all line delimiters in the document - HashSet<String> existingDelimiters = new HashSet<String>(); + HashSet<String> existingDelimiters = new HashSet<>(); for (int i = fDocument.getNumberOfLines() - 1; i >= 0; i--) { try { @@ -588,7 +588,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener, IAdaptable { private void fireBufferChanged(BufferChangedEvent event) { if (fBufferListeners != null && fBufferListeners.size() > 0) { - Iterator<IBufferChangedListener> e = new ArrayList<IBufferChangedListener>(fBufferListeners).iterator(); + Iterator<IBufferChangedListener> e = new ArrayList<>(fBufferListeners).iterator(); while (e.hasNext()) e.next().bufferChanged(event); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java index ee2d0c9ead5..e5a265580dd 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EclipsePreferencesAdapter.java @@ -57,7 +57,7 @@ class EclipsePreferencesAdapter implements IPreferenceStore { } /** Listeners on on this adapter */ - private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<IPropertyChangeListener>( + private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<>( ListenerList.IDENTITY); /** Listener on the node */ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java index a2daeb77e47..1a7aea46a58 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InactiveCodeHighlighting.java @@ -229,10 +229,10 @@ public class InactiveCodeHighlighting implements ICReconcilingListener, ITextInp if (fileName == null) { return Collections.emptyList(); } - List<Position> positions = new ArrayList<Position>(); + List<Position> positions = new ArrayList<>(); int inactiveCodeStart = -1; boolean inInactiveCode = false; - Stack<Boolean> inactiveCodeStack = new Stack<Boolean>(); + Stack<Boolean> inactiveCodeStack = new Stack<>(); IASTPreprocessorStatement[] preprocStmts = translationUnit.getAllPreprocessorStatements(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java index a3badc46ee4..18e32bf4423 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/InteractiveHeaderChooser.java @@ -39,7 +39,7 @@ public class InteractiveHeaderChooser implements IHeaderChooser { public InteractiveHeaderChooser(String title, Shell shell) { this.title = title; this.shell = shell; - userChoiceCache = new HashMap<Collection<IPath>, IPath>(); + userChoiceCache = new HashMap<>(); } @Override @@ -49,7 +49,7 @@ public class InteractiveHeaderChooser implements IHeaderChooser { if (headers.size() == 1) return headers.iterator().next(); - Set<IPath> cacheKey = new HashSet<IPath>(headers); + Set<IPath> cacheKey = new HashSet<>(headers); // Check the decision cache. If the cache doesn't help, ask the user. // Query the cache. if (userChoiceCache.containsKey(cacheKey)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java index 7b989a51c9c..bd10ca4b757 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java @@ -113,7 +113,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener { return; final IIndex index = ast.getIndex(); - final Map<Annotation, Position> annotationMap = new HashMap<Annotation, Position>(50); + final Map<Annotation, Position> annotationMap = new HashMap<>(50); class MethodFinder extends ASTVisitor { { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionHistory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionHistory.java index 9f15c4f8747..2e850a468ee 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionHistory.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionHistory.java @@ -31,7 +31,7 @@ public class SelectionHistory { public SelectionHistory(CEditor editor) { Assert.isNotNull(editor); fEditor = editor; - fHistory = new Stack<ISourceRange>(); + fHistory = new Stack<>(); fSelectionListener = new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionToDeclarationJob.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionToDeclarationJob.java index 710188148a5..25adab75cf7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionToDeclarationJob.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SelectionToDeclarationJob.java @@ -196,7 +196,7 @@ public class SelectionToDeclarationJob extends Job implements ASTRunnable { targets = ArrayUtil.trim(ArrayUtil.addAll(targets, implicitTargets)); - final ArrayList<IFunctionDeclaration> functionElements = new ArrayList<IFunctionDeclaration>(); + final ArrayList<IFunctionDeclaration> functionElements = new ArrayList<>(); filterToFunctions(fTranslationUnit.getCProject(), fIndex, targets, functionElements); // save the resolved function declarations @@ -256,7 +256,7 @@ public class SelectionToDeclarationJob extends Job implements ASTRunnable { private IName[] findDefinitions(IIndex index, IASTTranslationUnit ast, NameKind kind, IBinding binding) throws CoreException { - List<IASTName> declNames = new ArrayList<IASTName>(); + List<IASTName> declNames = new ArrayList<>(); declNames.addAll(Arrays.asList(ast.getDefinitionsInAST(binding))); for (Iterator<IASTName> i = declNames.iterator(); i.hasNext();) { IASTName name = i.next(); @@ -296,7 +296,7 @@ public class SelectionToDeclarationJob extends Job implements ASTRunnable { astNames[i] = null; } else if (ASTQueries.findAncestorWithType(name, ICPPASTUsingDeclaration.class) != null) { if (usingDeclarations == null) - usingDeclarations = new ArrayList<IASTName>(1); + usingDeclarations = new ArrayList<>(1); usingDeclarations.add(name); astNames[i] = null; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingManager.java index e932f37e45d..c722a9f5248 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingManager.java @@ -418,7 +418,7 @@ public class SemanticHighlightingManager implements IPropertyChangeListener { private static class PreviewerExternalSDKHighlighting extends SemanticHighlightingWithOwnPreference { static private final Set<String> fHarcodedSDKFunctions; static { - fHarcodedSDKFunctions = new HashSet<String>(); + fHarcodedSDKFunctions = new HashSet<>(); fHarcodedSDKFunctions.add("fprintf"); //$NON-NLS-1$ // add others as necessary } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java index 5d8297a87e2..d81f5646e77 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingPresenter.java @@ -233,7 +233,7 @@ public class SemanticHighlightingPresenter implements ITextPresentationListener, private CPresentationReconciler fPresentationReconciler; /** UI's current highlighted positions - can contain <code>null</code> elements */ - private List<HighlightedPosition> fPositions = new ArrayList<HighlightedPosition>(); + private List<HighlightedPosition> fPositions = new ArrayList<>(); /** UI position lock */ private Object fPositionLock = new Object(); @@ -398,7 +398,7 @@ public class SemanticHighlightingPresenter implements ITextPresentationListener, * removed on the fly. The second of two is the list of added positions. The result * is stored in newPositions. */ - List<HighlightedPosition> newPositions = new ArrayList<HighlightedPosition>(newSize); + List<HighlightedPosition> newPositions = new ArrayList<>(newSize); HighlightedPosition position = null; HighlightedPosition addedPosition = null; for (int i = 0, j = 0, n = oldPositions.size(), m = addedPositions.length; i < n || position != null @@ -550,7 +550,7 @@ public class SemanticHighlightingPresenter implements ITextPresentationListener, int i = computeIndexAtOffset(fPositions, region.getOffset()); int n = computeIndexAtOffset(fPositions, region.getOffset() + region.getLength()); if (n - i > 2) { - List<StyleRange> ranges = new ArrayList<StyleRange>(n - i); + List<StyleRange> ranges = new ArrayList<>(n - i); for (; i < n; i++) { HighlightedPosition position = fPositions.get(i); if (!position.isDeleted()) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java index db55fded183..b3c093de5c2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java @@ -345,9 +345,9 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener { private HighlightingStyle[] fHighlightings; /** Background job's added highlighted positions */ - protected List<HighlightedPosition> fAddedPositions = new ArrayList<HighlightedPosition>(); + protected List<HighlightedPosition> fAddedPositions = new ArrayList<>(); /** Background job's removed highlighted positions */ - protected List<HighlightedPosition> fRemovedPositions = new ArrayList<HighlightedPosition>(); + protected List<HighlightedPosition> fRemovedPositions = new ArrayList<>(); /** Number of removed positions */ protected int fNOfRemovedPositions; @@ -452,7 +452,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener { CPPSemantics.popLookupPoint(); } List<HighlightedPosition> oldPositions = fRemovedPositions; - List<HighlightedPosition> newPositions = new ArrayList<HighlightedPosition>(fNOfRemovedPositions); + List<HighlightedPosition> newPositions = new ArrayList<>(fNOfRemovedPositions); for (int i = 0, n = oldPositions.size(); i < n; i++) { HighlightedPosition current = oldPositions.get(i); if (current != null) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java index 36f30dc50dc..1c401db70fb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java @@ -2086,7 +2086,7 @@ public class SemanticHighlightings { private static SemanticHighlighting[] loadSemanticHighlightings() { - Map<Key, SemanticHighlighting> highlightings = new TreeMap<SemanticHighlightings.Key, SemanticHighlighting>(); + Map<Key, SemanticHighlighting> highlightings = new TreeMap<>(); // load the built-in highlightings loadBuiltInSemanticHighlightings(highlightings); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SourceHeaderPartnerFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SourceHeaderPartnerFinder.java index 9b5a7c7fd69..392278b8f39 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SourceHeaderPartnerFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SourceHeaderPartnerFinder.java @@ -124,7 +124,7 @@ public final class SourceHeaderPartnerFinder { } public PartnerFileVisitor() { - fMap = new HashMap<IPath, Counter>(); + fMap = new HashMap<>(); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java index b3f9a8ef0e9..342903f8f57 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java @@ -341,7 +341,7 @@ public final class ToggleCommentAction extends TextEditorAction { fPrefixesMap = null; String[] types = configuration.getConfiguredContentTypes(sourceViewer); - Map<String, String[]> prefixesMap = new HashMap<String, String[]>(types.length); + Map<String, String[]> prefixesMap = new HashMap<>(types.length); for (String type : types) { String[] prefixes = configuration.getDefaultPrefixes(sourceViewer, type); if (prefixes != null && prefixes.length > 0) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java index aea4b0541d2..eb87948b976 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java @@ -51,7 +51,7 @@ public final class AsmCodeScanner extends AbstractCScanner { protected List<IRule> createRules() { IToken token; - List<IRule> rules = new ArrayList<IRule>(); + List<IRule> rules = new ArrayList<>(); // Add rule(s) for single line comments token = getToken(ICColorConstants.C_SINGLE_LINE_COMMENT); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPreprocessorScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPreprocessorScanner.java index cfe6a007d15..32fcce6b15c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPreprocessorScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPreprocessorScanner.java @@ -60,7 +60,7 @@ public class AsmPreprocessorScanner extends AbstractCScanner { * Creates rules used in this RulesBasedScanner */ protected List<IRule> createRules() { - List<IRule> rules = new ArrayList<IRule>(); + List<IRule> rules = new ArrayList<>(); IToken defaultToken = getToken(ICColorConstants.PP_DEFAULT); IToken token; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/CustomFiltersDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/CustomFiltersDialog.java index bf6d5fabc3a..9739122f81f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/CustomFiltersDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/CustomFiltersDialog.java @@ -90,7 +90,7 @@ public class CustomFiltersDialog extends SelectionDialog { fEnabledFilterIds = enabledFilterIds; fBuiltInFilters = FilterDescriptor.getFilterDescriptors(fViewId); - fFilterDescriptorChangeHistory = new Stack<FilterDescriptor>(); + fFilterDescriptorChangeHistory = new Stack<>(); setShellStyle(getShellStyle() | SWT.RESIZE); } @@ -280,7 +280,7 @@ public class CustomFiltersDialog extends SelectionDialog { @Override protected void okPressed() { if (fBuiltInFilters != null) { - ArrayList<FilterDescriptor> result = new ArrayList<FilterDescriptor>(); + ArrayList<FilterDescriptor> result = new ArrayList<>(); for (int i = 0; i < fBuiltInFilters.length; ++i) { if (fCheckBoxList.getChecked(fBuiltInFilters[i])) result.add(fBuiltInFilters[i]); @@ -333,7 +333,7 @@ public class CustomFiltersDialog extends SelectionDialog { */ public String[] getEnabledFilterIds() { Object[] result = getResult(); - Set<String> enabledIds = new HashSet<String>(result.length); + Set<String> enabledIds = new HashSet<>(result.length); for (Object element : result) enabledIds.add(((FilterDescriptor) element).getId()); return enabledIds.toArray(new String[enabledIds.size()]); @@ -356,7 +356,7 @@ public class CustomFiltersDialog extends SelectionDialog { private FilterDescriptor[] getEnabledFilterDescriptors() { FilterDescriptor[] filterDescs = fBuiltInFilters; - List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(filterDescs.length); + List<FilterDescriptor> result = new ArrayList<>(filterDescs.length); List<String> enabledFilterIds = Arrays.asList(fEnabledFilterIds); for (FilterDescriptor filterDesc : filterDescs) { String id = filterDesc.getId(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java index 999f1c14754..c6f4493300a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/filters/FilterDescriptor.java @@ -86,7 +86,7 @@ public class FilterDescriptor implements Comparable<FilterDescriptor> { */ public static FilterDescriptor[] getFilterDescriptors(String targetId) { FilterDescriptor[] filterDescs = FilterDescriptor.getFilterDescriptors(); - List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(filterDescs.length); + List<FilterDescriptor> result = new ArrayList<>(filterDescs.length); for (int i = 0; i < filterDescs.length; i++) { String tid = filterDescs[i].getTargetId(); if (tid == null || tid.equals(targetId)) @@ -247,8 +247,8 @@ public class FilterDescriptor implements Comparable<FilterDescriptor> { * Creates the filter descriptors. */ private static FilterDescriptor[] createFilterDescriptors(IConfigurationElement[] elements) { - List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(5); - Set<String> descIds = new HashSet<String>(5); + List<FilterDescriptor> result = new ArrayList<>(5); + Set<String> descIds = new HashSet<>(5); for (int i = 0; i < elements.length; i++) { final IConfigurationElement element = elements[i]; if (FILTER_TAG.equals(element.getName())) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CFunctionSummary.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CFunctionSummary.java index 8ba53f9bde4..da25eb8c325 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CFunctionSummary.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CFunctionSummary.java @@ -44,7 +44,7 @@ public class CFunctionSummary implements IFunctionSummary { String args = null; String type = null; NodeList list = e.getChildNodes(); - ArrayList<IRequiredInclude> incList = new ArrayList<IRequiredInclude>(); + ArrayList<IRequiredInclude> incList = new ArrayList<>(); for (int j = 0; j < list.getLength(); j++) { Node node = list.item(j); if (node.getNodeType() != Node.ELEMENT_NODE) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java index 3f3434d4c95..9361f0bc3b8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpBook.java @@ -42,7 +42,7 @@ public class CHelpBook implements ICHelpBook { private TreeMap<String, CHelpEntry> entries; public CHelpBook(Element e) { - entries = new TreeMap<String, CHelpEntry>(); + entries = new TreeMap<>(); if (e.hasAttribute(ATTR_TITLE)) title = e.getAttribute(ATTR_TITLE).trim(); @@ -126,7 +126,7 @@ public class CHelpBook implements ICHelpBook { } if (col.size() > 0) { - ArrayList<IFunctionSummary> out = new ArrayList<IFunctionSummary>(col.size()); + ArrayList<IFunctionSummary> out = new ArrayList<>(col.size()); for (CHelpEntry he : col) for (IFunctionSummary fs : he.getFunctionSummary()) out.add(fs); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java index c15ccbdeead..d7c6d07e8a1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpEntry.java @@ -33,8 +33,8 @@ public class CHelpEntry { public CHelpEntry(Element e) { keyword = e.getAttribute(ATTR_KEYWD).trim(); - ArrayList<CFunctionSummary> obs1 = new ArrayList<CFunctionSummary>(); - ArrayList<CHelpTopic> obs2 = new ArrayList<CHelpTopic>(); + ArrayList<CFunctionSummary> obs1 = new ArrayList<>(); + ArrayList<CHelpTopic> obs2 = new ArrayList<>(); NodeList list = e.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpProvider.java index 1170bc2d1d0..6181ae206d4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/help/CHelpProvider.java @@ -78,7 +78,7 @@ public class CHelpProvider implements ICHelpProvider { public ICHelpResourceDescriptor[] getHelpResources(ICHelpInvocationContext context, ICHelpBook[] helpBooks, String name) { - ArrayList<ICHelpResourceDescriptor> lst = new ArrayList<ICHelpResourceDescriptor>(); + ArrayList<ICHelpResourceDescriptor> lst = new ArrayList<>(); for (ICHelpBook h : helpBooks) { if (h instanceof CHelpBook) { ICHelpResourceDescriptor hrd = ((CHelpBook) h).getHelpResources(context, name); @@ -94,7 +94,7 @@ public class CHelpProvider implements ICHelpProvider { @Override public IFunctionSummary[] getMatchingFunctions(ICHelpInvocationContext context, ICHelpBook[] helpBooks, String prefix) { - ArrayList<IFunctionSummary> lst = new ArrayList<IFunctionSummary>(); + ArrayList<IFunctionSummary> lst = new ArrayList<>(); for (int i = 0; i < helpBooks.length; i++) { if (helpBooks[i] instanceof CHelpBook) { List<IFunctionSummary> fs = ((CHelpBook) helpBooks[i]).getMatchingFunctions(context, prefix); @@ -132,7 +132,7 @@ public class CHelpProvider implements ICHelpProvider { if (extensionPoint != null) { IExtension[] extensions = extensionPoint.getExtensions(); if (extensions != null) { - ArrayList<ICHelpBook> chbl = new ArrayList<ICHelpBook>(); + ArrayList<ICHelpBook> chbl = new ArrayList<>(); for (IExtension ex : extensions) { String pluginId = ex.getNamespaceIdentifier(); for (IConfigurationElement el : ex.getConfigurationElements()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java index a31f3a15df0..06641474ad8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java @@ -107,7 +107,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { directiveFile = node.getRepresentedFile(); } if (includes.length > 0) { - Set<IBNode> result = new LinkedHashSet<IBNode>(includes.length); + Set<IBNode> result = new LinkedHashSet<>(includes.length); for (IIndexInclude include : includes) { try { if (fComputeIncludedBy) { @@ -156,8 +156,8 @@ public class IBContentProvider extends AsyncTreeContentProvider { return index.findIncludedBy(files[0]); } if (files.length > 0) { - ArrayList<IIndexInclude> list = new ArrayList<IIndexInclude>(); - HashSet<IIndexFileLocation> handled = new HashSet<IIndexFileLocation>(); + ArrayList<IIndexInclude> list = new ArrayList<>(); + HashSet<IIndexFileLocation> handled = new HashSet<>(); for (IIndexFile file : files) { final IIndexInclude[] includes = index.findIncludedBy(file); for (IIndexInclude indexInclude : includes) { @@ -183,8 +183,8 @@ public class IBContentProvider extends AsyncTreeContentProvider { return index.findIncludes(files[0]); } if (files.length > 0) { - ArrayList<IIndexInclude> list = new ArrayList<IIndexInclude>(); - HashSet<IIndexFileLocation> handled = new HashSet<IIndexFileLocation>(); + ArrayList<IIndexInclude> list = new ArrayList<>(); + HashSet<IIndexFileLocation> handled = new HashSet<>(); for (IIndexFile file : files) { final IIndexInclude[] includes = index.findIncludes(file); for (IIndexInclude indexInclude : includes) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java index 21dda2df7a5..c5db6d3a0d2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBConversions.java @@ -60,7 +60,7 @@ public class IBConversions { public static ISelection nodeSelectionToRepresentedTUSelection(ISelection sel) { if (sel instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) sel; - ArrayList<ITranslationUnit> tus = new ArrayList<ITranslationUnit>(); + ArrayList<ITranslationUnit> tus = new ArrayList<>(); for (Iterator<?> iter = ssel.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof IBNode) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java index 06dcdfa3a42..32a070efd12 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBDragSourceListener.java @@ -30,7 +30,7 @@ import org.eclipse.ui.part.ResourceTransfer; public class IBDragSourceListener implements DragSourceListener { private TreeViewer fTreeViewer; - private ArrayList<IBNode> fSelectedNodes = new ArrayList<IBNode>(); + private ArrayList<IBNode> fSelectedNodes = new ArrayList<>(); private IBDropTargetListener fDropTargetListener; public IBDragSourceListener(TreeViewer viewer) { @@ -69,7 +69,7 @@ public class IBDragSourceListener implements DragSourceListener { } private String[] getFiles() { - ArrayList<String> files = new ArrayList<String>(fSelectedNodes.size()); + ArrayList<String> files = new ArrayList<>(fSelectedNodes.size()); for (Iterator<IBNode> iter = fSelectedNodes.iterator(); iter.hasNext();) { IBNode node = iter.next(); IIndexFileLocation ifl = (IIndexFileLocation) node.getAdapter(IIndexFileLocation.class); @@ -84,7 +84,7 @@ public class IBDragSourceListener implements DragSourceListener { } private IFile[] getResources() { - ArrayList<IFile> files = new ArrayList<IFile>(fSelectedNodes.size()); + ArrayList<IFile> files = new ArrayList<>(fSelectedNodes.size()); for (Iterator<IBNode> iter = fSelectedNodes.iterator(); iter.hasNext();) { IBNode node = iter.next(); IFile file = (IFile) node.getAdapter(IFile.class); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java index 8ab41797e34..fdb0fcc5b9e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBHistoryListAction.java @@ -72,7 +72,7 @@ public class IBHistoryListAction extends Action { ILabelProvider labelProvider = new CUILabelProvider(CElementLabels.APPEND_ROOT_PATH, CElementImageProvider.OVERLAY_ICONS); - fHistoryList = new ListDialogField<ITranslationUnit>(adapter, buttonLabels, labelProvider); + fHistoryList = new ListDialogField<>(adapter, buttonLabels, labelProvider); fHistoryList.setLabelText(IBMessages.IBHistoryListAction_HistoryList_label); fHistoryList.setElements(Arrays.asList(elements)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java index b6023892642..166390e5f81 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBLabelProvider.java @@ -35,7 +35,7 @@ public class IBLabelProvider extends LabelProvider implements IColorProvider { private CElementLabelProvider fCLabelProvider = new CElementLabelProvider(); private Color fColorInactive; private IBContentProvider fContentProvider; - private HashMap<String, Image> fCachedImages = new HashMap<String, Image>(); + private HashMap<String, Image> fCachedImages = new HashMap<>(); private boolean fShowFolders; public IBLabelProvider(Display display, IBContentProvider cp) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java index 8156f731c12..6090b5ab3f3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBViewPart.java @@ -131,7 +131,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget private IMemento fMemento; private boolean fShowsMessage; private IBNode fLastNavigationNode; - private ArrayList<ITranslationUnit> fHistoryEntries = new ArrayList<ITranslationUnit>(MAX_HISTORY_SIZE); + private ArrayList<ITranslationUnit> fHistoryEntries = new ArrayList<>(MAX_HISTORY_SIZE); // widgets private PageBook fPagebook; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java index 8dfde297732..13b005fa171 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexView.java @@ -79,7 +79,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang Filter filter = new Filter(); public boolean isLinking = false; private volatile boolean fUpdateRequested = false; - private Map<String, Long> fTimestampPerProject = new HashMap<String, Long>(); + private Map<String, Long> fTimestampPerProject = new HashMap<>(); private IndexContentProvider contentProvider; public void toggleExternalDefs() { @@ -153,7 +153,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang private ArrayList<IPDOMNode> fNodes; public Children() { - fNodes = new ArrayList<IPDOMNode>(); + fNodes = new ArrayList<>(); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ContentTypeMappingDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ContentTypeMappingDialog.java index 852f0f1a1d3..86b0b332557 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ContentTypeMappingDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ContentTypeMappingDialog.java @@ -42,8 +42,8 @@ public abstract class ContentTypeMappingDialog extends Dialog { public ContentTypeMappingDialog(Shell parentShell) { super(parentShell); - fContentTypeNamesToIDsMap = new HashMap<String, String>(); - fLanguageNamesToIDsMap = new HashMap<String, String>(); + fContentTypeNamesToIDsMap = new HashMap<>(); + fLanguageNamesToIDsMap = new HashMap<>(); } public String getSelectedContentTypeName() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/FileLanguageMappingPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/FileLanguageMappingPropertyPage.java index 56f2a8fa273..22666c8c08c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/FileLanguageMappingPropertyPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/FileLanguageMappingPropertyPage.java @@ -326,7 +326,7 @@ public class FileLanguageMappingPropertyPage extends PropertyPage { LanguageManager manager = LanguageManager.getInstance(); ProjectLanguageConfiguration config = manager.getLanguageConfiguration(project); - Map<String, String> mappings = new TreeMap<String, String>(); + Map<String, String> mappings = new TreeMap<>(); TableItem[] items = fTable.getItems(); for (int i = 0; i < items.length; i++) { TableItem item = items[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageMappingWidget.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageMappingWidget.java index f3fb938ff1f..61760ada7e6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageMappingWidget.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageMappingWidget.java @@ -53,7 +53,7 @@ public abstract class LanguageMappingWidget { fOverriddenContentTypes = Collections.emptySet(); // keep a mapping of all registered content types and their names - fContentTypeNamesToIDsMap = new HashMap<String, String>(); + fContentTypeNamesToIDsMap = new HashMap<>(); String[] contentTypesIDs = LanguageManager.getInstance().getRegisteredContentTypeIds(); IContentTypeManager contentTypeManager = Platform.getContentTypeManager(); @@ -68,7 +68,7 @@ public abstract class LanguageMappingWidget { fContentTypeNamesToIDsMap.put(name, contentTypesIDs[i]); } - fAffectedContentTypes = new HashSet<IContentType>(); + fAffectedContentTypes = new HashSet<>(); } public IAdaptable getElement() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java index 84750c2389f..c48668f0a40 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java @@ -37,7 +37,7 @@ public class LanguageVerifier { public static Map<String, ILanguage> computeAvailableLanguages() { ILanguage[] registeredLanguages = LanguageManager.getInstance().getRegisteredLanguages(); - Map<String, ILanguage> languages = new TreeMap<String, ILanguage>(); + Map<String, ILanguage> languages = new TreeMap<>(); for (int i = 0; i < registeredLanguages.length; i++) { languages.put(registeredLanguages[i].getId(), registeredLanguages[i]); } @@ -56,7 +56,7 @@ public class LanguageVerifier { public static Set<String> removeMissingLanguages(ProjectLanguageConfiguration config, ICProjectDescription description, Map<String, ILanguage> availableLanguages) { - Set<String> missingLanguages = new TreeSet<String>(); + Set<String> missingLanguages = new TreeSet<>(); // Check file mappings Iterator<Entry<String, Map<String, String>>> fileConfigurationMappings = config.getFileMappings().entrySet() @@ -103,11 +103,11 @@ public class LanguageVerifier { public static Set<String> removeMissingLanguages(WorkspaceLanguageConfiguration config, Map<String, ILanguage> availableLanguages) { - Set<String> missingLanguages = new TreeSet<String>(); + Set<String> missingLanguages = new TreeSet<>(); // Check content type mappings Iterator<Entry<String, String>> contentTypeMappings = config.getWorkspaceMappings().entrySet().iterator(); - List<String> removals = new ArrayList<String>(); + List<String> removals = new ArrayList<>(); while (contentTypeMappings.hasNext()) { Entry<String, String> entry = contentTypeMappings.next(); String languageId = entry.getValue(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectContentTypeMappingDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectContentTypeMappingDialog.java index d05d7790ba2..14d0c81097a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectContentTypeMappingDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectContentTypeMappingDialog.java @@ -138,7 +138,7 @@ public class ProjectContentTypeMappingDialog extends ContentTypeMappingDialog { private void configureContentTypes(Combo combo, ICConfigurationDescription configuration) { combo.removeAll(); IContentTypeManager contentTypeManager = Platform.getContentTypeManager(); - List<String> names = new LinkedList<String>(); + List<String> names = new LinkedList<>(); for (int i = 0; i < fContentTypesIDs.length; i++) { String contentTypeId = fContentTypesIDs[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingWidget.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingWidget.java index 8805c3f63fb..93a52254bf0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingWidget.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingWidget.java @@ -134,7 +134,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget { } Map<String, String> contentTypeMappings = fConfigurationContentTypeMappings.get(configuration); if (contentTypeMappings == null) { - contentTypeMappings = new TreeMap<String, String>(); + contentTypeMappings = new TreeMap<>(); fConfigurationContentTypeMappings.put(configuration, contentTypeMappings); } contentTypeMappings.put(contentType, language); @@ -189,7 +189,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget { } private Set<String> createContentTypeFilter(Map<String, Map<String, String>> mappings) { - Set<String> filter = new HashSet<String>(); + Set<String> filter = new HashSet<>(); Iterator<Entry<String, Map<String, String>>> configurationContentTypeMappings = mappings.entrySet().iterator(); while (configurationContentTypeMappings.hasNext()) { Entry<String, Map<String, String>> entry = configurationContentTypeMappings.next(); @@ -253,7 +253,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget { } if (fChild != null) { - Set<String> overrides = new HashSet<String>( + Set<String> overrides = new HashSet<>( createWorkspaceContentTypeFilter(fConfigurationContentTypeMappings)); fChild.setOverriddenContentTypes(overrides); fChild.refreshMappings(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/WorkspaceLanguageMappingWidget.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/WorkspaceLanguageMappingWidget.java index a46dc2accbc..93115b83626 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/WorkspaceLanguageMappingWidget.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/WorkspaceLanguageMappingWidget.java @@ -47,7 +47,7 @@ public class WorkspaceLanguageMappingWidget extends LanguageMappingWidget { public WorkspaceLanguageMappingWidget() { super(); - fContentTypeMappings = new TreeMap<String, String>(); + fContentTypeMappings = new TreeMap<>(); } @Override @@ -174,7 +174,7 @@ public class WorkspaceLanguageMappingWidget extends LanguageMappingWidget { } if (fChild != null) { - Set<String> overrides = new HashSet<String>(fContentTypeMappings.keySet()); + Set<String> overrides = new HashSet<>(fContentTypeMappings.keySet()); overrides.addAll(fOverriddenContentTypes); fChild.setOverriddenContentTypes(overrides); fChild.refreshMappings(); @@ -182,7 +182,7 @@ public class WorkspaceLanguageMappingWidget extends LanguageMappingWidget { } public void setMappings(Map<String, String> mappings) { - fContentTypeMappings = new TreeMap<String, String>(mappings); + fContentTypeMappings = new TreeMap<>(mappings); } public Map<String, String> getContentTypeMappings() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java index c6d6a1cd8b0..d085ab5de40 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java @@ -116,7 +116,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { private static final String CLEAR_STR = Messages.LanguageSettingsProviderTab_Clear; - private Map<String, List<ILanguageSettingsProvider>> initialProvidersMap = new HashMap<String, List<ILanguageSettingsProvider>>(); + private Map<String, List<ILanguageSettingsProvider>> initialProvidersMap = new HashMap<>(); /** * Label provider for language settings providers displayed by this tab. @@ -205,7 +205,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { } // convert to modifiable list - entriesList = new ArrayList<ICLanguageSettingEntry>(entriesList); + entriesList = new ArrayList<>(entriesList); if (builtInCheckBox.getSelection() == false) { for (Iterator<ICLanguageSettingEntry> iter = entriesList.iterator(); iter.hasNext();) { @@ -771,7 +771,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { if (entries == null) { entries = getSettingEntriesUpResourceTree(provider); } - entries = new ArrayList<ICLanguageSettingEntry>(entries); + entries = new ArrayList<>(entries); return entries; } @@ -802,7 +802,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { ICConfigurationDescription cfgDescription = getConfigurationDescription(); List<ILanguageSettingsProvider> initialProviders = initialProvidersMap.get(cfgDescription.getId()); if (initialProviders.contains(provider)) { - List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>( + List<ILanguageSettingsProvider> providers = new ArrayList<>( ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()); int pos = providers.indexOf(provider); if (pos >= 0) { @@ -883,7 +883,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { private void clearProvider(ILanguageSettingsProvider provider) { if (provider != null) { String providerId = provider.getId(); - List<ICLanguageSettingEntry> empty = new ArrayList<ICLanguageSettingEntry>(); + List<ICLanguageSettingEntry> empty = new ArrayList<>(); saveEntries(provider, empty); updateTreeForEntries(providerId, null); } @@ -1002,7 +1002,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { * Get list of providers to display in the settings entry tree. */ private List<ILanguageSettingsProvider> getProviders(String languageSettingId) { - List<ILanguageSettingsProvider> itemsList = new LinkedList<ILanguageSettingsProvider>(); + List<ILanguageSettingsProvider> itemsList = new LinkedList<>(); IResource rc = getResource(); ICConfigurationDescription cfgDescription = getConfigurationDescription(); if (rc != null && cfgDescription instanceof ILanguageSettingsProvidersKeeper) { @@ -1083,7 +1083,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { // Use a TreeMap to sort the languages by name. // For each name we keep a list of ids in case of name overlap. - Map<String, List<String>> map = new TreeMap<String, List<String>>(); + Map<String, List<String>> map = new TreeMap<>(); for (String langId : languageIds) { ILanguage language = LanguageManager.getInstance().getLanguage(langId); @@ -1093,7 +1093,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { continue; List<String> langIds = map.get(langName); if (langIds == null) { - langIds = new ArrayList<String>(); + langIds = new ArrayList<>(); map.put(langName, langIds); } langIds.add(langId); @@ -1190,7 +1190,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { IResource rc = getResource(); List<ILanguageSettingsProvider> oldProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription) .getLanguageSettingProviders(); - List<ILanguageSettingsProvider> newProviders = new ArrayList<ILanguageSettingsProvider>( + List<ILanguageSettingsProvider> newProviders = new ArrayList<>( oldProviders.size()); // clear entries for a given resource for all languages where applicable diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java index 6e54203427b..27a02463aa9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java @@ -52,14 +52,14 @@ public class LanguageSettingsProviderAssociationManager { private static final String ATTR_UI_EDIT_ENTRIES = "ui-edit-entries"; //$NON-NLS-1$ private static boolean isLoaded = false; - private static List<URL> loadedIcons = new ArrayList<URL>(); - private static Map<String, URL> fImagesUrlById = new HashMap<String, URL>(); - private static Map<String, URL> fImagesUrlByClass = new HashMap<String, URL>(); - private static List<String> fRegirestedIds = new ArrayList<String>(); - private static List<String> fRegisteredClasses = new ArrayList<String>(); + private static List<URL> loadedIcons = new ArrayList<>(); + private static Map<String, URL> fImagesUrlById = new HashMap<>(); + private static Map<String, URL> fImagesUrlByClass = new HashMap<>(); + private static List<String> fRegirestedIds = new ArrayList<>(); + private static List<String> fRegisteredClasses = new ArrayList<>(); - private static Map<String, Map<String, String>> fAssociationsById = new HashMap<String, Map<String, String>>(); - private static Map<String, Map<String, String>> fAssociationsByClass = new HashMap<String, Map<String, String>>(); + private static Map<String, Map<String, String>> fAssociationsById = new HashMap<>(); + private static Map<String, Map<String, String>> fAssociationsByClass = new HashMap<>(); /** * Load extensions into memory maps. @@ -85,7 +85,7 @@ public class LanguageSettingsProviderAssociationManager { fImagesUrlById.put(id, url); fRegirestedIds.add(id); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); putNotEmpty(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE)); putNotEmpty(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES)); putNotEmpty(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES)); @@ -99,7 +99,7 @@ public class LanguageSettingsProviderAssociationManager { fRegisteredClasses.add(className); } - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); putNotEmpty(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE)); putNotEmpty(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES)); putNotEmpty(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java index 7e3bfb174fc..0e92b496b0f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderTab.java @@ -108,8 +108,8 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab { * not raw providers. */ private List<ILanguageSettingsProvider> presentedProviders = null; - private final Map<String, ICOptionPage> optionsPageMap = new HashMap<String, ICOptionPage>(); - private Map<String/*cfgId*/, List<ILanguageSettingsProvider>> initialProvidersByCfg = new HashMap<String, List<ILanguageSettingsProvider>>(); + private final Map<String, ICOptionPage> optionsPageMap = new HashMap<>(); + private Map<String/*cfgId*/, List<ILanguageSettingsProvider>> initialProvidersByCfg = new HashMap<>(); /** * Label provider for language settings providers displayed by this tab. @@ -908,18 +908,18 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab { // The providers list is formed to consist of configuration providers (checked elements on top of the table) // and after that other providers which could be possible added (unchecked) sorted by name. - List<String> idsList = new ArrayList<String>(); + List<String> idsList = new ArrayList<>(); List<ILanguageSettingsProvider> providers; ICConfigurationDescription cfgDescription = getConfigurationDescription(); if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { - providers = new ArrayList<ILanguageSettingsProvider>( + providers = new ArrayList<>( ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()); for (ILanguageSettingsProvider provider : providers) { idsList.add(provider.getId()); } } else { - providers = new ArrayList<ILanguageSettingsProvider>(); + providers = new ArrayList<>(); } List<ILanguageSettingsProvider> allAvailableProvidersSet = LanguageSettingsManager.getWorkspaceProviders(); @@ -1137,7 +1137,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab { ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null)); ICConfigurationDescription cfgDescription = getConfigurationDescription(); if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { - List<ILanguageSettingsProvider> cfgProviders = new ArrayList<ILanguageSettingsProvider>( + List<ILanguageSettingsProvider> cfgProviders = new ArrayList<>( ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()); String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription) .getDefaultLanguageSettingsProvidersIds(); @@ -1150,7 +1150,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab { } } else if (page.isForPrefs()) { - presentedProviders = new ArrayList<ILanguageSettingsProvider>(); + presentedProviders = new ArrayList<>(); for (String id : LanguageSettingsManager.getExtensionProviderIds()) { ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(id); ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(provider); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java index 44718c42cdd..c6591ab41ae 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java @@ -420,7 +420,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I * @return <code>true</code> if the input set was modified */ private boolean convertToCElements(Set<Object> currentChildren) { - LinkedHashSet<ICElement> convertedChildren = new LinkedHashSet<ICElement>(); + LinkedHashSet<ICElement> convertedChildren = new LinkedHashSet<>(); ICElement newChild; for (Iterator<Object> iter = currentChildren.iterator(); iter.hasNext();) { Object child = iter.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java index bed23aaff9e..559df1409c5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java @@ -73,7 +73,7 @@ public class CNavigatorDragAdapterAssistant extends CommonDragAdapterAssistant { return true; } } else if (FileTransfer.getInstance().isSupportedType(event.dataType)) { - List<String> files = new ArrayList<String>(); + List<String> files = new ArrayList<>(); for (Iterator<?> iter = (selection).iterator(); iter.hasNext();) { Object element = iter.next(); if (element instanceof ITranslationUnit) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java index 0e1af1c23e0..5bf9be83ce5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java @@ -429,7 +429,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant { return null; } List<?> elements = ((IStructuredSelection) selection).toList(); - List<Object> resources = new ArrayList<Object>(elements.size()); + List<Object> resources = new ArrayList<>(elements.size()); for (Object element : elements) { if (element instanceof ITranslationUnit) { continue; @@ -500,7 +500,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant { * @return the resource selection from the LocalSelectionTransfer */ private IResource[] getSelectedResources(IStructuredSelection selection) { - ArrayList<Object> selectedResources = new ArrayList<Object>(); + ArrayList<Object> selectedResources = new ArrayList<>(); for (Iterator<?> i = selection.iterator(); i.hasNext();) { Object o = i.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractConfigurationBlock.java index c38c278c6e6..cc0392c9adc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractConfigurationBlock.java @@ -73,7 +73,7 @@ abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlo protected final class SectionManager { /** The preference setting for keeping no section open. */ private static final String __NONE = "__none"; //$NON-NLS-1$ - private final Set<ExpandableComposite> fSections = new HashSet<ExpandableComposite>(); + private final Set<ExpandableComposite> fSections = new HashSet<>(); private boolean fIsBeingManaged = false; private final ExpansionAdapter fListener = new ExpansionAdapter() { @Override @@ -210,7 +210,7 @@ abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlo protected static final int INDENT = 20; private final OverlayPreferenceStore fStore; - private final Map<Object, String> fCheckBoxes = new HashMap<Object, String>(); + private final Map<Object, String> fCheckBoxes = new HashMap<>(); private final SelectionListener fCheckBoxListener = new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { @@ -223,7 +223,7 @@ abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlo } }; - private final Map<Object, String> fTextFields = new HashMap<Object, String>(); + private final Map<Object, String> fTextFields = new HashMap<>(); private final ModifyListener fTextFieldListener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { @@ -232,7 +232,7 @@ abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlo } }; - private final ArrayList<Text> fNumberFields = new ArrayList<Text>(); + private final ArrayList<Text> fNumberFields = new ArrayList<>(); private final ModifyListener fNumberFieldListener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { @@ -246,7 +246,7 @@ abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlo * @see #createDependency(Button, Control) * @since 3.0 */ - private final ArrayList<Object> fMasterSlaveListeners = new ArrayList<Object>(); + private final ArrayList<Object> fMasterSlaveListeners = new ArrayList<>(); private StatusInfo fStatus; private final PreferencePage fMainPage; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractMixedPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractMixedPreferencePage.java index 909c4a555ea..4fb8c6b1122 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractMixedPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AbstractMixedPreferencePage.java @@ -35,7 +35,7 @@ public abstract class AbstractMixedPreferencePage extends AbstractPreferencePage protected OverlayPreferenceStore corePrefsOverlayStore; - private Map<Button, String> corePrefsCheckBoxes = new HashMap<Button, String>(); + private Map<Button, String> corePrefsCheckBoxes = new HashMap<>(); private SelectionListener corePrefsCheckBoxListener = new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java index 6986ce85fe6..99427b5e4eb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java @@ -360,7 +360,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock { /** * Highlighting color list */ - private final java.util.List<HighlightingColorListItem> fListModel = new ArrayList<HighlightingColorListItem>(); + private final java.util.List<HighlightingColorListItem> fListModel = new ArrayList<>(); /** * Highlighting color list viewer */ @@ -414,7 +414,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock { } private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { - List<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>(); + List<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java index a56853ecadf..a02b0d5dc6c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorHoverConfigurationBlock.java @@ -186,7 +186,7 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { - ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); + ArrayList<OverlayKey> overlayKeys = new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)); @@ -469,7 +469,7 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB StringTokenizer tokenizer = new StringTokenizer(compiledTextHoverModifiers, CEditorTextHoverDescriptor.VALUE_SEPARATOR); - HashMap<String, String> idToModifier = new HashMap<String, String>(tokenizer.countTokens() / 2); + HashMap<String, String> idToModifier = new HashMap<>(tokenizer.countTokens() / 2); while (tokenizer.hasMoreTokens()) { String id = tokenizer.nextToken(); @@ -481,7 +481,7 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB .getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS); tokenizer = new StringTokenizer(compiledTextHoverModifierMasks, CEditorTextHoverDescriptor.VALUE_SEPARATOR); - HashMap<String, String> idToModifierMask = new HashMap<String, String>(tokenizer.countTokens() / 2); + HashMap<String, String> idToModifierMask = new HashMap<>(tokenizer.countTokens() / 2); while (tokenizer.hasMoreTokens()) { String id = tokenizer.nextToken(); @@ -569,7 +569,7 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB fStatus = new StatusInfo(); int i = 0; - HashMap<Integer, String> stateMasks = new HashMap<Integer, String>(fHoverConfigs.length); + HashMap<Integer, String> stateMasks = new HashMap<>(fHoverConfigs.length); while (fStatus.isOK() && i < fHoverConfigs.length) { if (fHoverConfigs[i].fIsEnabled) { String label = getContributedHovers()[i].getLabel(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypeDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypeDialog.java index 153b09c2078..3e04b634ca1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypeDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypeDialog.java @@ -116,7 +116,7 @@ public class CFileTypeDialog extends Dialog { private void populateTypesCombo() { IContentTypeManager manager = Platform.getContentTypeManager(); String[] ids = CoreModel.getRegistedContentTypeIds(); - ArrayList<IContentType> list = new ArrayList<IContentType>(ids.length); + ArrayList<IContentType> list = new ArrayList<>(ids.length); for (String id : ids) { IContentType ctype = manager.getContentType(id); if (ctype != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPreferenceBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPreferenceBlock.java index 3e4ce9d14f9..be91aa9f2e7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPreferenceBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPreferenceBlock.java @@ -181,8 +181,8 @@ public class CFileTypesPreferenceBlock { } public CFileTypesPreferenceBlock(IProject input) { - fAddAssoc = new ArrayList<CFileTypeAssociation>(); - fRemoveAssoc = new ArrayList<CFileTypeAssociation>(); + fAddAssoc = new ArrayList<>(); + fRemoveAssoc = new ArrayList<>(); fInput = input; setDirty(false); } @@ -327,7 +327,7 @@ public class CFileTypesPreferenceBlock { } private CFileTypeAssociation[] getCFileTypeAssociations() { - ArrayList<CFileTypeAssociation> list = new ArrayList<CFileTypeAssociation>(); + ArrayList<CFileTypeAssociation> list = new ArrayList<>(); if (fInput == null) { fillWithUserDefinedCFileTypeAssociations(list); fillWithPredefinedCFileTypeAssociations(list); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPropertyPage.java index d17771c47b7..a136e368014 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPropertyPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CFileTypesPropertyPage.java @@ -48,7 +48,7 @@ import org.eclipse.ui.dialogs.PropertyPage; public class CFileTypesPropertyPage extends PropertyPage { class FixCFileTypesPreferenceBlock extends CFileTypesPreferenceBlock { - ArrayList<ContentTypeChangeEvent> list = new ArrayList<ContentTypeChangeEvent>(); + ArrayList<ContentTypeChangeEvent> list = new ArrayList<>(); public FixCFileTypesPreferenceBlock() { super(); @@ -232,7 +232,7 @@ public class CFileTypesPropertyPage extends PropertyPage { void computeEvents(IProject project) { IScopeContext projectScope = new ProjectScope(project); IContentType[] ctypes = getRegistedContentTypes(); - ArrayList<IContentType> list = new ArrayList<IContentType>(ctypes.length); + ArrayList<IContentType> list = new ArrayList<>(ctypes.length); for (IContentType ctype : ctypes) { try { IContentTypeSettings projectSettings = ctype.getSettings(projectScope); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java index d9202bb33c9..9231cf9e1b4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java @@ -60,7 +60,7 @@ public class CPluginPreferencePage extends PreferencePage implements IWorkbenchP setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore()); setDescription(PreferencesMessages.CPluginPreferencePage_description); - fCheckBoxes = new ArrayList<Button>(); + fCheckBoxes = new ArrayList<>(); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistAdvancedConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistAdvancedConfigurationBlock.java index 21596d0ae17..86927a8c57f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistAdvancedConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistAdvancedConfigurationBlock.java @@ -172,7 +172,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo public PreferenceModel(CompletionProposalComputerRegistry registry) { List<CompletionProposalCategory> categories = registry.getProposalCategories(); - fElements = new ArrayList<ModelElement>(); + fElements = new ArrayList<>(); for (CompletionProposalCategory category : categories) { if (category.hasComputers()) { fElements.add(new ModelElement(category, this)); @@ -340,7 +340,7 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo /** element type: {@link ModelElement}. */ private final PreferenceModel fModel; - private final Map<ImageDescriptor, Image> fImages = new HashMap<ImageDescriptor, Image>(); + private final Map<ImageDescriptor, Image> fImages = new HashMap<>(); private CheckboxTableViewer fDefaultViewer; private CheckboxTableViewer fSeparateViewer; @@ -654,8 +654,8 @@ final class CodeAssistAdvancedConfigurationBlock extends OptionsConfigurationBlo private void updateCheckedState() { final int size = fModel.elements.size(); - List<ModelElement> defaultChecked = new ArrayList<ModelElement>(size); - List<ModelElement> separateChecked = new ArrayList<ModelElement>(size); + List<ModelElement> defaultChecked = new ArrayList<>(size); + List<ModelElement> separateChecked = new ArrayList<>(size); for (Object element2 : fModel.elements) { ModelElement element = (ModelElement) element2; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java index 892ff6674ab..429499ce061 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeTemplateBlock.java @@ -350,7 +350,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock { PreferencesMessages.CodeTemplateBlock_templates_import_button, PreferencesMessages.CodeTemplateBlock_templates_export_button, PreferencesMessages.CodeTemplateBlock_templates_exportall_button }; - fCodeTemplateTree = new TreeListDialogField<Object>(adapter, buttonLabels, new CodeTemplateLabelProvider()); + fCodeTemplateTree = new TreeListDialogField<>(adapter, buttonLabels, new CodeTemplateLabelProvider()); fCodeTemplateTree.setDialogFieldListener(adapter); fCodeTemplateTree.setLabelText(PreferencesMessages.CodeTemplateBlock_templates_label); fCodeTemplateTree.setViewerComparator(adapter); @@ -467,7 +467,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock { } protected TemplatePersistenceData[] getCodeTemplatesOfCategory(boolean isComment) { - ArrayList<TemplatePersistenceData> res = new ArrayList<TemplatePersistenceData>(); + ArrayList<TemplatePersistenceData> res = new ArrayList<>(); TemplatePersistenceData[] templates = fTemplateStore.getTemplateData(); for (TemplatePersistenceData curr : templates) { boolean isUserAdded = curr.getId() == null; @@ -486,7 +486,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock { } protected TemplatePersistenceData[] getTemplatesOfContextType(String contextTypeId) { - ArrayList<TemplatePersistenceData> res = new ArrayList<TemplatePersistenceData>(); + ArrayList<TemplatePersistenceData> res = new ArrayList<>(); TemplatePersistenceData[] templates = fTemplateStore.getTemplateData(); for (TemplatePersistenceData curr : templates) { if (contextTypeId.equals(curr.getTemplate().getContextTypeId())) { @@ -514,7 +514,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock { protected TemplateContextType[] getFileTemplateContextTypes() { Iterator<?> iter = getFileTemplateContextRegistry().contextTypes(); - ArrayList<TemplateContextType> result = new ArrayList<TemplateContextType>(); + ArrayList<TemplateContextType> result = new ArrayList<>(); while (iter.hasNext()) { TemplateContextType contextType = (TemplateContextType) iter.next(); if (getTemplatesOfContextType(contextType).length > 0) { @@ -719,7 +719,7 @@ public class CodeTemplateBlock extends OptionsConfigurationBlock { } private void export(List<Object> selected) { - Set<Object> datas = new HashSet<Object>(); + Set<Object> datas = new HashSet<>(); for (int i = 0; i < selected.size(); i++) { Object curr = selected.get(i); if (curr instanceof TemplatePersistenceData) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java index 30abbfc6849..15e1a41824f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java @@ -161,8 +161,8 @@ public class EditTemplateDialog extends StatusDialog { private StatusInfo fValidationStatus; private boolean fSuppressError = true; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=4354 - private final Map<String, TextViewerAction> fGlobalActions = new HashMap<String, TextViewerAction>(10); - private final List<String> fSelectionActions = new ArrayList<String>(3); + private final Map<String, TextViewerAction> fGlobalActions = new HashMap<>(10); + private final List<String> fSelectionActions = new ArrayList<>(3); private String[][] fContextTypes; private ContextTypeRegistry fContextTypeRegistry; @@ -193,7 +193,7 @@ public class EditTemplateDialog extends StatusDialog { // String delim= new Document().getLegalLineDelimiters()[0]; - List<String[]> contexts = new ArrayList<String[]>(); + List<String[]> contexts = new ArrayList<>(); for (Iterator<?> it = registry.contextTypes(); it.hasNext();) { TemplateContextType type = (TemplateContextType) it.next(); // TODO cppdoc? doxygen? @@ -485,7 +485,7 @@ public class EditTemplateDialog extends StatusDialog { } private void initializeActions() { - final ArrayList<IHandlerActivation> handlerActivations = new ArrayList<IHandlerActivation>(3); + final ArrayList<IHandlerActivation> handlerActivations = new ArrayList<>(3); final IHandlerService handlerService = PlatformUI.getWorkbench().getAdapter(IHandlerService.class); getShell().addDisposeListener(new DisposeListener() { @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/FoldingConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/FoldingConfigurationBlock.java index 07ce2a42f6d..f54e28277d4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/FoldingConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/FoldingConfigurationBlock.java @@ -110,15 +110,15 @@ class FoldingConfigurationBlock implements IPreferenceConfigurationBlock { fStore = store; fStore.addKeys(createOverlayStoreKeys()); fProviderDescriptors = createListModel(); - fProviderPreferences = new HashMap<String, ICFoldingPreferenceBlock>(); - fProviderControls = new HashMap<String, Control>(); + fProviderPreferences = new HashMap<>(); + fProviderControls = new HashMap<>(); } private Map<String, CFoldingStructureProviderDescriptor> createListModel() { CFoldingStructureProviderRegistry reg = CUIPlugin.getDefault().getFoldingStructureProviderRegistry(); reg.reloadExtensions(); CFoldingStructureProviderDescriptor[] descs = reg.getFoldingProviderDescriptors(); - Map<String, CFoldingStructureProviderDescriptor> map = new HashMap<String, CFoldingStructureProviderDescriptor>(); + Map<String, CFoldingStructureProviderDescriptor> map = new HashMap<>(); for (int i = 0; i < descs.length; i++) { map.put(descs[i].getId(), descs[i]); } @@ -127,7 +127,7 @@ class FoldingConfigurationBlock implements IPreferenceConfigurationBlock { private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { - ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); + ArrayList<OverlayKey> overlayKeys = new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOLDING_ENABLED)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionBlock.java index 41cec642bf2..a717ecebbe7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionBlock.java @@ -105,7 +105,7 @@ public class HeaderSubstitutionBlock extends OptionsConfigurationBlock { PreferencesMessages.HeaderSubstitutionBlock_remove_button, PreferencesMessages.HeaderSubstitutionBlock_up_button, PreferencesMessages.HeaderSubstitutionBlock_down_button, }; - fHeaderMapsList = new ListDialogField<HeaderSubstitutionMap>(adapter, buttons, new HeaderMapLabelProvider()); + fHeaderMapsList = new ListDialogField<>(adapter, buttons, new HeaderMapLabelProvider()); fHeaderMapsList.setLabelText(PreferencesMessages.HeaderSubstitutionBlock_header_substitution_maps); fHeaderMapsList.setDialogFieldListener(adapter); fHeaderMapsList.setRemoveButtonIndex(IDX_REMOVE); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionMapEditDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionMapEditDialog.java index 7611512731b..9d8faa6a295 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionMapEditDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/HeaderSubstitutionMapEditDialog.java @@ -237,7 +237,7 @@ public class HeaderSubstitutionMapEditDialog extends ResizableStatusDialog { List<HeaderSubstitutionMap> existingEntries) { super(parent); - fExistingNames = new HashSet<String>(); + fExistingNames = new HashSet<>(); for (HeaderSubstitutionMap exising : existingEntries) { if (!exising.equals(map)) { fExistingNames.add(exising.getName()); @@ -319,7 +319,7 @@ public class HeaderSubstitutionMapEditDialog extends ResizableStatusDialog { } private List<HeaderSubstitutionRule> getSubstitutionRules(IncludeMap map) { - ArrayList<HeaderSubstitutionRule> result = new ArrayList<HeaderSubstitutionRule>(); + ArrayList<HeaderSubstitutionRule> result = new ArrayList<>(); for (Entry<IncludeInfo, List<IncludeInfo>> entry : map.getMap().entrySet()) { String source = stripQuotes(entry.getKey().toString()); for (IncludeInfo target : entry.getValue()) { @@ -542,7 +542,7 @@ public class HeaderSubstitutionMapEditDialog extends ResizableStatusDialog { for (HeaderSubstitutionRule rule : fOptionalSubstitutionsField.getElements()) { if (rule.getSource().equals(newRule.getSource())) { if (rulesToDelete == null) - rulesToDelete = new ArrayList<HeaderSubstitutionRule>(); + rulesToDelete = new ArrayList<>(); rulesToDelete.add(rule); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeCategoriesBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeCategoriesBlock.java index 03a1f839b23..06556a4ed9b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeCategoriesBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeCategoriesBlock.java @@ -47,7 +47,7 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; */ public class IncludeCategoriesBlock extends OptionsConfigurationBlock { private final List<IncludeGroupStyle> styles; - private final Map<IncludeKind, Category> categories = new HashMap<IncludeKind, Category>(); + private final Map<IncludeKind, Category> categories = new HashMap<>(); private TreeListDialogField<Category> categoryTree; private PixelConverter pixelConverter; private StackLayout editorAreaStack; @@ -100,7 +100,7 @@ public class IncludeCategoriesBlock extends OptionsConfigurationBlock { composite.setLayout(layout); IncludeStyleAdapter adapter = new IncludeStyleAdapter(); - categoryTree = new TreeListDialogField<Category>(adapter, null, new IncludeStyleLabelProvider()); + categoryTree = new TreeListDialogField<>(adapter, null, new IncludeStyleLabelProvider()); categoryTree.setDialogFieldListener(adapter); categoryTree.setLabelText(PreferencesMessages.IncludeCategoriesBlock_header_categories); categoryTree.setViewerComparator(adapter); @@ -134,7 +134,7 @@ public class IncludeCategoriesBlock extends OptionsConfigurationBlock { editorArea.setFont(parent.getFont()); editorAreaStack = new StackLayout(); editorArea.setLayout(editorAreaStack); - Map<IncludeKind, IncludeGroupStyle> stylesByKind = new HashMap<IncludeKind, IncludeGroupStyle>(); + Map<IncludeKind, IncludeGroupStyle> stylesByKind = new HashMap<>(); for (IncludeGroupStyle style : styles) { if (style.getIncludeKind() != IncludeKind.MATCHING_PATTERN) stylesByKind.put(style.getIncludeKind(), style); @@ -188,7 +188,7 @@ public class IncludeCategoriesBlock extends OptionsConfigurationBlock { Category(IncludeKind includeKind, Category parent) { this.includeKind = includeKind; this.parent = parent; - children = new ArrayList<Category>(); + children = new ArrayList<>(); index = parent != null ? parent.addChild(this) : 0; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeOrderBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeOrderBlock.java index 64a8b570dcf..f2aa7a59831 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeOrderBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeOrderBlock.java @@ -93,9 +93,9 @@ public class IncludeOrderBlock extends OptionsConfigurationBlock { protected void updateControls() { super.updateControls(); stylesByKind = getStylesByKind(styles); - List<IncludeGroupStyle> orderedStyles = new ArrayList<IncludeGroupStyle>(styles); + List<IncludeGroupStyle> orderedStyles = new ArrayList<>(styles); Collections.sort(orderedStyles); // Sort according to values returned by getOrder() method. - List<IncludeGroupStyle> groupedStyles = new ArrayList<IncludeGroupStyle>(); + List<IncludeGroupStyle> groupedStyles = new ArrayList<>(); int order = 0; for (IncludeGroupStyle style : orderedStyles) { style.setOrder(order++); @@ -146,7 +146,7 @@ public class IncludeOrderBlock extends OptionsConfigurationBlock { } private static Map<IncludeKind, IncludeGroupStyle> getStylesByKind(List<IncludeGroupStyle> styles) { - Map<IncludeKind, IncludeGroupStyle> stylesByKind = new HashMap<IncludeKind, IncludeGroupStyle>(); + Map<IncludeKind, IncludeGroupStyle> stylesByKind = new HashMap<>(); for (IncludeGroupStyle style : styles) { if (style.getIncludeKind() != IncludeKind.MATCHING_PATTERN) stylesByKind.put(style.getIncludeKind(), style); @@ -236,7 +236,7 @@ public class IncludeOrderBlock extends OptionsConfigurationBlock { } private List<IncludeGroupStyle> reverse(List<IncludeGroupStyle> p) { - List<IncludeGroupStyle> reverse = new ArrayList<IncludeGroupStyle>(p.size()); + List<IncludeGroupStyle> reverse = new ArrayList<>(p.size()); for (int i = p.size(); --i >= 0;) { reverse.add(p.get(i)); } @@ -267,8 +267,8 @@ public class IncludeOrderBlock extends OptionsConfigurationBlock { private List<IncludeGroupStyle> moveUp(List<IncludeGroupStyle> elements, boolean[] selected) { int nElements = elements.size(); - List<IncludeGroupStyle> res = new ArrayList<IncludeGroupStyle>(nElements); - List<IncludeGroupStyle> floating = new ArrayList<IncludeGroupStyle>(); + List<IncludeGroupStyle> res = new ArrayList<>(nElements); + List<IncludeGroupStyle> floating = new ArrayList<>(); for (int i = 0; i < nElements; i++) { IncludeGroupStyle curr = elements.get(i); if (selected[i]) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeStyleBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeStyleBlock.java index db02beeae87..59751b644b3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeStyleBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/IncludeStyleBlock.java @@ -72,7 +72,7 @@ public class IncludeStyleBlock extends TabConfigurationBlock { } private static Map<IncludeKind, Key> createKeyMap() { - Map<IncludeKind, Key> map = new HashMap<IncludeKind, Key>(); + Map<IncludeKind, Key> map = new HashMap<>(); map.put(IncludeKind.RELATED, KEY_STYLE_RELATED); map.put(IncludeKind.PARTNER, KEY_STYLE_PARTNER); map.put(IncludeKind.IN_SAME_FOLDER, KEY_STYLE_SAME_FOLDER); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java index 41b97419cc0..aa5341e15b9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java @@ -46,7 +46,7 @@ import org.eclipse.ui.dialogs.PreferencesUtil; class MarkOccurrencesConfigurationBlock implements IPreferenceConfigurationBlock { private final OverlayPreferenceStore fStore; - private final Map<Object, String> fCheckBoxes = new HashMap<Object, String>(); + private final Map<Object, String> fCheckBoxes = new HashMap<>(); private final SelectionListener fCheckBoxListener = new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { @@ -64,7 +64,7 @@ class MarkOccurrencesConfigurationBlock implements IPreferenceConfigurationBlock * * @see #createDependency(Button, String, Control) */ - private final ArrayList<Object> fMasterSlaveListeners = new ArrayList<Object>(); + private final ArrayList<Object> fMasterSlaveListeners = new ArrayList<>(); private StatusInfo fStatus; @@ -77,7 +77,7 @@ class MarkOccurrencesConfigurationBlock implements IPreferenceConfigurationBlock private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { - ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); + ArrayList<OverlayKey> overlayKeys = new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MARK_OCCURRENCES)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java index 192b3a83f22..769d3b1030a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/NameStyleBlock.java @@ -229,7 +229,7 @@ public class NameStyleBlock extends OptionsConfigurationBlock { composite.setLayout(layout); NameStyleAdapter adapter = new NameStyleAdapter(); - categoryTree = new TreeListDialogField<Category>(adapter, null, new NameStyleLabelProvider()); + categoryTree = new TreeListDialogField<>(adapter, null, new NameStyleLabelProvider()); categoryTree.setDialogFieldListener(adapter); categoryTree.setLabelText(PreferencesMessages.NameStyleBlock_categories_label); categoryTree.setViewerComparator(adapter); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/OptionsConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/OptionsConfigurationBlock.java index 40a1b9220a6..39face13b8a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/OptionsConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/OptionsConfigurationBlock.java @@ -206,7 +206,7 @@ public abstract class OptionsConfigurationBlock { if (fProject == null || hasProjectSpecificOptions(fProject)) { fDisabledProjectSettings = null; } else { - fDisabledProjectSettings = new IdentityHashMap<Key, String>(); + fDisabledProjectSettings = new IdentityHashMap<>(); for (int i = 0; i < allKeys.length; i++) { Key curr = allKeys[i]; fDisabledProjectSettings.put(curr, curr.getStoredValue(fLookupOrder, false, fManager)); @@ -215,11 +215,11 @@ public abstract class OptionsConfigurationBlock { settingsUpdated(); - fCheckBoxes = new ArrayList<Button>(); - fComboBoxes = new ArrayList<Combo>(); - fTextBoxes = new ArrayList<Text>(2); - fLabels = new HashMap<Control, Label>(); - fExpandedComposites = new ArrayList<ExpandableComposite>(); + fCheckBoxes = new ArrayList<>(); + fComboBoxes = new ArrayList<>(); + fTextBoxes = new ArrayList<>(2); + fLabels = new HashMap<>(); + fExpandedComposites = new ArrayList<>(); fRebuildCount = getRebuildCount(); } @@ -717,7 +717,7 @@ public abstract class OptionsConfigurationBlock { updateControls(); validateSettings(null, null, null); } else { - fDisabledProjectSettings = new IdentityHashMap<Key, String>(); + fDisabledProjectSettings = new IdentityHashMap<>(); for (int i = 0; i < fAllKeys.length; i++) { Key curr = fAllKeys[i]; String oldSetting = curr.getStoredValue(fLookupOrder, false, fManager); @@ -743,7 +743,7 @@ public abstract class OptionsConfigurationBlock { protected boolean processChanges(IWorkbenchPreferenceContainer container) { IScopeContext currContext = fLookupOrder[0]; - List<Key> changedOptions = new ArrayList<Key>(); + List<Key> changedOptions = new ArrayList<>(); boolean needsBuild = getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PropertyAndPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PropertyAndPreferencePage.java index 8b0dfe7c68b..e51f2ffde44 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PropertyAndPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PropertyAndPreferencePage.java @@ -199,13 +199,13 @@ public abstract class PropertyAndPreferencePage extends PreferencePage * @param link the link */ final void doLinkActivated(Link link) { - Map<String, Boolean> data = new HashMap<String, Boolean>(); + Map<String, Boolean> data = new HashMap<>(); data.put(DATA_NO_LINK, Boolean.TRUE); if (isProjectPreferencePage()) { openWorkspacePreferences(data); } else { - HashSet<ICProject> projectsWithSpecifics = new HashSet<ICProject>(); + HashSet<ICProject> projectsWithSpecifics = new HashSet<>(); try { ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects(); for (ICProject curr : projects) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ProposalFilterPreferencesUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ProposalFilterPreferencesUtil.java index f20b09d3797..c2fca344b27 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ProposalFilterPreferencesUtil.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ProposalFilterPreferencesUtil.java @@ -43,7 +43,7 @@ public class ProposalFilterPreferencesUtil { * to fill into the Combo) */ public static String[] getProposalFilterNames() { - ArrayList<String> names = new ArrayList<String>(); + ArrayList<String> names = new ArrayList<>(); try { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "ProposalFilter"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SaveActionsPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SaveActionsPreferencePage.java index fb7a521b658..b7cc72aeae9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SaveActionsPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SaveActionsPreferencePage.java @@ -48,7 +48,7 @@ public class SaveActionsPreferencePage extends AbstractPreferencePage { @Override protected OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { - ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); + ArrayList<OverlayKey> overlayKeys = new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, FORMAT_SOURCE_CODE)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ScalabilityPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ScalabilityPreferencePage.java index be3a1a33e4b..b84655022ab 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ScalabilityPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ScalabilityPreferencePage.java @@ -70,14 +70,14 @@ public class ScalabilityPreferencePage extends PreferencePage implements IWorkbe private ScalabilityIntegerFieldEditor fMaximumTokens; - private final Map<Object, String> fCheckBoxes = new HashMap<Object, String>(); + private final Map<Object, String> fCheckBoxes = new HashMap<>(); /** * List of master/slave listeners when there's a dependency. * * @see #createDependency(Button, String, Control) */ - private final ArrayList<Object> fMasterSlaveListeners = new ArrayList<Object>(); + private final ArrayList<Object> fMasterSlaveListeners = new ArrayList<>(); public ScalabilityPreferencePage() { setPreferenceStore(PreferenceConstants.getPreferenceStore()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SpellingConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SpellingConfigurationBlock.java index 613b5bbad27..32b0dad7e9d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SpellingConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/SpellingConfigurationBlock.java @@ -312,7 +312,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); - List<Control> allControls = new ArrayList<Control>(); + List<Control> allControls = new ArrayList<>(); final PixelConverter converter = new PixelConverter(parent); final String[] trueFalse = new String[] { IPreferenceStore.TRUE, IPreferenceStore.FALSE }; @@ -657,7 +657,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock { fEnabledControls = null; } if (!enabled && fEnabledControls == null) { - List<Control> enabledControls = new ArrayList<Control>(); + List<Control> enabledControls = new ArrayList<>(); for (int i = fAllControls.length - 1; i >= 0; i--) { Control control = fAllControls[i]; if (control.isEnabled()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TabConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TabConfigurationBlock.java index 669324b517d..2760aeba143 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TabConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TabConfigurationBlock.java @@ -65,7 +65,7 @@ public class TabConfigurationBlock extends OptionsConfigurationBlock { } private static Key[] getAllKeys(OptionsConfigurationBlock[] tabs) { - ArrayList<Key> keys = new ArrayList<Key>(); + ArrayList<Key> keys = new ArrayList<>(); for (OptionsConfigurationBlock tab : tabs) { ArrayUtil.addAll(keys, tab.fAllKeys); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java index 255e3312434..4dda1668aaf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskConfigurationBlock.java @@ -140,7 +140,7 @@ public class TodoTaskConfigurationBlock extends OptionsConfigurationBlock { PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_edit_button, PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_remove_button, null, PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_setdefault_button, }; - fTodoTasksList = new ListDialogField<TodoTask>(adapter, buttons, new TodoTaskLabelProvider()); + fTodoTasksList = new ListDialogField<>(adapter, buttons, new TodoTaskLabelProvider()); fTodoTasksList.setDialogFieldListener(adapter); fTodoTasksList.setRemoveButtonIndex(IDX_REMOVE); @@ -302,7 +302,7 @@ public class TodoTaskConfigurationBlock extends OptionsConfigurationBlock { String currPrios = getValue(PREF_TODO_TASK_PRIORITIES); String[] tags = getTokens(currTags, ","); //$NON-NLS-1$ String[] prios = getTokens(currPrios, ","); //$NON-NLS-1$ - ArrayList<TodoTask> elements = new ArrayList<TodoTask>(tags.length); + ArrayList<TodoTask> elements = new ArrayList<>(tags.length); for (int i = 0; i < tags.length; i++) { TodoTask task = new TodoTask(); task.name = tags[i].trim(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskInputDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskInputDialog.java index 6b3235b6137..8e122df081f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskInputDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/TodoTaskInputDialog.java @@ -54,7 +54,7 @@ public class TodoTaskInputDialog extends StatusDialog { public TodoTaskInputDialog(Shell parent, TodoTask task, List<TodoTask> existingEntries) { super(parent); - fExistingNames = new ArrayList<String>(existingEntries.size()); + fExistingNames = new ArrayList<>(existingEntries.size()); for (int i = 0; i < existingEntries.size(); i++) { TodoTask curr = existingEntries.get(i); if (!curr.equals(task)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/WorkInProgressPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/WorkInProgressPreferencePage.java index 3275b97d942..6b06b1cbdad 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/WorkInProgressPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/WorkInProgressPreferencePage.java @@ -46,9 +46,9 @@ public class WorkInProgressPreferencePage extends PreferencePage implements IWor */ public WorkInProgressPreferencePage() { setPreferenceStore(getPreferenceStore()); - fRadioButtons = new ArrayList<Button>(); - fCheckBoxes = new ArrayList<Button>(); - fTextControls = new ArrayList<Text>(); + fRadioButtons = new ArrayList<>(); + fCheckBoxes = new ArrayList<>(); + fTextControls = new ArrayList<>(); } Button addCheckBox(Composite parent, String label, String key) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CreateProfileDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CreateProfileDialog.java index 0e49a80617c..1175fdb1bf6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CreateProfileDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CreateProfileDialog.java @@ -191,7 +191,7 @@ public class CreateProfileDialog extends StatusDialog { CUIPlugin.getDefault().getDialogSettings().put(PREF_OPEN_EDIT_DIALOG, fOpenEditDialog); - final Map<String, String> baseSettings = new HashMap<String, String>( + final Map<String, String> baseSettings = new HashMap<>( (fSortedProfiles.get(fProfileCombo.getSelectionIndex())).getSettings()); final String profileName = fNameText.getText(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterProfileManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterProfileManager.java index d453f64a3d4..0cde7e371cd 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterProfileManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterProfileManager.java @@ -41,7 +41,7 @@ public class FormatterProfileManager extends ProfileManager { private final static KeySet[] KEY_SETS = new KeySet[] { new KeySet(CCorePlugin.PLUGIN_ID, - new ArrayList<String>(DefaultCodeFormatterConstants.getDefaultSettings().keySet())), + new ArrayList<>(DefaultCodeFormatterConstants.getDefaultSettings().keySet())), new KeySet(CUIPlugin.PLUGIN_ID, EMPTY_LIST) }; private final static String PROFILE_KEY = PreferenceConstants.FORMATTER_PROFILE; @@ -75,7 +75,7 @@ public class FormatterProfileManager extends ProfileManager { List<Profile> defaultProfiles = new FormatterProfileStore(profileVersioner) .readProfiles(DefaultScope.INSTANCE); if (defaultProfiles != null) { - Map<String, Profile> profMap = new LinkedHashMap<String, Profile>(); + Map<String, Profile> profMap = new LinkedHashMap<>(); // Add the already loaded / created profiles to a map for (Profile p : profiles) profMap.put(p.getID(), p); @@ -84,7 +84,7 @@ public class FormatterProfileManager extends ProfileManager { for (Profile p : defaultProfiles) profMap.put(p.getID(), new BuiltInProfile(p.getName(), p.getName(), p.getSettings(), 2, profileVersioner.getCurrentVersion(), profileVersioner.getProfileKind())); - profiles = new ArrayList<Profile>(profMap.values()); + profiles = new ArrayList<>(profMap.values()); } } catch (CoreException e) { CUIPlugin.log(e); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java index e7bd57fb3c0..d01c56d97a6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java @@ -75,7 +75,7 @@ public class LineWrappingTabPage extends FormatterTabPage { this.prologue = prologue; this.previewText = previewText != null ? createPreviewHeader(name) + previewText : null; this.description = description; - children = new ArrayList<Category>(); + children = new ArrayList<>(); } public Category(String key, String previewText, String name, String description) { @@ -103,7 +103,7 @@ public class LineWrappingTabPage extends FormatterTabPage { private int fIndex = 0; public CategoryListener(List<Category> categoriesTree) { - fCategoriesList = new ArrayList<Category>(); + fCategoriesList = new ArrayList<>(); flatten(fCategoriesList, categoriesTree); } @@ -190,12 +190,12 @@ public class LineWrappingTabPage extends FormatterTabPage { } private class SelectionState { - private List<Category> fElements = new ArrayList<Category>(); + private List<Category> fElements = new ArrayList<>(); public void refreshState(IStructuredSelection selection) { - Map<Object, Integer> wrappingStyleMap = new HashMap<Object, Integer>(); - Map<Object, Integer> indentStyleMap = new HashMap<Object, Integer>(); - Map<Object, Integer> forceWrappingMap = new HashMap<Object, Integer>(); + Map<Object, Integer> wrappingStyleMap = new HashMap<>(); + Map<Object, Integer> indentStyleMap = new HashMap<>(); + Map<Object, Integer> forceWrappingMap = new HashMap<>(); fElements.clear(); evaluateElements(selection.iterator()); evaluateMaps(wrappingStyleMap, indentStyleMap, forceWrappingMap); @@ -611,7 +611,7 @@ public class LineWrappingTabPage extends FormatterTabPage { final String previewLineWidth = fDialogSettings.get(PREF_PREVIEW_LINE_WIDTH); - fPreviewPreferences = new HashMap<String, String>(); + fPreviewPreferences = new HashMap<>(); fPreviewPreferences.put(LINE_SPLIT, previewLineWidth != null ? previewLineWidth : String.valueOf(DEFAULT_PREVIEW_WINDOW_LINE_WIDTH)); @@ -665,7 +665,7 @@ public class LineWrappingTabPage extends FormatterTabPage { // final Category statements= new Category(FormatterMessages.LineWrappingTabPage_statements); // statements.children.add(fCompactIfCategory); - final List<Category> root = new ArrayList<Category>(); + final List<Category> root = new ArrayList<>(); root.add(classDeclarations); // root.add(constructorDeclarations); root.add(methodDeclarations); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialog.java index b6c53a9059e..6b17b472355 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialog.java @@ -113,9 +113,9 @@ public abstract class ModifyDialog extends StatusDialog implements IModifyDialog fProfile = profile; setTitle(Messages.format(FormatterMessages.ModifyDialog_dialog_title, profile.getName())); - fWorkingValues = new HashMap<String, String>(fProfile.getSettings()); + fWorkingValues = new HashMap<>(fProfile.getSettings()); setStatusLineAboveButtons(false); - fTabPages = new ArrayList<IModifyDialogTabPage>(); + fTabPages = new ArrayList<>(); fDialogSettings = CUIPlugin.getDefault().getDialogSettings(); } @@ -270,13 +270,13 @@ public abstract class ModifyDialog extends StatusDialog implements IModifyDialog if (!fProfile.getName().equals(fProfileNameField.getText())) { fProfile = fProfile.rename(fProfileNameField.getText(), fProfileManager); } - fProfile.setSettings(new HashMap<String, String>(fWorkingValues)); + fProfile.setSettings(new HashMap<>(fWorkingValues)); fProfileManager.setSelected(fProfile); doValidate(); } private void saveButtonPressed() { - Profile selected = new CustomProfile(fProfileNameField.getText(), new HashMap<String, String>(fWorkingValues), + Profile selected = new CustomProfile(fProfileNameField.getText(), new HashMap<>(fWorkingValues), fProfile.getVersion(), fProfileManager.getProfileVersioner().getProfileKind()); final FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); @@ -303,7 +303,7 @@ public abstract class ModifyDialog extends StatusDialog implements IModifyDialog final IContentType type = Platform.getContentTypeManager().getContentType("org.eclipse.core.runtime.xml"); //$NON-NLS-1$ if (type != null) encoding = type.getDefaultCharset(); - final Collection<Profile> profiles = new ArrayList<Profile>(); + final Collection<Profile> profiles = new ArrayList<>(); profiles.add(selected); try { fProfileStore.writeProfilesToFile(profiles, file, encoding); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialogTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialogTabPage.java index ec7e2d02deb..4401c3080c0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialogTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialogTabPage.java @@ -491,8 +491,8 @@ public abstract class ModifyDialogTabPage implements IModifyDialogTabPage { public DefaultFocusManager() { fDialogSettings = CUIPlugin.getDefault().getDialogSettings(); - fItemMap = new HashMap<Control, Integer>(); - fItemList = new ArrayList<Control>(); + fItemMap = new HashMap<>(); + fItemList = new ArrayList<>(); fIndex = 0; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java index 25d19714f3f..023a141d508 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java @@ -297,7 +297,7 @@ public abstract class ProfileConfigurationBlock { } if (profiles == null) - profiles = new ArrayList<Profile>(); + profiles = new ArrayList<>(); fProfileManager = createProfileManager(profiles, fCurrContext, access, fProfileVersioner); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileManager.java index a5ae96512f2..bd7ad804d5c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileManager.java @@ -370,8 +370,8 @@ public abstract class ProfileManager extends Observable { fProfileKey = profileKey; fProfileVersionKey = profileVersionKey; - fProfiles = new HashMap<String, Profile>(); - fProfilesByName = new ArrayList<Profile>(); + fProfiles = new HashMap<>(); + fProfilesByName = new ArrayList<>(); for (Object element : profiles) { final Profile profile = (Profile) element; @@ -396,7 +396,7 @@ public abstract class ProfileManager extends Observable { Map<String, String> map = readFromPreferenceStore(context, profile); if (map != null) { - List<String> allKeys = new ArrayList<String>(); + List<String> allKeys = new ArrayList<>(); for (KeySet keySet : fKeySets) { allKeys.addAll(keySet.getKeys()); } @@ -488,12 +488,12 @@ public abstract class ProfileManager extends Observable { * @param context The project context */ public Map<String, String> readFromPreferenceStore(IScopeContext context, Profile workspaceProfile) { - final Map<String, String> profileOptions = new HashMap<String, String>(); + final Map<String, String> profileOptions = new HashMap<>(); IEclipsePreferences uiPrefs = context.getNode(CUIPlugin.PLUGIN_ID); int version = uiPrefs.getInt(fProfileVersionKey, fProfileVersioner.getFirstVersion()); if (version != fProfileVersioner.getCurrentVersion()) { - Map<String, String> allOptions = new HashMap<String, String>(); + Map<String, String> allOptions = new HashMap<>(); for (KeySet keySet : fKeySets) { addAll(context.getNode(keySet.getNodeName()), allOptions); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileStore.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileStore.java index 597771ab9c3..bacafcf0c80 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileStore.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileStore.java @@ -93,11 +93,11 @@ public class ProfileStore { if (fKind == null) //Can only be an CodeFormatterProfile created pre 20061106 fKind = ProfileVersioner.CODE_FORMATTER_PROFILE_KIND; - fSettings = new HashMap<String, String>(200); + fSettings = new HashMap<>(200); } else if (qName.equals(XML_NODE_ROOT)) { - fProfiles = new ArrayList<Profile>(); + fProfiles = new ArrayList<>(); try { fVersion = Integer.parseInt(attributes.getValue(XML_ATTRIBUTE_VERSION)); } catch (NumberFormatException ex) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/SnippetPreview.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/SnippetPreview.java index ec75985f893..5ca5c0e039b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/SnippetPreview.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/SnippetPreview.java @@ -44,7 +44,7 @@ public class SnippetPreview extends CPreview { public SnippetPreview(Map<String, String> workingValues, Composite parent) { super(workingValues, parent); - fSnippets = new ArrayList<PreviewSnippet>(); + fSnippets = new ArrayList<>(); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/TranslationUnitPreview.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/TranslationUnitPreview.java index b7a281f266a..780e890fde8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/TranslationUnitPreview.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/TranslationUnitPreview.java @@ -61,7 +61,7 @@ public class TranslationUnitPreview extends CPreview { final IContentFormatterExtension extension = (IContentFormatterExtension) formatter; Map<String, String> prefs = fWorkingValues; if (fFormatterId != null) { - prefs = new HashMap<String, String>(fWorkingValues); + prefs = new HashMap<>(fWorkingValues); prefs.put(CCorePreferenceConstants.CODE_FORMATTER, fFormatterId); } context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, prefs); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java index 66afa66eb86..a544d85313a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java @@ -49,7 +49,7 @@ public final class WhiteSpaceOptions { fParent = parent; fWorkingValues = workingValues; fName = message; - fChildren = new ArrayList<Node>(); + fChildren = new ArrayList<>(); if (fParent != null) fParent.add(this); } @@ -99,7 +99,7 @@ public final class WhiteSpaceOptions { @Override public List<PreviewSnippet> getSnippets() { - final ArrayList<PreviewSnippet> snippets = new ArrayList<PreviewSnippet>(fChildren.size()); + final ArrayList<PreviewSnippet> snippets = new ArrayList<>(fChildren.size()); for (Object element : fChildren) { final List<PreviewSnippet> childSnippets = ((Node) element).getSnippets(); for (PreviewSnippet snippet : childSnippets) { @@ -129,7 +129,7 @@ public final class WhiteSpaceOptions { PreviewSnippet snippet) { super(parent, workingValues, messageKey); fKey = key; - fSnippets = new ArrayList<PreviewSnippet>(1); + fSnippets = new ArrayList<>(1); fSnippets.add(snippet); } @@ -232,7 +232,7 @@ public final class WhiteSpaceOptions { * @return returns roots (type <code>Node</code>) */ public List<InnerNode> createTreeBySyntaxElem(Map<String, String> workingValues) { - final ArrayList<InnerNode> roots = new ArrayList<InnerNode>(); + final ArrayList<InnerNode> roots = new ArrayList<>(); InnerNode element; @@ -334,7 +334,7 @@ public final class WhiteSpaceOptions { */ public List<InnerNode> createAltTree(Map<String, String> workingValues) { - final ArrayList<InnerNode> roots = new ArrayList<InnerNode>(); + final ArrayList<InnerNode> roots = new ArrayList<>(); InnerNode parent; @@ -482,7 +482,7 @@ public final class WhiteSpaceOptions { createTemplateArgumentTree(workingValues, templates); createTemplateParameterTree(workingValues, templates); - final ArrayList<InnerNode> roots = new ArrayList<InnerNode>(); + final ArrayList<InnerNode> roots = new ArrayList<>(); roots.add(declarations); roots.add(statements); roots.add(expressions); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java index 6111e3e8eab..51724b9bd0b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java @@ -71,7 +71,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { private Node fLastSelected = null; public SyntaxComponent() { - fIndexedNodeList = new ArrayList<Node>(); + fIndexedNodeList = new ArrayList<>(); fTree = new WhiteSpaceOptions().createAltTree(fWorkingValues); WhiteSpaceOptions.makeIndexForNodes(fTree, fIndexedNodeList); } @@ -129,7 +129,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { } public void refreshState() { - final ArrayList<OptionNode> checked = new ArrayList<OptionNode>(100); + final ArrayList<OptionNode> checked = new ArrayList<>(100); for (Node node : fTree) (node).getCheckedLeafs(checked); fTreeViewer.setGrayedElements(new Object[0]); @@ -212,7 +212,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { private Composite fComposite; public CElementComponent() { - fIndexedNodeList = new ArrayList<Node>(); + fIndexedNodeList = new ArrayList<>(); fTree = new WhiteSpaceOptions().createTreeByCElement(fWorkingValues); WhiteSpaceOptions.makeIndexForNodes(fTree, fIndexedNodeList); } @@ -240,7 +240,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { @Override public Object[] getChildren(Object parentElement) { final List<Node> children = ((Node) parentElement).getChildren(); - final ArrayList<Object> innerChildren = new ArrayList<Object>(); + final ArrayList<Object> innerChildren = new ArrayList<>(); for (Object o : children) { if (o instanceof InnerNode) innerChildren.add(o); @@ -368,7 +368,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { final List<Node> children = selectedNode.getChildren(); - final ArrayList<OptionNode> optionsChildren = new ArrayList<OptionNode>(); + final ArrayList<OptionNode> optionsChildren = new ArrayList<>(); for (Object o : children) { if (o instanceof OptionNode) optionsChildren.add((OptionNode) o); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java index 002c53a4f52..e1971b4efc5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/CRefactoring.java @@ -206,7 +206,7 @@ public abstract class CRefactoring extends Refactoring { } protected List<IASTName> findAllMarkedNames(IASTTranslationUnit ast) { - final List<IASTName> names = new ArrayList<IASTName>(); + final List<IASTName> names = new ArrayList<>(); ast.accept(new ASTVisitor() { { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java index 2d613137201..bc487e036e5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeParametersControl.java @@ -104,7 +104,7 @@ public class ChangeParametersControl extends Composite { } private NameInformation[] removeMarkedAsDeleted(List<NameInformation> params) { - List<NameInformation> result = new ArrayList<NameInformation>(params.size()); + List<NameInformation> result = new ArrayList<>(params.size()); for (Iterator<NameInformation> iter = params.iterator(); iter.hasNext();) { NameInformation info = iter.next(); if (!info.isDeleted()) @@ -309,7 +309,7 @@ public class ChangeParametersControl extends Composite { fTypeContext = typeContext; fParamNameProposals = paramNameProposals; - ArrayList<String> properties = new ArrayList<String>(); + ArrayList<String> properties = new ArrayList<>(); indexType = properties.size(); properties.add("type"); //$NON-NLS-1$ @@ -584,7 +584,7 @@ public class ChangeParametersControl extends Composite { button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - Set<String> excludedParamNames = new HashSet<String>(fParameters.size()); + Set<String> excludedParamNames = new HashSet<>(fParameters.size()); for (int i = 0; i < fParameters.size(); i++) { NameInformation info = fParameters.get(i); excludedParamNames.add(info.getNewName()); @@ -675,7 +675,7 @@ public class ChangeParametersControl extends Composite { private void addCellEditors() { fTableViewer.setColumnProperties(columnProperties); - ArrayList<CellEditor> editors = new ArrayList<CellEditor>(); + ArrayList<CellEditor> editors = new ArrayList<>(); TableTextCellEditor cellEditorType = new TableTextCellEditor(fTableViewer, indexType); editors.add(cellEditorType); if (indexDirection >= 0) { @@ -747,8 +747,8 @@ public class ChangeParametersControl extends Composite { } private static void moveUp(List<NameInformation> elements, List<NameInformation> move) { - List<NameInformation> res = new ArrayList<NameInformation>(elements.size()); - List<NameInformation> deleted = new ArrayList<NameInformation>(); + List<NameInformation> res = new ArrayList<>(elements.size()); + List<NameInformation> deleted = new ArrayList<>(); NameInformation floating = null; for (Iterator<NameInformation> iter = elements.iterator(); iter.hasNext();) { NameInformation curr = iter.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeTreeSet.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeTreeSet.java index c0bd74049cb..b05cd519f85 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeTreeSet.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/ChangeTreeSet.java @@ -36,7 +36,7 @@ public class ChangeTreeSet { } } - private final TreeSet<CTextFileChange> changes = new TreeSet<CTextFileChange>(new ChangePositionComparator()); + private final TreeSet<CTextFileChange> changes = new TreeSet<>(new ChangePositionComparator()); public void add(CTextFileChange change) { changes.add(change); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/DocumentAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/DocumentAdapter.java index 3e2df59de98..edd24975b41 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/DocumentAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/DocumentAdapter.java @@ -223,7 +223,7 @@ public class DocumentAdapter implements IBuffer, IAdaptable, IDocumentListener { private Set<String> fLegalLineDelimiters; - private List<IBufferChangedListener> fBufferListeners = new ArrayList<IBufferChangedListener>(3); + private List<IBufferChangedListener> fBufferListeners = new ArrayList<>(3); private IStatus fStatus; public DocumentAdapter(IWorkingCopy owner, IFile file) { @@ -495,7 +495,7 @@ public class DocumentAdapter implements IBuffer, IAdaptable, IDocumentListener { private void validateLineDelimiters(String contents) { if (fLegalLineDelimiters == null) { // collect all line delimiters in the document - HashSet<String> existingDelimiters = new HashSet<String>(); + HashSet<String> existingDelimiters = new HashSet<>(); for (int i = fDocument.getNumberOfLines() - 1; i >= 0; i--) { try { @@ -555,7 +555,7 @@ public class DocumentAdapter implements IBuffer, IAdaptable, IDocumentListener { private void fireBufferChanged(BufferChangedEvent event) { if (fBufferListeners != null && fBufferListeners.size() > 0) { - Iterator<IBufferChangedListener> e = new ArrayList<IBufferChangedListener>(fBufferListeners).iterator(); + Iterator<IBufferChangedListener> e = new ArrayList<>(fBufferListeners).iterator(); while (e.hasNext()) e.next().bufferChanged(event); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java index 276119220d6..ee93fc0ce12 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java @@ -63,7 +63,7 @@ public class NodeContainer { public NodeContainer() { super(); - nodes = new ArrayList<IASTNode>(); + nodes = new ArrayList<>(); } public final int size() { @@ -82,7 +82,7 @@ public class NodeContainer { if (names != null) { return; } - names = new ArrayList<NameInformation>(); + names = new ArrayList<>(); final int startOffset = getStartOffset(); final int endOffset = getEndOffset(); @@ -163,8 +163,8 @@ public class NodeContainer { Set<IVariable> externalReads = getVariablesReadOutside(); - Set<IASTName> declarations = new HashSet<IASTName>(); - interfaceNames = new ArrayList<NameInformation>(); + Set<IASTName> declarations = new HashSet<>(); + interfaceNames = new ArrayList<>(); for (NameInformation nameInfo : names) { IASTName declarationName = nameInfo.getDeclarationName(); @@ -251,7 +251,7 @@ public class NodeContainer { for (NameInformation nameInfo : getInterfaceNames()) { if (nameInfo.mustBeReturnValue() == isReturnValue) { if (selectedNames == null) { - selectedNames = new ArrayList<NameInformation>(); + selectedNames = new ArrayList<>(); } selectedNames.add(nameInfo); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/VariableNameInformation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/VariableNameInformation.java index 1f39ea694ab..25a3ba4d80e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/VariableNameInformation.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/VariableNameInformation.java @@ -23,7 +23,7 @@ import java.util.List; */ public class VariableNameInformation { private String name = ""; //$NON-NLS-1$ - private final ArrayList<String> usedNames = new ArrayList<String>(); + private final ArrayList<String> usedNames = new ArrayList<>(); public String getName() { return name; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/dialogs/ValidatingLabeledTextField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/dialogs/ValidatingLabeledTextField.java index 4f7bb1d699d..321eb5d1658 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/dialogs/ValidatingLabeledTextField.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/dialogs/ValidatingLabeledTextField.java @@ -43,9 +43,9 @@ public class ValidatingLabeledTextField extends Composite { private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - private final Map<Text, Boolean> validationStatus = new HashMap<Text, Boolean>(); + private final Map<Text, Boolean> validationStatus = new HashMap<>(); - private final ArrayList<Listener> inputTextListeners = new ArrayList<Listener>(); + private final ArrayList<Listener> inputTextListeners = new ArrayList<>(); private final Color errorColor = new Color(getShell().getDisplay(), new RGB(255, 208, 196)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExpressionExtractor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExpressionExtractor.java index f8fbe8e2eb1..c7a4c5dcec6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExpressionExtractor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExpressionExtractor.java @@ -108,7 +108,7 @@ public class ExpressionExtractor extends FunctionExtractor { } private List<ITypedef> getTypedefs(IASTNode extractedNode) { - final ArrayList<ITypedef> typeDefs = new ArrayList<ITypedef>(); + final ArrayList<ITypedef> typeDefs = new ArrayList<>(); extractedNode.accept(new ASTVisitor() { { shouldVisitExpressions = true; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionInformation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionInformation.java index c810cc7d8cd..c03789b336c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionInformation.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionInformation.java @@ -91,7 +91,7 @@ public class ExtractFunctionInformation { } public void setParameters(List<NameInformation> parameters) { - this.parameters = new ArrayList<NameInformation>(parameters); + this.parameters = new ArrayList<>(parameters); } public VisibilityEnum getVisibility() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java index b75ba36aaee..50d829b3757 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java @@ -753,9 +753,9 @@ public class ExtractFunctionRefactoring extends CRefactoring { IASTFunctionCallExpression callExpression = new CPPASTFunctionCallExpression(); IASTIdExpression idExpression = new CPPASTIdExpression(); idExpression.setName(astMethodName); - List<IASTInitializerClause> args = new ArrayList<IASTInitializerClause>(); + List<IASTInitializerClause> args = new ArrayList<>(); - Set<IASTName> declarations = new HashSet<IASTName>(); + Set<IASTName> declarations = new HashSet<>(); IASTName retName = null; boolean theRetName = false; @@ -929,8 +929,8 @@ public class ExtractFunctionRefactoring extends CRefactoring { } public List<IASTInitializerClause> getCallParameters() { - List<IASTInitializerClause> args = new ArrayList<IASTInitializerClause>(); - Set<IASTName> declarations = new HashSet<IASTName>(); + List<IASTInitializerClause> args = new ArrayList<>(); + Set<IASTName> declarations = new HashSet<>(); for (NameInformation nameInfo : info.getParameters()) { addParameterIfPossible(args, declarations, nameInfo); } @@ -960,7 +960,7 @@ public class ExtractFunctionRefactoring extends CRefactoring { } private Map<String, String> getArgumentMap() { - Map<String, String> arguments = new HashMap<String, String>(); + Map<String, String> arguments = new HashMap<>(); arguments.put(CRefactoringDescriptor.FILE_NAME, tu.getLocationURI().toString()); arguments.put(CRefactoringDescriptor.SELECTION, selectedRegion.getOffset() + "," + selectedRegion.getLength()); //$NON-NLS-1$ arguments.put(ExtractFunctionRefactoringDescriptor.NAME, info.getMethodName()); @@ -990,8 +990,8 @@ public class ExtractFunctionRefactoring extends CRefactoring { public RefactoringStatus checkParameterNames() { RefactoringStatus result = new RefactoringStatus(); List<NameInformation> parameters = info.getParameters(); - Set<String> usedNames = new HashSet<String>(); - Set<IASTName> declarations = new HashSet<IASTName>(); + Set<String> usedNames = new HashSet<>(); + Set<IASTName> declarations = new HashSet<>(); for (NameInformation nameInfo : container.getNames()) { IASTName declaration = nameInfo.getDeclarationName(); if (declarations.add(declaration) && !parameters.contains(nameInfo)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/SimilarFinderVisitor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/SimilarFinderVisitor.java index cb577825346..2dcd844bf53 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/SimilarFinderVisitor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/SimilarFinderVisitor.java @@ -29,7 +29,7 @@ abstract class SimilarFinderVisitor extends ASTVisitor { protected final ExtractFunctionRefactoring refactoring; protected final NodeContainer extractedNodes; protected NodeContainer similarContainer; - protected final List<IASTStatement> stmtToReplace = new ArrayList<IASTStatement>(); + protected final List<IASTStatement> stmtToReplace = new ArrayList<>(); private final List<IASTNode> trail; private final List<IASTNode> statements; private int statementCount; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java index de9364071a3..8d153c408ab 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java @@ -141,7 +141,7 @@ public class ExtractLocalVariableRefactoring extends CRefactoring { } private ArrayList<String> findAllDeclaredNames() { - ArrayList<String> names = new ArrayList<String>(); + ArrayList<String> names = new ArrayList<>(); IASTFunctionDefinition funcDef = ASTQueries.findAncestorWithType(target, IASTFunctionDefinition.class); ICPPASTCompositeTypeSpecifier comTypeSpec = getCompositeTypeSpecifier(funcDef); if (comTypeSpec != null) { @@ -326,8 +326,8 @@ public class ExtractLocalVariableRefactoring extends CRefactoring { * proposal should be used as "best guess" (if it exists). */ public String[] guessTempNames() { - final List<String> guessedTempNames = new ArrayList<String>(); - final List<String> usedNames = new ArrayList<String>(); + final List<String> guessedTempNames = new ArrayList<>(); + final List<String> usedNames = new ArrayList<>(); IASTFunctionDefinition funcDef = ASTQueries.findAncestorWithType(target, IASTFunctionDefinition.class); final IScope scope; if (funcDef != null && funcDef.getBody() instanceof IASTCompoundStatement) { @@ -475,7 +475,7 @@ public class ExtractLocalVariableRefactoring extends CRefactoring { } private String makeTempName(List<String> usedNames, IScope scope) { - List<String> noNames = new ArrayList<String>(); + List<String> noNames = new ArrayList<>(); for (int i = 0; i < 10; i++) { for (String used : usedNames) { String name = used + i; // such as "i2" @@ -496,7 +496,7 @@ public class ExtractLocalVariableRefactoring extends CRefactoring { } private Map<String, String> getArgumentMap() { - Map<String, String> arguments = new HashMap<String, String>(); + Map<String, String> arguments = new HashMap<>(); arguments.put(CRefactoringDescriptor.FILE_NAME, tu.getLocationURI().toString()); arguments.put(CRefactoringDescriptor.SELECTION, selectedRegion.getOffset() + "," + selectedRegion.getLength()); //$NON-NLS-1$ arguments.put(ExtractLocalVariableRefactoringDescriptor.NAME, info.getName()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/FieldDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/FieldDescriptor.java index 7a28555ca5a..114f651edeb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/FieldDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/FieldDescriptor.java @@ -52,7 +52,7 @@ class FieldDescriptor { name = null; this.setter = new AccessorDescriptor(AccessorKind.SETTER, name, this); - List<AccessorDescriptor> children = new ArrayList<AccessorDescriptor>(2); + List<AccessorDescriptor> children = new ArrayList<>(2); if (getter.canBeGenerated()) { children.add(getter); } @@ -63,7 +63,7 @@ class FieldDescriptor { } private Set<String> getNamesToAvoid() { - Set<String> namesToAvoid = new HashSet<String>(); + Set<String> namesToAvoid = new HashSet<>(); // Add field names. for (IASTDeclarator fieldDeclarator : context.existingFields) { namesToAvoid.add(String.valueOf(GetterSetterContext.getDeclaratorName(fieldDeclarator).getSimpleID())); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GenerateGettersAndSettersRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GenerateGettersAndSettersRefactoring.java index 67bf4606271..460d09588c7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GenerateGettersAndSettersRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GenerateGettersAndSettersRefactoring.java @@ -131,7 +131,7 @@ public class GenerateGettersAndSettersRefactoring extends CRefactoring { } private IFile[] getAllFilesToModify() { - List<IFile> files = new ArrayList<IFile>(2); + List<IFile> files = new ArrayList<>(2); IFile file = (IFile) tu.getResource(); if (file != null) { files.add(file); @@ -164,7 +164,7 @@ public class GenerateGettersAndSettersRefactoring extends CRefactoring { private IASTCompositeTypeSpecifier findCurrentCompositeTypeSpecifier(IASTTranslationUnit ast) throws OperationCanceledException, CoreException { final int start = selectedRegion.getOffset(); - Container<IASTCompositeTypeSpecifier> container = new Container<IASTCompositeTypeSpecifier>(); + Container<IASTCompositeTypeSpecifier> container = new Container<>(); ast.accept(new CompositeTypeSpecFinder(start, container)); return container.getObject(); } @@ -222,8 +222,8 @@ public class GenerateGettersAndSettersRefactoring extends CRefactoring { @Override protected void collectModifications(IProgressMonitor pm, ModificationCollector collector) throws CoreException, OperationCanceledException { - List<IASTNode> getterAndSetters = new ArrayList<IASTNode>(); - List<IASTFunctionDefinition> definitions = new ArrayList<IASTFunctionDefinition>(); + List<IASTNode> getterAndSetters = new ArrayList<>(); + List<IASTFunctionDefinition> definitions = new ArrayList<>(); ICPPASTCompositeTypeSpecifier classDefinition = ASTQueries.findAncestorWithType(context.existingFields.get(0), ICPPASTCompositeTypeSpecifier.class); for (AccessorDescriptor accessor : context.selectedAccessors) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterContext.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterContext.java index e6207f5c1ab..1db18ba99a3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterContext.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterContext.java @@ -29,10 +29,10 @@ import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; public class GetterSetterContext implements ITreeContentProvider { - final List<IASTDeclarator> existingFields = new ArrayList<IASTDeclarator>(); - final List<IASTFunctionDefinition> existingFunctionDefinitions = new ArrayList<IASTFunctionDefinition>(); - final List<IASTSimpleDeclaration> existingFunctionDeclarations = new ArrayList<IASTSimpleDeclaration>(); - final SortedSet<AccessorDescriptor> selectedAccessors = new TreeSet<AccessorDescriptor>(); + final List<IASTDeclarator> existingFields = new ArrayList<>(); + final List<IASTFunctionDefinition> existingFunctionDefinitions = new ArrayList<>(); + final List<IASTSimpleDeclaration> existingFunctionDeclarations = new ArrayList<>(); + final SortedSet<AccessorDescriptor> selectedAccessors = new TreeSet<>(); IASTName selectedName; private List<FieldDescriptor> fieldDescriptors; private boolean definitionSeparate; @@ -75,7 +75,7 @@ public class GetterSetterContext implements ITreeContentProvider { public void recreateFieldDescriptors() { // Delete field descriptors so that they are recreated by the next getFieldDescriptors call. fieldDescriptors = null; - SortedSet<AccessorDescriptor> oldSelected = new TreeSet<AccessorDescriptor>(selectedAccessors); + SortedSet<AccessorDescriptor> oldSelected = new TreeSet<>(selectedAccessors); selectedAccessors.clear(); for (FieldDescriptor descriptor : getFieldDescriptors()) { for (AccessorDescriptor accessor : descriptor.getChildNodes()) { @@ -110,7 +110,7 @@ public class GetterSetterContext implements ITreeContentProvider { private List<FieldDescriptor> getFieldDescriptors() { if (fieldDescriptors == null) { - fieldDescriptors = new ArrayList<FieldDescriptor>(); + fieldDescriptors = new ArrayList<>(); for (IASTDeclarator field : existingFields) { FieldDescriptor descriptor = new FieldDescriptor(field, this); if (descriptor.missingGetterOrSetter()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterNameGenerator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterNameGenerator.java index 38530599bbd..29dc2578f78 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterNameGenerator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterNameGenerator.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility; import org.eclipse.cdt.ui.PreferenceConstants; public class GetterSetterNameGenerator { - private static Set<String> generateGetterSettersPreferenceKeys = new HashSet<String>(); + private static Set<String> generateGetterSettersPreferenceKeys = new HashSet<>(); static { generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_CAPITALIZATION); generateGetterSettersPreferenceKeys.add(PreferenceConstants.NAME_STYLE_GETTER_WORD_DELIMITER); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/hidemethod/HideMethodRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/hidemethod/HideMethodRefactoring.java index 691bb01141a..dc0e3078ce4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/hidemethod/HideMethodRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/hidemethod/HideMethodRefactoring.java @@ -192,8 +192,8 @@ public class HideMethodRefactoring extends CRefactoring { IIndexBinding methodBinding = index.adaptBinding(methodName.resolveBinding()); if (methodBinding == null) return null; - List<IASTName> references = new ArrayList<IASTName>(); - Set<String> searchedFiles = new HashSet<String>(); + List<IASTName> references = new ArrayList<>(); + Set<String> searchedFiles = new HashSet<>(); IEditorPart[] dirtyEditors = EditorUtility.getDirtyEditors(true); SubMonitor loopProgress = sm.newChild(3).setWorkRemaining(dirtyEditors.length); for (IEditorPart editor : dirtyEditors) { @@ -257,7 +257,7 @@ public class HideMethodRefactoring extends CRefactoring { } private List<IASTName> findAllMarkedNames() throws OperationCanceledException, CoreException { - final ArrayList<IASTName> namesVector = new ArrayList<IASTName>(); + final ArrayList<IASTName> namesVector = new ArrayList<>(); IASTTranslationUnit ast = getAST(tu, null); ast.accept(new ASTVisitor() { @@ -288,7 +288,7 @@ public class HideMethodRefactoring extends CRefactoring { } private Map<String, String> getArgumentMap() { - Map<String, String> arguments = new HashMap<String, String>(); + Map<String, String> arguments = new HashMap<>(); arguments.put(CRefactoringDescriptor.FILE_NAME, tu.getLocationURI().toString()); arguments.put(CRefactoringDescriptor.SELECTION, selectedRegion.getOffset() + "," + selectedRegion.getLength()); //$NON-NLS-1$ return arguments; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodData.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodData.java index 183beafda38..42ede03fe7b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodData.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodData.java @@ -33,7 +33,7 @@ public class ImplementMethodData implements ITreeContentProvider { private List<MethodToImplementConfig> methodDeclarations; public void setMethodDeclarations(List<IASTSimpleDeclaration> methodDeclarations) { - this.methodDeclarations = new ArrayList<MethodToImplementConfig>(); + this.methodDeclarations = new ArrayList<>(); for (IASTSimpleDeclaration declaration : methodDeclarations) { this.methodDeclarations.add(new MethodToImplementConfig(declaration, new ParameterHandler(declaration))); @@ -79,7 +79,7 @@ public class ImplementMethodData implements ITreeContentProvider { } public List<MethodToImplementConfig> getMethodsToImplement() { - List<MethodToImplementConfig> ret = new ArrayList<MethodToImplementConfig>(); + List<MethodToImplementConfig> ret = new ArrayList<>(); for (MethodToImplementConfig config : methodDeclarations) { if (config.isChecked()) { ret.add(config); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java index 7ede8de5c8b..6574bb089ae 100755 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java @@ -84,7 +84,7 @@ public class ImplementMethodRefactoring extends CRefactoring { super(element, selection, project); data = new ImplementMethodData(); methodDefinitionInsertLocationFinder = new MethodDefinitionInsertLocationFinder(); - insertLocations = new HashMap<IASTSimpleDeclaration, InsertLocation>(); + insertLocations = new HashMap<>(); } @Override @@ -121,7 +121,7 @@ public class ImplementMethodRefactoring extends CRefactoring { throws OperationCanceledException, CoreException { final SubMonitor sm = SubMonitor.convert(pm, 2); IASTTranslationUnit ast = getAST(tu, sm.newChild(1)); - final List<IASTSimpleDeclaration> list = new ArrayList<IASTSimpleDeclaration>(); + final List<IASTSimpleDeclaration> list = new ArrayList<>(); ast.accept(new ASTVisitor() { { shouldVisitDeclarations = true; @@ -318,7 +318,7 @@ public class ImplementMethodRefactoring extends CRefactoring { } private IFile[] getAllFilesToModify() { - List<IFile> files = new ArrayList<IFile>(2); + List<IFile> files = new ArrayList<>(2); IFile file = (IFile) tu.getResource(); if (file != null) { files.add(file); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodWizard.java index 907bb5fee0a..857e0abb0fe 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodWizard.java @@ -29,7 +29,7 @@ import org.eclipse.ltk.ui.refactoring.RefactoringWizard; */ public class ImplementMethodWizard extends RefactoringWizard { private final ImplementMethodRefactoring refactoring; - private Map<MethodToImplementConfig, ParameterNamesInputPage> pagesMap = new HashMap<MethodToImplementConfig, ParameterNamesInputPage>(); + private Map<MethodToImplementConfig, ParameterNamesInputPage> pagesMap = new HashMap<>(); public ImplementMethodWizard(ImplementMethodRefactoring refactoring) { super(refactoring, DIALOG_BASED_USER_INTERFACE | PREVIEW_EXPAND_FIRST_NODE); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/MethodDefinitionInsertLocationFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/MethodDefinitionInsertLocationFinder.java index 9b17fae211e..9261859b492 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/MethodDefinitionInsertLocationFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/MethodDefinitionInsertLocationFinder.java @@ -50,7 +50,7 @@ public class MethodDefinitionInsertLocationFinder { // might want to find multiple insert locations in the same translation unit. This prevents // many redundant calls to DefinitionFinder.getDefinition and speeds up the process quite // a bit. Unfortunately, this has the minor side-effect or having to instantiate this class. - Map<IASTSimpleDeclaration, IASTName> cachedDeclarationToDefinition = new HashMap<IASTSimpleDeclaration, IASTName>(); + Map<IASTSimpleDeclaration, IASTName> cachedDeclarationToDefinition = new HashMap<>(); public InsertLocation find(ITranslationUnit declarationTu, IASTFileLocation methodDeclarationLocation, IASTNode parent, CRefactoringContext refactoringContext, IProgressMonitor pm) throws CoreException { @@ -155,7 +155,7 @@ public class MethodDefinitionInsertLocationFinder { */ private static Collection<IASTSimpleDeclaration> getAllPreviousSimpleDeclarationsFromClassInReverseOrder( IASTDeclaration[] declarations, IASTFileLocation methodPosition, IProgressMonitor pm) { - ArrayList<IASTSimpleDeclaration> outputDeclarations = new ArrayList<IASTSimpleDeclaration>(); + ArrayList<IASTSimpleDeclaration> outputDeclarations = new ArrayList<>(); if (declarations.length >= 0) { for (IASTDeclaration decl : declarations) { if (pm != null && pm.isCanceled()) { @@ -175,7 +175,7 @@ public class MethodDefinitionInsertLocationFinder { private static Collection<IASTSimpleDeclaration> getAllFollowingSimpleDeclarationsFromClass( IASTDeclaration[] declarations, IASTFileLocation methodPosition, IProgressMonitor pm) { - ArrayList<IASTSimpleDeclaration> outputDeclarations = new ArrayList<IASTSimpleDeclaration>(); + ArrayList<IASTSimpleDeclaration> outputDeclarations = new ArrayList<>(); if (declarations.length >= 0) { for (IASTDeclaration decl : declarations) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterHandler.java index 9d320158df1..eb067f44f58 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterHandler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterHandler.java @@ -50,7 +50,7 @@ public class ParameterHandler { return; } needsAditionalArgumentNames = false; - parameterInfos = new ArrayList<ParameterInfo>(); + parameterInfos = new ArrayList<>(); for (IASTParameterDeclaration actParam : getParametersFromMethodNode()) { String actName = actParam.getDeclarator().getName().toString(); boolean isChangable = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/HeaderSubstitutionMap.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/HeaderSubstitutionMap.java index 16b3212078a..917420a5d21 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/HeaderSubstitutionMap.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/HeaderSubstitutionMap.java @@ -165,7 +165,7 @@ public class HeaderSubstitutionMap { return Collections.emptyList(); } - List<HeaderSubstitutionMap> maps = new ArrayList<HeaderSubstitutionMap>(); + List<HeaderSubstitutionMap> maps = new ArrayList<>(); for (IMemento element : memento.getChildren(TAG_HEADER_SUBSTITUTION_MAP)) { maps.add(fromMemento(element)); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeGroupStyle.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeGroupStyle.java index 60d03ec8597..7857b1d2f78 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeGroupStyle.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeGroupStyle.java @@ -61,7 +61,7 @@ public class IncludeGroupStyle implements Comparable<IncludeGroupStyle> { public final String name; public final String description; public final IncludeKind parent; - public final List<IncludeKind> children = new ArrayList<IncludeKind>(); + public final List<IncludeKind> children = new ArrayList<>(); private IncludeKind(String name, String description, IncludeKind parent) { this.name = name; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeMap.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeMap.java index 744754b40b8..be61a48f3a2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeMap.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeMap.java @@ -173,7 +173,7 @@ public class IncludeMap { public static IncludeMap fromMemento(boolean unconditionalSubstitution, IMemento memento) { IncludeMap includeMap = new IncludeMap(unconditionalSubstitution); - Set<String> keys = unconditionalSubstitution ? new HashSet<String>() : Collections.<String>emptySet(); + Set<String> keys = unconditionalSubstitution ? new HashSet<>() : Collections.<String>emptySet(); for (IMemento mapping : memento.getChildren(TAG_MAPPING)) { String key = mapping.getString(TAG_KEY); // There can be no more than one unconditional substitution for any header file. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/SymbolExportMap.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/SymbolExportMap.java index 18ce3a2594c..fc581dbb5c0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/SymbolExportMap.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/SymbolExportMap.java @@ -47,7 +47,7 @@ public class SymbolExportMap { private final Map<String, Set<IncludeInfo>> map; public SymbolExportMap() { - this.map = new HashMap<String, Set<IncludeInfo>>(); + this.map = new HashMap<>(); } /** @@ -58,7 +58,7 @@ public class SymbolExportMap { public SymbolExportMap(String[] keysAndValues) { if (keysAndValues.length % 2 != 0) throw new IllegalArgumentException("More keys than values"); //$NON-NLS-1$ - this.map = new HashMap<String, Set<IncludeInfo>>(keysAndValues.length / 2); + this.map = new HashMap<>(keysAndValues.length / 2); for (int i = 0; i < keysAndValues.length;) { String key = keysAndValues[i++]; addMapping(key, keysAndValues[i++]); @@ -66,7 +66,7 @@ public class SymbolExportMap { } public SymbolExportMap(SymbolExportMap other) { - this.map = new HashMap<String, Set<IncludeInfo>>(other.map.size()); + this.map = new HashMap<>(other.map.size()); addAllMappings(other); } @@ -81,7 +81,7 @@ public class SymbolExportMap { return; // Don't allow mapping to itself. Set<IncludeInfo> list = map.get(symbol); if (list == null) { - list = new LinkedHashSet<IncludeInfo>(); + list = new LinkedHashSet<>(); map.put(symbol, list); } list.add(header); @@ -128,10 +128,10 @@ public class SymbolExportMap { * Writes the map to a memento. */ public void saveToMemento(IMemento memento) { - List<String> keys = new ArrayList<String>(map.keySet()); + List<String> keys = new ArrayList<>(map.keySet()); Collections.sort(keys, COLLATOR); for (String key : keys) { - List<IncludeInfo> values = new ArrayList<IncludeInfo>(map.get(key)); + List<IncludeInfo> values = new ArrayList<>(map.get(key)); Collections.sort(values); for (IncludeInfo value : values) { IMemento mapping = memento.createChild(TAG_MAPPING); @@ -156,7 +156,7 @@ public class SymbolExportMap { Set<IncludeInfo> otherTargets = entry.getValue(); Set<IncludeInfo> targets = map.get(source); if (targets == null) { - targets = new LinkedHashSet<IncludeInfo>(otherTargets); + targets = new LinkedHashSet<>(otherTargets); map.put(source, targets); } else { targets.addAll(otherTargets); @@ -168,13 +168,13 @@ public class SymbolExportMap { @Override public String toString() { StringBuilder buf = new StringBuilder(); - ArrayList<String> symbols = new ArrayList<String>(map.keySet()); + ArrayList<String> symbols = new ArrayList<>(map.keySet()); Collections.sort(symbols); for (String symbol : symbols) { buf.append('\n'); buf.append(symbol); buf.append(" exported by "); //$NON-NLS-1$ - List<IncludeInfo> targets = new ArrayList<IncludeInfo>(map.get(symbol)); + List<IncludeInfo> targets = new ArrayList<>(map.get(symbol)); for (int i = 0; i < targets.size(); i++) { if (i > 0) buf.append(", "); //$NON-NLS-1$ @@ -211,7 +211,7 @@ public class SymbolExportMap { return Collections.emptyList(); } - List<SymbolExportMap> maps = new ArrayList<SymbolExportMap>(); + List<SymbolExportMap> maps = new ArrayList<>(); for (IMemento element : memento.getChildren(TAG_SYMBOL_EXPORT_MAP)) { maps.add(fromMemento(element)); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRefactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRefactory.java index 09b4cfd03f7..9ea3f198600 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRefactory.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRefactory.java @@ -118,7 +118,7 @@ public class CRefactory { public String[] getCCppPatterns() { IContentType[] cts = Platform.getContentTypeManager().getAllContentTypes(); - HashSet<String> all = new HashSet<String>(); + HashSet<String> all = new HashSet<>(); for (IContentType candidate : cts) { IContentType type = candidate; boolean useIt = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/TextSearchWrapper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/TextSearchWrapper.java index ab0f46e8e28..3c397a168e7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/TextSearchWrapper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/TextSearchWrapper.java @@ -67,7 +67,7 @@ public class TextSearchWrapper { private static class SearchScope extends TextSearchScope { public static SearchScope newSearchScope(IFile[] files, IWorkingSet ws) { IAdaptable[] adaptables = ws.getElements(); - ArrayList<IResource> resources = new ArrayList<IResource>(); + ArrayList<IResource> resources = new ArrayList<>(); for (int i = 0; i < adaptables.length; i++) { IAdaptable adaptable = adaptables[i]; IResource resource = adaptable.getAdapter(IResource.class); @@ -80,7 +80,7 @@ public class TextSearchWrapper { public static SearchScope newSearchScope(IFile[] files, IResource[] roots) { if (files != null) { - ArrayList<IResource> resources = new ArrayList<IResource>(files.length + roots.length); + ArrayList<IResource> resources = new ArrayList<>(files.length + roots.length); for (IFile file : files) { if (!isInForest(file, roots)) { resources.add(file); @@ -106,7 +106,7 @@ public class TextSearchWrapper { } private IResource[] fRootResources; - private ArrayList<Matcher> fFileMatcher = new ArrayList<Matcher>(); + private ArrayList<Matcher> fFileMatcher = new ArrayList<>(); private SearchScope(IResource[] roots) { fRootResources = roots; @@ -199,8 +199,8 @@ public class TextSearchWrapper { } private TextSearchScope defineRelatedProjectsAsSearchScope(IFile[] files, IProject project, String[] patterns) { - HashSet<IProject> projects = new HashSet<IProject>(); - LinkedList<IProject> workThrough = new LinkedList<IProject>(); + HashSet<IProject> projects = new HashSet<>(); + LinkedList<IProject> workThrough = new LinkedList<>(); workThrough.add(project); while (!workThrough.isEmpty()) { IProject proj = workThrough.removeLast(); @@ -300,7 +300,7 @@ public class TextSearchWrapper { IFile tfile = match.getFile(); if (file == null || !file.equals(tfile)) { file = tfile; - locations = new ArrayList<int[]>(); + locations = new ArrayList<>(); computeLocations(file, locations); } match.setLocation(findLocation(match, locations)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java index 0ad5f210d74..7bce00e643f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java @@ -83,7 +83,7 @@ public class InsertionPointFinder { * @param ast the translation unit where to find the definitions */ private static void findAllDefinitionsoutSideClass(IASTTranslationUnit ast) { - final ArrayList<ICPPASTFunctionDefinition> definitions = new ArrayList<ICPPASTFunctionDefinition>(); + final ArrayList<ICPPASTFunctionDefinition> definitions = new ArrayList<>(); if (ast == null) { alldefinitionsoutside = definitions; return; @@ -110,7 +110,7 @@ public class InsertionPointFinder { private static ArrayList<ICPPASTFunctionDeclarator> getDeclarationsInClass(ICPPASTCompositeTypeSpecifier klass, final IASTFunctionDeclarator selected) { - final ArrayList<ICPPASTFunctionDeclarator> declarations = new ArrayList<ICPPASTFunctionDeclarator>(); + final ArrayList<ICPPASTFunctionDeclarator> declarations = new ArrayList<>(); klass.accept(new ASTVisitor() { { @@ -137,7 +137,7 @@ public class InsertionPointFinder { } private static ICPPASTCompositeTypeSpecifier getklass(IASTTranslationUnit unit) { - final Container<ICPPASTCompositeTypeSpecifier> result = new Container<ICPPASTCompositeTypeSpecifier>(); + final Container<ICPPASTCompositeTypeSpecifier> result = new Container<>(); unit.accept(new ASTVisitor() { { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java index 28314bd929a..c7c2ee9417a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java @@ -397,14 +397,14 @@ public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefact } private IASTNode searchNamespaceInImplementation(final List<ICPPASTNamespaceDefinition> namespaces) { - final Container<IASTNode> result = new Container<IASTNode>(); + final Container<IASTNode> result = new Container<>(); ASTVisitor visitor = new NamespaceFinderVisitor(namespaces, result); this.implAst.accept(visitor); return result.getObject(); } private List<ICPPASTNamespaceDefinition> getNamespacesToAdd(final List<ICPPASTNamespaceDefinition> namespaces) { - final List<ICPPASTNamespaceDefinition> result = new ArrayList<ICPPASTNamespaceDefinition>(); + final List<ICPPASTNamespaceDefinition> result = new ArrayList<>(); this.implAst.accept(new NamespaceFinderVisitor(namespaces, new Container<IASTNode>()) { { shouldVisitTranslationUnit = true; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleNodeHelper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleNodeHelper.java index 4217cebe4f2..9cd68fb4cc0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleNodeHelper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleNodeHelper.java @@ -84,7 +84,7 @@ public class ToggleNodeHelper extends NodeHelper { } private static List<ICPPASTConstructorChainInitializer> getInitializerList(IASTFunctionDefinition definition) { - ArrayList<ICPPASTConstructorChainInitializer> initalizers = new ArrayList<ICPPASTConstructorChainInitializer>(); + ArrayList<ICPPASTConstructorChainInitializer> initalizers = new ArrayList<>(); for (IASTNode node : definition.getChildren()) { if (node instanceof ICPPASTConstructorChainInitializer) { @@ -286,7 +286,7 @@ public class ToggleNodeHelper extends NodeHelper { } private static ArrayList<ICPPASTTemplateDeclaration> getAllTemplateDeclarations(IASTNode node) { - ArrayList<ICPPASTTemplateDeclaration> templdecs = new ArrayList<ICPPASTTemplateDeclaration>(); + ArrayList<ICPPASTTemplateDeclaration> templdecs = new ArrayList<>(); while (node.getParent() != null) { node = node.getParent(); if (node instanceof ICPPASTTemplateDeclaration) { @@ -363,7 +363,7 @@ public class ToggleNodeHelper extends NodeHelper { private static Stack<IASTNode> getQualifiedNames(IASTFunctionDeclarator declarator, IASTNode limiter, IASTNode node) { IASTName lastName = declarator.getName(); - Stack<IASTNode> nodes = new Stack<IASTNode>(); + Stack<IASTNode> nodes = new Stack<>(); while (node.getParent() != null && node.getParent() != limiter) { node = node.getParent(); if (node instanceof IASTCompositeTypeSpecifier) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java index e2f8aee9d61..30a3a0733ac 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ASTHelper.java @@ -108,7 +108,7 @@ public class ASTHelper { } public static Collection<IASTDeclSpecifier> getCompositeTypeSpecifiers(IASTNode baseNode) { - final Collection<IASTDeclSpecifier> specifiers = new ArrayList<IASTDeclSpecifier>(); + final Collection<IASTDeclSpecifier> specifiers = new ArrayList<>(); ASTVisitor visitor = new ASTVisitor() { @Override public int visit(IASTDeclSpecifier declSpec) { @@ -123,7 +123,7 @@ public class ASTHelper { public static Collection<IASTPreprocessorStatement> getAllInFilePreprocessorStatements(IASTTranslationUnit unit, String aktFileName) { - Collection<IASTPreprocessorStatement> statements = new ArrayList<IASTPreprocessorStatement>(); + Collection<IASTPreprocessorStatement> statements = new ArrayList<>(); for (IASTPreprocessorStatement aktStatement : unit.getAllPreprocessorStatements()) { if (aktStatement.getFileLocation() != null && aktStatement.getFileLocation().getFileName().equals(aktFileName)) { @@ -134,7 +134,7 @@ public class ASTHelper { } public static Collection<IASTDeclaration> getAllInFileDeclarations(IASTTranslationUnit unit, String aktFileName) { - Collection<IASTDeclaration> decls = new ArrayList<IASTDeclaration>(); + Collection<IASTDeclaration> decls = new ArrayList<>(); for (IASTDeclaration aktDecl : unit.getDeclarations()) { if (aktDecl.getFileLocation() != null && aktDecl.getFileLocation().getFileName().equals(aktFileName)) { decls.add(aktDecl); @@ -157,7 +157,7 @@ public class ASTHelper { } public static Collection<ICPPASTUsingDeclaration> getUsingDeclarations(IASTTranslationUnit unit) { - Collection<ICPPASTUsingDeclaration> usingDecls = new ArrayList<ICPPASTUsingDeclaration>(); + Collection<ICPPASTUsingDeclaration> usingDecls = new ArrayList<>(); for (IASTDeclaration aktDecl : unit.getDeclarations()) { if (aktDecl instanceof ICPPASTUsingDeclaration) { usingDecls.add((ICPPASTUsingDeclaration) aktDecl); @@ -177,7 +177,7 @@ public class ASTHelper { } public static Collection<IASTFunctionDeclarator> getFunctionDeclaratorsForClass(IASTCompositeTypeSpecifier klass) { - Collection<IASTFunctionDeclarator> declarators = new ArrayList<IASTFunctionDeclarator>(); + Collection<IASTFunctionDeclarator> declarators = new ArrayList<>(); for (IASTDeclaration aktDeclaration : klass.getMembers()) { if (aktDeclaration instanceof IASTSimpleDeclaration) { for (IASTDeclarator aktDeclarator : ((IASTSimpleDeclaration) aktDeclaration).getDeclarators()) { @@ -191,7 +191,7 @@ public class ASTHelper { } public static Collection<IASTFunctionDefinition> getFunctionDefinitionsForClass(IASTCompositeTypeSpecifier klass) { - Collection<IASTFunctionDefinition> definitions = new ArrayList<IASTFunctionDefinition>(); + Collection<IASTFunctionDefinition> definitions = new ArrayList<>(); for (IASTFunctionDeclarator aktDeclarator : getFunctionDeclaratorsForClass(klass)) { IBinding binding = aktDeclarator.getName().resolveBinding(); for (IASTName aktName : aktDeclarator.getTranslationUnit().getDefinitionsInAST(binding)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java index ce34bf04972..00564d10904 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/DefinitionFinder.java @@ -91,8 +91,8 @@ public class DefinitionFinder { IIndexBinding indexBinding = index.adaptBinding(binding); if (binding == null) return null; - Set<String> searchedFiles = new HashSet<String>(); - List<IASTName> definitions = new ArrayList<IASTName>(); + Set<String> searchedFiles = new HashSet<>(); + List<IASTName> definitions = new ArrayList<>(); IIndexName[] definitionsFromIndex = index.findNames(indexBinding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES); int remainingCount = definitionsFromIndex.length; @@ -156,7 +156,7 @@ public class DefinitionFinder { IIndexBinding indexBinding = index.adaptBinding(binding); if (binding == null) return false; - Set<String> dirtyFiles = new HashSet<String>(); + Set<String> dirtyFiles = new HashSet<>(); IEditorPart[] dirtyEditors = EditorUtility.getDirtyEditors(true); for (IEditorPart editor : dirtyEditors) { IEditorInput editorInput = editor.getEditorInput(); @@ -166,7 +166,7 @@ public class DefinitionFinder { } } - Set<String> searchedFiles = new HashSet<String>(); + Set<String> searchedFiles = new HashSet<>(); IIndexName[] definitionsFromIndex = index.findNames(indexBinding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES); int remainingCount = definitionsFromIndex.length; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java index 8cd31c1adbe..4841bb9a9a1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java @@ -28,7 +28,7 @@ import org.eclipse.core.runtime.Path; public class ExpressionFinder { public static IASTName findExpressionInTranslationUnit(IASTTranslationUnit transUnit, final IIndexName indexName) { - final Container<IASTName> expName = new Container<IASTName>(); + final Container<IASTName> expName = new Container<>(); transUnit.accept(new ASTVisitor() { { shouldVisitNames = true; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java index f9171854df7..ca665b6747c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/PseudoNameGenerator.java @@ -25,7 +25,7 @@ import java.util.Set; */ public class PseudoNameGenerator { - private final Set<String> names = new HashSet<String>(); + private final Set<String> names = new HashSet<>(); public void addExistingName(String name) { names.add(name); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/resources/ResourceExclusionContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/resources/ResourceExclusionContributor.java index 62381c86297..a7f2835f9a0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/resources/ResourceExclusionContributor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/resources/ResourceExclusionContributor.java @@ -103,8 +103,8 @@ public class ResourceExclusionContributor extends RefreshExclusionContributor { gridData.minimumWidth = 275; exceptionsList.setLayoutData(gridData); - final HashMap<String, ExclusionInstance> exclusionInstanceStrings = new LinkedHashMap<String, ExclusionInstance>(); - final HashMap<String, Object> exclusionInstanceResources = new LinkedHashMap<String, Object>(); + final HashMap<String, ExclusionInstance> exclusionInstanceStrings = new LinkedHashMap<>(); + final HashMap<String, Object> exclusionInstanceResources = new LinkedHashMap<>(); java.util.List<ExclusionInstance> exclusionInstances = exclusion.getExclusionInstances(); @@ -156,7 +156,7 @@ public class ResourceExclusionContributor extends RefreshExclusionContributor { IContainer container = (IContainer) parentElement; if (container.isAccessible()) { try { - java.util.List<IResource> children = new ArrayList<IResource>(); + java.util.List<IResource> children = new ArrayList<>(); IResource[] members = container.members(); for (int i = 0; i < members.length; i++) { if (members[i].getType() == IResource.FOLDER) { @@ -208,7 +208,7 @@ public class ResourceExclusionContributor extends RefreshExclusionContributor { Object[] selection = dialog.getResult(); exceptionsList.removeAll(); exclusionInstanceResources.clear(); - final HashMap<String, ExclusionInstance> oldExclusionInstanceStrings = new LinkedHashMap<String, ExclusionInstance>( + final HashMap<String, ExclusionInstance> oldExclusionInstanceStrings = new LinkedHashMap<>( exclusionInstanceStrings); exclusionInstanceStrings.clear(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java index 811dfd17e03..1e51dfd6ab4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java @@ -45,12 +45,12 @@ public class CSearchListContentProvider implements IStructuredContentProvider, I @Override public Object[] getElements(Object inputElement) { - Set<String> uncoveredProjects = new HashSet<String>(); + Set<String> uncoveredProjects = new HashSet<>(); CSearchResult result = (CSearchResult) inputElement; Object[] results = result.getElements(); - List<Object> resultList = new ArrayList<Object>(); + List<Object> resultList = new ArrayList<>(); // see which projects returned results for (int i = 0; i < results.length; i++) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java index ef3d3f77786..1573ae076b3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java @@ -176,7 +176,7 @@ public class CSearchPage extends DialogPage implements ISearchPage { } // get the list of elements for the scope - Set<ICElement> elements = new HashSet<ICElement>(); + Set<ICElement> elements = new HashSet<>(); String scopeDescription = ""; //$NON-NLS-1$ switch (getContainer().getSelectedScope()) { case ISearchPageContainer.SELECTED_PROJECTS_SCOPE: diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java index 1829ce2c1a8..5ac68d0b04d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java @@ -77,7 +77,7 @@ public class CSearchPatternQuery extends CSearchQuery { this.patternStr = patternStr.trim(); // Parse the pattern string - List<Pattern> patternList = new ArrayList<Pattern>(); + List<Pattern> patternList = new ArrayList<>(); StringBuilder buff = new StringBuilder(); int n = patternStr.length(); for (int i = 0; i < n; ++i) { @@ -143,7 +143,7 @@ public class CSearchPatternQuery extends CSearchQuery { try { IndexFilter filter = IndexFilter.ALL; IIndexBinding[] bindings = index.findBindings(pattern, false, filter, monitor); - ArrayList<IIndexBinding> matchedBindings = new ArrayList<IIndexBinding>(); + ArrayList<IIndexBinding> matchedBindings = new ArrayList<>(); for (int i = 0; i < bindings.length; ++i) { IIndexBinding pdomBinding = bindings[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchProviderManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchProviderManager.java index 50ae63025eb..df2e208d8fc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchProviderManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchProviderManager.java @@ -43,7 +43,7 @@ public class CSearchProviderManager { public List<IExternalSearchProvider> getExternalSearchProviders() { if (externalSearchProviders == null) { - externalSearchProviders = new ArrayList<IExternalSearchProvider>(); + externalSearchProviders = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint indexProviderPoint = registry.getExtensionPoint(SEARCH_PROVIDERS); for (IExtension extension : indexProviderPoint.getExtensions()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTreeContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTreeContentProvider.java index 421778d7374..9721c95cebc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTreeContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTreeContentProvider.java @@ -47,7 +47,7 @@ import org.eclipse.jface.viewers.Viewer; public class CSearchTreeContentProvider implements ITreeContentProvider, IPDOMSearchContentProvider { private TreeViewer viewer; private CSearchResult result; - private final Map<Object, Set<Object>> tree = new HashMap<Object, Set<Object>>(); + private final Map<Object, Set<Object>> tree = new HashMap<>(); private final CSearchViewPage fPage; CSearchTreeContentProvider(CSearchViewPage page) { @@ -119,7 +119,7 @@ public class CSearchTreeContentProvider implements ITreeContentProvider, IPDOMSe private boolean insertChild(Object parent, Object child) { Set<Object> children = tree.get(parent); if (children == null) { - children = new HashSet<Object>(); + children = new HashSet<>(); tree.put(parent, children); } return children.add(child); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LRUWorkingSets.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LRUWorkingSets.java index aba35cb0b71..e6fe418b577 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LRUWorkingSets.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LRUWorkingSets.java @@ -40,7 +40,7 @@ public class LRUWorkingSets { int size = 0; public LRUWorkingSets(int size) { - workingSetsCache = new ArrayList<IWorkingSet[]>(size); + workingSetsCache = new ArrayList<>(size); this.size = size; } @@ -56,11 +56,11 @@ public class LRUWorkingSets { } private IWorkingSet[] find(ArrayList<IWorkingSet[]> list, IWorkingSet[] workingSet) { - Set<IWorkingSet> workingSetList = new HashSet<IWorkingSet>(Arrays.asList(workingSet)); + Set<IWorkingSet> workingSetList = new HashSet<>(Arrays.asList(workingSet)); Iterator<IWorkingSet[]> iter = list.iterator(); while (iter.hasNext()) { IWorkingSet[] lruWorkingSets = iter.next(); - Set<IWorkingSet> lruWorkingSetList = new HashSet<IWorkingSet>(Arrays.asList(lruWorkingSets)); + Set<IWorkingSet> lruWorkingSetList = new HashSet<>(Arrays.asList(lruWorkingSets)); if (lruWorkingSetList.equals(workingSetList)) return lruWorkingSets; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LineSearchElement.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LineSearchElement.java index 35a17dc1c08..2a65e70c469 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LineSearchElement.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LineSearchElement.java @@ -172,8 +172,8 @@ public class LineSearchElement extends CSearchElement { // Sort matches according to their offsets Arrays.sort(matches, MATCHES_COMPARATOR); // Group all matches by lines and create LineSearchElements - List<LineSearchElement> result = new ArrayList<LineSearchElement>(); - List<Match> matchCollector = new ArrayList<Match>(); + List<LineSearchElement> result = new ArrayList<>(); + List<Match> matchCollector = new ArrayList<>(); int minOffset = 0; int lineNumber = 0; int lineOffset = 0; @@ -223,8 +223,8 @@ public class LineSearchElement extends CSearchElement { private static LineSearchElement[] collectLineElements(AbstractCharArray buf, Match[] matches, IIndexFileLocation fileLocation) { - List<LineSearchElement> result = new ArrayList<LineSearchElement>(); - List<Match> matchCollector = new ArrayList<Match>(); + List<LineSearchElement> result = new ArrayList<>(); + List<Match> matchCollector = new ArrayList<>(); boolean skipLF = false; int lineNumber = 1; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java index d904757b565..c6fa83f76b6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java @@ -77,7 +77,7 @@ public class LinkedNamesFinder { public BindingFinder(IASTTranslationUnit root, IASTNode point) { this.root = root; - locations = new ArrayList<IRegion>(); + locations = new ArrayList<>(); } public void find(IBinding target) { @@ -191,7 +191,7 @@ public class LinkedNamesFinder { private void findMacro(IMacroBinding target) { findBinding(target); char[] nameChars = target.getNameCharArray(); - List<IASTName> ifdefNameStack = new ArrayList<IASTName>(); + List<IASTName> ifdefNameStack = new ArrayList<>(); IASTPreprocessorStatement[] statements = root.getAllPreprocessorStatements(); for (IASTPreprocessorStatement statement : statements) { if (!statement.isPartOfTranslationUnitFile()) { @@ -308,8 +308,8 @@ public class LinkedNamesFinder { } private final ICPPClassType baseClass; - private Set<ICPPClassType> subclasses = new HashSet<ICPPClassType>(); - private Set<IBinding> seenClasses = new HashSet<IBinding>(); + private Set<ICPPClassType> subclasses = new HashSet<>(); + private Set<IBinding> seenClasses = new HashSet<>(); SubclassFinder(ICPPClassType baseClass) { this.baseClass = baseClass; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/DeclarationsSearchGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/DeclarationsSearchGroup.java index 79628b24431..7e188aaccbf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/DeclarationsSearchGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/DeclarationsSearchGroup.java @@ -111,7 +111,7 @@ public class DeclarationsSearchGroup extends ActionGroup { } private FindAction[] getWorkingSetActions() { - ArrayList<FindAction> actions = new ArrayList<FindAction>(CSearchUtil.LRU_WORKINGSET_LIST_SIZE); + ArrayList<FindAction> actions = new ArrayList<>(CSearchUtil.LRU_WORKINGSET_LIST_SIZE); Iterator<IWorkingSet[]> iter = CSearchUtil.getLRUWorkingSets().iterator(); while (iter.hasNext()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java index 5e03c3e1d5a..21cd67b8d7a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java @@ -71,7 +71,7 @@ public abstract class FindInWorkingSetAction extends FindAction { if (fWorkingSets == null) { return ICElement.EMPTY_ARRAY; } - List<ICElement> scope = new ArrayList<ICElement>(); + List<ICElement> scope = new ArrayList<>(); for (int i = 0; i < fWorkingSets.length; ++i) { IAdaptable[] elements = fWorkingSets[i].getElements(); for (int j = 0; j < elements.length; ++j) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java index 1a5e10a7bfa..f93aa22ae68 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java @@ -104,7 +104,7 @@ public class ReferencesSearchGroup extends ActionGroup { } private FindAction[] getWorkingSetActions() { - ArrayList<FindAction> actions = new ArrayList<FindAction>(CSearchUtil.LRU_WORKINGSET_LIST_SIZE); + ArrayList<FindAction> actions = new ArrayList<>(CSearchUtil.LRU_WORKINGSET_LIST_SIZE); Iterator<IWorkingSet[]> iter = CSearchUtil.getLRUWorkingSets().iterator(); while (iter.hasNext()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java index 31ceaff2d51..89808e7427a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java @@ -55,7 +55,7 @@ public final class CCodeScanner extends AbstractCScanner { */ protected List<IRule> createRules() { - List<IRule> rules = new ArrayList<IRule>(); + List<IRule> rules = new ArrayList<>(); IToken token; token = getToken(ICColorConstants.C_DEFAULT); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java index 40b7ab39df3..3a82ebb4031 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java @@ -83,7 +83,7 @@ public class CHelpProviderDescriptor { private static Map<String, ICHelpProvider> getProvidersMap() { if (fProvidersMap == null) { - fProvidersMap = new HashMap<String, ICHelpProvider>(); + fProvidersMap = new HashMap<>(); } return fProvidersMap; } @@ -137,7 +137,7 @@ public class CHelpProviderDescriptor { if (provider != null && fProject != null) { ICHelpBook books[] = provider.getCHelpBooks(); if (books != null) { - List<CHelpBookDescriptor> descriptorList = new ArrayList<CHelpBookDescriptor>(); + List<CHelpBookDescriptor> descriptorList = new ArrayList<>(); for (int i = 0; i < books.length; i++) { CHelpBookDescriptor des = new CHelpBookDescriptor(books[i], projectElement); if (des.matches(fProject)) @@ -160,7 +160,7 @@ public class CHelpProviderDescriptor { CHelpBookDescriptor bookDescriptors[] = getCHelpBookDescriptors(); if (bookDescriptors.length == 0) return null; - List<ICHelpBook> bookList = new ArrayList<ICHelpBook>(); + List<ICHelpBook> bookList = new ArrayList<>(); for (int i = 0; i < bookDescriptors.length; i++) { if (bookDescriptors[i].isEnabled() && bookDescriptors[i].matches(context)) bookList.add(bookDescriptors[i].getCHelpBook()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpSettings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpSettings.java index c15fa38cf4d..b94da6d98ea 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpSettings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpSettings.java @@ -96,7 +96,7 @@ public class CHelpSettings { if (providerDescriptors.length == 0) return new CHelpBookDescriptor[0]; - List<CHelpBookDescriptor> bookList = new ArrayList<CHelpBookDescriptor>(); + List<CHelpBookDescriptor> bookList = new ArrayList<>(); for (int i = 0; i < providerDescriptors.length; i++) { CHelpBookDescriptor bookDescriptors[] = providerDescriptors[i].getCHelpBookDescriptors(); if (bookDescriptors.length != 0) @@ -133,7 +133,7 @@ public class CHelpSettings { public IFunctionSummary[] getMatchingFunctions(ICHelpInvocationContext context, String frag) { CHelpProviderDescriptor providerDescriptors[] = getCHelpProviderDescriptors(); - List<IFunctionSummary> sumaryList = new ArrayList<IFunctionSummary>(); + List<IFunctionSummary> sumaryList = new ArrayList<>(); for (int i = 0; i < providerDescriptors.length; i++) { ICHelpBook books[] = providerDescriptors[i].getEnabledMatchedCHelpBooks(context); if (books != null && books.length != 0) { @@ -153,7 +153,7 @@ public class CHelpSettings { public ICHelpResourceDescriptor[] getHelpResources(ICHelpInvocationContext context, String name) { CHelpProviderDescriptor providerDescriptors[] = getCHelpProviderDescriptors(); - List<ICHelpResourceDescriptor> resourcesList = new ArrayList<ICHelpResourceDescriptor>(); + List<ICHelpResourceDescriptor> resourcesList = new ArrayList<>(); for (int i = 0; i < providerDescriptors.length; i++) { ICHelpBook books[] = providerDescriptors[i].getEnabledMatchedCHelpBooks(context); if (books != null && books.length != 0) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java index 13763e2c701..8b4cc1835ba 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPreprocessorScanner.java @@ -55,7 +55,7 @@ public class CPreprocessorScanner extends AbstractCScanner { protected List<IRule> createRules() { IToken defaultToken = getToken(ICColorConstants.PP_DEFAULT); - List<IRule> rules = new ArrayList<IRule>(); + List<IRule> rules = new ArrayList<>(); IToken token; // Add generic white space rule. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CombinedWordRule.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CombinedWordRule.java index 5da2ece78f8..dd166b348e4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CombinedWordRule.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CombinedWordRule.java @@ -49,7 +49,7 @@ public class CombinedWordRule implements IRule { */ public static class WordMatcher { /** The table of predefined words and token for this matcher */ - private Map<CharacterBuffer, IToken> fWords = new HashMap<CharacterBuffer, IToken>(); + private Map<CharacterBuffer, IToken> fWords = new HashMap<>(); /** * Adds a word and the token to be returned if it is detected. @@ -236,7 +236,7 @@ public class CombinedWordRule implements IRule { private CharacterBuffer fBuffer = new CharacterBuffer(16); /** List of word matchers */ - private List<WordMatcher> fMatchers = new ArrayList<WordMatcher>(); + private List<WordMatcher> fMatchers = new ArrayList<>(); /** * Creates a rule which, with the help of an word detector, will return the token diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TaskTagRule.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TaskTagRule.java index ed220f88de6..adab694b9cb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TaskTagRule.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TaskTagRule.java @@ -55,7 +55,7 @@ public final class TaskTagRule extends CombinedWordRule implements IPropertyChan /** * Uppercase words */ - private Map<CharacterBuffer, IToken> fUppercaseWords = new HashMap<CharacterBuffer, IToken>(); + private Map<CharacterBuffer, IToken> fUppercaseWords = new HashMap<>(); /** * <code>true</code> if task tag detection is case-sensitive. */ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TokenStore.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TokenStore.java index 3b1af804352..b36ef5f7c2d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TokenStore.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/TokenStore.java @@ -43,7 +43,7 @@ public class TokenStore implements ITokenStore { private IColorManager fColorManager; private IPreferenceStore fPreferenceStore; - private Map<String, IToken> fTokenMap = new HashMap<String, IToken>(); + private Map<String, IToken> fTokenMap = new HashMap<>(); private String[] fPropertyNamesColor; private boolean fNeedsLazyColorLoading; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java index eae08ba039f..85e470629db 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java @@ -63,8 +63,8 @@ public class BestMatchHover extends AbstractCEditorTextHover { CEditorTextHoverDescriptor[] hoverDescs = CUIPlugin.getDefault().getCEditorTextHoverDescriptors(); // Initialize lists - indicates that the initialization happened - fTextHoverSpecifications = new ArrayList<CEditorTextHoverDescriptor>(hoverDescs.length - 1); - fInstantiatedTextHovers = new ArrayList<ITextHover>(hoverDescs.length - 1); + fTextHoverSpecifications = new ArrayList<>(hoverDescs.length - 1); + fInstantiatedTextHovers = new ArrayList<>(hoverDescs.length - 1); // Populate list for (int i = 0; i < hoverDescs.length; i++) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java index 307be739cad..9ac0a9f8b26 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java @@ -192,7 +192,7 @@ public class CEditorTextHoverDescriptor implements Comparable<CEditorTextHoverDe } private static CEditorTextHoverDescriptor[] createDescriptors(IConfigurationElement[] elements) { - List<CEditorTextHoverDescriptor> result = new ArrayList<CEditorTextHoverDescriptor>(elements.length); + List<CEditorTextHoverDescriptor> result = new ArrayList<>(elements.length); for (IConfigurationElement element : elements) { if (HOVER_TAG.equals(element.getName())) { CEditorTextHoverDescriptor desc = new CEditorTextHoverDescriptor(element); @@ -208,7 +208,7 @@ public class CEditorTextHoverDescriptor implements Comparable<CEditorTextHoverDe .getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS); StringTokenizer tokenizer = new StringTokenizer(compiledTextHoverModifiers, VALUE_SEPARATOR); - HashMap<String, String> idToModifier = new HashMap<String, String>(tokenizer.countTokens() / 2); + HashMap<String, String> idToModifier = new HashMap<>(tokenizer.countTokens() / 2); while (tokenizer.hasMoreTokens()) { String id = tokenizer.nextToken(); @@ -220,7 +220,7 @@ public class CEditorTextHoverDescriptor implements Comparable<CEditorTextHoverDe .getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS); tokenizer = new StringTokenizer(compiledTextHoverModifierMasks, VALUE_SEPARATOR); - HashMap<String, String> idToModifierMask = new HashMap<String, String>(tokenizer.countTokens() / 2); + HashMap<String, String> idToModifierMask = new HashMap<>(tokenizer.countTokens() / 2); while (tokenizer.hasMoreTokens()) { String id = tokenizer.nextToken(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionExplorationControl.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionExplorationControl.java index 4e894185ff6..a5224704305 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionExplorationControl.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionExplorationControl.java @@ -326,7 +326,7 @@ public class CMacroExpansionExplorationControl extends AbstractCompareViewerInfo fHandlerService = workbench.getService(IHandlerService.class); fContextService = workbench.getService(IContextService.class); fContextActivation = fContextService.activateContext(CONTEXT_ID_MACRO_EXPANSION_HOVER); - fHandlerActivations = new ArrayList<IHandlerActivation>(); + fHandlerActivations = new ArrayList<>(); fHandlerActivations.add(fHandlerService.activateHandler(COMMAND_ID_EXPANSION_BACK, backwardHandler)); fHandlerActivations.add(fHandlerService.activateHandler(COMMAND_ID_EXPANSION_FORWARD, forwardHandler)); fHandlerActivations diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionInput.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionInput.java index 1c542160723..46cef06cea7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionInput.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionInput.java @@ -81,7 +81,7 @@ public class CMacroExpansionInput { private final Position fTextRegion; private final boolean fAllowSelection; private IASTNode fEnclosingNode; - private List<IASTNode> fExpansionNodes = new ArrayList<IASTNode>(); + private List<IASTNode> fExpansionNodes = new ArrayList<>(); private MacroExpansionExplorer fExplorer; private IRegion fExpansionRegion; @@ -177,7 +177,7 @@ public class CMacroExpansionInput { if (node == other) { return other; } - List<IASTNode> ancestors = new ArrayList<IASTNode>(); + List<IASTNode> ancestors = new ArrayList<>(); while (node != null) { node = node.getParent(); ancestors.add(node); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/ProblemHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/ProblemHover.java index 7e1f33f21e2..f3315c1e89b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/ProblemHover.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/ProblemHover.java @@ -85,7 +85,7 @@ public class ProblemHover extends AbstractAnnotationHover { if (!SpellingAnnotation.TYPE.equals(cAnnotation.getType())) return NO_PROPOSALS; - List<ICCompletionProposal> proposals = new ArrayList<ICCompletionProposal>(); + List<ICCompletionProposal> proposals = new ArrayList<>(); CCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CCompletionProposalComparator()); @@ -121,7 +121,7 @@ public class ProblemHover extends AbstractAnnotationHover { CorrectionContext context = new CorrectionContext(tu, sourceViewer, position.getOffset(), position.getLength()); - List<ICCompletionProposal> proposals = new ArrayList<ICCompletionProposal>(); + List<ICCompletionProposal> proposals = new ArrayList<>(); CCorrectionProcessor.collectProposals(context, model, new Annotation[] { markerAnnotation }, true, false, proposals); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java index 9eaa7ddc221..67ac911e7f7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java @@ -80,7 +80,7 @@ final class CompletionProposalComputerDescriptor { private static final String SESSION_ENDED = "sessionEnded()"; //$NON-NLS-1$ static { - Set<String> partitions = new HashSet<String>(); + Set<String> partitions = new HashSet<>(); partitions.add(IDocument.DEFAULT_CONTENT_TYPE); partitions.addAll(Arrays.asList(ICPartitions.ALL_CPARTITIONS)); @@ -142,7 +142,7 @@ final class CompletionProposalComputerDescriptor { else fName = name; - Set<String> partitions = new HashSet<String>(); + Set<String> partitions = new HashSet<>(); IConfigurationElement[] children = element.getChildren(PARTITION); if (children.length == 0) { fPartitions = PARTITION_SET; // add to all partition types if no partition is configured diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java index 268639f0f3d..12c66d662e1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java @@ -83,26 +83,26 @@ public final class CompletionProposalComputerRegistry { * {@link String}, value type: * {@linkplain List List<CompletionProposalComputerDescriptor>}). */ - private final Map<String, List<CompletionProposalComputerDescriptor>> fDescriptorsByPartition = new HashMap<String, List<CompletionProposalComputerDescriptor>>(); + private final Map<String, List<CompletionProposalComputerDescriptor>> fDescriptorsByPartition = new HashMap<>(); /** * Unmodifiable versions of the sets stored in * <code>fDescriptorsByPartition</code> (key type: {@link String}, * value type: * {@linkplain List List<CompletionProposalComputerDescriptor>}). */ - private final Map<String, List<CompletionProposalComputerDescriptor>> fPublicDescriptorsByPartition = new HashMap<String, List<CompletionProposalComputerDescriptor>>(); + private final Map<String, List<CompletionProposalComputerDescriptor>> fPublicDescriptorsByPartition = new HashMap<>(); /** * All descriptors (element type: * {@link CompletionProposalComputerDescriptor}). */ - private final List<CompletionProposalComputerDescriptor> fDescriptors = new ArrayList<CompletionProposalComputerDescriptor>(); + private final List<CompletionProposalComputerDescriptor> fDescriptors = new ArrayList<>(); /** * Unmodifiable view of <code>fDescriptors</code> */ private final List<CompletionProposalComputerDescriptor> fPublicDescriptors = Collections .unmodifiableList(fDescriptors); - private final List<CompletionProposalCategory> fCategories = new ArrayList<CompletionProposalCategory>(); + private final List<CompletionProposalCategory> fCategories = new ArrayList<>(); private final List<CompletionProposalCategory> fPublicCategories = Collections.unmodifiableList(fCategories); /** * <code>true</code> if this registry has been loaded. @@ -209,11 +209,11 @@ public final class CompletionProposalComputerRegistry { */ public void reload() { IExtensionRegistry registry = Platform.getExtensionRegistry(); - List<IConfigurationElement> elements = new ArrayList<IConfigurationElement>( + List<IConfigurationElement> elements = new ArrayList<>( Arrays.asList(registry.getConfigurationElementsFor(CUIPlugin.getPluginId(), EXTENSION_POINT))); - Map<String, List<CompletionProposalComputerDescriptor>> map = new HashMap<String, List<CompletionProposalComputerDescriptor>>(); - List<CompletionProposalComputerDescriptor> all = new ArrayList<CompletionProposalComputerDescriptor>(); + Map<String, List<CompletionProposalComputerDescriptor>> map = new HashMap<>(); + List<CompletionProposalComputerDescriptor> all = new ArrayList<>(); List<CompletionProposalCategory> categories = getCategories(elements); for (IConfigurationElement element : elements) { @@ -225,7 +225,7 @@ public final class CompletionProposalComputerRegistry { String partition = (String) element2; List<CompletionProposalComputerDescriptor> list = map.get(partition); if (list == null) { - list = new ArrayList<CompletionProposalComputerDescriptor>(); + list = new ArrayList<>(); map.put(partition, list); } list.add(desc); @@ -273,11 +273,11 @@ public final class CompletionProposalComputerRegistry { private List<CompletionProposalCategory> getCategories(List<IConfigurationElement> elements) { IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore(); String preference = store.getString(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); - Set<String> disabled = new HashSet<String>(); + Set<String> disabled = new HashSet<>(); StringTokenizer tok = new StringTokenizer(preference, "\0"); //$NON-NLS-1$ while (tok.hasMoreTokens()) disabled.add(tok.nextToken()); - Map<String, Integer> ordered = new HashMap<String, Integer>(); + Map<String, Integer> ordered = new HashMap<>(); preference = store.getString(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); tok = new StringTokenizer(preference, "\0"); //$NON-NLS-1$ while (tok.hasMoreTokens()) { @@ -287,7 +287,7 @@ public final class CompletionProposalComputerRegistry { ordered.put(id, Integer.valueOf(rank)); } - List<CompletionProposalCategory> categories = new ArrayList<CompletionProposalCategory>(); + List<CompletionProposalCategory> categories = new ArrayList<>(); for (Iterator<IConfigurationElement> iter = elements.iterator(); iter.hasNext();) { IConfigurationElement element = iter.next(); try { @@ -382,7 +382,7 @@ public final class CompletionProposalComputerRegistry { * @return the names of the contributors other than <code>culprit</code> that contribute to <code>category</code> (element type: {@link String}) */ private Set<String> getAffectedContributors(CompletionProposalCategory category, IContributor culprit) { - Set<String> affectedPlugins = new HashSet<String>(); + Set<String> affectedPlugins = new HashSet<>(); for (CompletionProposalComputerDescriptor desc : getProposalComputerDescriptors()) { CompletionProposalCategory cat = desc.getCategory(); if (cat.equals(category)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistComputerParameter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistComputerParameter.java index c22f5ff5716..90873817348 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistComputerParameter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistComputerParameter.java @@ -33,7 +33,7 @@ public final class ContentAssistComputerParameter implements IParameterValues { public Map<String, String> getParameterValues() { Collection<CompletionProposalCategory> descriptors = CompletionProposalComputerRegistry.getDefault() .getProposalCategories(); - Map<String, String> map = new HashMap<String, String>(descriptors.size()); + Map<String, String> map = new HashMap<>(descriptors.size()); for (CompletionProposalCategory category : descriptors) { map.put(category.getDisplayName(), category.getId()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java index aeb25719866..dd7b1084dfe 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java @@ -110,7 +110,7 @@ public class HelpCompletionProposalComputer extends ParsingBasedProposalComputer // not generate prefix matches to begin with if it's set. boolean requireExactMatch = cContext.isContextInformationStyle(); - List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); + List<ICompletionProposal> proposals = new ArrayList<>(); for (IFunctionSummary summary : summaries) { if (requireExactMatch && !summary.getName().equals(prefix)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java index c4867ebaeb5..725ebb7ba1d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java @@ -71,7 +71,7 @@ public class InclusionProposalComputer implements ICompletionProposalComputer { CContentAssistInvocationContext cContext = (CContentAssistInvocationContext) context; if (inIncludeDirective(cContext)) { // add include file proposals - proposals = new ArrayList<ICompletionProposal>(); + proposals = new ArrayList<>(); try { addInclusionProposals(cContext, proposals); } catch (Exception exc) { @@ -157,7 +157,7 @@ public class InclusionProposalComputer implements ICompletionProposalComputer { PotentialInclude[] potentialIncludes = collectIncludeFiles(tu, prefixPath, angleBrackets); if (potentialIncludes.length > 0) { IInclude[] includes = tu.getIncludes(); - Set<String> alreadyIncluded = new HashSet<String>(); + Set<String> alreadyIncluded = new HashSet<>(); for (IInclude includeDirective : includes) { alreadyIncluded.add(includeDirective.getElementName()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java index c153fd1d8d6..2b7ca4b0c93 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java @@ -59,7 +59,7 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu // keywords are matched case-sensitive final int relevance = RelevanceConstants.CASE_MATCH_RELEVANCE + RelevanceConstants.KEYWORD_TYPE_RELEVANCE; - List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); + List<ICompletionProposal> proposals = new ArrayList<>(); ICLanguageKeywords languageKeywords = null; ITranslationUnit tu = context.getTranslationUnit(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java index 2c5a6fa02e2..1c0f7cb6c28 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java @@ -71,8 +71,8 @@ public abstract class ParsingBasedProposalComputer implements ICompletionProposa IProgressMonitor monitor) { Collection<ICompletionProposal> proposals = computeCompletionProposals(context, monitor); // Remove duplicates - proposals = (new LinkedHashSet<ICompletionProposal>(proposals)); - List<IContextInformation> result = new ArrayList<IContextInformation>(); + proposals = (new LinkedHashSet<>(proposals)); + List<IContextInformation> result = new ArrayList<>(); for (ICompletionProposal proposal : proposals) { IContextInformation contextInformation = proposal.getContextInformation(); if (contextInformation != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java index bec6504b00a..330a904f621 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java @@ -153,7 +153,7 @@ public class CCorrectionAssistant extends QuickAssistAssistant { // Let superclass deal with this return super.showPossibleQuickAssists(); - ArrayList<Annotation> resultingAnnotations = new ArrayList<Annotation>(20); + ArrayList<Annotation> resultingAnnotations = new ArrayList<>(20); try { Point selectedRange = fViewer.getSelectedRange(); int currOffset = selectedRange.x; @@ -205,8 +205,8 @@ public class CCorrectionAssistant extends QuickAssistAssistant { int rangeStart = lineInfo.getOffset(); int rangeEnd = rangeStart + lineInfo.getLength(); - ArrayList<Annotation> allAnnotations = new ArrayList<Annotation>(); - ArrayList<Position> allPositions = new ArrayList<Position>(); + ArrayList<Annotation> allAnnotations = new ArrayList<>(); + ArrayList<Position> allPositions = new ArrayList<>(); int bestOffset = Integer.MAX_VALUE; while (iter.hasNext()) { Annotation annot = (Annotation) iter.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java index 09a058afb0f..d47a00021eb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java @@ -64,7 +64,7 @@ public class CCorrectionProcessor implements org.eclipse.jface.text.quickassist. boolean testMarkerTypes) { IConfigurationElement[] elements = Platform.getExtensionRegistry() .getConfigurationElementsFor(CUIPlugin.PLUGIN_ID, contributionId); - ArrayList<ContributedProcessorDescriptor> res = new ArrayList<ContributedProcessorDescriptor>(elements.length); + ArrayList<ContributedProcessorDescriptor> res = new ArrayList<>(elements.length); for (int i = 0; i < elements.length; i++) { ContributedProcessorDescriptor desc = new ContributedProcessorDescriptor(elements[i], testMarkerTypes); @@ -208,7 +208,7 @@ public class CCorrectionProcessor implements org.eclipse.jface.text.quickassist. ICCompletionProposal[] res = null; if (model != null && annotations != null) { - ArrayList<ICCompletionProposal> proposals = new ArrayList<ICCompletionProposal>(10); + ArrayList<ICCompletionProposal> proposals = new ArrayList<>(10); IStatus status = collectProposals(context, model, annotations, true, !fAssistant.isUpdatedOffset(), proposals); res = proposals.toArray(new ICCompletionProposal[proposals.size()]); @@ -230,7 +230,7 @@ public class CCorrectionProcessor implements org.eclipse.jface.text.quickassist. public static IStatus collectProposals(CorrectionContext context, IAnnotationModel model, Annotation[] annotations, boolean addQuickFixes, boolean addQuickAssists, Collection<ICCompletionProposal> proposals) { - ArrayList<ProblemLocation> problems = new ArrayList<ProblemLocation>(); + ArrayList<ProblemLocation> problems = new ArrayList<>(); // collect problem locations and corrections from marker annotations for (int i = 0; i < annotations.length; i++) { @@ -461,13 +461,13 @@ public class CCorrectionProcessor implements org.eclipse.jface.text.quickassist. if (processor.canHandleMarkerType(curr.getMarkerType())) { if (!allHandled) { // first handled problem if (res == null) { - res = new ArrayList<IProblemLocation>(locations.length - i); + res = new ArrayList<>(locations.length - i); } res.add(curr); } } else if (allHandled) { if (i > 0) { // first non handled problem - res = new ArrayList<IProblemLocation>(locations.length - i); + res = new ArrayList<>(locations.length - i); for (int k = 0; k < i; k++) { res.add(locations[k]); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java index 26be1a8fbeb..b324e6f20bf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java @@ -56,7 +56,7 @@ public final class ContributedProcessorDescriptor { } private Set<String> getHandledMarkerTypes(IConfigurationElement element) { - HashSet<String> map = new HashSet<String>(7); + HashSet<String> map = new HashSet<>(7); IConfigurationElement[] children = element.getChildren(HANDLED_MARKER_TYPES); for (IConfigurationElement element2 : children) { IConfigurationElement[] types = element2.getChildren(MARKER_TYPE); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandHandler.java index 29c2c4d133c..0e3b8f8419c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandHandler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandHandler.java @@ -102,7 +102,7 @@ public class CorrectionCommandHandler extends AbstractHandler { private ICompletionProposal findCorrection(String id, boolean isAssist, ITextSelection selection, ITranslationUnit tu, IAnnotationModel model) { CorrectionContext context = new CorrectionContext(tu, selection.getOffset(), selection.getLength()); - Collection<ICCompletionProposal> proposals = new ArrayList<ICCompletionProposal>(10); + Collection<ICCompletionProposal> proposals = new ArrayList<>(10); if (isAssist) { if (id.equals(LinkedNamesAssistProposal.ASSIST_ID)) { return getLocalRenameProposal(context); // shortcut for local rename @@ -129,7 +129,7 @@ public class CorrectionCommandHandler extends AbstractHandler { } private Annotation[] getAnnotations(int offset, boolean goToClosest) throws BadLocationException { - ArrayList<Annotation> resultingAnnotations = new ArrayList<Annotation>(); + ArrayList<Annotation> resultingAnnotations = new ArrayList<>(); CCorrectionAssistant.collectQuickFixableAnnotations(fEditor, offset, goToClosest, resultingAnnotations); return resultingAnnotations.toArray(new Annotation[resultingAnnotations.size()]); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandInstaller.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandInstaller.java index ec7361a3e7d..a57eb6a374c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandInstaller.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CorrectionCommandInstaller.java @@ -56,7 +56,7 @@ public class CorrectionCommandInstaller { if (fCorrectionHandlerActivations != null) { CUIPlugin.logError("Correction handler activations not released"); //$NON-NLS-1$ } - fCorrectionHandlerActivations = new ArrayList<IHandlerActivation>(); + fCorrectionHandlerActivations = new ArrayList<>(); @SuppressWarnings("unchecked") Collection<String> definedCommandIds = commandService.getDefinedCommandIds(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/QuickAssistProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/QuickAssistProcessor.java index d2c3605c556..972b39fc6a0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/QuickAssistProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/QuickAssistProcessor.java @@ -76,7 +76,7 @@ public class QuickAssistProcessor implements IQuickAssistProcessor { @Override public ICCompletionProposal[] getAssists(final IInvocationContext context, final IProblemLocation[] problemLocations) throws CoreException { - final ArrayList<ICCompletionProposal> proposals = new ArrayList<ICCompletionProposal>(); + final ArrayList<ICCompletionProposal> proposals = new ArrayList<>(); ASTProvider.getASTProvider().runOnAST(context.getTranslationUnit(), ASTProvider.WAIT_ACTIVE_ONLY, new NullProgressMonitor(), new ASTRunnable() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/DocCommentOwnerManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/DocCommentOwnerManager.java index 021e5a921d1..4919f6ca576 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/DocCommentOwnerManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/DocCommentOwnerManager.java @@ -69,12 +69,12 @@ public class DocCommentOwnerManager { private Map<String, IDocCommentOwner> fOwners; private IDocCommentOwner fWorkspaceOwner; - private Map<IProject, ProjectMap> prj2map = new HashMap<IProject, ProjectMap>(); + private Map<IProject, ProjectMap> prj2map = new HashMap<>(); private static List<IDocCommentOwnershipListener> fListeners; private DocCommentOwnerManager() { fOwners = getCommentOwnerExtensions(); - fListeners = new ArrayList<IDocCommentOwnershipListener>(); + fListeners = new ArrayList<>(); Preferences defaultPrefs = DefaultScope.INSTANCE.getNode(QUALIFIER).node(WORKSPACE_DOC_TOOL_NODE); Preferences prefs = InstanceScope.INSTANCE.getNode(QUALIFIER).node(WORKSPACE_DOC_TOOL_NODE); @@ -227,7 +227,7 @@ public class DocCommentOwnerManager { * via the DocCommentOwner extension point */ private static Map<String, IDocCommentOwner> getCommentOwnerExtensions() { - Map<String, IDocCommentOwner> result = new HashMap<String, IDocCommentOwner>(); + Map<String, IDocCommentOwner> result = new HashMap<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint indexProviders = registry.getExtensionPoint(CUIPlugin.ID_COMMENT_OWNER); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/EditorReopener.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/EditorReopener.java index e68a3af1e6e..f8b1eee67a5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/EditorReopener.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/EditorReopener.java @@ -97,7 +97,7 @@ public class EditorReopener implements IDocCommentOwnershipListener { * This could be smarter in determining smaller sets of editors to re-open */ private IEditorPart[] getEditorsToRepon(IWorkbenchWindow window, IResource resource) { - List<IEditorPart> needReopening = new ArrayList<IEditorPart>(); + List<IEditorPart> needReopening = new ArrayList<>(); if (window.getActivePage() != null) { IEditorReference[] es = window.getActivePage().getEditorReferences(); for (int i = 0; i < es.length; i++) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java index 5949cf86e9e..3cb15089465 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java @@ -61,7 +61,7 @@ class ProjectMap { fMap = load(project); } catch (CoreException ce) { CUIPlugin.log(ce); - fMap = new HashMap<IPath, String>(); + fMap = new HashMap<>(); } fProject = project; } @@ -116,7 +116,7 @@ class ProjectMap { } private static Map<IPath, String> load(IProject project) throws CoreException { - Map<IPath, String> result = new HashMap<IPath, String>(); + Map<IPath, String> result = new HashMap<>(); ICProjectDescription pd = CCorePlugin.getDefault().getProjectDescription(project, false); if (pd != null) { ICStorageElement element = pd.getStorage(ATTRVAL_STORAGEID, false); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderRegistry.java index a1b2912af25..c90bcddd39a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderRegistry.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderRegistry.java @@ -105,7 +105,7 @@ public class CFoldingStructureProviderRegistry { */ public void reloadExtensions() { IExtensionRegistry registry = Platform.getExtensionRegistry(); - Map<String, CFoldingStructureProviderDescriptor> map = new HashMap<String, CFoldingStructureProviderDescriptor>(); + Map<String, CFoldingStructureProviderDescriptor> map = new HashMap<>(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(CUIPlugin.getPluginId(), EXTENSION_POINT); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingPreferenceBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingPreferenceBlock.java index 1a2c0194442..c2de9c7071e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingPreferenceBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingPreferenceBlock.java @@ -44,7 +44,7 @@ public class DefaultCFoldingPreferenceBlock implements ICFoldingPreferenceBlock private IPreferenceStore fStore; protected OverlayPreferenceStore fOverlayStore; private OverlayKey[] fKeys; - protected Map<Button, String> fCheckBoxes = new HashMap<Button, String>(); + protected Map<Button, String> fCheckBoxes = new HashMap<>(); private SelectionListener fCheckBoxListener = new SelectionListener() { @Override @@ -71,7 +71,7 @@ public class DefaultCFoldingPreferenceBlock implements ICFoldingPreferenceBlock } private OverlayKey[] createKeys() { - ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); + ArrayList<OverlayKey> overlayKeys = new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOLDING_MACROS)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingStructureProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingStructureProvider.java index bd0d41fabd3..8e826eb549a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingStructureProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/DefaultCFoldingStructureProvider.java @@ -124,7 +124,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi } private final Stack<StatementRegion> fStatements; int fLevel = 0; - Stack<String> fScope = new Stack<String>(); + Stack<String> fScope = new Stack<>(); private StatementVisitor(Stack<StatementRegion> statements) { fStatements = statements; @@ -372,7 +372,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi private ISourceReference fFirstType; private boolean fHasHeaderComment; - private LinkedHashMap<CProjectionAnnotation, Position> fMap = new LinkedHashMap<CProjectionAnnotation, Position>(); + private LinkedHashMap<CProjectionAnnotation, Position> fMap = new LinkedHashMap<>(); private IASTTranslationUnit fAST; FoldingStructureComputationContext(IDocument document, ProjectionAnnotationModel model, @@ -1079,9 +1079,9 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi fSelectionListener = null; } - Map<CProjectionAnnotation, Position> additions = new HashMap<CProjectionAnnotation, Position>(); - List<CProjectionAnnotation> deletions = new ArrayList<CProjectionAnnotation>(); - List<CProjectionAnnotation> updates = new ArrayList<CProjectionAnnotation>(); + Map<CProjectionAnnotation, Position> additions = new HashMap<>(); + List<CProjectionAnnotation> deletions = new ArrayList<>(); + List<CProjectionAnnotation> updates = new ArrayList<>(); computeFoldingStructure(ctx); Map<CProjectionAnnotation, Position> updated = ctx.fMap; @@ -1183,8 +1183,8 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) return; - List<CProjectionAnnotation> newDeletions = new ArrayList<CProjectionAnnotation>(); - List<CProjectionAnnotation> newChanges = new ArrayList<CProjectionAnnotation>(); + List<CProjectionAnnotation> newDeletions = new ArrayList<>(); + List<CProjectionAnnotation> newChanges = new ArrayList<>(); Iterator<CProjectionAnnotation> deletionIterator = deletions.iterator(); while (deletionIterator.hasNext()) { @@ -1277,7 +1277,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi boolean includeBranches = fPreprocessorBranchFoldingEnabled && ctx.fAST != null; boolean includeStmts = fStatementsFoldingEnabled && ctx.fAST != null; boolean includeCModel = ctx.fAST != null || !(fPreprocessorBranchFoldingEnabled || fStatementsFoldingEnabled); - Map<Object, List<Tuple>> map = new HashMap<Object, List<Tuple>>(); + Map<Object, List<Tuple>> map = new HashMap<>(); ProjectionAnnotationModel model = ctx.getModel(); Iterator<?> e = model.getAnnotationIterator(); while (e.hasNext()) { @@ -1304,7 +1304,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi if (include || position.length < 5) { List<Tuple> list = map.get(cAnnotation.getElement()); if (list == null) { - list = new ArrayList<Tuple>(2); + list = new ArrayList<>(2); map.put(cAnnotation.getElement(), list); } list.add(new Tuple(cAnnotation, position)); @@ -1401,7 +1401,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi * @param ctx */ private void computeStatementFoldingStructure(IASTTranslationUnit ast, FoldingStructureComputationContext ctx) { - final Stack<StatementRegion> iral = new Stack<StatementRegion>(); + final Stack<StatementRegion> iral = new Stack<>(); ast.accept(new StatementVisitor(iral)); while (!iral.empty()) { StatementRegion mr = iral.pop(); @@ -1446,8 +1446,8 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi * @param ctx */ private void computePreprocessorFoldingStructure(IASTTranslationUnit ast, FoldingStructureComputationContext ctx) { - List<Branch> branches = new ArrayList<Branch>(); - Stack<Branch> branchStack = new Stack<Branch>(); + List<Branch> branches = new ArrayList<>(); + Stack<Branch> branchStack = new Stack<>(); IASTPreprocessorStatement[] preprocStmts = ast.getAllPreprocessorStatements(); @@ -1512,7 +1512,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi branches.add(branch); } - Map<String, Counter> keys = new HashMap<String, Counter>(branches.size()); + Map<String, Counter> keys = new HashMap<>(branches.size()); for (Branch branch : branches) { IRegion aligned = alignRegion(branch, ctx, branch.fInclusive); if (aligned != null) { @@ -1564,7 +1564,7 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi int startLine = -1; int endLine = -1; boolean startLineIsDocComment = false; - List<Tuple> comments = new ArrayList<Tuple>(); + List<Tuple> comments = new ArrayList<>(); ModifiableRegion commentRange = new ModifiableRegion(); for (ITypedRegion partition : partitions) { boolean singleLine = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/CSpellingProblem.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/CSpellingProblem.java index eaf44cb24fc..dc30c0ca9e0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/CSpellingProblem.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/CSpellingProblem.java @@ -123,7 +123,7 @@ public class CSpellingProblem extends SpellingProblem { result = new ICCompletionProposal[] { new ChangeCaseProposal(arguments, getOffset(), getLength(), context, engine.getLocale()) }; } else { - proposals = new ArrayList<RankedWordProposal>(checker.getProposals(arguments[0], sentence)); + proposals = new ArrayList<>(checker.getProposals(arguments[0], sentence)); size = proposals.size(); if (threshold > 0 && size > threshold) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java index d0f6c1c38b7..765ae321621 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java @@ -92,7 +92,7 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe return fgLocalesWithInstalledDictionaries = Collections.emptySet(); } - fgLocalesWithInstalledDictionaries = new HashSet<Locale>(); + fgLocalesWithInstalledDictionaries = new HashSet<>(); int fileNameCount = fileNames.length; for (int i = 0; i < fileNameCount; i++) { String fileName = fileNames[i]; @@ -215,13 +215,13 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe } /** The registered locale insensitive dictionaries */ - private Set<ISpellDictionary> fGlobalDictionaries = new HashSet<ISpellDictionary>(); + private Set<ISpellDictionary> fGlobalDictionaries = new HashSet<>(); /** The spell checker for fLocale */ private ISpellChecker fChecker = null; /** The registered locale sensitive dictionaries */ - private Map<Locale, ISpellDictionary> fLocaleDictionaries = new HashMap<Locale, ISpellDictionary>(); + private Map<Locale, ISpellDictionary> fLocaleDictionaries = new HashMap<>(); /** The user dictionary */ private ISpellDictionary fUserDictionary = null; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckIterator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckIterator.java index 7a399bbb04d..52ed410dbc9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckIterator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckIterator.java @@ -48,7 +48,7 @@ public class SpellCheckIterator implements ISpellCheckIterator { protected int fPrevious = 0; /** The sentence breaks */ - private final LinkedList<Integer> fSentenceBreaks = new LinkedList<Integer>(); + private final LinkedList<Integer> fSentenceBreaks = new LinkedList<>(); /** Does the current word start a sentence? */ private boolean fStartsSentence = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellingEngineDispatcher.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellingEngineDispatcher.java index 822659eb4e7..4b128941a58 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellingEngineDispatcher.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellingEngineDispatcher.java @@ -52,7 +52,7 @@ public class SpellingEngineDispatcher implements ISpellingEngine { .getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE); /** Available spelling engines by content type */ - private Map<IContentType, SpellingEngine> fEngines = new HashMap<IContentType, SpellingEngine>(); + private Map<IContentType, SpellingEngine> fEngines = new HashMap<>(); private ISpellingEngine defaultEngine; /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordCompletionProposalComputer.java index 0755e2613f2..913e1dc2402 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordCompletionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordCompletionProposalComputer.java @@ -70,9 +70,9 @@ public final class WordCompletionProposalComputer implements ICompletionProposal final ISpellChecker checker = engine.getSpellChecker(); if (checker != null) { - final List<RankedWordProposal> proposals = new ArrayList<RankedWordProposal>( + final List<RankedWordProposal> proposals = new ArrayList<>( checker.getProposals(candidate, Character.isUpperCase(candidate.charAt(0)))); - final List<ICompletionProposal> result = new ArrayList<ICompletionProposal>(proposals.size()); + final List<ICompletionProposal> result = new ArrayList<>(proposals.size()); for (Object element : proposals) { RankedWordProposal word = (RankedWordProposal) element; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordQuickFixProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordQuickFixProcessor.java index e116029138d..50a5685bc48 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordQuickFixProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/WordQuickFixProcessor.java @@ -77,7 +77,7 @@ public class WordQuickFixProcessor implements IQuickFixProcessor { result = new ICCompletionProposal[] { new ChangeCaseProposal(arguments, location.getOffset(), location.getLength(), context, engine.getLocale()) }; } else { - proposals = new ArrayList<RankedWordProposal>(checker.getProposals(arguments[0], sentence)); + proposals = new ArrayList<>(checker.getProposals(arguments[0], sentence)); size = proposals.size(); if (threshold > 0 && size > threshold) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java index acc7adccf03..5fb4cc09ce3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/AbstractSpellDictionary.java @@ -62,7 +62,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary { private IPhoneticDistanceAlgorithm fDistanceAlgorithm = new DefaultPhoneticDistanceAlgorithm(); /** The mapping from phonetic hashes to word lists */ - private final Map<String, Serializable> fHashBuckets = new HashMap<String, Serializable>(HASH_CAPACITY); + private final Map<String, Serializable> fHashBuckets = new HashMap<>(HASH_CAPACITY); /** The phonetic hash provider */ private IPhoneticHashProvider fHashProvider = new DefaultPhoneticHashProvider(); @@ -110,7 +110,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary { String hash = null; final StringBuilder buffer = new StringBuilder(BUFFER_CAPACITY); - final HashSet<RankedWordProposal> result = new HashSet<RankedWordProposal>(BUCKET_CAPACITY * hashs.size()); + final HashSet<RankedWordProposal> result = new HashSet<>(BUCKET_CAPACITY * hashs.size()); for (int index = 0; index < hashs.size(); index++) { @@ -190,7 +190,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary { @SuppressWarnings("unchecked") final ArrayList<String> candidateList = (ArrayList<String>) candidates; - final ArrayList<RankedWordProposal> matches = new ArrayList<RankedWordProposal>(candidateList.size()); + final ArrayList<RankedWordProposal> matches = new ArrayList<>(candidateList.size()); for (int index = 0; index < candidateList.size(); index++) { String candidate = candidateList.get(index); @@ -265,7 +265,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary { final String hash = fHashProvider.getHash(word); final char[] mutators = fHashProvider.getMutators(); - final ArrayList<String> neighborhood = new ArrayList<String>((word.length() + 1) * (mutators.length + 2)); + final ArrayList<String> neighborhood = new ArrayList<>((word.length() + 1) * (mutators.length + 2)); neighborhood.add(hash); final Set<RankedWordProposal> candidates = getCandidates(word, sentence, neighborhood); @@ -383,7 +383,7 @@ public abstract class AbstractSpellDictionary implements ISpellDictionary { final ArrayList<Object> bucket2 = (ArrayList) bucket; bucket2.add(word); } else { - ArrayList<Object> list = new ArrayList<Object>(BUCKET_CAPACITY); + ArrayList<Object> list = new ArrayList<>(BUCKET_CAPACITY); list.add(bucket); list.add(word); fHashBuckets.put(hash, list); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java index 07862f2b2e6..d48012a2cae 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/engine/DefaultSpellChecker.java @@ -174,7 +174,7 @@ public class DefaultSpellChecker implements ISpellChecker { // the modifying methods add/checkWord (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { - copy = new HashSet<ISpellDictionary>(fDictionaries); + copy = new HashSet<>(fDictionaries); } ISpellDictionary dictionary = null; @@ -194,7 +194,7 @@ public class DefaultSpellChecker implements ISpellChecker { // synchronizing is necessary as this is a write access Set<ISpellDictionary> copy; synchronized (fDictionaries) { - copy = new HashSet<ISpellDictionary>(fDictionaries); + copy = new HashSet<>(fDictionaries); } final String addable = word.toLowerCase(); @@ -272,7 +272,7 @@ public class DefaultSpellChecker implements ISpellChecker { // synchronizing is necessary as this is called from execute Set<ISpellEventListener> copy; synchronized (fListeners) { - copy = new HashSet<ISpellEventListener>(fListeners); + copy = new HashSet<>(fListeners); } for (ISpellEventListener spellEventListener : copy) { spellEventListener.handle(event); @@ -289,11 +289,11 @@ public class DefaultSpellChecker implements ISpellChecker { // the modifying methods add/removeDictionary (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { - copy = new HashSet<ISpellDictionary>(fDictionaries); + copy = new HashSet<>(fDictionaries); } ISpellDictionary dictionary = null; - final HashSet<RankedWordProposal> proposals = new HashSet<RankedWordProposal>(); + final HashSet<RankedWordProposal> proposals = new HashSet<>(); for (final Iterator<ISpellDictionary> iterator = copy.iterator(); iterator.hasNext();) { dictionary = iterator.next(); @@ -319,7 +319,7 @@ public class DefaultSpellChecker implements ISpellChecker { // synchronizing is necessary as this is called from execute Set<ISpellDictionary> copy; synchronized (fDictionaries) { - copy = new HashSet<ISpellDictionary>(fDictionaries); + copy = new HashSet<>(fDictionaries); } if (fIgnored.contains(word.toLowerCase())) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java index 968e479546f..7721f48fbc3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java @@ -59,9 +59,9 @@ public class TemplateEngine { /** The context type. */ private final TemplateContextType fContextType; /** The result proposals. */ - private final ArrayList<ICompletionProposal> fProposals = new ArrayList<ICompletionProposal>(); + private final ArrayList<ICompletionProposal> fProposals = new ArrayList<>(); /** Positions created on the key documents to remove in reset. */ - private final Map<IDocument, Position> fPositions = new HashMap<IDocument, Position>(); + private final Map<IDocument, Position> fPositions = new HashMap<>(); /** Pattern to match the start of a line content */ private final Pattern fStartOfLineContentPattern = Pattern.compile("[^ \t]"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateVariableProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateVariableProcessor.java index 18684e39229..bbf956e0aaf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateVariableProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateVariableProcessor.java @@ -72,7 +72,7 @@ public class TemplateVariableProcessor implements IContentAssistProcessor { if (fContextType == null) return null; - List<TemplateVariableProposal> proposals = new ArrayList<TemplateVariableProposal>(); + List<TemplateVariableProposal> proposals = new ArrayList<>(); String text = viewer.getDocument().get(); int start = getStart(text, documentOffset); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java index 777d04c465b..4a45321a7a4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHistoryListAction.java @@ -71,7 +71,7 @@ public class THHistoryListAction extends Action { ILabelProvider labelProvider = new CUILabelProvider(THHistoryAction.LABEL_OPTIONS, CElementImageProvider.OVERLAY_ICONS); - fHistoryList = new ListDialogField<ICElement>(adapter, buttonLabels, labelProvider); + fHistoryList = new ListDialogField<>(adapter, buttonLabels, labelProvider); fHistoryList.setLabelText(Messages.THHistoryListAction_HistoryList_label); fHistoryList.setElements(Arrays.asList(historyEntries)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java index fbbe24e1c24..d3dae3d0133 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THLabelProvider.java @@ -41,7 +41,7 @@ public class THLabelProvider extends AppearanceAwareLabelProvider { private CUILabelProvider fCLabelProvider = new CUILabelProvider(LABEL_OPTIONS_SIMPLE, 0); private THHierarchyModel fModel; - private HashMap<String, Image> fCachedImages = new HashMap<String, Image>(); + private HashMap<String, Image> fCachedImages = new HashMap<>(); private Color fColorInactive; private boolean fMarkImplementers = true; private boolean fHideNonImplementers = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java index 05ef4a1e877..e3b1fcd4334 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java @@ -141,7 +141,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter { private boolean fShowsMessage = true; private int fCurrentViewOrientation = -1; private boolean fInComputeOrientation = false; - private ArrayList<ICElement> fHistoryEntries = new ArrayList<ICElement>(MAX_HISTORY_SIZE); + private ArrayList<ICElement> fHistoryEntries = new ArrayList<>(MAX_HISTORY_SIZE); private int fIgnoreSelectionChanges = 0; // widgets diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/AbstractResourceActionHandler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/AbstractResourceActionHandler.java index 9857ff16194..717b12897da 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/AbstractResourceActionHandler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/AbstractResourceActionHandler.java @@ -139,7 +139,7 @@ public abstract class AbstractResourceActionHandler extends AbstractHandler { } private static Collection<IResource> getSelectedResources(IStructuredSelection selection) { - Set<IResource> result = new LinkedHashSet<IResource>(); + Set<IResource> result = new LinkedHashSet<>(); for (Object obj : selection.toList()) { IResource resource = AdapterUtil.adapt(obj, IResource.class); if (resource != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CHelpDisplayContext.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CHelpDisplayContext.java index ca22190e2ec..84d07dc1452 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CHelpDisplayContext.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/CHelpDisplayContext.java @@ -70,7 +70,7 @@ public class CHelpDisplayContext implements IContext { public CHelpDisplayContext(IContext context, final ITextEditor editor, String selected) throws CoreException { - List<IHelpResource> helpResources = new ArrayList<IHelpResource>(); + List<IHelpResource> helpResources = new ArrayList<>(); ICHelpInvocationContext invocationContext = new ICHelpInvocationContext() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteIProblemMarkerAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteIProblemMarkerAction.java index f7a454ae26a..fd7d2d6d3e0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteIProblemMarkerAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteIProblemMarkerAction.java @@ -47,7 +47,7 @@ public class DeleteIProblemMarkerAction extends ActionDelegate implements IObjec } try { List<?> list = selection.toList(); - List<IMarker> listMarkers = new ArrayList<IMarker>(); + List<IMarker> listMarkers = new ArrayList<>(); Iterator<?> iterator = list.iterator(); while (iterator.hasNext()) { IMarker marker = (IMarker) iterator.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteTaskAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteTaskAction.java index ed81ed4d321..d9e4bedd86c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteTaskAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/DeleteTaskAction.java @@ -43,7 +43,7 @@ public class DeleteTaskAction extends ActionDelegate implements IObjectActionDel } try { List<?> list = selection.toList(); - List<IMarker> listMarkers = new ArrayList<IMarker>(); + List<IMarker> listMarkers = new ArrayList<>(); Iterator<?> iterator = list.iterator(); while (iterator.hasNext()) { IMarker marker = (IMarker) iterator.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java index 70076b62dc7..8dfa618e90a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ImageDescriptorRegistry.java @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Display; */ public class ImageDescriptorRegistry { - private HashMap<ImageDescriptor, Image> fRegistry = new HashMap<ImageDescriptor, Image>(10); + private HashMap<ImageDescriptor, Image> fRegistry = new HashMap<>(10); private Display fDisplay; /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemMarkerManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemMarkerManager.java index 241b56731ef..2c0c7899fb1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemMarkerManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemMarkerManager.java @@ -105,7 +105,7 @@ public class ProblemMarkerManager @Override public void resourceChanged(IResourceChangeEvent event) { - HashSet<IResource> changedElements = new HashSet<IResource>(); + HashSet<IResource> changedElements = new HashSet<>(); try { IResourceDelta delta = event.getDelta(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTableViewer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTableViewer.java index 7887c2fdbb9..81c7acfcd8e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTableViewer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTableViewer.java @@ -112,7 +112,7 @@ public class ProblemTableViewer extends TableViewer { Object[] changed = event.getElements(); if (changed != null && !fResourceToItemsMapper.isEmpty()) { - ArrayList<Object> others = new ArrayList<Object>(changed.length); + ArrayList<Object> others = new ArrayList<>(changed.length); for (int i = 0; i < changed.length; i++) { Object curr = changed[i]; if (curr instanceof IResource) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java index 724a7573380..ce5df2eb490 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ProblemTreeViewer.java @@ -111,7 +111,7 @@ public class ProblemTreeViewer extends TreeViewer { } Object[] changed = event.getElements(); if (changed != null && !fResourceToItemsMapper.isEmpty()) { - ArrayList<Object> others = new ArrayList<Object>(changed.length); + ArrayList<Object> others = new ArrayList<>(changed.length); for (int i = 0; i < changed.length; i++) { Object curr = changed[i]; if (curr instanceof IResource) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeContentManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeContentManager.java index 3e38e94f0e3..35a66dfdf24 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeContentManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeContentManager.java @@ -52,9 +52,9 @@ public class RemoteTreeContentManager { * Queue of parents to fetch children for, and * associated element collectors and deferred adapters. */ - private List<Object> fElementQueue = new ArrayList<Object>(); - private List<IElementCollector> fCollectors = new ArrayList<IElementCollector>(); - private List<IDeferredWorkbenchAdapter> fAdapaters = new ArrayList<IDeferredWorkbenchAdapter>(); + private List<Object> fElementQueue = new ArrayList<>(); + private List<IElementCollector> fCollectors = new ArrayList<>(); + private List<IDeferredWorkbenchAdapter> fAdapaters = new ArrayList<>(); /** * Fetching children is done in a single background job. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeViewer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeViewer.java index d5d879d3165..190aa898c4b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeViewer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/RemoteTreeViewer.java @@ -42,7 +42,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer { class ExpansionJob extends UIJob { private Object element; - private List<Object> parents = new ArrayList<Object>(); // top down + private List<Object> parents = new ArrayList<>(); // top down /** * Constucts a job to expand the given element. @@ -111,7 +111,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer { private IStructuredSelection selection; private Object first; - private List<Object> parents = new ArrayList<Object>(); // top down + private List<Object> parents = new ArrayList<>(); // top down /** * Constucts a job to select the given element. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java index 246f0372f37..8b789bec0cc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java @@ -45,8 +45,8 @@ public class ResourceToItemsMapper { private ContentViewer fContentViewer; public ResourceToItemsMapper(ContentViewer viewer) { - fResourceToItem = new HashMap<IResource, Object>(); - fReuseLists = new Stack<List<Item>>(); + fResourceToItem = new HashMap<>(); + fReuseLists = new Stack<>(); fContentViewer = viewer; } @@ -158,7 +158,7 @@ public class ResourceToItemsMapper { if (!fReuseLists.isEmpty()) { return fReuseLists.pop(); } - return new ArrayList<Item>(2); + return new ArrayList<>(2); } private void releaseList(List<Item> list) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StringMatcher.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StringMatcher.java index 272f5ea6887..84d453cf51b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StringMatcher.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/StringMatcher.java @@ -248,7 +248,7 @@ public class StringMatcher { } } - Vector<String> temp = new Vector<String>(); + Vector<String> temp = new Vector<>(); int pos = 0; StringBuilder buf = new StringBuilder(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/TableLayoutComposite.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/TableLayoutComposite.java index 4c2692ea3c9..fd5562fde5d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/TableLayoutComposite.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/TableLayoutComposite.java @@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.TableColumn; */ public class TableLayoutComposite extends Composite { - private List<ColumnLayoutData> columns = new ArrayList<ColumnLayoutData>(); + private List<ColumnLayoutData> columns = new ArrayList<>(); /** * Creates a new <code>TableLayoutComposite</code>. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AdaptingSelectionProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AdaptingSelectionProvider.java index 149cdd430c7..434d2677d4b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AdaptingSelectionProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AdaptingSelectionProvider.java @@ -47,7 +47,7 @@ public class AdaptingSelectionProvider implements ISelectionProvider, ISelection if (selection != null) { if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; - ArrayList<Object> adapted = new ArrayList<Object>(); + ArrayList<Object> adapted = new ArrayList<>(); for (Iterator<?> iter = ss.iterator(); iter.hasNext();) { Object elem = adaptElem(iter.next()); if (elem != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java index 13eb49e83c9..9094dc48069 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AsyncTreeContentProvider.java @@ -45,10 +45,10 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider { protected static final Object[] NO_CHILDREN = new Object[0]; private Object fInput; - private HashMap<Object, Object[]> fChildNodes = new HashMap<Object, Object[]>(); - private HashSet<Object> fHighPriorityTasks = new HashSet<Object>(); - private HashSet<Object> fLowPriorityTasks = new HashSet<Object>(); - private HashMap<Object, Object[]> fViewUpdates = new HashMap<Object, Object[]>(); + private HashMap<Object, Object[]> fChildNodes = new HashMap<>(); + private HashSet<Object> fHighPriorityTasks = new HashSet<>(); + private HashSet<Object> fLowPriorityTasks = new HashSet<>(); + private HashMap<Object, Object[]> fViewUpdates = new HashMap<>(); private int fViewUpdateDelta; private Job fJob; private Display fDisplay; @@ -137,7 +137,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider { */ public void recompute() { if (getInput() != null) { - fAutoexpand = new HashSet<Object>(); + fAutoexpand = new HashSet<>(); fAutoexpand.addAll(Arrays.asList(fTreeViewer.getVisibleExpandedElements())); fAutoSelect = null; fAutoSelect = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement(); @@ -260,7 +260,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider { return; } updates = fViewUpdates; - fViewUpdates = new HashMap<Object, Object[]>(); + fViewUpdates = new HashMap<>(); } fChildNodes.putAll(updates); if (fTreeViewer instanceof ExtendedTreeViewer) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CDTContextActivator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CDTContextActivator.java index e5c2b610a0e..cd03c30e052 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CDTContextActivator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CDTContextActivator.java @@ -50,9 +50,9 @@ import org.eclipse.ui.views.contentoutline.ContentOutline; public class CDTContextActivator implements IWindowListener, IPartListener2 { private static CDTContextActivator sInstance = new CDTContextActivator(); - private Map<ContentOutline, IContextActivation> fActivationPerOutline = new HashMap<ContentOutline, IContextActivation>(); - private Map<CommonNavigator, SelectionListener> fActivationPerNavigator = new HashMap<CommonNavigator, SelectionListener>(); - private Collection<IWorkbenchWindow> fWindows = new HashSet<IWorkbenchWindow>(); + private Map<ContentOutline, IContextActivation> fActivationPerOutline = new HashMap<>(); + private Map<CommonNavigator, SelectionListener> fActivationPerNavigator = new HashMap<>(); + private Collection<IWorkbenchWindow> fWindows = new HashSet<>(); private CDTContextActivator() { } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CUILabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CUILabelProvider.java index 1badfde7f18..5c36b407178 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CUILabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CUILabelProvider.java @@ -68,7 +68,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider, I */ public void addLabelDecorator(ILabelDecorator decorator) { if (fLabelDecorators == null) { - fLabelDecorators = new ArrayList<ILabelDecorator>(2); + fLabelDecorators = new ArrayList<>(2); } fLabelDecorators.add(decorator); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java index 08bd86e56d6..250e5689855 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ColoredViewersManager.java @@ -36,7 +36,7 @@ public class ColoredViewersManager implements IPropertyChangeListener { private Set<ColoringLabelProvider> fManagedLabelProviders; public ColoredViewersManager() { - fManagedLabelProviders = new HashSet<ColoringLabelProvider>(); + fManagedLabelProviders = new HashSet<>(); } public void installColoredLabels(ColoringLabelProvider labelProvider) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java index 5da71f678f1..a100cadd85b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesCache.java @@ -63,7 +63,7 @@ class IndexedFilesCache implements IIndexChangeListener, IIndexerStateListener, return INSTANCE; } - private final HashMap<String, Set<Integer>> fIndexedFiles = new HashMap<String, Set<Integer>>(); + private final HashMap<String, Set<Integer>> fIndexedFiles = new HashMap<>(); private boolean fIsDirty = false; private boolean fActive = false; @@ -125,7 +125,7 @@ class IndexedFilesCache implements IIndexChangeListener, IIndexerStateListener, final protected void initialize(ICProject prj) throws CoreException, InterruptedException { IIndex index = CCorePlugin.getIndexManager().getIndex(prj); - List<IIndexFileLocation> list = new ArrayList<IIndexFileLocation>(); + List<IIndexFileLocation> list = new ArrayList<>(); index.acquireReadLock(); try { IIndexFile[] files = index.getAllFiles(); @@ -139,7 +139,7 @@ class IndexedFilesCache implements IIndexChangeListener, IIndexerStateListener, synchronized (fIndexedFiles) { Set<Integer> cache = fIndexedFiles.get(prjName); if (cache == null) { - cache = new HashSet<Integer>(); + cache = new HashSet<>(); fIndexedFiles.put(prjName, cache); } else { if (!cache.isEmpty()) { @@ -185,7 +185,7 @@ class IndexedFilesCache implements IIndexChangeListener, IIndexerStateListener, if (!(filesCleared.isEmpty() && filesWritten.isEmpty())) { Set<Integer> cache = fIndexedFiles.get(prjName); if (cache == null) { - cache = new HashSet<Integer>(); + cache = new HashSet<>(); fIndexedFiles.put(prjName, cache); } for (IIndexFileLocation ifl : filesCleared) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java index 9c90653bcd3..146229becc3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java @@ -120,7 +120,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe private IProblemChangedListener fProblemChangedListener; private ListenerList<ILabelProviderListener> fListeners; - private Map<MarkersCacheKey, IMarker[]> fMarkersCache = new HashMap<MarkersCacheKey, IMarker[]>(); + private Map<MarkersCacheKey, IMarker[]> fMarkersCache = new HashMap<>(); /** * Creates a new <code>ProblemsLabelDecorator</code>. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java index 01459df915c..645ba51dd72 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java @@ -110,7 +110,7 @@ public final class ProjectTemplateStore { if (fProjectStore != null) { fProjectStore.load(); - Set<String> datas = new HashSet<String>(); + Set<String> datas = new HashSet<>(); TemplatePersistenceData[] data = fProjectStore.getTemplateData(false); for (TemplatePersistenceData element : data) { String id = element.getId(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java index 0bcab5882c5..91552f75bbd 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java @@ -194,7 +194,7 @@ public class SelectionListenerWithASTManager { private Map<ITextEditor, PartListenerGroup> fListenerGroups; private SelectionListenerWithASTManager() { - fListenerGroups = new HashMap<ITextEditor, PartListenerGroup>(); + fListenerGroups = new HashMap<>(); } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionProviderMediator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionProviderMediator.java index 706a45da22c..239f60ad2c1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionProviderMediator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionProviderMediator.java @@ -29,7 +29,7 @@ import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.widgets.Control; public class SelectionProviderMediator implements ISelectionProvider { - private Map<Control, ISelectionProvider> fProviders = new HashMap<Control, ISelectionProvider>(); + private Map<Control, ISelectionProvider> fProviders = new HashMap<>(); private ISelectionProvider fActiveProvider = null; private ISelectionChangedListener fSelectionChangedListener; private FocusListener fFocusListener; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/StorageLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/StorageLabelProvider.java index 79d74e8e82b..f9c78dd80a3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/StorageLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/StorageLabelProvider.java @@ -33,7 +33,7 @@ import org.eclipse.ui.PlatformUI; public class StorageLabelProvider extends LabelProvider { private IEditorRegistry fEditorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); - private Map<String, Image> fJarImageMap = new HashMap<String, Image>(10); + private Map<String, Image> fJarImageMap = new HashMap<>(10); private Image fDefaultImage; /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilter.java index 9194937ba8e..f38b9683c3d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilter.java @@ -81,7 +81,7 @@ public class WorkingSetFilter { fResourceFilter = null; } else { IAdaptable[] input = workingSetFilter.getElements(); - fResourceFilter = new HashMap<IPath, Object>(); + fResourceFilter = new HashMap<>(); for (int i = 0; i < input.length; i++) { IAdaptable adaptable = input[i]; IResource res = adaptable.getAdapter(IResource.class); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilterUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilterUI.java index 98b832dd589..59ff57c6fbc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilterUI.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/WorkingSetFilterUI.java @@ -169,7 +169,7 @@ public abstract class WorkingSetFilterUI { public List<String> getRecent() { IWorkingSet[] workingSets = fWSManager.getRecentWorkingSets(); - ArrayList<String> result = new ArrayList<String>(workingSets.length); + ArrayList<String> result = new ArrayList<>(workingSets.length); for (int i = 0; i < workingSets.length; i++) { result.add(workingSets[i].getName()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/CWizardRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/CWizardRegistry.java index 1284b7bdc81..f1211bba560 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/CWizardRegistry.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/CWizardRegistry.java @@ -97,7 +97,7 @@ public class CWizardRegistry { * @return an array of IConfigurationElement */ public static IConfigurationElement[] getProjectWizardElements() { - List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>(); + List<IConfigurationElement> elemList = new ArrayList<>(); IConfigurationElement[] elements = getAllWizardElements(); for (int i = 0; i < elements.length; ++i) { IConfigurationElement element = elements[i]; @@ -164,7 +164,7 @@ public class CWizardRegistry { * @return an array of IConfigurationElement */ public static IConfigurationElement[] getTypeWizardElements() { - List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>(); + List<IConfigurationElement> elemList = new ArrayList<>(); IConfigurationElement[] elements = getAllWizardElements(); for (int i = 0; i < elements.length; ++i) { IConfigurationElement element = elements[i]; @@ -224,7 +224,7 @@ public class CWizardRegistry { * @return an array of IConfigurationElement */ public static IConfigurationElement[] getFileWizardElements() { - List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>(); + List<IConfigurationElement> elemList = new ArrayList<>(); IConfigurationElement[] elements = getAllWizardElements(); for (int i = 0; i < elements.length; ++i) { IConfigurationElement element = elements[i]; @@ -284,7 +284,7 @@ public class CWizardRegistry { * @return an array of IConfigurationElement */ public static IConfigurationElement[] getFolderWizardElements() { - List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>(); + List<IConfigurationElement> elemList = new ArrayList<>(); IConfigurationElement[] elements = getAllWizardElements(); for (int i = 0; i < elements.length; ++i) { IConfigurationElement element = elements[i]; @@ -318,7 +318,7 @@ public class CWizardRegistry { } private static String[] getWizardIDs(IConfigurationElement[] elements) { - List<String> idList = new ArrayList<String>(); + List<String> idList = new ArrayList<>(); // add C wizards first for (int i = 0; i < elements.length; ++i) { @@ -345,8 +345,8 @@ public class CWizardRegistry { } private static IAction[] createActions(IConfigurationElement[] elements) { - List<String> idList = new ArrayList<String>(); - List<IAction> actionList = new ArrayList<IAction>(); + List<String> idList = new ArrayList<>(); + List<IAction> actionList = new ArrayList<>(); // add C wizards first for (int i = 0; i < elements.length; ++i) { @@ -411,7 +411,7 @@ public class CWizardRegistry { * @return an array of IConfigurationElement */ public static IConfigurationElement[] getAllWizardElements() { - List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>(); + List<IConfigurationElement> elemList = new ArrayList<>(); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW); if (extensionPoint != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewBaseClassSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewBaseClassSelectionDialog.java index 4c2ffe403de..fa641c0f69b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewBaseClassSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewBaseClassSelectionDialog.java @@ -48,8 +48,8 @@ public class NewBaseClassSelectionDialog extends ElementSelectionDialog { setDialogSettings(DIALOG_SETTINGS); setVisibleTypes(VISIBLE_TYPES); setStatusLineAboveButtons(true); - fTypeList = new ArrayList<ITypeInfo>(); - fTypeListeners = new ArrayList<ITypeSelectionListener>(); + fTypeList = new ArrayList<>(); + fTypeListeners = new ArrayList<>(); } public void addListener(ITypeSelectionListener listener) { @@ -63,7 +63,7 @@ public class NewBaseClassSelectionDialog extends ElementSelectionDialog { private void notifyTypeAddedListeners(ITypeInfo type) { // first copy listeners in case one calls removeListener - List<ITypeSelectionListener> list = new ArrayList<ITypeSelectionListener>(fTypeListeners); + List<ITypeSelectionListener> list = new ArrayList<>(fTypeListeners); for (Iterator<ITypeSelectionListener> i = list.iterator(); i.hasNext();) { ITypeSelectionListener listener = i.next(); listener.typeAdded(type); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java index d8d840bc140..b5bbb7e4933 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java @@ -329,7 +329,7 @@ public class NewClassCodeGenerator { */ private String formatSource(String content, ITranslationUnit tu) throws CModelException { String lineDelimiter = StubUtility.getLineDelimiterUsed(tu); - Map<String, Object> options = new HashMap<String, Object>(tu.getCProject().getOptions(true)); + Map<String, Object> options = new HashMap<>(tu.getCProject().getOptions(true)); options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu); TextEdit edit = CodeFormatterUtil.format(CodeFormatter.K_TRANSLATION_UNIT, content, 0, lineDelimiter, options); if (edit != null) { @@ -622,7 +622,7 @@ public class NewClassCodeGenerator { } private List<IMethodStub> getStubs(ASTAccessVisibility access, boolean skipInline) { - List<IMethodStub> list = new ArrayList<IMethodStub>(); + List<IMethodStub> list = new ArrayList<>(); if (fMethodStubs != null) { for (int i = 0; i < fMethodStubs.length; ++i) { IMethodStub stub = fMethodStubs[i]; @@ -689,7 +689,7 @@ public class NewClassCodeGenerator { } InclusionContext inclusionContext = new InclusionContext(headerTU); - List<StyledInclude> includes = new ArrayList<StyledInclude>(); + List<StyledInclude> includes = new ArrayList<>(); for (IPath baseClassLocation : baseClassPaths) { IncludeInfo includeInfo = inclusionContext.getIncludeForHeaderFile(baseClassLocation); if (includeInfo != null) { @@ -739,8 +739,8 @@ public class NewClassCodeGenerator { //TODO prefs option whether to add to project or parent source folder? IPath addToResourcePath = cProject.getPath(); try { - List<IPathEntry> pathEntryList = new ArrayList<IPathEntry>(); - List<IPathEntry> checkEntryList = new ArrayList<IPathEntry>(); + List<IPathEntry> pathEntryList = new ArrayList<>(); + List<IPathEntry> checkEntryList = new ArrayList<>(); IPathEntry[] checkEntries = cProject.getResolvedPathEntries(); IPathEntry[] pathEntries = cProject.getRawPathEntries(); @@ -787,7 +787,7 @@ public class NewClassCodeGenerator { private List<IPath> getMissingIncludePaths(IPath projectLocation, List<IPath> includePaths, List<IPath> baseClassPaths) { // check for missing include paths - List<IPath> newIncludePaths = new ArrayList<IPath>(); + List<IPath> newIncludePaths = new ArrayList<>(); for (IPath baseClassLocation : baseClassPaths) { // skip any paths inside the same project //TODO possibly a preferences option? @@ -849,7 +849,7 @@ public class NewClassCodeGenerator { if (info != null) { String[] includePaths = info.getIncludePaths(); if (includePaths != null) { - List<IPath> list = new ArrayList<IPath>(); + List<IPath> list = new ArrayList<>(); for (int i = 0; i < includePaths.length; ++i) { //TODO do we need to canonicalize these paths first? IPath path = new Path(includePaths[i]); @@ -865,7 +865,7 @@ public class NewClassCodeGenerator { } private List<IPath> getBaseClassPaths(boolean verifyLocation) throws CodeGeneratorException { - List<IPath> list = new ArrayList<IPath>(); + List<IPath> list = new ArrayList<>(); for (int i = 0; i < fBaseClasses.length; ++i) { IBaseClassInfo baseClass = fBaseClasses[i]; ITypeReference ref = baseClass.getType().getResolvedReference(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java index 45f497ed471..e9bc4c7d7a9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/SourceFileSelectionDialog.java @@ -199,7 +199,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog { fFileNameDialogField.setDialogFieldListener(fFieldsAdapter); fFileNameDialogField.setLabelText(NewClassWizardMessages.SourceFileSelectionDialog_fileName_label); - setResult(new ArrayList<Object>(0)); + setResult(new ArrayList<>(0)); setStatusLineAboveButtons(true); int shellStyle = getShellStyle(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java index cacac52cb17..d052d9dcb8a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/CheckedListDialogField.java @@ -42,7 +42,7 @@ public class CheckedListDialogField<T> extends ListDialogField<T> { public CheckedListDialogField(IListAdapter<T> adapter, String[] customButtonLabels, IBaseLabelProvider lprovider) { super(adapter, customButtonLabels, lprovider); - fCheckElements = new ArrayList<T>(); + fCheckElements = new ArrayList<>(); fCheckAllButtonIndex = -1; fUncheckAllButtonIndex = -1; @@ -113,7 +113,7 @@ public class CheckedListDialogField<T> extends ListDialogField<T> { * Gets the checked elements. */ public List<T> getCheckedElements() { - return new ArrayList<T>(fCheckElements); + return new ArrayList<>(fCheckElements); } /** @@ -134,7 +134,7 @@ public class CheckedListDialogField<T> extends ListDialogField<T> { * Sets the checked elements. */ public void setCheckedElements(Collection<T> list) { - fCheckElements = new ArrayList<T>(list); + fCheckElements = new ArrayList<>(list); if (fTable != null) { ((CheckboxTableViewer) fTable).setCheckedElements(list.toArray()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java index b70848e6b2e..d9c74fcbf85 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/ListDialogField.java @@ -130,7 +130,7 @@ public class ListDialogField<T> extends DialogField { fListViewerAdapter = new ListViewerAdapter(); fParentElement = this; - fElements = new ArrayList<T>(10); + fElements = new ArrayList<>(10); fButtonLabels = buttonLabels; if (fButtonLabels != null) { @@ -541,7 +541,7 @@ public class ListDialogField<T> extends DialogField { * Sets the elements shown in the list. */ public void setElements(List<? extends T> elements) { - fElements = new ArrayList<T>(elements); + fElements = new ArrayList<>(elements); if (fTable != null) { fTable.refresh(); } @@ -553,7 +553,7 @@ public class ListDialogField<T> extends DialogField { * The list returned is a copy, so it can be modified by the user. */ public List<T> getElements() { - return new ArrayList<T>(fElements); + return new ArrayList<>(fElements); } /** @@ -613,7 +613,7 @@ public class ListDialogField<T> extends DialogField { if (nElements > 0) { // filter duplicated - ArrayList<T> elementsToAdd = new ArrayList<T>(nElements); + ArrayList<T> elementsToAdd = new ArrayList<>(nElements); for (int i = 0; i < nElements; i++) { T elem = elements.get(i); @@ -743,7 +743,7 @@ public class ListDialogField<T> extends DialogField { private List<T> moveUp(List<? extends T> elements, List<? extends T> move) { int nElements = elements.size(); - List<T> res = new ArrayList<T>(nElements); + List<T> res = new ArrayList<>(nElements); T floating = null; for (int i = 0; i < nElements; i++) { T curr = elements.get(i); @@ -777,7 +777,7 @@ public class ListDialogField<T> extends DialogField { } private List<T> reverse(List<? extends T> p) { - List<T> reverse = new ArrayList<T>(p.size()); + List<T> reverse = new ArrayList<>(p.size()); for (int i = p.size() - 1; i >= 0; i--) { reverse.add(p.get(i)); } @@ -825,7 +825,7 @@ public class ListDialogField<T> extends DialogField { * Returns the selected elements. */ public List<T> getSelectedElements() { - List<T> result = new ArrayList<T>(); + List<T> result = new ArrayList<>(); if (fTable != null) { ISelection selection = fTable.getSelection(); if (selection instanceof IStructuredSelection) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java index a28325dca17..3f394d86025 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/TreeListDialogField.java @@ -91,7 +91,7 @@ public class TreeListDialogField<T> extends DialogField { fTreeViewerAdapter = new TreeViewerAdapter(); fParentElement = this; - fElements = new ArrayList<T>(10); + fElements = new ArrayList<>(10); fButtonLabels = buttonLabels; if (fButtonLabels != null) { @@ -517,7 +517,7 @@ public class TreeListDialogField<T> extends DialogField { * Sets the elements shown in the list. */ public void setElements(List<T> elements) { - fElements = new ArrayList<T>(elements); + fElements = new ArrayList<>(elements); refresh(); if (fTree != null) { fTree.expandToLevel(fTreeExpandLevel); @@ -530,7 +530,7 @@ public class TreeListDialogField<T> extends DialogField { * can be modified by the user. */ public List<T> getElements() { - return new ArrayList<T>(fElements); + return new ArrayList<>(fElements); } /** @@ -596,7 +596,7 @@ public class TreeListDialogField<T> extends DialogField { if (nElements > 0) { // filter duplicated - ArrayList<T> elementsToAdd = new ArrayList<T>(nElements); + ArrayList<T> elementsToAdd = new ArrayList<>(nElements); for (int i = 0; i < nElements; i++) { T elem = elements.get(i); @@ -739,7 +739,7 @@ public class TreeListDialogField<T> extends DialogField { private List<T> moveUp(List<T> elements, List<?> move) { int nElements = elements.size(); - List<T> res = new ArrayList<T>(nElements); + List<T> res = new ArrayList<>(nElements); T floating = null; for (int i = 0; i < nElements; i++) { T curr = elements.get(i); @@ -773,7 +773,7 @@ public class TreeListDialogField<T> extends DialogField { } private List<T> reverse(List<T> p) { - List<T> reverse = new ArrayList<T>(p.size()); + List<T> reverse = new ArrayList<>(p.size()); for (int i = p.size() - 1; i >= 0; i--) { reverse.add(p.get(i)); } @@ -823,7 +823,7 @@ public class TreeListDialogField<T> extends DialogField { * Returns the selected elements. */ public List<Object> getSelectedElements() { - ArrayList<Object> result = new ArrayList<Object>(); + ArrayList<Object> result = new ArrayList<>(); if (fTree != null) { ISelection selection = fTree.getSelection(); if (selection instanceof IStructuredSelection) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java index d2b60d853ba..110a8da384c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/AbstractFileCreationWizardPage.java @@ -232,7 +232,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag templateName = template.getName(); } if (templateName != null) { - data = new HashMap<String, String>(); + data = new HashMap<>(); data.put(CodeTemplatePreferencePage.DATA_SELECT_TEMPLATE, templateName); } PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), prefPageId, diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/WizardNewFileFromTemplateCreationPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/WizardNewFileFromTemplateCreationPage.java index cebda1487ff..d5d0d5633e8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/WizardNewFileFromTemplateCreationPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/filewizard/WizardNewFileFromTemplateCreationPage.java @@ -125,7 +125,7 @@ public class WizardNewFileFromTemplateCreationPage extends WizardNewFileCreation templateName = template.getName(); } if (templateName != null) { - data = new HashMap<String, String>(); + data = new HashMap<>(); data.put(CodeTemplatePreferencePage.DATA_SELECT_TEMPLATE, templateName); } PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), prefPageId, @@ -253,7 +253,7 @@ public class WizardNewFileFromTemplateCreationPage extends WizardNewFileCreation } } IContentType[] contentTypes = matcher.findContentTypesFor(fileName); - List<String> result = new ArrayList<String>(contentTypes.length * 2); + List<String> result = new ArrayList<>(contentTypes.length * 2); for (int i = 0; i < contentTypes.length; i++) { IContentType contentType = contentTypes[i]; String id = contentType.getId(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java index 11722d41f4f..9bf3abc2c9b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/indexwizards/TeamProjectIndexExportWizardPage.java @@ -195,7 +195,7 @@ public class TeamProjectIndexExportWizardPage extends WizardPage implements List } private void initProjects() { - ArrayList<ICProject> input = new ArrayList<ICProject>(); + ArrayList<ICProject> input = new ArrayList<>(); ICProject[] projects; try { projects = CoreModel.getDefault().getCModel().getCProjects(); @@ -211,7 +211,7 @@ public class TeamProjectIndexExportWizardPage extends WizardPage implements List } private void setupBasedOnInitialSelections() { - HashSet<String> names = new HashSet<String>(); + HashSet<String> names = new HashSet<>(); Iterator<?> it = fInitialSelection.iterator(); while (it.hasNext()) { IProject project = (IProject) it.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/IncludePathsSettingsProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/IncludePathsSettingsProcessor.java index 261adf78e00..1df9bd7106e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/IncludePathsSettingsProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/IncludePathsSettingsProcessor.java @@ -85,7 +85,7 @@ public class IncludePathsSettingsProcessor extends SettingsProcessor { @Override protected void readSettings(ICLanguageSetting setting, Element language) throws SettingsImportExportException { - List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>(); + List<ICLanguageSettingEntry> includes = new ArrayList<>(); List<Element> includeNodes = XMLUtils.extractChildElements(language, INCLUDE_PATH_ELEMENT); for (Element includeElement : includeNodes) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/MacroSettingsProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/MacroSettingsProcessor.java index b52eb3b7dac..5dd69f82ab8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/MacroSettingsProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/MacroSettingsProcessor.java @@ -95,7 +95,7 @@ public class MacroSettingsProcessor extends SettingsProcessor { @Override protected void readSettings(ICLanguageSetting setting, Element language) throws SettingsImportExportException { - List<ICLanguageSettingEntry> macros = new ArrayList<ICLanguageSettingEntry>(); + List<ICLanguageSettingEntry> macros = new ArrayList<>(); List<Element> macrosNodes = XMLUtils.extractChildElements(language, MACRO_ELEMENT); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsImportStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsImportStrategy.java index e95cad4f445..11d6e650060 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsImportStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsImportStrategy.java @@ -91,7 +91,7 @@ public class ProjectSettingsImportStrategy implements IProjectSettingsWizardPage page.setMessage(Messages.ProjectSettingsWizardPage_Import_parseError, IMessageProvider.ERROR); } - List<ISettingsProcessor> importersToDisplay = new ArrayList<ISettingsProcessor>(); + List<ISettingsProcessor> importersToDisplay = new ArrayList<>(); for (ImporterSectionPair pair : pairs) { importersToDisplay.add(pair.importer); } @@ -168,7 +168,7 @@ public class ProjectSettingsImportStrategy implements IProjectSettingsWizardPage String filePath = page.getDestinationFilePath(); // get all the importers - Map<String, ISettingsProcessor> importers = new HashMap<String, ISettingsProcessor>(); + Map<String, ISettingsProcessor> importers = new HashMap<>(); for (ISettingsProcessor processor : page.getSettingsProcessors()) { importers.put(processor.getSectionName(), processor); } @@ -182,7 +182,7 @@ public class ProjectSettingsImportStrategy implements IProjectSettingsWizardPage Element root = document.getDocumentElement(); List<Element> sections = XMLUtils.extractChildElements(root, ProjectSettingsExportStrategy.SECTION_ELEMENT); - List<ImporterSectionPair> pairs = new ArrayList<ImporterSectionPair>(); + List<ImporterSectionPair> pairs = new ArrayList<>(); // associate an importer with each section for (Element section : sections) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizardPage.java index 38402a67994..04863d64ea2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizardPage.java @@ -133,7 +133,7 @@ abstract public class ProjectSettingsWizardPage extends WizardPage implements IP @Override public List<ISettingsProcessor> getSelectedSettingsProcessors() { - List<ISettingsProcessor> selected = new ArrayList<ISettingsProcessor>(); + List<ISettingsProcessor> selected = new ArrayList<>(); for (Object element : settingsViewer.getCheckedElements()) { selected.add((ISettingsProcessor) element); } @@ -300,7 +300,7 @@ abstract public class ProjectSettingsWizardPage extends WizardPage implements IP } private static List<ICProject> getAllOpenCProjects() { - List<ICProject> projects = new ArrayList<ICProject>(); + List<ICProject> projects = new ArrayList<>(); try { for (ICProject project : CoreModel.getDefault().getCModel().getCProjects()) { if (project.getProject().isOpen()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/SettingsProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/SettingsProcessor.java index 36cc7c2f722..0ce07081dea 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/SettingsProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/SettingsProcessor.java @@ -95,7 +95,7 @@ public abstract class SettingsProcessor implements ISettingsProcessor { public void readSectionXML(ICFolderDescription projectRoot, Element section) throws SettingsImportExportException { ICLanguageSetting[] languageSettings = projectRoot.getLanguageSettings(); - Map<String, ICLanguageSetting> languageMap = new HashMap<String, ICLanguageSetting>(); + Map<String, ICLanguageSetting> languageMap = new HashMap<>(); for (ICLanguageSetting language : languageSettings) { languageMap.put(language.getName(), language); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/XMLUtils.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/XMLUtils.java index e99f73b4aa8..2cdddb6aabf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/XMLUtils.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/XMLUtils.java @@ -28,7 +28,7 @@ public class XMLUtils { public static List<Element> extractChildElements(Element node, String childElementName) throws SettingsImportExportException { - List<Element> extracted = new ArrayList<Element>(); + List<Element> extracted = new ArrayList<>(); NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetConfigsContribution.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetConfigsContribution.java index 388e5d372d5..617f67bda28 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetConfigsContribution.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetConfigsContribution.java @@ -74,7 +74,7 @@ abstract class AbstractWorkingSetConfigsContribution extends CompoundContributio } // sort the configurations by name - List<IWorkingSetConfiguration> configs = new java.util.ArrayList<IWorkingSetConfiguration>( + List<IWorkingSetConfiguration> configs = new java.util.ArrayList<>( getWorkingSet().getConfigurations()); Collections.sort(configs, configOrdering); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetsContribution.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetsContribution.java index 14a75d970be..5d08b86f784 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetsContribution.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/AbstractWorkingSetsContribution.java @@ -57,7 +57,7 @@ abstract class AbstractWorkingSetsContribution extends CompoundContributionItem @Override protected IContributionItem[] getContributionItems() { // at most 5 recent working sets - List<IContributionItem> result = new java.util.ArrayList<IContributionItem>(5); + List<IContributionItem> result = new java.util.ArrayList<>(5); int i = 0; for (IWorkingSet recent : getWorkingsetManager().getRecentWorkingSets()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/BuildJob.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/BuildJob.java index 567946f9682..b1862d26aa8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/BuildJob.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/BuildJob.java @@ -44,7 +44,7 @@ public final class BuildJob extends Job { */ public BuildJob(Collection<IProject> projects) { super(Messages.WorkingSetConfigAction_21); - this.projects = new java.util.ArrayList<IProject>(projects); + this.projects = new java.util.ArrayList<>(projects); } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java index 0bf1127b3cf..e368a3e7d60 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java @@ -185,7 +185,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag @Override public void finish() { String workingSetName = fWorkingSetName.getText(); - ArrayList<Object> elements = new ArrayList<Object>(10); + ArrayList<Object> elements = new ArrayList<>(10); findCheckedElements(elements, fTree.getInput()); if (fWorkingSet == null) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); @@ -194,7 +194,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag } else { // Add inaccessible resources IAdaptable[] oldItems = fWorkingSet.getElements(); - HashSet<IProject> closedWithChildren = new HashSet<IProject>(elements.size()); + HashSet<IProject> closedWithChildren = new HashSet<>(elements.size()); for (IAdaptable oldItem : oldItems) { IResource oldResource = null; if (oldItem instanceof IResource) { @@ -341,7 +341,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag } } fTree.setCheckedElements(elements); - HashSet<Object> parents = new HashSet<Object>(); + HashSet<Object> parents = new HashSet<>(); for (Object element : elements) { if (isExpandable(element)) setSubtreeChecked(element, true, true); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPageContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPageContentProvider.java index 66df9c9b5b0..7531989dd13 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPageContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPageContentProvider.java @@ -33,7 +33,7 @@ class CElementWorkingSetPageContentProvider extends BaseCElementContentProvider if (element instanceof IWorkspaceRoot) { IWorkspaceRoot root = (IWorkspaceRoot) element; IProject[] projects = root.getProjects(); - List<ICProject> list = new ArrayList<ICProject>(projects.length); + List<ICProject> list = new ArrayList<>(projects.length); for (int i = 0; i < projects.length; i++) { if (CoreModel.hasCNature(projects[i])) { list.add(CoreModel.getDefault().create(projects[i])); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java index 7e7f150c476..b5e21652776 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java @@ -88,7 +88,7 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh public WorkingSetDelta(IWorkingSet workingSet) { fWorkingSet = workingSet; synchronized (fWorkingSet) { - fElements = new ArrayList<Object>(Arrays.asList(fWorkingSet.getElements())); + fElements = new ArrayList<>(Arrays.asList(fWorkingSet.getElements())); } } @@ -119,7 +119,7 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh } public CElementWorkingSetUpdater() { - fWorkingSets = new ArrayList<IWorkingSet>(); + fWorkingSets = new ArrayList<>(); CoreModel.getDefault().addElementChangedListener(this); } @@ -278,7 +278,7 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh } private static void checkElementExistence(IWorkingSet workingSet) { - List<IAdaptable> elements = new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements())); + List<IAdaptable> elements = new ArrayList<>(Arrays.asList(workingSet.getElements())); boolean changed = false; for (Iterator<IAdaptable> iter = elements.iterator(); iter.hasNext();) { IAdaptable element = iter.next(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java index 17750350fcb..728ed011d2b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java @@ -118,8 +118,8 @@ public interface IWorkingSetProjectConfigurationFactory { public static Registry INSTANCE = new Registry(); private final IWorkingSetProjectConfigurationFactory defaultFactory = new Default(); - private final Map<String, IWorkingSetProjectConfigurationFactory> factoriesByID = new java.util.HashMap<String, IWorkingSetProjectConfigurationFactory>(); - private final Map<String, IWorkingSetProjectConfigurationFactory> factoriesByNature = new java.util.HashMap<String, IWorkingSetProjectConfigurationFactory>(); + private final Map<String, IWorkingSetProjectConfigurationFactory> factoriesByID = new java.util.HashMap<>(); + private final Map<String, IWorkingSetProjectConfigurationFactory> factoriesByNature = new java.util.HashMap<>(); private Map<String, Set<String>> projectNaturePartOrdering; @@ -205,13 +205,13 @@ public interface IWorkingSetProjectConfigurationFactory { } private Map<String, Set<String>> computeProjectNaturePartOrdering() { - Map<String, Set<String>> result = new java.util.HashMap<String, Set<String>>(); + Map<String, Set<String>> result = new java.util.HashMap<>(); // first pass to populate the map with immediate requireds IWorkspace ws = ResourcesPlugin.getWorkspace(); for (IProjectNatureDescriptor next : ws.getNatureDescriptors()) { result.put(next.getNatureId(), - new java.util.HashSet<String>(Arrays.asList(next.getRequiredNatureIds()))); + new java.util.HashSet<>(Arrays.asList(next.getRequiredNatureIds()))); } // now, iterate to add transitive requireds @@ -221,7 +221,7 @@ public interface IWorkingSetProjectConfigurationFactory { for (Map.Entry<String, Set<String>> next : result.entrySet()) { Set<String> requireds = next.getValue(); - Set<String> newRequireds = new java.util.HashSet<String>(requireds); + Set<String> newRequireds = new java.util.HashSet<>(requireds); boolean changed = false; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigsController.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigsController.java index b6803dbf4ca..3e676614445 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigsController.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigsController.java @@ -193,9 +193,9 @@ class ProjectConfigsController implements ICheckStateListener, DisposeListener { private Map<IWorkingSetProjectConfigurationController, ILabelProvider> labelProviders; ControllerContext(Viewer viewer) { - elementToControllerMap = new java.util.IdentityHashMap<Object, IWorkingSetProjectConfigurationController>(); - contentProviders = new java.util.HashMap<IWorkingSetProjectConfigurationController, ITreeContentProvider>(); - labelProviders = new java.util.HashMap<IWorkingSetProjectConfigurationController, ILabelProvider>(); + elementToControllerMap = new java.util.IdentityHashMap<>(); + contentProviders = new java.util.HashMap<>(); + labelProviders = new java.util.HashMap<>(); for (IWorkingSetProjectConfiguration next : getWorkingSetConfiguration().getProjectConfigurations()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigurationController.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigurationController.java index 05b58893d97..2baebcf2a92 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigurationController.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/ProjectConfigurationController.java @@ -126,7 +126,7 @@ public class ProjectConfigurationController implements IWorkingSetProjectConfigu ContentProvider(IWorkingSetProjectConfiguration project) { this.project = project; - this.configs = new java.util.HashSet<ICConfigurationDescription>(project.resolveConfigurations()); + this.configs = new java.util.HashSet<>(project.resolveConfigurations()); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java index ee19a6f010d..1ec07330293 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigsController.java @@ -369,7 +369,7 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange */ private void updateForActivation() { // update all working-set configs that intersect this config - Collection<IWorkingSetProxy.ISnapshot> unaffectedWorkingSets = new java.util.HashSet<IWorkingSetProxy.ISnapshot>( + Collection<IWorkingSetProxy.ISnapshot> unaffectedWorkingSets = new java.util.HashSet<>( workspace.getWorkingSets()); for (IProject project : currentConfig.getWorkingSet().resolveProjects()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfiguration.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfiguration.java index 4cc2b0bb9a9..e18a4ed0140 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfiguration.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfiguration.java @@ -113,7 +113,7 @@ public class WorkingSetConfiguration implements IWorkingSetConfiguration { private Map<String, IWorkingSetProjectConfiguration> getProjects() { if (projects == null) { - projects = new java.util.HashMap<String, IWorkingSetProjectConfiguration>(); + projects = new java.util.HashMap<>(); for (IProject next : workingSet.resolveProjects()) { IWorkingSetProjectConfiguration child = createProjectConfiguration(next); @@ -130,7 +130,7 @@ public class WorkingSetConfiguration implements IWorkingSetConfiguration { protected void basicAddProjectConfiguration(IWorkingSetProjectConfiguration projectConfig) { if (projects == null) { - projects = new java.util.HashMap<String, IWorkingSetProjectConfiguration>(); + projects = new java.util.HashMap<>(); } projects.put(projectConfig.getProjectName(), projectConfig); @@ -181,7 +181,7 @@ public class WorkingSetConfiguration implements IWorkingSetConfiguration { public IStatus build(IProgressMonitor monitor) { MultiStatus result = new MultiStatus(CUIPlugin.PLUGIN_ID, 0, WorkingSetMessages.WSConfig_build_problems, null); - List<IWorkingSetProjectConfiguration> toBuild = new java.util.ArrayList<IWorkingSetProjectConfiguration>( + List<IWorkingSetProjectConfiguration> toBuild = new java.util.ArrayList<>( getProjectConfigurations().size()); for (IWorkingSetProjectConfiguration next : getProjectConfigurations()) { IProject project = next.resolveProject(); @@ -229,7 +229,7 @@ public class WorkingSetConfiguration implements IWorkingSetConfiguration { public void loadState(IMemento memento) { setName(memento.getString(ATTR_NAME)); - Map<String, IMemento> projectMementos = new java.util.HashMap<String, IMemento>(); + Map<String, IMemento> projectMementos = new java.util.HashMap<>(); for (IMemento next : memento.getChildren(KEY_PROJECT)) { projectMementos.put(next.getString(ATTR_NAME), next); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java index 539a72de0bc..77f01d6ac58 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java @@ -346,7 +346,7 @@ public class WorkingSetConfigurationBlock { return workingSets; } - Collection<IWorkingSetProxy> result = new java.util.ArrayList<IWorkingSetProxy>(); + Collection<IWorkingSetProxy> result = new java.util.ArrayList<>(); for (IWorkingSetProxy next : workingSets) { if (workingSetFilter.select(next)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationManager.java index ac65057e1db..4d8d2ad4d51 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationManager.java @@ -153,7 +153,7 @@ public class WorkingSetConfigurationManager { * </p> */ private void load() { - workingSets = new java.util.HashMap<String, IWorkingSetProxy>(); + workingSets = new java.util.HashMap<>(); for (IMemento next : store.getChildren(KEY_WORKING_SET)) { WorkingSetProxy ws = new WorkingSetProxy(); @@ -291,7 +291,7 @@ public class WorkingSetConfigurationManager { result = XMLMemento.createWriteRoot(TYPE_WORKING_SET_CONFIGS); // collect the unordered entries by working set - Map<String, IMemento> configMap = new HashMap<String, IMemento>(); + Map<String, IMemento> configMap = new HashMap<>(); for (String next : configSetStrings) { String[] bits = next.split(" "); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetProxy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetProxy.java index a4c2ed7ff37..c776dcc8f93 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetProxy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetProxy.java @@ -73,7 +73,7 @@ public class WorkingSetProxy implements IWorkingSetProxy { @Override public Collection<IProject> resolveProjects() { - Set<IProject> result = new java.util.HashSet<IProject>(); + Set<IProject> result = new java.util.HashSet<>(); IWorkingSet resolvedWS = resolve(); if (resolvedWS != null) { @@ -96,7 +96,7 @@ public class WorkingSetProxy implements IWorkingSetProxy { private Map<String, IWorkingSetConfiguration> getConfigurationsMap() { if (configurations == null) { - configurations = new java.util.HashMap<String, IWorkingSetConfiguration>(); + configurations = new java.util.HashMap<>(); } return configurations; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkspaceSnapshot.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkspaceSnapshot.java index 379e1343a51..e598e3f3c13 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkspaceSnapshot.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkspaceSnapshot.java @@ -57,8 +57,8 @@ import org.eclipse.ui.IWorkingSet; * */ public class WorkspaceSnapshot { - private Map<String, IWorkingSetProxy.ISnapshot> workingSets = new java.util.HashMap<String, IWorkingSetProxy.ISnapshot>(); - private Map<IProject, ProjectState> projectStates = new java.util.HashMap<IProject, ProjectState>(); + private Map<String, IWorkingSetProxy.ISnapshot> workingSets = new java.util.HashMap<>(); + private Map<IProject, ProjectState> projectStates = new java.util.HashMap<>(); /** * Initializes me. I capture the current C/C++ active configuration state of the projects in the @@ -297,7 +297,7 @@ public class WorkspaceSnapshot { * @return the projects needing to be re-built */ public Collection<IProject> getProjectsToBuild() { - Collection<IProject> result = new java.util.ArrayList<IProject>(); + Collection<IProject> result = new java.util.ArrayList<>(); for (ProjectState next : projectStates.values()) { if (next.needsBuild()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTUIImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTUIImages.java index c7648a21542..2db48152210 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTUIImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTUIImages.java @@ -31,7 +31,7 @@ import org.eclipse.swt.graphics.Image; public class CDTUIImages { private static final String ICONS = "icons/"; //$NON-NLS-1$ /** Converter from CPluginImages key to CDTSharedImages key */ - private static Map<String, String> fPathMap = new HashMap<String, String>(); + private static Map<String, String> fPathMap = new HashMap<>(); private static final String NAME_PREFIX = CUIPlugin.PLUGIN_ID + '.'; private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java index fd6eb6efa9f..1eabfae8979 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java @@ -76,7 +76,7 @@ public class CElementContentProvider extends BaseCElementContentProvider protected Object fInput; /** Remember what refreshes we already have pending so we don't post them again. */ - protected HashSet<IRefreshable> pendingRefreshes = new HashSet<IRefreshable>(); + protected HashSet<IRefreshable> pendingRefreshes = new HashSet<>(); /** * Creates a new content provider for C elements. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java index e8d68df1d6f..406e2322840 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java @@ -803,8 +803,8 @@ public class CUIPlugin extends AbstractUIPlugin { * @return an array of all dirty editor parts. */ public static IEditorPart[] getDirtyEditors() { - Set<IEditorInput> inputs = new HashSet<IEditorInput>(); - List<IEditorPart> result = new ArrayList<IEditorPart>(0); + Set<IEditorInput> inputs = new HashSet<>(); + List<IEditorPart> result = new ArrayList<>(0); IWorkbench workbench = getDefault().getWorkbench(); for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) { for (IWorkbenchPage page : window.getPages()) { @@ -827,7 +827,7 @@ public class CUIPlugin extends AbstractUIPlugin { * Returns an array of all instantiated editors. */ public static IEditorPart[] getInstanciatedEditors() { - List<IEditorPart> result = new ArrayList<IEditorPart>(0); + List<IEditorPart> result = new ArrayList<>(0); IWorkbench workbench = getDefault().getWorkbench(); IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); for (IWorkbenchWindow window : windows) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/NamespacesGrouping.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/NamespacesGrouping.java index 7c8c1effc28..ff070922ea1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/NamespacesGrouping.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/NamespacesGrouping.java @@ -70,7 +70,7 @@ public class NamespacesGrouping extends CElementGrouping { */ @Override public Object[] getChildren(Object object) { - Set<Object> list = new LinkedHashSet<Object>(); + Set<Object> list = new LinkedHashSet<>(); try { INamespace[] namespaces = getNamespaces(); for (INamespace iNamespace : namespaces) { @@ -87,7 +87,7 @@ public class NamespacesGrouping extends CElementGrouping { * @since 5.1 */ public INamespace[] getNamespaces() { - List<INamespace> list = new ArrayList<INamespace>(); + List<INamespace> list = new ArrayList<>(); try { List<ICElement> namespaces = fUnit.getChildrenOfType(ICElement.C_NAMESPACE); for (ICElement icElement : namespaces) { @@ -108,9 +108,9 @@ public class NamespacesGrouping extends CElementGrouping { if (!fMemberGrouping) { return Arrays.asList(children); } - List<Object> list = new ArrayList<Object>(children.length); + List<Object> list = new ArrayList<>(children.length); // check if there is another member with the same namespace for the same parent - Map<String, MembersGrouping> map = new HashMap<String, MembersGrouping>(); + Map<String, MembersGrouping> map = new HashMap<>(); for (int i = 0; i < children.length; ++i) { if (children[i] instanceof IMember) { final ICElement member = (ICElement) children[i]; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/SharedImagesFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/SharedImagesFactory.java index ea39946ba4e..8e70abe3550 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/SharedImagesFactory.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/SharedImagesFactory.java @@ -51,7 +51,7 @@ public class SharedImagesFactory { private Bundle bundle; private ImageRegistry imageRegistry; - private Map<String, URL> urlMap = new HashMap<String, URL>(); + private Map<String, URL> urlMap = new HashMap<>(); /** * Constructor. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigActionBase.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigActionBase.java index 074fbdb038f..35316325084 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigActionBase.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigActionBase.java @@ -53,7 +53,7 @@ public class ChangeBuildConfigActionBase { /** * List of selected managed-built projects */ - protected HashSet<IProject> fProjects = new HashSet<IProject>(); + protected HashSet<IProject> fProjects = new HashSet<>(); /** * Fills the menu with build configurations which are common for all selected projects @@ -68,7 +68,7 @@ public class ChangeBuildConfigActionBase { for (MenuItem item2 : items) item2.dispose(); - SortedSet<String> configNames = new TreeSet<String>(); + SortedSet<String> configNames = new TreeSet<>(); String sCurrentConfig = null; boolean bCurrentConfig = true; for (IProject prj : fProjects) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/CustomFiltersActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/CustomFiltersActionGroup.java index 94cc721f6e5..820ee8ba3b1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/CustomFiltersActionGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/CustomFiltersActionGroup.java @@ -224,7 +224,7 @@ public class CustomFiltersActionGroup extends ActionGroup { fTargetId = ownerId; fViewer = viewer; - fLRUFilterIdsStack = new Stack<String>(); + fLRUFilterIdsStack = new Stack<>(); initializeWithPluginContributions(); initializeWithViewDefaults(); @@ -243,7 +243,7 @@ public class CustomFiltersActionGroup extends ActionGroup { public String[] removeFiltersFor(Object parent, Object element, IContentProvider contentProvider) { String[] enabledFilters = getEnabledFilterIds(); - Set<String> newFilters = new HashSet<String>(); + Set<String> newFilters = new HashSet<>(); for (String filterName : enabledFilters) { ViewerFilter filter = fInstalledBuiltInFilters.get(filterName); if (filter == null) @@ -293,7 +293,7 @@ public class CustomFiltersActionGroup extends ActionGroup { } private String[] getEnabledFilterIds() { - Set<String> enabledFilterIds = new HashSet<String>(fEnabledFilterIds.size()); + Set<String> enabledFilterIds = new HashSet<>(fEnabledFilterIds.size()); Iterator<Map.Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, Boolean> entry = iter.next(); @@ -327,7 +327,7 @@ public class CustomFiltersActionGroup extends ActionGroup { * @since 3.0 */ private void setRecentlyChangedFilters(Stack<FilterDescriptor> changeHistory) { - Stack<String> oldestFirstStack = new Stack<String>(); + Stack<String> oldestFirstStack = new Stack<>(); int length = Math.min(changeHistory.size(), MAX_FILTER_MENU_ENTRIES); for (int i = 0; i < length; i++) @@ -389,7 +389,7 @@ public class CustomFiltersActionGroup extends ActionGroup { return; } - SortedSet<Object> sortedFilters = new TreeSet<Object>(fLRUFilterIdsStack); + SortedSet<Object> sortedFilters = new TreeSet<>(fLRUFilterIdsStack); String[] recentlyChangedFilterIds = sortedFilters.toArray(new String[sortedFilters.size()]); fFilterIdsUsedInLastViewMenu = new String[recentlyChangedFilterIds.length]; @@ -421,8 +421,8 @@ public class CustomFiltersActionGroup extends ActionGroup { fUserDefinedPatternsEnabled = false; FilterDescriptor[] filterDescs = FilterDescriptor.getFilterDescriptors(fTargetId); - fFilterDescriptorMap = new HashMap<String, FilterDescriptor>(filterDescs.length); - fEnabledFilterIds = new HashMap<String, Boolean>(filterDescs.length); + fFilterDescriptorMap = new HashMap<>(filterDescs.length); + fEnabledFilterIds = new HashMap<>(filterDescs.length); for (FilterDescriptor filterDesc : filterDescs) { String id = filterDesc.getId(); Boolean isEnabled = filterDesc.isEnabled(); @@ -436,7 +436,7 @@ public class CustomFiltersActionGroup extends ActionGroup { // ---------- viewer filter handling ---------- private void installFilters() { - fInstalledBuiltInFilters = new HashMap<String, ViewerFilter>(fEnabledFilterIds.size()); + fInstalledBuiltInFilters = new HashMap<>(fEnabledFilterIds.size()); fPatternFilter = new NamePatternFilter(); fPatternFilter.setPatterns(getUserAndBuiltInPatterns()); fViewer.addFilter(fPatternFilter); @@ -455,8 +455,8 @@ public class CustomFiltersActionGroup extends ActionGroup { private void updateBuiltInFilters() { Set<String> installedFilters = fInstalledBuiltInFilters.keySet(); - Set<String> filtersToAdd = new HashSet<String>(fEnabledFilterIds.size()); - Set<String> filtersToRemove = new HashSet<String>(fEnabledFilterIds.size()); + Set<String> filtersToAdd = new HashSet<>(fEnabledFilterIds.size()); + Set<String> filtersToRemove = new HashSet<>(fEnabledFilterIds.size()); Iterator<Map.Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, Boolean> entry = iter.next(); @@ -491,7 +491,7 @@ public class CustomFiltersActionGroup extends ActionGroup { } private String[] getUserAndBuiltInPatterns() { - List<String> patterns = new ArrayList<String>(fUserDefinedPatterns.length); + List<String> patterns = new ArrayList<>(fUserDefinedPatterns.length); if (areUserDefinedPatternsEnabled()) patterns.addAll(Arrays.asList(fUserDefinedPatterns)); FilterDescriptor[] filterDescs = FilterDescriptor.getFilterDescriptors(fTargetId); @@ -698,7 +698,7 @@ public class CustomFiltersActionGroup extends ActionGroup { private void cleanUpPatternDuplicates() { if (!areUserDefinedPatternsEnabled()) return; - List<String> userDefinedPatterns = new ArrayList<String>(Arrays.asList(fUserDefinedPatterns)); + List<String> userDefinedPatterns = new ArrayList<>(Arrays.asList(fUserDefinedPatterns)); FilterDescriptor[] filters = FilterDescriptor.getFilterDescriptors(fTargetId); for (FilterDescriptor filter : filters) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java index 2845b52eac0..1de2e3cfdf2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/DeleteResConfigsAction.java @@ -96,7 +96,7 @@ public class DeleteResConfigsAction implements IWorkbenchWindowPulldownDelegate2 ICResourceDescription rd = cfgd.getResourceDescription(path, true); if (rd != null) { if (objects == null) - objects = new ArrayList<IResource>(); + objects = new ArrayList<>(); objects.add(res); break; // stop configurations scanning } @@ -172,7 +172,7 @@ public class DeleteResConfigsAction implements IWorkbenchWindowPulldownDelegate2 if (outData != null) return outData.toArray(); - outData = new ArrayList<ResCfgData>(); + outData = new ArrayList<>(); List<?> ls = (List<?>) inputElement; Iterator<?> it = ls.iterator(); IProject proj = null; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java index 9dc5d753036..71ba1b511ac 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ExcludeFromBuildAction.java @@ -91,10 +91,10 @@ public class ExcludeFromBuildAction implements IWorkbenchWindowPulldownDelegate2 continue; if (objects == null) - objects = new ArrayList<IResource>(); + objects = new ArrayList<>(); objects.add(res); if (cfgNames == null) { - cfgNames = new ArrayList<String>(cfgds.length); + cfgNames = new ArrayList<>(cfgds.length); for (int j = 0; j < cfgds.length; j++) { if (!canExclude(res, cfgds[j])) { cfgNames = null; @@ -179,7 +179,7 @@ public class ExcludeFromBuildAction implements IWorkbenchWindowPulldownDelegate2 status[i] = true; } } - ArrayList<String> lst = new ArrayList<String>(); + ArrayList<String> lst = new ArrayList<>(); for (int i = 0; i < status.length; i++) if (status[i]) lst.add(cfgNames.get(i)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java index 124850684c0..56105d1ddad 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/FormatAllAction.java @@ -146,7 +146,7 @@ public class FormatAllAction extends SelectionDispatchAction { } private ITranslationUnit[] getTranslationUnits(IStructuredSelection selection) { - HashSet<ICElement> result = new HashSet<ICElement>(); + HashSet<ICElement> result = new HashSet<>(); Object[] selected = selection.toArray(); for (int i = 0; i < selected.length; i++) { try { @@ -296,7 +296,7 @@ public class FormatAllAction extends SelectionDispatchAction { } private static Map<String, Object> getFomatterSettings(ICProject project) { - return new HashMap<String, Object>(project.getOptions(true)); + return new HashMap<>(project.getOptions(true)); } private void doFormat(IDocument document, Map<String, Object> options) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/GenerateActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/GenerateActionGroup.java index b2d369aea9e..9039ada687d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/GenerateActionGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/GenerateActionGroup.java @@ -114,7 +114,7 @@ public class GenerateActionGroup extends ActionGroup implements ISelectionChange private IWorkbenchSite fSite; private String fGroupName = IContextMenuConstants.GROUP_REORGANIZE; private List<ISelectionChangedListener> fRegisteredSelectionListeners; - private List<RefactoringAction> fRefactorActions = new ArrayList<RefactoringAction>(); + private List<RefactoringAction> fRefactorActions = new ArrayList<>(); private AddIncludeAction fAddInclude; // private OverrideMethodsAction fOverrideMethods; @@ -366,7 +366,7 @@ public class GenerateActionGroup extends ActionGroup implements ISelectionChange private void registerSelectionListener(ISelectionProvider provider, ISelectionChangedListener listener) { if (fRegisteredSelectionListeners == null) - fRegisteredSelectionListeners = new ArrayList<ISelectionChangedListener>(10); + fRegisteredSelectionListeners = new ArrayList<>(10); provider.addSelectionChangedListener(listener); fRegisteredSelectionListeners.add(listener); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java index 17aecc4fe77..33b2b3e6e20 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/MemberFilterActionGroup.java @@ -184,7 +184,7 @@ public class MemberFilterActionGroup extends ActionGroup { fFilter = new MemberFilter(); String title, helpContext; - ArrayList<MemberFilterAction> actions = new ArrayList<MemberFilterAction>(4); + ArrayList<MemberFilterAction> actions = new ArrayList<>(4); // fields int filterProperty = FILTER_FIELDS; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java index 9fc01e9cdf6..171de36b46c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java @@ -70,7 +70,7 @@ public abstract class AbstractBinaryParserPage extends AbstractCOptionPage { } private void initializeParserPageMap() { - fParserPageMap = new HashMap<String, BinaryParserPageConfiguration>(5); + fParserPageMap = new HashMap<>(5); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java index ce82e16113b..5ee47eba6ee 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java @@ -52,7 +52,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage { private static String[] EMPTY = new String[0]; private Preferences fPrefs; - protected HashMap<String, String> mapParsers = new HashMap<String, String>(); + protected HashMap<String, String> mapParsers = new HashMap<>(); private CheckedListDialogField<String> fErrorParserList; protected boolean listDirty = false; @@ -139,7 +139,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage { String[] empty = new String[0]; if (parserIDs != null && parserIDs.length() > 0) { StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$ - List<String> list = new ArrayList<String>(tok.countTokens()); + List<String> list = new ArrayList<>(tok.countTokens()); while (tok.hasMoreElements()) { list.add(tok.nextToken()); } @@ -271,7 +271,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage { null, CUIMessages.AbstractErrorParserBlock_label_selectAll, CUIMessages.AbstractErrorParserBlock_label_unselectAll }; - fErrorParserList = new CheckedListDialogField<String>(null, buttonLabels, getLabelProvider()); + fErrorParserList = new CheckedListDialogField<>(null, buttonLabels, getLabelProvider()); fErrorParserList.setDialogFieldListener(getFieldListenerAdapter()); fErrorParserList.setLabelText(CUIMessages.AbstractErrorParserBlock_label_errorParsers); fErrorParserList.setUpButtonIndex(0); @@ -295,7 +295,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage { monitor.beginTask(CUIMessages.AbstractErrorParserBlock_task_setErrorParser, 1); List<String> elements = fErrorParserList.getElements(); int count = elements.size(); - List<Object> list = new ArrayList<Object>(count); + List<Object> list = new ArrayList<>(count); for (int i = 0; i < count; i++) { Object obj = elements.get(i); if (fErrorParserList.isChecked(obj)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java index 0aeb9c93126..3df74d0573a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java @@ -162,7 +162,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { CCorePlugin.BINARY_PARSER_SIMPLE_ID); if (point != null) { IExtension[] exts = point.getExtensions(); - configMap = new HashMap<String, BinaryParserConfiguration>(exts.length); + configMap = new HashMap<>(exts.length); for (IExtension ext : exts) { if (isExtensionVisible(ext)) { configMap.put(ext.getUniqueIdentifier(), new BinaryParserConfiguration(ext)); @@ -230,7 +230,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { } monitor.beginTask(CUIMessages.BinaryParserBlock_settingBinaryParser, 2); List<BinaryParserConfiguration> parsers = binaryList.getElements(); - final List<BinaryParserConfiguration> selected = new ArrayList<BinaryParserConfiguration>(); // must do this to get proper order. + final List<BinaryParserConfiguration> selected = new ArrayList<>(); // must do this to get proper order. for (int i = 0; i < parsers.size(); i++) { if (binaryList.isChecked(parsers.get(i))) { selected.add(parsers.get(i)); @@ -286,13 +286,13 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { public void setContainer(ICOptionContainer container) { super.setContainer(container); - List<BinaryParserConfiguration> elements = new ArrayList<BinaryParserConfiguration>(); + List<BinaryParserConfiguration> elements = new ArrayList<>(); if (getContainer().getProject() != null) { try { ICConfigExtensionReference[] ref = CCorePlugin.getDefault() .getDefaultBinaryParserExtensions(getContainer().getProject()); - initialSelected = new ArrayList<BinaryParserConfiguration>(ref.length); + initialSelected = new ArrayList<>(ref.length); for (ICConfigExtensionReference element : ref) { if (configMap.get(element.getID()) != null) { initialSelected.add(configMap.get(element.getID())); @@ -319,7 +319,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { if (id != null && id.length() > 0) { String[] ids = parseStringToArray(id); - initialSelected = new ArrayList<BinaryParserConfiguration>(ids.length); + initialSelected = new ArrayList<>(ids.length); for (String id2 : ids) { if (configMap.get(id2) != null) { initialSelected.add(configMap.get(id2)); @@ -352,7 +352,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { private String[] parseStringToArray(String syms) { if (syms != null && syms.length() > 0) { StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$ - ArrayList<String> list = new ArrayList<String>(tok.countTokens()); + ArrayList<String> list = new ArrayList<>(tok.countTokens()); while (tok.hasMoreElements()) { list.add(tok.nextToken()); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CHelpConfigurationPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CHelpConfigurationPropertyPage.java index bf71b40ba87..3451e6d51ec 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CHelpConfigurationPropertyPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CHelpConfigurationPropertyPage.java @@ -89,7 +89,7 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements IWor /* 0 */ CUIMessages.CHelpConfigurationPropertyPage_buttonLabels_CheckAll, /* 1 */ CUIMessages.CHelpConfigurationPropertyPage_buttonLabels_UncheckAll }; - fCHelpBookList = new CheckedListDialogField<CHelpBookDescriptor>(null, buttonLabels, + fCHelpBookList = new CheckedListDialogField<>(null, buttonLabels, new CHelpBookListLabelProvider()); fCHelpBookList.setLabelText(CUIMessages.CHelpConfigurationPropertyPage_HelpBooks); fCHelpBookList.setCheckAllButtonIndex(0); @@ -136,7 +136,7 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements IWor private List<CHelpBookDescriptor> getEnabledEntries(List<CHelpBookDescriptor> list) { int size = list.size(); - List<CHelpBookDescriptor> desList = new ArrayList<CHelpBookDescriptor>(); + List<CHelpBookDescriptor> desList = new ArrayList<>(); for (int i = 0; i < size; i++) { CHelpBookDescriptor el = list.get(i); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerCombo.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerCombo.java index 4c2422634c2..5ca135269fe 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerCombo.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerCombo.java @@ -53,7 +53,7 @@ public class DocCommentOwnerCombo extends Composite { * test plug-in. */ private static IDocCommentOwner[] getNontestOwners() { - List<IDocCommentOwner> result = new ArrayList<IDocCommentOwner>(); + List<IDocCommentOwner> result = new ArrayList<>(); for (IDocCommentOwner owner : DocCommentOwnerManager.getInstance().getRegisteredOwners()) { if (owner.getID().indexOf(".test.") == -1) //$NON-NLS-1$ result.add(owner); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java index 205e50c643e..dd7cf4c4bf3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java @@ -508,7 +508,7 @@ public class IndexerBlock extends AbstractCOptionPage { * Adds all the contributed Indexer Pages to a map */ private void initializeIndexerConfigMap() { - fIndexerConfigMap = new HashMap<String, IndexerConfig>(5); + fIndexerConfigMap = new HashMap<>(5); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.getPluginId(), "IndexerPage"); //$NON-NLS-1$ IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java index 6f4e7f27e8c..08275cb8469 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/ReferenceBlock.java @@ -80,7 +80,7 @@ public class ReferenceBlock extends AbstractCOptionPage { public Object[] getChildren(Object element) { if (!(element instanceof IWorkspace)) return new Object[0]; - ArrayList<IProject> aList = new ArrayList<IProject>(15); + ArrayList<IProject> aList = new ArrayList<>(15); final IProject[] projects = ((IWorkspace) element).getRoot().getProjects(); for (int i = 0; i < projects.length; i++) { if (CoreModel.hasCNature(projects[i])) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/RegexErrorParserOptionPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/RegexErrorParserOptionPage.java index 22e31359a26..d12833e3f14 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/RegexErrorParserOptionPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/RegexErrorParserOptionPage.java @@ -97,7 +97,7 @@ public final class RegexErrorParserOptionPage extends AbstractCOptionPage { private RegexErrorParser fErrorParser; private boolean fEditable; - private List<Listener> fListeners = new ArrayList<Listener>(); + private List<Listener> fListeners = new ArrayList<>(); /** * Provides generic implementation for overridden methods. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java index 7bd1059fc37..3f9d4e10a4d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java @@ -46,7 +46,7 @@ public abstract class TabFolderOptionBlock { private boolean bIsValid = true; private Label messageLabel; - private ArrayList<ICOptionPage> pages = new ArrayList<ICOptionPage>(); + private ArrayList<ICOptionPage> pages = new ArrayList<>(); protected ICOptionContainer fParent; private ICOptionPage fCurrentPage; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractExportTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractExportTab.java index 0cf3b39b36c..c8b09f4c3c3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractExportTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractExportTab.java @@ -71,8 +71,8 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab { public static final Image IMG_MK = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_MACRO); private static final String ALL = Messages.AbstractExportTab_0; private static final String LIST = Messages.AbstractExportTab_1; - private static Map<String, String> names_l = new HashMap<String, String>(); - private static Map<String, String> names_t = new HashMap<String, String>(); + private static Map<String, String> names_l = new HashMap<>(); + private static Map<String, String> names_t = new HashMap<>(); private static String[] names_ls; private static String[] names_ts; private List<String> namesList; @@ -193,8 +193,8 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab { if (x == -1) x = 0; - namesList = new ArrayList<String>(); - ArrayList<ExtData> lst = new ArrayList<ExtData>(); + namesList = new ArrayList<>(); + ArrayList<ExtData> lst = new ArrayList<>(); ICExternalSetting[] vals = cfg.getExternalSettings(); if (vals == null || vals.length == 0) { tv.setInput(null); @@ -309,7 +309,7 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab { if (old.entry.isReadOnly() || old.entry.isBuiltIn()) continue; ICSettingEntry[] ls = old.setting.getEntries(getKind()); - ArrayList<ICSettingEntry> lst = new ArrayList<ICSettingEntry>(); + ArrayList<ICSettingEntry> lst = new ArrayList<>(); outer: for (ICSettingEntry se : ls) { for (int y = t; y < its.length; y++) { if (its[y] == null) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java index 971b62c0df0..0624b22caad 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java @@ -406,7 +406,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { } protected LinkedList<ICLanguageSettingEntry> getIncs() { - LinkedList<ICLanguageSettingEntry> l = new LinkedList<ICLanguageSettingEntry>(); + LinkedList<ICLanguageSettingEntry> l = new LinkedList<>(); List<ICLanguageSettingEntry> lst = getSettingEntriesList(getKind()); if (lst != null) { for (ICLanguageSettingEntry ent : lst) { @@ -473,7 +473,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { } private void updateExport() { - exported = new ArrayList<ICSettingEntry>(); + exported = new ArrayList<>(); ICExternalSetting[] extSettings = getResDesc().getConfiguration().getExternalSettings(); if (!(extSettings == null || extSettings.length == 0)) { for (ICExternalSetting extSetting : extSettings) { @@ -531,7 +531,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { ICLanguageSetting[] langSettings = (ICLanguageSetting[]) ms.getItems(); ICLanguageSettingEntry[][] es = ms.getSettingEntriesM(getKind()); for (int i = 0; i < langSettings.length; i++) { - List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(Arrays.asList(es[i])); + List<ICLanguageSettingEntry> entries = new ArrayList<>(Arrays.asList(es[i])); if (del != null) { for (ICLanguageSettingEntry entry : entries) { if (entry.getName().equals(del.getName())) { @@ -842,7 +842,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { ICLanguageSetting[] fs = conv2LS(CDTPrefUtil.getListForDisplay(lsArray2D, comp)); lsets = new ICLanguageSetting[fs.length]; for (int i = 0; i < fs.length; i++) { - ArrayList<ICLanguageSetting> list = new ArrayList<ICLanguageSetting>(lsArray2D.length); + ArrayList<ICLanguageSetting> list = new ArrayList<>(lsArray2D.length); for (ICLanguageSetting[] lsArray : lsArray2D) { int x = Arrays.binarySearch(lsArray, fs[i], comp); if (x >= 0) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java index 56129b8b31e..4afc24e5cf0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java @@ -151,8 +151,8 @@ public abstract class AbstractPage extends PropertyPage implements IPreferencePa private static final String PREF_ASK_REINDEX = "askReindex"; //$NON-NLS-1$ - private Map<URL, Image> loadedIcons = new HashMap<URL, Image>(); - private static Map<Class<? extends AbstractPage>, Class<? extends ICPropertyTab>> recentTabs = new HashMap<Class<? extends AbstractPage>, Class<? extends ICPropertyTab>>(); + private Map<URL, Image> loadedIcons = new HashMap<>(); + private static Map<Class<? extends AbstractPage>, Class<? extends ICPropertyTab>> recentTabs = new HashMap<>(); private final Image IMG_WARN = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_REFACTORING_WARNING); /* @@ -177,7 +177,7 @@ public abstract class AbstractPage extends PropertyPage implements IPreferencePa // tabs protected TabFolder folder; - protected ArrayList<InternalTab> itabs = new ArrayList<InternalTab>(); + protected ArrayList<InternalTab> itabs = new ArrayList<>(); protected ICPropertyTab currentTab; private static boolean isNewOpening = true; @@ -1124,7 +1124,7 @@ public abstract class AbstractPage extends PropertyPage implements IPreferencePa if (extensions == null) return; - List<IConfigurationElement> elements = new ArrayList<IConfigurationElement>(); + List<IConfigurationElement> elements = new ArrayList<>(); for (IExtension ext : extensions) elements.addAll(Arrays.asList(ext.getConfigurationElements())); Collections.sort(elements, CDTUIListComparator.getInstance()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java index 53c89f7c3c8..2aa6d8ebd2b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java @@ -238,7 +238,7 @@ public class BinaryParsTab extends AbstractCPropertyTab { ids = CoreModelUtil.getBinaryParserIds(cfgs); } Object[] data = new Object[configMap.size()]; - HashMap<String, BinaryParserConfiguration> clone = new HashMap<String, BinaryParserConfiguration>(configMap); + HashMap<String, BinaryParserConfiguration> clone = new HashMap<>(configMap); // add checked elements int i; for (i = 0; i < ids.length; i++) { @@ -268,7 +268,7 @@ public class BinaryParsTab extends AbstractCPropertyTab { CCorePlugin.BINARY_PARSER_SIMPLE_ID); if (point != null) { IExtension[] exts = point.getExtensions(); - configMap = new HashMap<String, BinaryParserConfiguration>(exts.length); + configMap = new HashMap<>(exts.length); for (IExtension ext : exts) { if (isExtensionVisible(ext)) { configMap.put(ext.getUniqueIdentifier(), new BinaryParserConfiguration(ext)); @@ -278,7 +278,7 @@ public class BinaryParsTab extends AbstractCPropertyTab { } private void initializeParserPageMap() { - fParserPageMap = new HashMap<String, BinaryParserPageConfiguration>(5); + fParserPageMap = new HashMap<>(5); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java index 7e15cb2e43f..5a967bf4567 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java @@ -110,7 +110,7 @@ public class CDTPrefUtil { // up-level methods public static void readPreferredTCs() { - preferredTCs = new LinkedList<String>(Arrays.asList(getStr(KEY_PREFTC).split(DELIMITER))); + preferredTCs = new LinkedList<>(Arrays.asList(getStr(KEY_PREFTC).split(DELIMITER))); } public static List<String> getPreferredTCs() { @@ -303,7 +303,7 @@ public class CDTPrefUtil { return EMPTY_ARRAY; if (getMultiCfgStringListDisplayMode() == DMODE_CONJUNCTION) { - ArrayList<Object> lst = new ArrayList<Object>(); + ArrayList<Object> lst = new ArrayList<>(); for (int i = 0; i < s1.length; i++) { if (s1[i] == null) continue; @@ -327,7 +327,7 @@ public class CDTPrefUtil { } return lst.toArray(); } - TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles + TreeSet<Object> lst = new TreeSet<>(cmp); // set, to avoid doubles for (Object[] element : input) { if (element == null || element.length == 0) { continue; @@ -346,7 +346,7 @@ public class CDTPrefUtil { */ @Deprecated public static List<String> readConfigSets() { - return new LinkedList<String>(Arrays.asList(getStr(KEY_CONFSET).split(CONFSETDEL))); + return new LinkedList<>(Arrays.asList(getStr(KEY_CONFSET).split(CONFSETDEL))); } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPropertyManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPropertyManager.java index b900b0fb276..6894685ee8a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPropertyManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPropertyManager.java @@ -53,7 +53,7 @@ import org.eclipse.ui.dialogs.PropertyPage; */ public class CDTPropertyManager { - private static ArrayList<Object> pages = new ArrayList<Object>(); + private static ArrayList<Object> pages = new ArrayList<>(); private static ICProjectDescription prjd = null; private static boolean saveDone = false; private static IProject project = null; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java index 7fd9b9e553c..79569eba077 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java @@ -303,7 +303,7 @@ public abstract class CLocationTab extends AbstractCPropertyTab { setAllVisible(true, null); - src = new ArrayList<_Entry>(); + src = new ArrayList<>(); _Entry selectedSourcePath = null; for (ICExclusionPatternPathEntry e : getEntries(cfgd)) { _Entry entry = new _Entry(e); @@ -355,7 +355,7 @@ public abstract class CLocationTab extends AbstractCPropertyTab { } private String[] getProjectDialog(Shell shell) { - Set<IPath> set = new HashSet<IPath>(src.size()); + Set<IPath> set = new HashSet<>(src.size()); for (_Entry e : src) set.add(e.getPath()); @@ -531,7 +531,7 @@ public abstract class CLocationTab extends AbstractCPropertyTab { if (page.getElement() instanceof IFolder) { IFolder folder = (IFolder) page.getElement(); - List<Holder> list = new ArrayList<Holder>(); + List<Holder> list = new ArrayList<>(); list.add(new Holder(folder)); for (IContainer parentFolder = folder .getParent(); parentFolder instanceof IFolder; parentFolder = parentFolder.getParent()) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvironmentTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvironmentTab.java index fb22ddaf045..1884ab32b44 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvironmentTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/EnvironmentTab.java @@ -74,7 +74,7 @@ public class EnvironmentTab extends AbstractCPropertyTab { private Table table; private TableViewer tv; - private ArrayList<TabData> data = new ArrayList<TabData>(); + private ArrayList<TabData> data = new ArrayList<>(); private Button b1, b2; private StringListModeControl stringListModeControl; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ErrorParsTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ErrorParsTab.java index af0bf848796..86c060992f0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ErrorParsTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ErrorParsTab.java @@ -99,8 +99,8 @@ public class ErrorParsTab extends AbstractCPropertyTab { private static Map<String, IErrorParserNamed> fExtensionErrorParsers = null; - private final Map<String, IErrorParserNamed> fAvailableErrorParsers = new LinkedHashMap<String, IErrorParserNamed>(); - private final Map<String, ICOptionPage> fOptionsPageMap = new HashMap<String, ICOptionPage>(); + private final Map<String, IErrorParserNamed> fAvailableErrorParsers = new LinkedHashMap<>(); + private final Map<String, ICOptionPage> fOptionsPageMap = new HashMap<>(); private ICOptionPage fCurrentOptionsPage = null; private Composite fCompositeForOptionsPage; @@ -235,7 +235,7 @@ public class ErrorParsTab extends AbstractCPropertyTab { private void initMapParsers() { if (fExtensionErrorParsers == null) { - fExtensionErrorParsers = new LinkedHashMap<String, IErrorParserNamed>(); + fExtensionErrorParsers = new LinkedHashMap<>(); String[] idsExt = ErrorParserManager.getErrorParserExtensionIds(); for (String idExt : idsExt) { IErrorParserNamed errorParserExt = ErrorParserManager.getErrorParserExtensionCopy(idExt); @@ -259,7 +259,7 @@ public class ErrorParsTab extends AbstractCPropertyTab { } else { ids = srcCfgDesc.getBuildSetting().getErrorParserIDs(); } - Set<String> setIds = new LinkedHashSet<String>(Arrays.asList(ids)); + Set<String> setIds = new LinkedHashSet<>(Arrays.asList(ids)); setIds.addAll(fAvailableErrorParsers.keySet()); fTableViewer.setInput(setIds.toArray(new String[0])); } else { @@ -551,7 +551,7 @@ public class ErrorParsTab extends AbstractCPropertyTab { if (fCfgDesc == null) { // Build Settings page try { - List<IErrorParserNamed> errorParsersList = new ArrayList<IErrorParserNamed>(fTable.getItemCount()); + List<IErrorParserNamed> errorParsersList = new ArrayList<>(fTable.getItemCount()); for (TableItem item : fTable.getItems()) { if (item.getData() instanceof String) { String id = (String) item.getData(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ExPatternDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ExPatternDialog.java index 95c91ea2779..d8f5aba476d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ExPatternDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ExPatternDialog.java @@ -88,7 +88,7 @@ public class ExPatternDialog extends StatusDialog { ExclusionPatternAdapter adapter = new ExclusionPatternAdapter(); - fExclusionPatternList = new ListDialogField<String>(adapter, buttonLabels, new ExPatternLabelProvider()); + fExclusionPatternList = new ListDialogField<>(adapter, buttonLabels, new ExPatternLabelProvider()); fExclusionPatternList.setDialogFieldListener(adapter); fExclusionPatternList.setLabelText(label); fExclusionPatternList.setRemoveButtonIndex(IDX_REMOVE); @@ -100,7 +100,7 @@ public class ExPatternDialog extends StatusDialog { fCurrSourceFolder = (IContainer) res; } - ArrayList<String> elements = new ArrayList<String>(pattern.length); + ArrayList<String> elements = new ArrayList<>(pattern.length); for (IPath p : pattern) elements.add(p.toString()); fExclusionPatternList.setElements(elements); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java index bb74ad4ea89..fa50ec6c52c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java @@ -78,7 +78,7 @@ public class ManageConfigSelector { * @return array with only new-style projects included */ public static IProject[] getProjects(Object[] obs) { - ArrayList<IProject> lst = new ArrayList<IProject>(); + ArrayList<IProject> lst = new ArrayList<>(); if (obs != null) { for (Object ob : obs) { IProject prj = null; @@ -121,7 +121,7 @@ public class ManageConfigSelector { if (extensions == null) return; - ArrayList<IConfigManager> list = new ArrayList<IConfigManager>(); + ArrayList<IConfigManager> list = new ArrayList<>(); for (int i = 0; i < extensions.length; ++i) { IConfigurationElement[] elements = extensions[i].getConfigurationElements(); for (int k = 0; k < elements.length; k++) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java index 3bff85563e7..c2785f03f3c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java @@ -158,7 +158,7 @@ public class RefsTab extends AbstractCPropertyTab { Map<String, String> oldMapping = getResDesc().getConfiguration().getReferenceInfo(); TreeItem ti = tree.getSelection()[0]; String projectName = ti.getText(); - List<String> projNames = new ArrayList<String>(oldMapping.keySet()); + List<String> projNames = new ArrayList<>(oldMapping.keySet()); int index = projNames.indexOf(projectName); if (n == MOVEUP_BUTTON) { if (index > 0) { @@ -171,7 +171,7 @@ public class RefsTab extends AbstractCPropertyTab { projNames.set(index + 1, projectName); } } - Map<String, String> newMapping = new LinkedHashMap<String, String>(oldMapping.size()); + Map<String, String> newMapping = new LinkedHashMap<>(oldMapping.size()); for (String name : projNames) newMapping.put(name, oldMapping.get(name)); getResDesc().getConfiguration().setReferenceInfo(newMapping); @@ -200,7 +200,7 @@ public class RefsTab extends AbstractCPropertyTab { * Persist the checked configurations */ private void saveChecked() { - Map<String, String> refs = new LinkedHashMap<String, String>(); + Map<String, String> refs = new LinkedHashMap<>(); for (TreeItem project : tree.getItems()) { if (project.getChecked()) { if (project.getData() instanceof String) { @@ -237,7 +237,7 @@ public class RefsTab extends AbstractCPropertyTab { private void initData() { // Persist the current select / expand state to restore... String currentSelection = tree.getSelectionCount() == 1 ? tree.getSelection()[0].getText() : null; - Set<String> currentExpanded = new HashSet<String>(); + Set<String> currentExpanded = new HashSet<>(); for (TreeItem ti : tree.getItems()) if (ti.getExpanded()) currentExpanded.add(ti.getText()); @@ -251,7 +251,7 @@ public class RefsTab extends AbstractCPropertyTab { Map<String, String> refs = getResDesc().getConfiguration().getReferenceInfo(); // Preserve project order. All linked to projects occur before others - Set<String> projects = new LinkedHashSet<String>(refs.keySet()); + Set<String> projects = new LinkedHashSet<>(refs.keySet()); for (IProject prj : p.getWorkspace().getRoot().getProjects()) projects.add(prj.getName()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StringListModeControl.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StringListModeControl.java index a320348da8e..3ac3979fa07 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StringListModeControl.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/StringListModeControl.java @@ -37,7 +37,7 @@ public class StringListModeControl { private static final String STRING_LIST_MODE_PREFERENCE_PAGE = "org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_MultiConfig"; //$NON-NLS-1$ private ICPropertyProvider page; private Link linkStringListMode; - private List<Listener> listeners = new ArrayList<Listener>(); + private List<Listener> listeners = new ArrayList<>(); /** * Constructor. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/CRefactoringActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/CRefactoringActionGroup.java index 66149813d43..c68c0a5a6cf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/CRefactoringActionGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/refactoring/actions/CRefactoringActionGroup.java @@ -120,7 +120,7 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh private RefactoringAction fToggleFunctionAction; private RefactoringAction fHideMethodAction; private IWorkbenchSite fSite; - private List<RefactoringAction> fAllActions = new ArrayList<RefactoringAction>(); + private List<RefactoringAction> fAllActions = new ArrayList<>(); public CRefactoringActionGroup(IWorkbenchPart part) { this(part, null); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/resources/RefreshExclusionContributionManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/resources/RefreshExclusionContributionManager.java index 90cc789b062..4d8c0015046 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/resources/RefreshExclusionContributionManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/resources/RefreshExclusionContributionManager.java @@ -50,7 +50,7 @@ public class RefreshExclusionContributionManager { private LinkedHashMap<String, RefreshExclusionContributor> fIDtoContributorsMap; private RefreshExclusionContributionManager() { - fIDtoContributorsMap = new LinkedHashMap<String, RefreshExclusionContributor>(); + fIDtoContributorsMap = new LinkedHashMap<>(); loadExtensions(); } @@ -63,7 +63,7 @@ public class RefreshExclusionContributionManager { } public List<RefreshExclusionContributor> getContributors(boolean returnTestContributors) { - List<RefreshExclusionContributor> retVal = new LinkedList<RefreshExclusionContributor>(); + List<RefreshExclusionContributor> retVal = new LinkedList<>(); if (!returnTestContributors) { for (RefreshExclusionContributor contributor : fIDtoContributorsMap.values()) { @@ -76,7 +76,7 @@ public class RefreshExclusionContributionManager { } else { - return new LinkedList<RefreshExclusionContributor>(fIDtoContributorsMap.values()); + return new LinkedList<>(fIDtoContributorsMap.values()); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/AbstractCScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/AbstractCScanner.java index c72e22b2e63..bcd10fedd78 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/AbstractCScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/AbstractCScanner.java @@ -46,7 +46,7 @@ public abstract class AbstractCScanner extends BufferedRuleBasedScanner implemen */ public AbstractCScanner(ITokenStore tokenStore) { fTokenStore = tokenStore; - fParticipants = new ArrayList<IPropertyChangeParticipant>(); + fParticipants = new ArrayList<>(); } /** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenHelper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenHelper.java index 8737f6ba99c..1826a6e2299 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenHelper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenHelper.java @@ -61,7 +61,7 @@ public class DoxygenHelper extends AbstractPreferenceInitializer { if (fTags == null) { InputStream is = null; try { - List<GenericDocTag> temp = new ArrayList<GenericDocTag>(); + List<GenericDocTag> temp = new ArrayList<>(); is = FileLocator.openStream(CUIPlugin.getDefault().getBundle(), TAGS_CSV, false); BufferedReader br = new BufferedReader(new InputStreamReader(is)); StringBuilder content = new StringBuilder(2000); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java index a8a7da71f0e..adb34568c6a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java @@ -281,7 +281,7 @@ public class DoxygenMultilineAutoEditStrategy extends DefaultMultilineCommentAut } boolean noCollisions = true; - LinkedHashSet<Entry> entries = new LinkedHashSet<Entry>(); + LinkedHashSet<Entry> entries = new LinkedHashSet<>(); for (IASTEnumerator enumerator : enms) { IASTNodeLocation loc = enumerator.getName().getFileLocation(); if (loc != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCommentScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCommentScanner.java index 35e14a98362..ada55329c91 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCommentScanner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCommentScanner.java @@ -81,7 +81,7 @@ public class GenericTagCommentScanner extends BufferedRuleBasedScanner implement * @return the rules to use in this scanner */ protected IRule[] createRules() { - List<IRule> result = new ArrayList<IRule>(); + List<IRule> result = new ArrayList<>(); class TagDetector implements IWordDetector { @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCompletionProposalComputer.java index ade04e42cc3..e5b9b502f09 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCompletionProposalComputer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/generic/GenericTagCompletionProposalComputer.java @@ -73,7 +73,7 @@ public class GenericTagCompletionProposalComputer implements ICompletionProposal firstNonWS--; String prefix = doc.get(firstNonWS, ivcOffset - firstNonWS); if (prefix.length() > 0 && isTagMarker(prefix.charAt(0))) { - List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); + List<ICompletionProposal> proposals = new ArrayList<>(); char tagMarker = prefix.charAt(0); for (GenericDocTag tag2 : tags) { String tag = tag2.getTagName(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java index d56120c4087..eccdec4095e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java @@ -400,7 +400,7 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard String[] contentTypeIds = getContentTypeIDs(); if (contentTypeIds.length > 0) { IContentTypeManager manager = Platform.getContentTypeManager(); - List<String> languageIDs = new ArrayList<String>(); + List<String> languageIDs = new ArrayList<>(); for (int i = 0; i < contentTypeIds.length; ++i) { IContentType contentType = manager.getContentType(contentTypeIds[i]); if (null != contentType) { @@ -425,7 +425,7 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard String[] contentTypeIds = getContentTypeIDs(); if (contentTypeIds.length > 0) { IContentTypeManager manager = Platform.getContentTypeManager(); - List<String> extensions = new ArrayList<String>(); + List<String> extensions = new ArrayList<>(); for (int i = 0; i < contentTypeIds.length; ++i) { IContentType contentType = manager.getContentType(contentTypeIds[i]); if (null != contentType) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java index ea368304025..59a335cb7b2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java @@ -276,7 +276,7 @@ public class CDTMainWizardPage extends WizardNewProjectCreationPage implements I if (extensions == null) return null; - List<EntryDescriptor> items = new ArrayList<EntryDescriptor>(); + List<EntryDescriptor> items = new ArrayList<>(); for (int i = 0; i < extensions.length; ++i) { IConfigurationElement[] elements = extensions[i].getConfigurationElements(); for (IConfigurationElement element : elements) { @@ -310,7 +310,7 @@ public class CDTMainWizardPage extends WizardNewProjectCreationPage implements I // items filtering if (ls != null) { // NULL means call from prefs List<EntryDescriptor> filteredItems = ls.filterItems(items); - List<EntryDescriptor> newItems = new ArrayList<EntryDescriptor>(filteredItems); + List<EntryDescriptor> newItems = new ArrayList<>(filteredItems); // Add parent folders for (EntryDescriptor ed : filteredItems) { @@ -397,8 +397,8 @@ public class CDTMainWizardPage extends WizardNewProjectCreationPage implements I // Sorting is disabled because of users requests // Collections.sort(items, CDTListComparator.getInstance()); - ArrayList<TreeItem> placedTreeItemsList = new ArrayList<TreeItem>(items.size()); - ArrayList<EntryDescriptor> placedEntryDescriptorsList = new ArrayList<EntryDescriptor>(items.size()); + ArrayList<TreeItem> placedTreeItemsList = new ArrayList<>(items.size()); + ArrayList<EntryDescriptor> placedEntryDescriptorsList = new ArrayList<>(items.size()); for (EntryDescriptor wd : items) { if (wd.getParentId() == null) { wd.setPath(wd.getId()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java index ad968200931..7ec5f86869a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java @@ -402,7 +402,7 @@ public abstract class ConvertProjectWizardPage extends WizardPage { IWorkspace workspace = CUIPlugin.getWorkspace(); IProject[] projects = workspace.getRoot().getProjects(); - Vector<IProject> candidates = new Vector<IProject>(projects.length); + Vector<IProject> candidates = new Vector<>(projects.length); IProject next = null; // ensure we only present open, valid candidates to the user |