Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2014-05-20 02:52:37 +0000
committerSergey Prigogin2014-05-20 21:12:32 +0000
commit7e64f6a1329f5978703c5671618326f6226aefeb (patch)
tree16713e361d61048bae4b9a3c01b986e292d36124
parent009a3a7d5f835b2aedf62424dd3929c229d10559 (diff)
downloadorg.eclipse.cdt-7e64f6a1329f5978703c5671618326f6226aefeb.tar.gz
org.eclipse.cdt-7e64f6a1329f5978703c5671618326f6226aefeb.tar.xz
org.eclipse.cdt-7e64f6a1329f5978703c5671618326f6226aefeb.zip
Cosmetics.
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeCreator.java25
2 files changed, 14 insertions, 15 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java
index f6af972a253..6f87d569a17 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java
@@ -134,9 +134,7 @@ public class AddIncludeAction extends TextEditorAction {
manager.beginCompoundChange();
try {
edit.apply(document);
- } catch (MalformedTreeException e) {
- CUIPlugin.log(e);
- } catch (BadLocationException e) {
+ } catch (MalformedTreeException | BadLocationException e) {
CUIPlugin.log(e);
}
manager.endCompoundChange();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeCreator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeCreator.java
index cbc54a86ba4..2b256e8ebc8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeCreator.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeCreator.java
@@ -133,13 +133,13 @@ public class IncludeCreator {
return rootEdit;
}
- final Map<String, IncludeCandidate> candidatesMap= new HashMap<String, IncludeCandidate>();
+ final Map<String, IncludeCandidate> candidatesMap= new HashMap<>();
final IndexFilter filter = IndexFilter.getDeclaredBindingFilter(ast.getLinkage().getLinkageID(), false);
- final List<IncludeInfo> requiredIncludes = new ArrayList<IncludeInfo>();
- final List<UsingDeclaration> usingDeclarations = new ArrayList<UsingDeclaration>();
+ final List<IncludeInfo> requiredIncludes = new ArrayList<>();
+ final List<UsingDeclaration> usingDeclarations = new ArrayList<>();
- List<IIndexBinding> bindings = new ArrayList<IIndexBinding>();
+ List<IIndexBinding> bindings = new ArrayList<>();
try {
IIndex index = fContext.getIndex();
IIndexBinding adaptedBinding= index.adaptBinding(binding);
@@ -184,7 +184,7 @@ public class IncludeCreator {
considerForInclusion(definition, macro, index, headerSubstitutor, candidatesMap);
}
- final ArrayList<IncludeCandidate> candidates = new ArrayList<IncludeCandidate>(candidatesMap.values());
+ final ArrayList<IncludeCandidate> candidates = new ArrayList<>(candidatesMap.values());
if (candidates.size() > 1) {
IncludeCandidate candidate = fAmbiguityResolver.selectElement(candidates);
if (candidate == null)
@@ -245,7 +245,7 @@ public class IncludeCreator {
IASTPreprocessorIncludeStatement[] existingIncludes = ast.getIncludeDirectives();
fContext.addHeadersIncludedPreviously(existingIncludes);
- List<StyledInclude> styledIncludes = new ArrayList<StyledInclude>();
+ List<StyledInclude> styledIncludes = new ArrayList<>();
// Put the new includes into styledIncludes.
for (IncludeInfo includeInfo : includes) {
IPath header = fContext.resolveInclude(includeInfo);
@@ -258,7 +258,7 @@ public class IncludeCreator {
Collections.sort(styledIncludes, preferences);
// Populate list of existing includes in the include insertion region.
- List<StyledInclude> mergedIncludes = new ArrayList<StyledInclude>();
+ List<StyledInclude> mergedIncludes = new ArrayList<>();
for (IASTPreprocessorIncludeStatement include : existingIncludes) {
if (include.isPartOfTranslationUnitFile() && isContainedInRegion(include, includeRegion)) {
String name = new String(include.getName().getSimpleID());
@@ -333,7 +333,7 @@ public class IncludeCreator {
if (usingDeclaration.existingDeclaration.isPartOfTranslationUnitFile() &&
ASTNodes.endOffset(usingDeclaration.existingDeclaration) <= selection.getOffset()) {
if (temp == null)
- temp = new ArrayList<UsingDeclaration>();
+ temp = new ArrayList<>();
temp.add(usingDeclaration);
}
}
@@ -386,7 +386,7 @@ public class IncludeCreator {
}
private List<UsingDeclaration> getUsingDeclarations(IASTTranslationUnit ast) {
- List<UsingDeclaration> usingDeclarations = new ArrayList<UsingDeclaration>();
+ List<UsingDeclaration> usingDeclarations = new ArrayList<>();
IASTDeclaration[] declarations = ast.getDeclarations();
for (IASTDeclaration declaration : declarations) {
if (declaration instanceof ICPPASTUsingDeclaration) {
@@ -508,7 +508,7 @@ public class IncludeCreator {
* For ns1::ns2::Name, e.g., it returns [Name, ns2, ns1].
*/
private ArrayList<String> getUsingChain(IBinding binding) {
- ArrayList<String> chain = new ArrayList<String>(4);
+ ArrayList<String> chain = new ArrayList<>(4);
for (; binding != null; binding = binding.getOwner()) {
String name = binding.getName();
if (binding instanceof ICPPNamespace) {
@@ -534,9 +534,9 @@ public class IncludeCreator {
if (isWorkspaceFile(headerFile.getLocation().getURI())) {
return headerFile;
}
- ArrayDeque<IIndexFile> front = new ArrayDeque<IIndexFile>();
+ ArrayDeque<IIndexFile> front = new ArrayDeque<>();
front.add(headerFile);
- HashSet<IIndexFile> processed = new HashSet<IIndexFile>();
+ HashSet<IIndexFile> processed = new HashSet<>();
processed.add(headerFile);
while (!front.isEmpty()) {
IIndexFile file = front.remove();
@@ -680,6 +680,7 @@ public class IncludeCreator {
/**
* Returns the fully qualified name for a given index binding.
+ *
* @param binding
* @return binding's fully qualified name
* @throws CoreException

Back to the top