mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 00:16:47 +00:00
Renamed all true names of 'eclipse' to 'Eclipse' (but not the eclipse package, of course),
and fixed a showstopper bug in the installer that would add -javaagent:lombok.jar to eclipse.ini, which is wrong of course; it needs to be lombok.eclipse.agent.jar.
This commit is contained in:
1 parent
8534a8e0a5
commit
f6778b0426
13 files changed
+75
-90
No files matched your search
+13
-13
@@ -36,11 +36,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Lombok wraps the AST produced by a target platform into its own AST system, mostly because both eclipse and javac
|
||||
* Lombok wraps the AST produced by a target platform into its own AST system, mostly because both Eclipse and javac
|
||||
* do not allow upward traversal (from a method to its owning type, for example).
|
||||
*
|
||||
* @param N The common type of all AST nodes in the internal representation of the target platform.
|
||||
* For example, JCTree for javac, and ASTNode for eclipse.
|
||||
* For example, JCTree for javac, and ASTNode for Eclipse.
|
||||
*/
|
||||
public abstract class AST<N> {
|
||||
/** The kind of node represented by a given AST.Node object. */
|
||||
@@ -77,7 +77,7 @@ public abstract class AST<N> {
|
||||
public abstract Collection<String> getImportStatements();
|
||||
|
||||
/**
|
||||
* Puts the given node in the map so that javac/eclipse's own internal AST object can be translated to
|
||||
* Puts the given node in the map so that javac/Eclipse's own internal AST object can be translated to
|
||||
* an AST.Node object. Also registers the object as visited to avoid endless loops.
|
||||
*/
|
||||
protected <T extends Node> T putInMap(T node) {
|
||||
@@ -86,7 +86,7 @@ public abstract class AST<N> {
|
||||
return node;
|
||||
}
|
||||
|
||||
/** Returns the node map, that can map javac/eclipse internal AST objects to AST.Node objects. */
|
||||
/** Returns the node map, that can map javac/Eclipse internal AST objects to AST.Node objects. */
|
||||
protected Map<N, Node> getNodeMap() {
|
||||
return nodeMap;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public abstract class AST<N> {
|
||||
return top;
|
||||
}
|
||||
|
||||
/** Maps a javac/eclipse internal AST Node to the appropriate AST.Node object. */
|
||||
/** Maps a javac/Eclipse internal AST Node to the appropriate AST.Node object. */
|
||||
public Node get(N node) {
|
||||
return nodeMap.get(node);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public abstract class AST<N> {
|
||||
return targetNode;
|
||||
}
|
||||
|
||||
/** An instance of this class wraps an eclipse/javac internal node object. */
|
||||
/** An instance of this class wraps an Eclipse/javac internal node object. */
|
||||
public abstract class Node {
|
||||
protected final Kind kind;
|
||||
protected final N node;
|
||||
@@ -214,7 +214,7 @@ public abstract class AST<N> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The javac/eclipse internal AST object wrapped by this AST.Node object.
|
||||
* @return The javac/Eclipse internal AST object wrapped by this AST.Node object.
|
||||
*/
|
||||
public N get() {
|
||||
return node;
|
||||
@@ -224,7 +224,7 @@ public abstract class AST<N> {
|
||||
* Replaces the AST node represented by this node object with the provided node. This node must
|
||||
* have a parent, obviously, for this to work.
|
||||
*
|
||||
* Also affects the underlying (eclipse/javac) AST.
|
||||
* Also affects the underlying (Eclipse/javac) AST.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Node replaceWith(N newN, Kind kind) {
|
||||
@@ -241,7 +241,7 @@ public abstract class AST<N> {
|
||||
/**
|
||||
* Replaces the stated node with a new one. The old node must be a direct child of this node.
|
||||
*
|
||||
* Also affects the underlying (eclipse/javac) AST.
|
||||
* Also affects the underlying (Eclipse/javac) AST.
|
||||
*/
|
||||
public void replaceChildNode(N oldN, N newN) {
|
||||
replaceStatementInNode(get(), oldN, newN);
|
||||
@@ -325,7 +325,7 @@ public abstract class AST<N> {
|
||||
/**
|
||||
* Adds the stated node as a direct child of this node.
|
||||
*
|
||||
* Does not change the underlying (javac/eclipse) AST, only the wrapped view.
|
||||
* Does not change the underlying (javac/Eclipse) AST, only the wrapped view.
|
||||
*/
|
||||
@SuppressWarnings("unchecked") public Node add(N newChild, Kind kind) {
|
||||
Node n = buildTree(newChild, kind);
|
||||
@@ -361,7 +361,7 @@ public abstract class AST<N> {
|
||||
/**
|
||||
* Removes the stated node, which must be a direct child of this node, from the AST.
|
||||
*
|
||||
* Does not change the underlying (javac/eclipse) AST, only the wrapped view.
|
||||
* Does not change the underlying (javac/Eclipse) AST, only the wrapped view.
|
||||
*/
|
||||
public void removeChild(Node child) {
|
||||
children.remove(child);
|
||||
@@ -394,7 +394,7 @@ public abstract class AST<N> {
|
||||
}
|
||||
}
|
||||
|
||||
/** Build an AST.Node object for the stated internal (javac/eclipse) AST Node object. */
|
||||
/** Build an AST.Node object for the stated internal (javac/Eclipse) AST Node object. */
|
||||
protected abstract Node buildTree(N item, Kind kind);
|
||||
|
||||
/**
|
||||
@@ -467,7 +467,7 @@ public abstract class AST<N> {
|
||||
|
||||
/**
|
||||
* The supertypes which are considered AST Node children. Usually, the Statement, and the Expression,
|
||||
* though some platforms (such as eclipse) group these under one common supertype. */
|
||||
* though some platforms (such as Eclipse) group these under one common supertype. */
|
||||
protected abstract Collection<Class<? extends N>> getStatementTypes();
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.Set;
|
||||
import lombok.Lombok;
|
||||
|
||||
/**
|
||||
* The java core libraries have a SPI discovery system, but it works only in Java 1.6 and up. For at least eclipse,
|
||||
* The java core libraries have a SPI discovery system, but it works only in Java 1.6 and up. For at least Eclipse,
|
||||
* lombok actually works in java 1.5, so we've rolled our own SPI discovery system.
|
||||
*
|
||||
* It is not API compatible with <code>ServiceLoader</code>.
|
||||
|
||||
@@ -23,7 +23,7 @@ package lombok.core;
|
||||
|
||||
/**
|
||||
* Container for static utility methods useful for some of the standard lombok transformations, regardless of
|
||||
* target platform (e.g. useful for both javac and eclipse lombok implementations).
|
||||
* target platform (e.g. useful for both javac and Eclipse lombok implementations).
|
||||
*/
|
||||
public class TransformationsUtil {
|
||||
private TransformationsUtil() {
|
||||
|
||||
@@ -77,28 +77,28 @@ public class Eclipse {
|
||||
private static final String DEFAULT_BUNDLE = "org.eclipse.jdt.core";
|
||||
|
||||
/**
|
||||
* Generates an error in the eclipse error log. Note that most people never look at it!
|
||||
* Generates an error in the Eclipse error log. Note that most people never look at it!
|
||||
*/
|
||||
public static void error(CompilationUnitDeclaration cud, String message) {
|
||||
error(cud, message, DEFAULT_BUNDLE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an error in the eclipse error log. Note that most people never look at it!
|
||||
* Generates an error in the Eclipse error log. Note that most people never look at it!
|
||||
*/
|
||||
public static void error(CompilationUnitDeclaration cud, String message, Throwable error) {
|
||||
error(cud, message, DEFAULT_BUNDLE, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an error in the eclipse error log. Note that most people never look at it!
|
||||
* Generates an error in the Eclipse error log. Note that most people never look at it!
|
||||
*/
|
||||
public static void error(CompilationUnitDeclaration cud, String message, String bundleName) {
|
||||
error(cud, message, bundleName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an error in the eclipse error log. Note that most people never look at it!
|
||||
* Generates an error in the Eclipse error log. Note that most people never look at it!
|
||||
*/
|
||||
public static void error(CompilationUnitDeclaration cud, String message, String bundleName, Throwable error) {
|
||||
Bundle bundle = Platform.getBundle(bundleName);
|
||||
@@ -114,7 +114,7 @@ public class Eclipse {
|
||||
}
|
||||
|
||||
/**
|
||||
* For 'speed' reasons, eclipse works a lot with char arrays. I have my doubts this was a fruitful exercise,
|
||||
* For 'speed' reasons, Eclipse works a lot with char arrays. I have my doubts this was a fruitful exercise,
|
||||
* but we need to deal with it. This turns [[java][lang][String]] into "java.lang.String".
|
||||
*/
|
||||
static String toQualifiedName(char[][] typeName) {
|
||||
|
||||
@@ -47,8 +47,8 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
|
||||
import org.eclipse.jdt.internal.compiler.util.Util;
|
||||
|
||||
/**
|
||||
* Wraps around eclipse's internal AST view to add useful features as well as the ability to visit parents from children,
|
||||
* something eclipse's own AST system does not offer.
|
||||
* Wraps around Eclipse's internal AST view to add useful features as well as the ability to visit parents from children,
|
||||
* something Eclipse own AST system does not offer.
|
||||
*/
|
||||
public class EclipseAST extends AST<ASTNode> {
|
||||
/**
|
||||
@@ -534,7 +534,7 @@ public class EclipseAST extends AST<ASTNode> {
|
||||
return putInMap(new Node(statement, childNodes, Kind.STATEMENT));
|
||||
}
|
||||
|
||||
/** For eclipse, only Statement counts, as Expression is a subclass of it, eventhough this isn't
|
||||
/** For Eclipse, only Statement counts, as Expression is a subclass of it, eventhough this isn't
|
||||
* entirely correct according to the JLS spec (only some expressions can be used as statements, not all of them). */
|
||||
@Override protected Collection<Class<? extends ASTNode>> getStatementTypes() {
|
||||
return Collections.<Class<? extends ASTNode>>singleton(Statement.class);
|
||||
|
||||
@@ -59,7 +59,7 @@ public interface EclipseASTVisitor {
|
||||
|
||||
/**
|
||||
* Called when visiting a field of a class.
|
||||
* Even though in eclipse initializers (both instance and static) are represented as Initializer objects,
|
||||
* Even though in Eclipse initializers (both instance and static) are represented as Initializer objects,
|
||||
* which are a subclass of FieldDeclaration, those do NOT result in a call to this method. They result
|
||||
* in a call to the visitInitializer method.
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ public interface EclipseASTVisitor {
|
||||
|
||||
/**
|
||||
* Called for both methods (MethodDeclaration) and constructors (ConstructorDeclaration), but not for
|
||||
* Clinit objects, which are a vestigial eclipse thing that never contain anything. Static initializers
|
||||
* Clinit objects, which are a vestigial Eclipse thing that never contain anything. Static initializers
|
||||
* show up as 'Initializer', in the visitInitializer method, with modifier bit STATIC set.
|
||||
*/
|
||||
void visitMethod(Node methodNode, AbstractMethodDeclaration method);
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface EclipseAnnotationHandler<T extends java.lang.annotation.Annotat
|
||||
* TargetType in the annotation to methods only.
|
||||
*
|
||||
* @param annotation The actual annotation - use this object to retrieve the annotation parameters.
|
||||
* @param ast The eclipse AST node representing the annotation.
|
||||
* @param ast The Eclipse AST node representing the annotation.
|
||||
* @param annotationNode The Lombok AST wrapper around the 'ast' parameter. You can use this object
|
||||
* to travel back up the chain (something javac AST can't do) to the parent of the annotation, as well
|
||||
* as access useful methods such as generating warnings or errors focused on the annotation.
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.eclipse.jdt.internal.compiler.ast.TypeReference;
|
||||
*/
|
||||
public class HandlerLibrary {
|
||||
/**
|
||||
* Creates a new HandlerLibrary. Errors will be reported to the eclipse Error log.
|
||||
* Creates a new HandlerLibrary. Errors will be reported to the Eclipse Error log.
|
||||
* You probably want to use {@link #load()} instead.
|
||||
*/
|
||||
public HandlerLibrary() {}
|
||||
@@ -81,7 +81,7 @@ public class HandlerLibrary {
|
||||
private boolean skipPrintAST;
|
||||
|
||||
/**
|
||||
* Creates a new HandlerLibrary. Errors will be reported to the eclipse Error log.
|
||||
* Creates a new HandlerLibrary. Errors will be reported to the Eclipse Error log.
|
||||
* then uses SPI discovery to load all annotation and visitor based handlers so that future calls
|
||||
* to the handle methods will defer to these handlers.
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ public class HandlerLibrary {
|
||||
}
|
||||
lib.typeLibrary.addType(container.annotationClass.getName());
|
||||
} catch ( Throwable t ) {
|
||||
Eclipse.error(null, "Can't load Lombok annotation handler for eclipse: ", t);
|
||||
Eclipse.error(null, "Can't load Lombok annotation handler for Eclipse: ", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class HandlerLibrary {
|
||||
try {
|
||||
lib.visitorHandlers.add(it.next());
|
||||
} catch ( Throwable t ) {
|
||||
Eclipse.error(null, "Can't load Lombok visitor handler for eclipse: ", t);
|
||||
Eclipse.error(null, "Can't load Lombok visitor handler for Eclipse: ", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ import org.eclipse.jdt.internal.compiler.parser.Parser;
|
||||
|
||||
/**
|
||||
* Entry point for the Eclipse Parser patch that lets lombok modify the Abstract Syntax Tree as generated by
|
||||
* eclipse's parser implementations. This class is injected into the appropriate OSGi ClassLoader and can thus
|
||||
* Eclipse's parser implementations. This class is injected into the appropriate OSGi ClassLoader and can thus
|
||||
* use any classes that belong to org.eclipse.jdt.(apt.)core.
|
||||
*
|
||||
* Note that, for any Method body, if Bit24 is set, the eclipse parser has been patched to never attempt to
|
||||
* Note that, for any Method body, if Bit24 is set, the Eclipse parser has been patched to never attempt to
|
||||
* (re)parse it. You should set Bit24 on any MethodDeclaration object you inject into the AST:
|
||||
*
|
||||
* <code>methodDeclaration.bits |= ASTNode.Bit24; //0x800000</code>
|
||||
@@ -70,14 +70,14 @@ public class TransformEclipseAST {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called immediately after eclipse finishes building a CompilationUnitDeclaration, which is
|
||||
* the top-level AST node when eclipse parses a source file. The signature is 'magic' - you should not
|
||||
* This method is called immediately after Eclipse finishes building a CompilationUnitDeclaration, which is
|
||||
* the top-level AST node when Eclipse parses a source file. The signature is 'magic' - you should not
|
||||
* change it!
|
||||
*
|
||||
* Eclipse's parsers often operate in diet mode, which means many parts of the AST have been left blank.
|
||||
* Be ready to deal with just about anything being null, such as the Statement[] arrays of the Method AST nodes.
|
||||
*
|
||||
* @param parser The eclipse parser object that generated the AST.
|
||||
* @param parser The Eclipse parser object that generated the AST.
|
||||
* @param ast The AST node belonging to the compilation unit (java speak for a single source file).
|
||||
*/
|
||||
public static void transform(Parser parser, CompilationUnitDeclaration ast) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import lombok.Lombok;
|
||||
|
||||
/** Utility class for doing various OS-specific operations related to finding eclipse installations. */
|
||||
/** Utility class for doing various OS-specific operations related to finding Eclipse installations. */
|
||||
class EclipseFinder {
|
||||
private EclipseFinder() {
|
||||
//Prevent instantiation.
|
||||
@@ -122,7 +122,7 @@ class EclipseFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of paths of eclipse installations.
|
||||
* Returns a list of paths of Eclipse installations.
|
||||
* Eclipse installations are found by checking for the existence of 'eclipse.exe' in the following locations:
|
||||
*
|
||||
* X:\*Program Files*\*Eclipse*
|
||||
@@ -171,10 +171,10 @@ class EclipseFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the OS-dependent 'find eclipse' routine. If the local OS doesn't have a routine written for it,
|
||||
* Calls the OS-dependent 'find Eclipse' routine. If the local OS doesn't have a routine written for it,
|
||||
* null is returned.
|
||||
*
|
||||
* @return List of directories that contain the eclipse executable.
|
||||
* @return List of directories that contain the Eclipse executable.
|
||||
*/
|
||||
static List<String> findEclipses() {
|
||||
switch ( getOS() ) {
|
||||
@@ -225,7 +225,7 @@ class EclipseFinder {
|
||||
for ( File dir : new File("/Applications").listFiles() ) {
|
||||
if ( !dir.isDirectory() ) continue;
|
||||
if ( dir.getName().toLowerCase().equals("eclipse.app") ) {
|
||||
//This would be kind of an unorthodox eclipse installation, but if eclipse ever
|
||||
//This would be kind of an unorthodox Eclipse installation, but if Eclipse ever
|
||||
//moves to this more maclike installation concept, our installer can still handle it.
|
||||
eclipses.add("/Applications");
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
* Represents an eclipse installation.
|
||||
* An instance can figure out if an eclipse installation has been lombok-ified, and can
|
||||
* install and uninstall lombok from the eclipse installation.
|
||||
* Represents an Eclipse installation.
|
||||
* An instance can figure out if an Eclipse installation has been lombok-ified, and can
|
||||
* install and uninstall lombok from the Eclipse installation.
|
||||
*/
|
||||
final class EclipseLocation {
|
||||
private static final String OS_NEWLINE;
|
||||
@@ -63,7 +63,7 @@ final class EclipseLocation {
|
||||
|
||||
/**
|
||||
* Thrown when creating a new EclipseLocation with a path object that doesn't, in fact,
|
||||
* point at an eclipse installation.
|
||||
* point at an Eclipse installation.
|
||||
*/
|
||||
final class NotAnEclipseException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -76,14 +76,14 @@ final class EclipseLocation {
|
||||
* Renders a message dialog with information about what went wrong.
|
||||
*/
|
||||
void showDialog(JFrame appWindow) {
|
||||
JOptionPane.showMessageDialog(appWindow, getMessage(), "Cannot configure eclipse installation", JOptionPane.WARNING_MESSAGE);
|
||||
JOptionPane.showMessageDialog(appWindow, getMessage(), "Cannot configure Eclipse installation", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new EclipseLocation by pointing at either the directory contain the eclipse executable, or the executable itself.
|
||||
* Create a new EclipseLocation by pointing at either the directory contain the Eclipse executable, or the executable itself.
|
||||
*
|
||||
* @throws NotAnEclipseException If this isn't an eclipse executable or a directory with an eclipse executable.
|
||||
* @throws NotAnEclipseException If this isn't an Eclipse executable or a directory with an Eclipse executable.
|
||||
*/
|
||||
EclipseLocation(String path) throws NotAnEclipseException {
|
||||
if ( path == null ) throw new NullPointerException("path");
|
||||
@@ -101,7 +101,7 @@ final class EclipseLocation {
|
||||
}
|
||||
|
||||
if ( !p.exists() || !p.getName().equalsIgnoreCase(execName) ) {
|
||||
throw new NotAnEclipseException("This path does not appear to contain an eclipse installation: " + p, null);
|
||||
throw new NotAnEclipseException("This path does not appear to contain an Eclipse installation: " + p, null);
|
||||
}
|
||||
|
||||
this.path = p;
|
||||
@@ -109,8 +109,8 @@ final class EclipseLocation {
|
||||
this.hasLombok = checkForLombok();
|
||||
} catch ( IOException e ) {
|
||||
throw new NotAnEclipseException(
|
||||
"I can't read the configuration file of the eclipse installed at " + this.path.getAbsolutePath() + "\n" +
|
||||
"You may need to run this installer with root privileges if you want to modify that eclipse.", e);
|
||||
"I can't read the configuration file of the Eclipse installed at " + this.path.getAbsolutePath() + "\n" +
|
||||
"You may need to run this installer with root privileges if you want to modify that Eclipse.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ final class EclipseLocation {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute path to the eclipse executable.
|
||||
* Returns the absolute path to the Eclipse executable.
|
||||
*
|
||||
* Executables: "eclipse.exe" (Windows), "Eclipse.app" (Mac OS X), "eclipse" (Linux and other unixes).
|
||||
*/
|
||||
@@ -133,7 +133,7 @@ final class EclipseLocation {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the eclipse installation has been instrumented with lombok.
|
||||
* @return true if the Eclipse installation has been instrumented with lombok.
|
||||
*/
|
||||
boolean hasLombok() {
|
||||
return hasLombok;
|
||||
@@ -141,7 +141,7 @@ final class EclipseLocation {
|
||||
|
||||
/**
|
||||
* Returns the various directories that can contain the 'eclipse.ini' file.
|
||||
* Returns multiple directories because there are a few different ways eclipse is packaged.
|
||||
* Returns multiple directories because there are a few different ways Eclipse is packaged.
|
||||
*/
|
||||
private List<File> getTargetDirs() {
|
||||
return Arrays.asList(path.getParentFile(), new File(new File(path, "Contents"), "MacOS"));
|
||||
@@ -270,7 +270,7 @@ final class EclipseLocation {
|
||||
}
|
||||
|
||||
/**
|
||||
* Install lombok into the eclipse at this location.
|
||||
* Install lombok into the Eclipse at this location.
|
||||
* If lombok is already there, it is overwritten neatly (upgrade mode).
|
||||
*
|
||||
* @throws InstallException If there's an obvious I/O problem that is preventing installation.
|
||||
@@ -334,7 +334,7 @@ final class EclipseLocation {
|
||||
} catch ( Throwable ignore ) {}
|
||||
if ( !readSucceeded ) throw new InstallException("I can't read my own jar file. I think you've found a bug in this installer! I suggest you restart it " +
|
||||
"and use the 'what do I do' link, to manually install lombok. And tell us about this. Thanks!", e);
|
||||
throw new InstallException("I can't write to your eclipse directory, probably because this installer does not have the access rights.", e);
|
||||
throw new InstallException("I can't write to your Eclipse directory, probably because this installer does not have the access rights.", e);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -367,7 +367,7 @@ final class EclipseLocation {
|
||||
fis.close();
|
||||
}
|
||||
|
||||
newContents.append("-javaagent:lombok.jar").append(OS_NEWLINE);
|
||||
newContents.append("-javaagent:lombok.eclipse.agent.jar").append(OS_NEWLINE);
|
||||
newContents.append("-Xbootclasspath/a:lombok.jar" + File.pathSeparator + "lombok.eclipse.agent.jar").append(OS_NEWLINE);
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(iniFile);
|
||||
@@ -390,7 +390,7 @@ final class EclipseLocation {
|
||||
}
|
||||
|
||||
if ( !installSucceeded ) {
|
||||
throw new InstallException("I can't find the eclipse.ini file. Is this a real eclipse installation?", null);
|
||||
throw new InstallException("I can't find the eclipse.ini file. Is this a real Eclipse installation?", null);
|
||||
}
|
||||
|
||||
for ( File dir : failedDirs ) {
|
||||
|
||||
@@ -71,8 +71,8 @@ import lombok.installer.EclipseLocation.UninstallException;
|
||||
|
||||
/**
|
||||
* The lombok installer proper.
|
||||
* Uses swing to show a simple GUI that can add and remove the java agent to eclipse installations.
|
||||
* Also offers info on what this installer does in case people want to instrument their eclipse manually,
|
||||
* Uses swing to show a simple GUI that can add and remove the java agent to Eclipse installations.
|
||||
* Also offers info on what this installer does in case people want to instrument their Eclipse manually,
|
||||
* and looks in some common places on Mac OS X and Windows.
|
||||
*/
|
||||
public class Installer {
|
||||
@@ -120,14 +120,14 @@ public class Installer {
|
||||
|
||||
/**
|
||||
* If run in headless mode, the installer can't show its fancy GUI. There's little point in running
|
||||
* the installer without a GUI environment, as eclipse doesn't run in headless mode either, so
|
||||
* the installer without a GUI environment, as Eclipse doesn't run in headless mode either, so
|
||||
* we'll make do with showing some basic info on Lombok as well as instructions for using lombok with javac.
|
||||
*/
|
||||
private static void printHeadlessInfo() {
|
||||
System.out.printf("About lombok v%s\n" +
|
||||
"Lombok makes java better by providing very spicy additions to the Java programming language," +
|
||||
"such as using @Getter to automatically generate a getter method for any field.\n\n" +
|
||||
"Browse to %s for more information. To install lombok on eclipse, re-run this jar file on a " +
|
||||
"Browse to %s for more information. To install lombok on Eclipse, re-run this jar file on a " +
|
||||
"graphical computer system - this message is being shown because your terminal is not graphics capable." +
|
||||
"If you are just using 'javac' or a tool that calls on javac, no installation is neccessary; just " +
|
||||
"make sure lombok.jar is in the classpath when you compile. Example:\n\n" +
|
||||
@@ -273,21 +273,6 @@ public class Installer {
|
||||
}
|
||||
|
||||
private Component buildEclipseArea() throws IOException {
|
||||
// "Or:" [I'll tell you where eclipse is] [Tell me how to install lombok manually]
|
||||
|
||||
//Mode 2 (manual):
|
||||
// Replace the entirety of the content (javac+eclipse) with an explanation about what to do:
|
||||
// - copy lombok.jar to your eclipse directory.
|
||||
// - jar xvf lombok.jar lombok.eclipse.agent.jar
|
||||
// - edit eclipse.ini with:
|
||||
// -javaagent:../../../lombok.eclipse.agent.jar
|
||||
// -Xbootclasspath/a:../../../lombok.eclipse.agent.jar:../../../lombok.jar
|
||||
|
||||
//Mode 3 (let me choose):
|
||||
// pop up a file chooser. Make sure we don't care what you pick - eclipse.ini, eclipse.exe, eclipse.app, or dir.
|
||||
// empty the list, remove the spinner and the [let me find eclipse on my own] button, and put the chosen
|
||||
// eclipse in the list.
|
||||
|
||||
JPanel container = new JPanel();
|
||||
|
||||
container.setLayout(new GridBagLayout());
|
||||
@@ -348,9 +333,9 @@ public class Installer {
|
||||
|
||||
if ( eclipses == null ) {
|
||||
JOptionPane.showMessageDialog(appWindow,
|
||||
"I don't know how to automatically find eclipse installations on this platform.\n" +
|
||||
"I don't know how to automatically find Eclipse installations on this platform.\n" +
|
||||
"Please use the 'Specify Eclipse Location...' button to manually point out the\n" +
|
||||
"location of your eclipse installation to me. Thanks!", "Can't find eclipse", JOptionPane.INFORMATION_MESSAGE);
|
||||
"location of your Eclipse installation to me. Thanks!", "Can't find Eclipse", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -363,7 +348,7 @@ public class Installer {
|
||||
findEclipsesThread.start();
|
||||
|
||||
Box buttonBar = Box.createHorizontalBox();
|
||||
JButton specifyEclipseLocationButton = new JButton("Specify eclipse location...");
|
||||
JButton specifyEclipseLocationButton = new JButton("Specify Eclipse location...");
|
||||
buttonBar.add(specifyEclipseLocationButton);
|
||||
specifyEclipseLocationButton.addActionListener(new ActionListener() {
|
||||
@Override public void actionPerformed(ActionEvent event) {
|
||||
@@ -428,7 +413,7 @@ public class Installer {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
List<EclipseLocation> locationsToInstall = new ArrayList<EclipseLocation>(eclipsesList.getSelectedEclipses());
|
||||
if ( locationsToInstall.isEmpty() ) {
|
||||
JOptionPane.showMessageDialog(appWindow, "You haven't selected any eclipse installations!.", "No Selection", JOptionPane.WARNING_MESSAGE);
|
||||
JOptionPane.showMessageDialog(appWindow, "You haven't selected any Eclipse installations!.", "No Selection", JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -442,7 +427,7 @@ public class Installer {
|
||||
|
||||
constraints.gridy = 5;
|
||||
constraints.fill = GridBagConstraints.NONE;
|
||||
uninstallButton = new JHyperLink("Uninstall lombok from selected eclipse installations.");
|
||||
uninstallButton = new JHyperLink("Uninstall lombok from selected Eclipse installations.");
|
||||
uninstallButton.addActionListener(new ActionListener() {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
List<EclipseLocation> locationsToUninstall = new ArrayList<EclipseLocation>();
|
||||
@@ -451,7 +436,7 @@ public class Installer {
|
||||
}
|
||||
|
||||
if ( locationsToUninstall.isEmpty() ) {
|
||||
JOptionPane.showMessageDialog(appWindow, "You haven't selected any eclipse installations that have been lombok-enabled.", "No Selection", JOptionPane.WARNING_MESSAGE);
|
||||
JOptionPane.showMessageDialog(appWindow, "You haven't selected any Eclipse installations that have been lombok-enabled.", "No Selection", JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -462,7 +447,7 @@ public class Installer {
|
||||
container.add(uninstallButton, constraints);
|
||||
|
||||
constraints.gridy = 6;
|
||||
JHyperLink showMe = new JHyperLink("Show me what this installer will do to my eclipse installation.");
|
||||
JHyperLink showMe = new JHyperLink("Show me what this installer will do to my Eclipse installation.");
|
||||
container.add(showMe, constraints);
|
||||
showMe.addActionListener(new ActionListener() {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
@@ -530,7 +515,7 @@ public class Installer {
|
||||
|
||||
if ( success.get() ) SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
JOptionPane.showMessageDialog(appWindow, "Lombok has been installed on the selected eclipse installations.", "Install successful", JOptionPane.INFORMATION_MESSAGE);
|
||||
JOptionPane.showMessageDialog(appWindow, "Lombok has been installed on the selected Eclipse installations.", "Install successful", JOptionPane.INFORMATION_MESSAGE);
|
||||
appWindow.setVisible(false);
|
||||
System.exit(0);
|
||||
}
|
||||
@@ -571,7 +556,7 @@ public class Installer {
|
||||
|
||||
if ( success.get() ) SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
JOptionPane.showMessageDialog(appWindow, "Lombok has been removed from the selected eclipse installations.", "Uninstall successful", JOptionPane.INFORMATION_MESSAGE);
|
||||
JOptionPane.showMessageDialog(appWindow, "Lombok has been removed from the selected Eclipse installations.", "Uninstall successful", JOptionPane.INFORMATION_MESSAGE);
|
||||
appWindow.setVisible(false);
|
||||
System.exit(0);
|
||||
}
|
||||
@@ -794,11 +779,11 @@ public class Installer {
|
||||
"<html><font size=\"+1\"><b><i>Eclipse</i></b></font></html>";
|
||||
|
||||
private static final String ECLIPSE_EXPLANATION =
|
||||
"<html>Lombok can update your eclipse to fully support all Lombok features.<br>" +
|
||||
"Select eclipse installations below and hit 'Install/Update'.</html>";
|
||||
"<html>Lombok can update your Eclipse to fully support all Lombok features.<br>" +
|
||||
"Select Eclipse installations below and hit 'Install/Update'.</html>";
|
||||
|
||||
private static final String ECLIPSE_LOADING_EXPLANATION =
|
||||
"Scanning your drives for eclipse installations...";
|
||||
"Scanning your drives for Eclipse installations...";
|
||||
|
||||
private static final String JAVAC_TITLE =
|
||||
"<html><font size=\"+1\"><b><i>Javac</i></b></font> (and tools that invoke javac such as <i>ant</i> and <i>maven</i>)</html>";
|
||||
@@ -820,7 +805,7 @@ public class Installer {
|
||||
|
||||
private static final String HOW_I_WORK_EXPLANATION =
|
||||
"<html><ol>" +
|
||||
"<li>First, I copy myself (lombok.jar) to your eclipse install directory.</li>" +
|
||||
"<li>First, I copy myself (lombok.jar) to your Eclipse install directory.</li>" +
|
||||
"<li>Then, I unpack lombok.eclipse.agent.jar like so:<br>" +
|
||||
"<pre>jar xvf lombok.jar lombok.eclipse.agent.jar</pre></li>" +
|
||||
"<li>Then, I edit the eclipse.ini file to add the following two entries:<br>" +
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
/**
|
||||
* This package contains the lombok installer. It explains to any user that double-clicks the lombok.jar what
|
||||
* lombok is about, and has the ability to instrument (or remove existing Lombok instrumentation) from any
|
||||
* eclipse installation. This package also contains the graphics uses in the installer in SVG format.
|
||||
* Eclipse installation. This package also contains the graphics uses in the installer in SVG format.
|
||||
*/
|
||||
package lombok.installer;
|
||||
Reference in new issue
Block a user