标签: eclipse-plugin

Eclipse PDE,Navigator View,TreeSelection - 获取文件类型和名称

我正在尝试在"导航器树"视图中获取Eclipse用户的结构化选择的详细信息.目前我有以下基于org.eclipse.ui.popMenus扩展点的内容:

public void run(IAction action) {

Shell shell = new Shell();

ISelection selection = workbenchPart.getSite().getSelectionProvider().getSelection();

if (structuredSelection instanceof org.eclipse.jface.viewers.TreeSelection) {

   org.eclipse.jface.viewers.TreeSelection treeSelection = (org.eclipse.jface.viewers.TreeSelection) structuredSelection;
   IAdaptable firstElement = (IAdaptable) treeSelection.getFirstElement();

   // Relies on an internal API, bad juju
   if (firstElement instanceof org.eclipse.jdt.internal.core.CompilationUnit) {
    org.eclipse.jdt.internal.core.CompilationUnit compilationUnit = (org.eclipse.jdt.internal.core.CompilationUnit) firstElement;                                   
    String editorSelection = new String(compilationUnit.getContents());
   }            
}
Run Code Online (Sandbox Code Playgroud)

这个问题是它目前已经加入了JDT编译单元API,它是内部的,并且对我想要的内容过于具体.

理想情况下,我希望能够获得基础文件名,类型和内容,而不必依赖:

  1. 内部API
  2. JDT编译单元代码.

这样,当用户右键单击导航器视图中的文件时,这将允许我获取通用文件的属性.

有人可以向我提供有关我如何做到这一点的任何指示吗?

java eclipse eclipse-pde eclipse-plugin eclipse-rcp

7
推荐指数
2
解决办法
3728
查看次数

如何正确设置Eclipse的Mercurial插件?

刚刚将Mercurial插件(1.4.12.86)添加到Eclipse(Web Dev Version,Build id:20090920-1017),并在启动时遇到此错误:

Cannot run program "hg": CreateProcess error=2, The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

找到了一个关于同一问题的线程,但不知道如何修复它.

这里有更多来自日志:

!SUBENTRY 1 com.vectrace.MercurialEclipse 4 -100 2009-09-29 22:41:09.150
!MESSAGE Cannot run program "hg": CreateProcess error=2, The system cannot find the file specified
!STACK 0
java.io.IOException: Cannot run program "hg": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at com.vectrace.MercurialEclipse.commands.AbstractShellCommand.executeToStream(AbstractShellCommand.java:191)
    at com.vectrace.MercurialEclipse.commands.AbstractShellCommand.executeToBytes(AbstractShellCommand.java:139)
    at com.vectrace.MercurialEclipse.commands.AbstractShellCommand.executeToBytes(AbstractShellCommand.java:126)
    at com.vectrace.MercurialEclipse.commands.HgDebugInstallClient.debugInstall(HgDebugInstallClient.java:24)
    at com.vectrace.MercurialEclipse.MercurialEclipsePlugin.checkHgInstallation(MercurialEclipsePlugin.java:117)
    at com.vectrace.MercurialEclipse.preferences.GeneralPreferencePage$LabelDecoratorRadioGroupFieldEditor.doStore(GeneralPreferencePage.java:55)
    at org.eclipse.jface.preference.FieldEditor.store(FieldEditor.java:680)
    at org.eclipse.jface.preference.FieldEditorPreferencePage.performOk(FieldEditorPreferencePage.java:343)
    at …
Run Code Online (Sandbox Code Playgroud)

eclipse mercurial eclipse-plugin

7
推荐指数
1
解决办法
9156
查看次数

代码分析器:PMD和FindBugs

1.关于PMD:

1.1如何设置PMD检查,忽略其中的一些,例如"变量名太短或太长","删除空构造函数等" - 如果我这样做,会出现另一个警告,说该类必须有一些静态的方法.基本上,这个课程是空的,以便以后开发,我现在想把它留下来.

1.2遵循此警告建议是否必要?

  A class which only has private constructors should be final
Run Code Online (Sandbox Code Playgroud)

1.3那是什么意思?

 The class 'Dog' has a Cyclomatic Complexity of 3 (Highest = 17)
Run Code Online (Sandbox Code Playgroud)

1.4这个怎么样?我很乐意改变这一点,但目前关于变化的事情并没有让我想到:

Assigning an Object to null is a code smell. Consider refactoring.
Run Code Online (Sandbox Code Playgroud)

2.关于FindBugs:

2.1写入静态字段是否真的那么糟糕,比它的声明要晚一些?以下代码给了我一个警告:

Main.appCalendar = Calendar.getInstance();
Main.appCalendar.setTimeInMillis(System.currentTimeMillis());
Run Code Online (Sandbox Code Playgroud)

哪里appCalendar是静态变量.

2.2此代码:

strLine = objBRdr.readLine().trim();
Run Code Online (Sandbox Code Playgroud)

发出警告:

Immediate dereference of the result of readLine()
Run Code Online (Sandbox Code Playgroud)

这里objBRdr是一个BufferedReader(FileReader).怎么会发生什么?readLine()可能是空的?代码嵌套在while (objBRdr.ready())测试中,到目前为止,我没有问题.

当我用以下代码替换代码时,Update1:​​2.2被修复了:

strLine = objBRdr.readLine();
    if (strLine != null) { …
Run Code Online (Sandbox Code Playgroud)

java eclipse eclipse-plugin findbugs pmd

7
推荐指数
1
解决办法
7671
查看次数

在运行时将jar添加到Eclipse插件

我正在研究一个Eclipse插件,它需要在编译时不知道的类.这些类通过jar文件在网络上发送.我想在运行时动态加载这些类.

我尝试过这里列出的方法:http://blog.imaginea.com/making-applications-work-together-in-eclipse/

不幸的是,它没有达到预期的效果.当类被加载时,我不能在我加载它们的函数之外使用它们.我猜这与使用不同的类加载器有关.

任何帮助表示赞赏.即使你告诉我,这是不可能的,所以我知道我不需要再看了.

java eclipse eclipse-plugin

7
推荐指数
1
解决办法
3426
查看次数

如何在Android Layout Editor中打开布局xml文件?

当我用默认的xml编辑器打开我的布局xml文件时,如何将其更改为Android Layout Editor而无需右键单击并打开选项.

当我尝试更新我的android sdk和eclipse插件时,会出现问题iceCream Sandwitch(ICS).

eclipse android eclipse-plugin android-layout

7
推荐指数
1
解决办法
5380
查看次数

从命令行恢复到以前的配置?

运行eclipse时遇到问题.安装3个插件(从TeXlipse)后,我有一个错误:

!ENTRY org.eclipse.osgi 4 0 2012-01-21 13:57:28.430
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "org.eclipse.ui.ide.workbench" could not be found in the registry.
Run Code Online (Sandbox Code Playgroud)

我试着用它来运行它,eclipse -clean但这没有帮助.

有没有办法从命令行恢复到以前的配置?我用Google搜索,但只能在IDE中看到GUI解决方案.我甚至不确定默认情况下该功能是否可用,或者它是一个额外的插件.

如果我要手动删除已安装的插件,仅仅删除eclipse/plugins中的相应文件夹/文件是否足够?我看到两个新的文件夹:

net.sourceforge.texlipse_1.5.0
de.vonloesch.pdf4eclipse.help_1.0.0.20111116150
Run Code Online (Sandbox Code Playgroud)

还有两个文件:

de.vonloesch.pdf4Eclipse_1.0.1.201111161450.jar
org.bibsonomy.texlipseextension_0.1.0.jar
Run Code Online (Sandbox Code Playgroud)

预先感谢您的帮助

P/S/I运行Eclipse IDE for Parallel Application Developers (includes Incubating components)在Ubuntu 11.10与SVN/ EGit之上插件.现在TeXlipse.

UPDATE1:

我试图运行这样的事情: ./eclipse -application org.eclipse.equinox.p2.director -uninstallIU de.vonloesch.pdf4eclipse.help_1.0.0.201111161450 -profile epp.package.parallel

要么

./eclipse -application org.eclipse.equinox.p2.director -revert 1327068337804 -profile epp.package.parallel

但它只是运行应用程序而不是"监听"命令行参数......

UPDATE2:

当我尝试从OSGi控制台启动p2时(我可以通过它启动./eclipse -console …

eclipse eclipse-plugin revert

7
推荐指数
1
解决办法
2684
查看次数

如何以编程方式在Eclipse插件中的Package Explorer中选择节点

有没有人知道或有一个关于如何在Eclipse插件的Package Explorer视图中以编程方式选择节点的示例?我看到了如何获得当前选择的一些帮助,但没有看到如何设置它们.

谢谢.

eclipse eclipse-plugin package-explorer

7
推荐指数
1
解决办法
1750
查看次数

用于Notepad ++的Eclipse插件

我已经尝试将Notepad ++关联为eclipse中某些文件类型的默认编辑器.但是,它们在外部窗口中打开.我希望他们在我的IDE中打开.

是否有任何Eclipse插件可以将Eclipse中的Notepad ++作为内部编辑器集成?

eclipse-plugin notepad++

7
推荐指数
1
解决办法
9841
查看次数

在config.ini文件中定义更新站点

我正在为我们的项目创建基于Eclipse 3.6.2的产品.我们的想法是创建一个Eclipse安装,其中包含我们需要的所有插件,并且所有配置都按照我们项目的需要进行设置.

作为其中的一部分,我想确保包含更新站点,但我该怎么做?

如果我选择导出首选项,则不包括更新站点.我可以从首选项页面导出更新站点并获取XML文件,但是如何将其包含在我的config.ini文件中?或者还有其他方式吗?

目标是,当用户运行自定义Eclipse产品时,我们的更新站点将位于站点列表中.理想情况下,列表中唯一的.

eclipse eclipse-plugin p2 eclipse-rcp eclipse-3.6

7
推荐指数
1
解决办法
964
查看次数

eclipse中的"已安装软件"与"功能"对比"插件"

当我点击Installation Details日食时, 在此输入图像描述

我有这个标签 Installed software

在此输入图像描述

和一个标签 Features

在此输入图像描述

和一个标签plug-ins.

在此输入图像描述

eclipse软件,eclipse功能和eclipse插件之间的关系如此窗口所示?

我想Help -> Install New Software ...安装软件,软件由一堆相关的插件组成.这两个选项卡是从Install New Software ...菜单安装的相同内容(软件名称/插件名称)?

Bananeweizen 在他的回答/sf/answers/900415421/中说Eclipse "features" are the smallest installable pieces of Eclipse applications for users (e.g. the Java development toolkit). They consist of multiple plugins, where plugins are the smallest pieces that make sense from the developers point of view (e.g. org.eclipse.jdt.core, org.eclipse.jdt.ui, org.eclipse.jdt.somethingelse).,但对我而言,eclipse功能似乎与eclipse软件几乎相同,而eclipse应用程序是一套eclipse软件(功能)在顶部日食平台.

java eclipse eclipse-plugin

7
推荐指数
1
解决办法
2242
查看次数