我听说有人选择了其中一种方式,并对其中一种方式发誓。
作为一个Eclipse的忠实粉丝,但没有时间尝试IntelliJ,我很有兴趣从“前Eclipse用户”IntelliJ用户那里听到一些用IntelliJ可以做而用Eclipse不能做的具体事情。
注意:这不是一个主观的问题,也不意味着变成一场IDE圣战。请为任何煽动性的答案投票。
我听说有人选择了其中一种方式,并对其中一种方式发誓。
作为一个Eclipse的忠实粉丝,但没有时间尝试IntelliJ,我很有兴趣从“前Eclipse用户”IntelliJ用户那里听到一些用IntelliJ可以做而用Eclipse不能做的具体事情。
注意:这不是一个主观的问题,也不意味着变成一场IDE圣战。请为任何煽动性的答案投票。
当前回答
如果你把光标放在一个方法上,然后按CTRL+SHIFT+I将弹出方法实现。如果方法是一个接口方法,那么你可以使用上下箭头来循环实现:
Map<String, Integer> m = ...
m.contains|Key("Wibble");
|的位置(例如)您的光标所在的位置。
其他回答
一个非常有用的特性是能够部分构建Maven反应堆项目,以便只包括您需要的部分。
To make this a little clearer, consider the case of a collection of WAR files with a lot of common resources (e.g. JavaScript, Spring config files etc) being shared between them using the overlay technique. If you are working on some web page (running in Jetty) and want to change some of the overlay code that is held in a separate module then you'd normally expect to have to stop Jetty, run the Maven build, start Jetty again and continue. This is the case with Eclipse and just about every other IDE I've worked with. Not so in IntelliJ. Using the project settings you can define which facet of which module you would like to be included in a background build. Consequently you end up with a process that appears seamless. You make a change to pretty much any code in the project and instantly it is available after you refresh the browser.
非常简洁,而且非常快。
我无法想象在没有它的情况下,在像YUI这样的东西中编写一个返回到DWR/SpringMVC的前端。
CTRL-click在任何地方都适用
CTRL-click that brings you to where clicked object is defined works everywhere - not only in Java classes and variables in Java code, but in Spring configuration (you can click on class name, or property, or bean name), in Hibernate (you can click on property name or class, or included resource), you can navigate within one click from Java class to where it is used as Spring or Hibernate bean; clicking on included JSP or JSTL tag also works, ctrl-click on JavaScript variable or function brings you to the place it is defined or shows a menu if there are more than one place, including other .js files and JS code in HTML or JSP files.
自动完成许多语言
Hibernate
在HSQL表达式、Hibernate配置(包括类、属性和DB列名)、Spring配置中自动完成
<property name="propName" ref="<hit CTRL-SPACE>"
它会显示你可以注入到属性中的bean列表。
Java
Java代码中非常智能的自动完成:
interface Person {
String getName();
String getAddress();
int getAge();
}
//---
Person p;
String name = p.<CTRL-SHIFT-SPACE>
它显示你只有getName(), getAddress()和toString()(只有他们是类型兼容)和getName()是第一个在列表中,因为它有更多相关的名称。EAP的最新版本8拥有更智能的自动补全功能。
interface Country{
}
interface Address {
String getStreetAddress();
String getZipCode();
Country getCountry();
}
interface Person {
String getName();
Address getAddress();
int getAge();
}
//---
Person p;
Country c = p.<CTRL-SHIFT-SPACE>
它会自动完成到
Country c = p.getAddress().getCountry();
Javascript
JavaScript中的智能自动完成。
function Person(name,address) {
this.getName = function() { return name };
this.getAddress = function() { return address };
}
Person.prototype.hello = function() {
return "I'm " + this.getName() + " from " + this.get<CTRL-SPACE>;
}
并且它只显示getName()和getAddress(),不管你在你的项目中的其他JS对象中如何使用get*方法,ctrl-click this.getName()将带你到这个定义的地方,即使在你的项目中有一些其他的getName()函数。
HTML
我提到过自动完成和按ctrl键点击文件路径,比如<script src="", <img src="",等等?
自动完成HTML标签属性。自动完成HTML标签的样式属性,包括属性名和值。在类属性中也可以自动完成。 输入<div class="<CTRL-SPACE>,它将显示您在项目中定义的CSS类列表。选择一个,按ctrl键单击它,您将被重定向到它定义的位置。
轻松凸显自己的语言
最新版本有语言注入,所以你可以声明你自定义的JSTL标签通常包含JavaScript,它会突出显示其中的JavaScript。
<ui:obfuscateJavaScript>function something(){...}</ui:obfuscateJavaScript>
跨所有项目的索引搜索。
You can use Find Usages of any Java class or method and it will find where it is used including not only Java classes but Hibernate, Spring, JSP and other places. Rename Method refactoring renames method not only in Java classes but anywhere including comments (it can not be sure if string in comments is really method name so it will ask). And it will find only your method even if there are methods of another class with same name. Good source control integration (does SVN support changelists? IDEA support them for every source control), ability to create a patch with your changes so you can send your changes to other team member without committing them.
改进的调试器
当我在调试器的监视窗口中查看HashMap时,我看到逻辑视图-键和值,上次我在Eclipse中做了它,它显示了带有哈希和下一个字段的条目-我不是真正调试HashMap,我只是想看看它的内容。
Spring和Hibernate配置验证
它在编辑时验证Spring和Hibernate配置,所以我不需要重新启动服务器来知道我拼错了类名,或者添加了构造函数参数,所以我的Spring cfg无效。
上次尝试时,我无法在Windows XP x64上运行Eclipse。
它会提示你person。name或person。address。 Ctrl-click Person .name,它将导航到Person类的getName()方法。
类型Pattern.compile (" ");输入\\在那里,点击CTRL-SPACE,看看你可以在正则表达式中输入什么的有用提示。你也可以在这里使用语言注入——定义你自己的接受字符串参数的方法,在IntelliLang选项对话框中声明你的参数是正则表达式——它也会给你自动补全。不用说,它突出了不正确的正则表达式。
其他功能
有几个特性我不确定Eclipse中是否存在。但是至少我们团队中使用Eclipse的每个成员,也使用一些合并工具来合并本地更改和来自源代码控制的更改,通常是WinMerge。我从来不需要它——合并到IDEA对我来说就足够了。通过3次点击,我可以看到源代码控制中的文件版本列表,通过3次点击,我可以比较以前的版本,或者以前和当前的版本,并可能合并。
它允许指定我需要WEB-INF\lib文件夹中的所有。jar文件,而不单独选择每个文件,因此当有人提交新的。jar文件到该文件夹时,它会自动选择它。
上面提到的可能是它所做的10%。我不使用Maven、Flex、Swing、EJB和其他很多东西,所以我不知道它对它们有什么帮助。但确实如此。
在IntelliJ中,您可以通过“最后编辑位置”跳过最后编辑位置的历史。Eclipse也有类似的特性,但是Eclipse只返回到编辑位置的一个级别。
拥有历史记录而不仅仅是Eclipse提供的一个级别是一个很好的生产力特性:它充当了一种自动书签的形式,因为您经常希望跳转回您进行更改的地方。我每天都要使用这个功能几次,当我被要求使用Eclipse来做某些事情时,我感到没有这个功能的痛苦。
Well, for me it's a thousand tiny things. Some of the macros, the GUI layout in general in Eclipse I find awful. I can't open multiple projects in different windows in Eclipse. I can open multiple projects, but then it's view based system swaps a bunch of things around on me when I switch files. IntelliJ's code inspections seem better. Its popup helpers to fix common issues is nice. Lots of simple usability things like the side bar where I can hover over a hot spot and it'll tell me every implementing subclass of a method or the method I'm implementing and from where.
每当我不得不使用Eclipse时,或者看到别人使用Eclipse时,他们似乎可以做我在IntelliJ中可以做的大部分事情,但它花费的时间更长,而且更笨重。
因为有了新的Android Studio,我试着改用IntelliJ。但我现在很失望。我使用Eclipse和代码推荐器插件。下面是Eclipse如此出色的一个简单示例:
我想创建一个新的SimpleTimeZone。SimpleTimeZone没有带零参数的构造函数。
在Eclipse中Ctrl + Space
IntelliJ中的Ctrl +空格
在IntelliJ中,我没有得到SimpleTimeZone有什么样的构造函数的信息。
进入Eclipse后
我得到先前选择的构造函数,其中填充了预定义的变量名。我可以看到每个参数的类型。使用代码推荐器,Eclipse根据先前在当前作用域中定义的变量类型猜测正确的构造函数,并用这些变量填充构造函数。
在IntelliJ中输入后什么都没有发生。构造函数是空的。我必须按Ctrl + P才能看到预期的参数。