aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2018-09-03 22:46:22 +0200
committerRoel Spilker <r.spilker@gmail.com>2018-09-03 22:46:22 +0200
commitf1c9909bd4e7560cc908e257a94e612ed3970f8c (patch)
tree945e0d1c76520cb064e7e25c4e479e2108338087 /src
parenta29c17761c8e319f93874ada007cb3322329fba7 (diff)
downloadlombok-f1c9909bd4e7560cc908e257a94e612ed3970f8c.tar.gz
lombok-f1c9909bd4e7560cc908e257a94e612ed3970f8c.tar.bz2
lombok-f1c9909bd4e7560cc908e257a94e612ed3970f8c.zip
Add Angular IDE support in installer, fixes #1830
Diffstat (limited to 'src')
-rw-r--r--src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java44
-rw-r--r--src/installer/lombok/installer/eclipse/StandardProductDescriptor.java15
-rw-r--r--src/installer/lombok/installer/eclipse/angular.pngbin0 -> 1012 bytes
3 files changed, 58 insertions, 1 deletions
diff --git a/src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java b/src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java
new file mode 100644
index 00000000..6d580e13
--- /dev/null
+++ b/src/installer/lombok/installer/eclipse/AngularIDELocationProvider.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 The Project Lombok Authors.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok.installer.eclipse;
+
+import java.util.Collections;
+
+import org.mangosdk.spi.ProviderFor;
+
+import lombok.installer.IdeLocationProvider;
+
+@ProviderFor(IdeLocationProvider.class)
+public class AngularIDELocationProvider extends EclipseProductLocationProvider {
+
+ private static final EclipseProductDescriptor ANGULAR = new StandardProductDescriptor(
+ "Angular IDE",
+ "angularide",
+ "angular",
+ AngularIDELocationProvider.class.getResource("angular.png"),
+ Collections.<String>emptySet()
+ );
+
+ public AngularIDELocationProvider() {
+ super(ANGULAR);
+ }
+}
diff --git a/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java b/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
index 47e103aa..9bd3ae94 100644
--- a/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
+++ b/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
@@ -21,6 +21,7 @@
*/
package lombok.installer.eclipse;
+import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,7 +35,7 @@ import lombok.installer.OsUtils;
public class StandardProductDescriptor implements EclipseProductDescriptor {
private static final String USER_HOME = System.getProperty("user.home", ".");
- private static final String[] WINDOWS_ROOTS = {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME};
+ private static final String[] WINDOWS_ROOTS = windowsRoots();
private static final String[] MAC_ROOTS = {"/Applications", USER_HOME};
private static final String[] UNIX_ROOTS = {USER_HOME};
@@ -155,4 +156,16 @@ public class StandardProductDescriptor implements EclipseProductDescriptor {
}
return base + pathSeparator + alternative.replaceAll("[\\/]", "\\" + pathSeparator);
}
+
+ private static String[] windowsRoots() {
+ String localAppData = windowsLocalAppData();
+ if (localAppData == null) return new String[] {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME};
+ return new String[] {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME, localAppData};
+ }
+
+ private static String windowsLocalAppData() {
+ String localAppData = System.getenv("LOCALAPPDATA");
+ File file = localAppData == null ? null : new File(localAppData);
+ return file != null && file.exists() && file.canRead() && file.isDirectory() ? localAppData : null;
+ }
}
diff --git a/src/installer/lombok/installer/eclipse/angular.png b/src/installer/lombok/installer/eclipse/angular.png
new file mode 100644
index 00000000..d3204cd7
--- /dev/null
+++ b/src/installer/lombok/installer/eclipse/angular.png
Binary files differ