IntelliJ 中可能的事情在 Eclipse 中不可能? [英] Things possible in IntelliJ that aren't possible in Eclipse?

查看:16
本文介绍了IntelliJ 中可能的事情在 Eclipse 中不可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说有人改变了任何一种方式并且对一种或另一种发誓.

I have heard from people who have switched either way and who swear by the one or the other.

作为 Eclipse 的忠实粉丝,但还没有时间尝试 IntelliJ,我很想听听ex-Eclipsians"IntelliJ 用户的一些具体事情,这些事情您可以用 IntelliJ 做而用 Eclipse 做不到.

Being a huge Eclipse fan but having not had the time to try out IntelliJ, I am interested in hearing from IntelliJ users who are "ex-Eclipsians" some specific things that you can do with IntelliJ that you can not do with Eclipse.

注意:这不是一个主观问题,也根本没有打算变成 IDE 圣战.请对任何火焰诱饵的回答投反对票.

Note: This is not a subjective question nor at all meant to turn into an IDE holy war. Please downvote any flamebait answers.

推荐答案

CTRL-click 随处可用

按住 CTRL 键单击可将您带到定义单击对象的位置,这在任何地方都有效——不仅在 Java 代码中的 Java 类和变量中,而且在 Spring 配置中(您可以单击类名、属性或 bean 名称),在Hibernate(您可以单击属性名称或类,或包含的资源),您可以一键从 Java 类导航到用作 Spring 或 Hibernate bean 的位置;单击包含的 JSP 或 JSTL 标记也有效,按住 ctrl 单击 JavaScript 变量或函数会将您带到定义它的位置,或者如果有多个位置,则显示菜单,包括其他 .js 文件和 HTML 或 JSP 中的 JS 代码文件.

CTRL-click works anywhere

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.

在 HSQL 表达式中、在 Hibernate 配置中(包括类、属性和 DB 列名)、在 Spring 配置中自动完成

Autocomplete in HSQL expressions, in Hibernate configuration (including class, property and DB column names), in Spring configuration

<property name="propName" ref="<hit CTRL-SPACE>"

它会向您显示可以注入该属性的 bean 列表.

and it will show you list of those beans which you can inject into that property.

Java 代码中非常智能的自动完成:

Very smart autocomplete in Java code:

interface Person {
    String getName();
    String getAddress();
    int getAge();
}
//---
Person p;
String name = p.<CTRL-SHIFT-SPACE>

它只显示getName()getAddress()toString()(只有它们按类型兼容)和getName() 是列表中的第一个,因为它具有更相关的名称.仍在 EAP 中的最新版本 8 具有更智能的自动完成功能.

and it shows you ONLY getName(), getAddress() and toString() (only they are compatible by type) and getName() is first in the list because it has more relevant name. Latest version 8 which is still in EAP has even more smart autocomplete.

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 中的智能自动完成.

Javascript

Smart autocomplete in 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 单击在 this.getName() 上会带您到定义此函数的地方,即使您的项目中还有其他一些 getName() 函数.

and it shows ONLY getName() and getAddress(), no matter how may get* methods you have in other JS objects in your project, and ctrl-click on this.getName() brings you to where this one is defined, even if there are some other getName() functions in your project.

我有没有提到文件路径中的自动完成和 ctrl 单击,例如 <script src=""、<img src="" 等?

Did I mention autocomplete and ctrl-clicking in paths to files, like <script src="", <img src="", etc?

HTML 标记属性中的自动完成.自动完成 HTML 标签的样式属性,包括属性名称和值.类属性中也会自动完成.
输入 <div class="<CTRL-SPACE>,它会显示你的项目中定义的 CSS 类列表.选择一个,按住 ctrl 键单击它,你将被重定向到它的定义位置.

Autocomplete in HTML tag attributes. Autocomplete in style attribute of HTML tags, both attribute names and values. Autocomplete in class attributes as well.
Type <div class="<CTRL-SPACE> and it will show you list of CSS classes defined in your project. Pick one, ctrl-click on it and you will be redirected to where it is defined.

最新版本有语言注入,所以你可以声明你的自定义 JSTL 标签通常包含 JavaScript,它会突出显示其中的 JavaScript.

