eclipse-jdt

How to get all the references of static field with JDT

喜夏-厌秋 提交于 2019-12-01 09:42:47
I found Java: Find all callers of a method – get all methods that call a particular method that gives a hint on how to find all the callers of a specific method. Then, how to get the users of a static field? For example, when I have static z in AnotherClass , and it is accessed with ClassA , how to get the IMethod ClassA#moved ? public class AnotherClass { public static int z = 20; .... } public class ClassA { public int moved(int x, int y) { int temp = AnotherClass.z; } Gavin Xiong The example is base on the org.eclipse.jdt.internal.* classes, I think you don't need to take so much effort to

Eclipse plugin development : How to listen events in Eclipse editor

十年热恋 提交于 2019-12-01 08:18:43
问题 I am trying to develop an eclipse plug-in. I am aware about the basics of this thing. In a sample plugin template when we click the menu entry (or button with eclipse icon in below image in this case) in testing instance of eclipse, execute method of sampleHandler.java is executed and a pop-up shown in image below appears. I want to invoke 'execute' method whenever I press some key (lets say backspace) in code editor instead of clicking any menu entry (or button). SampleHandler.java public

How to get all the references of static field with JDT

橙三吉。 提交于 2019-12-01 08:12:56
问题 I found Java: Find all callers of a method – get all methods that call a particular method that gives a hint on how to find all the callers of a specific method. Then, how to get the users of a static field? For example, when I have static z in AnotherClass , and it is accessed with ClassA , how to get the IMethod ClassA#moved ? public class AnotherClass { public static int z = 20; .... } public class ClassA { public int moved(int x, int y) { int temp = AnotherClass.z; } 回答1: The example is

Possible Java compiler bug! Program does not compile with some compilers

浪子不回头ぞ 提交于 2019-12-01 05:26:12
First, a little background (or skip down a little if not interested). I'm irritated and confused! This should be a pretty simple use case, and indeed my code has been compiling just fine with the Eclipse JDT compiler, so until now I've been configuring Maven to make sure to do this. It's been bothering me too much though that it doesn't compile with the Oracle JDK and OpenJDK, as I thought it may actually have been a problem with my code, so I've looked into it again. I thought perhaps that the bug was in the JDT compiler for allowing it to compile, not the Oracle JDK and OpenJDK for not

Is it possible to extend Eclipse Search Menu

馋奶兔 提交于 2019-12-01 05:18:28
问题 right now in eclipse it is not possible to extend Menu defined by Other plugins by using eclipse extension: org.eclipse.ui.menus. I want to add one menu item in Search but not a search page. since the Menu Search is defined by org.eclipse.search, I cannot add it. but I see JDT and CDT do add some menu item under search. does any body know how they make it work? any hint is appreciated. 回答1: You can extend menus from other plugins using org.eclipse.ui.actionSets extension point This is how the

Possible Java compiler bug! Program does not compile with some compilers

ぃ、小莉子 提交于 2019-12-01 03:50:12
问题 First, a little background (or skip down a little if not interested). I'm irritated and confused! This should be a pretty simple use case, and indeed my code has been compiling just fine with the Eclipse JDT compiler, so until now I've been configuring Maven to make sure to do this. It's been bothering me too much though that it doesn't compile with the Oracle JDK and OpenJDK, as I thought it may actually have been a problem with my code, so I've looked into it again. I thought perhaps that

eclipse shortcut for enabling / disabling JAVA breakpoints

落爺英雄遲暮 提交于 2019-12-01 03:11:24
I'm looking for a shortcut to completely enable / disable all JAVA breakpoints (analogue of pushing the "Skip all breakpoints" button in Debug view ), not to enable / disable them on a row-by-row basis. You have to assign your own keyboard shortcut to the Skip All Breakpoints command. Use Preferences>General>Keys preference page to do it. PW Ravi Bhatt Ctrl Shft B use Ctrl Shft L to open key assist for all possible keyword combinations. In Eclipse, in debug perspective, you have a blue crossed circle, to enable/disable all breakpoints. Follow following Steps: Open Preferences form Window-

Eclipse Plugin - How to get the last worked on editor

本秂侑毒 提交于 2019-12-01 00:01:59
I am writing an eclipse plugin which exposes a view to the user with several buttons. On the click of any button, I would like to paste a certain comment into the editor window where the user is currently working and at the cursor location he is pointing to. Once the user clicks the button, the editor window no longer has focus and the following code does not work. workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor() How can I detect the editor window where the user was working and the cursor location before the user clicked the button? Use an IPartListener to listen to part

How to install jdt.core in eclipse locally?

眉间皱痕 提交于 2019-11-30 22:59:40
I'm needing to install the eclipse JDT.Core plugin locally (eg download the file with site.xml etc), as opposed to installing it remotely due to the horrible firewall at work. Can anyone suggest where to download it so i can do the local install? Thanks I am not sure I ever saw an installation of jdt.core, since it is included in most of the eclipse distros (either Eclipse 3.5 Galileo or Eclipse 3.6 Helios ) That being said, the jdt core update site is part of the global Eclipse update sites , and I don't think you can easily download just the jdt.core part. The easiest way would still be to

How can I import eclipse JDT classes in a project

喜夏-厌秋 提交于 2019-11-30 22:39:20
I want to do the following imports in a class. import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.Compiler; import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; import org.eclipse.jdt.internal.compiler.ICompilerRequestor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt