Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorNitin Dahyabhai2020-05-12 02:43:43 +0000
committerNitin Dahyabhai2020-05-12 03:34:00 +0000
commitaa89af54c60a8a985307388ea4fc6e5758b4f1f7 (patch)
tree5b19297e5499073cf3a0f966c9c7e1948cf5e3ef /web
parentada1d9f33323e21ea538ce42b6d3a7e629816b21 (diff)
downloadwebtools.sourceediting-aa89af54c60a8a985307388ea4fc6e5758b4f1f7.tar.gz
webtools.sourceediting-aa89af54c60a8a985307388ea4fc6e5758b4f1f7.tar.xz
webtools.sourceediting-aa89af54c60a8a985307388ea4fc6e5758b4f1f7.zip
[563074] slight optimization and cleanup
Diffstat (limited to 'web')
-rw-r--r--web/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/resources/ContentTypeSpecs.java3
-rw-r--r--web/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/contentassist/TestHTMLContentAssistComputers.java26
2 files changed, 14 insertions, 15 deletions
diff --git a/web/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/resources/ContentTypeSpecs.java b/web/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/resources/ContentTypeSpecs.java
index 0acf4a1451..203cd64185 100644
--- a/web/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/resources/ContentTypeSpecs.java
+++ b/web/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/resources/ContentTypeSpecs.java
@@ -35,12 +35,11 @@ public class ContentTypeSpecs {
// long startTime = System.currentTimeMillis();
List<String> filenameExtensions = new ArrayList<String>();
Set<String> filenames = new HashSet<>();
- Set<String> combinedBaseExtensions = new HashSet<>();
for (String contentTypeId: contentTypeIds) {
IContentType baseContentType = Platform.getContentTypeManager().getContentType(contentTypeId);
String[] baseExtensions = baseContentType.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
for (int i = 0; i < baseExtensions.length; i++) {
- combinedBaseExtensions.add(baseExtensions[i]);
+ filenameExtensions.add(baseExtensions[i]);
}
String[] names = baseContentType.getFileSpecs(IContentType.FILE_NAME_SPEC);
for (int j = 0; j < names.length; j++) {
diff --git a/web/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/contentassist/TestHTMLContentAssistComputers.java b/web/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/contentassist/TestHTMLContentAssistComputers.java
index c0417e269f..8fea01457e 100644
--- a/web/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/contentassist/TestHTMLContentAssistComputers.java
+++ b/web/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/contentassist/TestHTMLContentAssistComputers.java
@@ -190,12 +190,12 @@ public class TestHTMLContentAssistComputers extends TestCase {
strings[i] = paths[i].toString();
}
assertTrue(String.valueOf(paths.length).concat(StringUtils.pack(strings)), paths.length >= 6);
- assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/alsoempty.css")));
- assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/alsoempty.js")));
- assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/alsoempty.txt")));
- assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.css")));
- assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.js")));
- assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.txt")));
+ assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/alsoempty.css")));
+ assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/alsoempty.js")));
+ assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/alsoempty.txt")));
+ assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.css")));
+ assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.js")));
+ assertTrue(StringUtils.pack(strings), Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.txt")));
}
public void testResourceProposalsForImgSrc() throws Exception {
@@ -211,9 +211,9 @@ public class TestHTMLContentAssistComputers extends TestCase {
strings[i] = paths[i].toString();
}
assertEquals(String.valueOf(paths.length).concat(StringUtils.pack(strings)), 3, paths.length);
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/alsoempty.png")));
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.gif")));
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.png")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/alsoempty.png")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.gif")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.png")));
}
public void testResourceProposalsForLinkHref() throws Exception {
@@ -229,8 +229,8 @@ public class TestHTMLContentAssistComputers extends TestCase {
strings[i] = paths[i].toString();
}
assertEquals(String.valueOf(paths.length).concat(StringUtils.pack(strings)), 2, paths.length);
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/alsoempty.css")));
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.css")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/alsoempty.css")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.css")));
}
public void testResourceProposalsForScriptSrc() throws Exception {
@@ -246,8 +246,8 @@ public class TestHTMLContentAssistComputers extends TestCase {
strings[i] = paths[i].toString();
}
assertEquals(String.valueOf(paths.length).concat(StringUtils.pack(strings)), 2, paths.length);
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/alsoempty.js")));
- assertTrue(Arrays.asList(paths).stream().map((p)->p.toString()).anyMatch((s)->s.endsWith("/empty.js")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/alsoempty.js")));
+ assertTrue(Arrays.asList(paths).stream().map((proposedPath)->proposedPath.toString()).anyMatch((pathAsString)->pathAsString.endsWith("/empty.js")));
}
/**

Back to the top