Latest version has language injection, so you can declare that you custom JSTL tag usually contains JavaScript and it will highlight JavaScript inside it.

<ui:obfuscateJavaScript>function something(){...}</ui:obfuscateJavaScript>

对所有项目进行索引搜索.

您可以使用任何 Java 类或方法的 Find Usages,它会找到使用它的地方,不仅包括 Java 类,还包括 Hibernate、Spring、JSP 和其他地方.重命名方法重构不仅在 Java 类中重命名方法,而且在包括注释在内的任何地方重命名方法(无法确定注释中的字符串是否真的是方法名称,因此它会询问).即使存在同名的另一个类的方法,它也只会找到您的方法.良好的源代码控制集成(SVN 是否支持更改列表?IDEA 支持每个源代码控制),能够为您的更改创建补丁,以便您可以将更改发送给其他团队成员而无需提交.

Indexed search across all project.

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,我只是想看看它的内容.

When I look at HashMap in debugger's watch window, I see logical view - keys and values, last time I did it in Eclipse it was showing entries with hash and next fields - I'm not really debugging HashMap, I just want to look at it contents.

当你编辑它时它会验证 Spring 和 Hibernate 配置,所以我不需要重新启动服务器来知道我拼错了类名,或者添加了构造函数参数所以我的 Spring cfg 无效.

It validates Spring and Hibernate configuration right when you edit it, so I do not need to restart server to know that I misspelled class name, or added constructor parameter so my Spring cfg is invalid.

上次尝试时,我无法在 Windows XP x64 上运行 Eclipse.

Last time I tried, I could not run Eclipse on Windows XP x64.

它会建议您person.nameperson.address.按住 Ctrl 键单击 person.name,它将导航到 Person 类的 getName() 方法.

and it will suggest you person.name or person.address. Ctrl-click on person.name and it will navigate you to getName() method of Person class.

输入 Pattern.compile(""); 把 \ 放在那里,按 CTRL-SPACE 并查看有关可以放入正则表达式的有用提示.您还可以在此处使用语言注入 - 定义您自己的接受字符串参数的方法,在 IntelliLang 选项对话框中声明您的参数是正则表达式 - 它也会在那里为您提供自动完成功能.不用说,它突出显示了不正确的正则表达式.

Type Pattern.compile(""); put \ there, hit CTRL-SPACE and see helpful hint about what you can put into your regular expression. You can also use language injection here - define your own method that takes string parameter, declare in IntelliLang options dialog that your parameter is regular expression - and it will give you autocomplete there as well. Needless to say it highlights incorrect regular expressions.

我不确定Eclipse 中是否存在一些功能.但至少我们团队中使用 Eclipse 的每个成员,也会使用一些合并工具将本地更改与源代码管理中的更改合并,通常是 WinMerge.我从不需要它 - 合并 IDEA 对我来说就足够了.点击 3 次我可以看到源代码管理中的文件版本列表,再点击 3 次我可以比较以前的版本,或者以前的和当前的版本,并可能合并.

There are few features which I'm not sure are present in Eclipse or not. But at least each member of our team who uses Eclipse, also uses some merging tool to merge local changes with changes from source control, usually WinMerge. I never need it - merging in IDEA is enough for me. By 3 clicks I can see list of file versions in source control, by 3 more clicks I can compare previous versions, or previous and current one and possibly merge.

它允许指定我需要 WEB-INFlib 文件夹中的所有 .jar,而无需单独选择每个文件,因此当有人将新的 .jar 提交到该文件夹​​时,它会自动选择.

It allows to to specify that I need all .jars inside WEB-INFlib folder, without picking each file separately, so when someone commits new .jar into that folder it picks it up automatically.

上面提到的可能是它所做的事情的 10%.我不使用 Maven、Flex、Swing、EJB 和许多其他东西,所以我不知道它对它们有什么帮助.但确实如此.

Mentioned above is probably 10% of what it does. I do not use Maven, Flex, Swing, EJB and a lot of other stuff, so I can not tell how it helps with them. But it does.

这篇关于IntelliJ 中可能的事情在 Eclipse 中不可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