You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/EclipsePluginDevelopmentFAQ.md
+112-3
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,28 @@ General Development
67
67
68
68
### How do I find a class from Eclipse?
69
69
70
-
See [here](/FAQ_How_do_I_find_a_particular_class_from_an_Eclipse_plug-in%3F"FAQ How do I find a particular class from an Eclipse plug-in?").
70
+
71
+
72
+
You need to set up your workspace so that all Eclipse plug-ins are found by the Java search engine. This can be accomplished by loading all the Eclipse plug-ins into your workspace, but this quickly results in a cluttered workspace in which it is difficult to find your own projects. There are two easier approaches to adding Eclipse plug-ins to the Java search engine's index.
73
+
74
+
**Option 1**
75
+
76
+
In Eclipse 3.5 (Galileo) or later
77
+
78
+
* Open the Plug-in Development Preference Page by going to **Window > Preferences > Plug-in Development**.
79
+
* Check the box marked **Include all plug-ins from target in Java search**.
80
+
81
+
**Option 2**
82
+
83
+
* Activate the 'Plug-ins' view by going to **Window > Show View > Other > PDE > Plug-ins**.
84
+
* Select all plug-ins in the view.
85
+
* From the context menu, select **Add to Java Search**.
86
+
87
+
Once you have done this, switch back to the Java perspective and use **Navigate > Open Type** (or press Ctrl + Shift + T) and start typing the name of the class or interface you are looking for. You will now be able to quickly open an editor on any Java type in the Eclipse Platform. If you are searching for the plug-in that contains that class, you will find that information in the bottom of the 'Open Type' dialog. Please note that a class that's in package x.y.z is not guaranteed to be in plug-in x.y.z, it may be contributed by another plug-in.
88
+
89
+
In case you are curious, this works by creating in your workspace a Java project called External Plug-in Libraries. This project will have all the Eclipse plug-ins you selected on its build path, which ensures that they will be consulted by the Java search engine when searching for and opening Java types. You can use a similar technique to add other Java libraries to the search index. Simply add the JARs you want to be able to search to the build path of any Java project in your workspace, and they will automatically be included in the search.
90
+
91
+
71
92
72
93
### I see these $NON-NLS-1$ tags all over the place when I'm browsing Eclipse's source code? What do they mean?
73
94
@@ -584,7 +605,46 @@ You should return true when you receive the proper notifications through [Abstra
584
605
585
606
### How do I close one/all of my editors upon workbench shutdown so that it won't appear upon workbench restart?
586
607
587
-
See [here](/FAQ_Close_All_Editors_On_Shutdown"FAQ Close All Editors On Shutdown").
608
+
The snippet below will close all Editors in the workbench when you close the eclipse application.
609
+
610
+
IWorkbench workbench = PlatformUI.getWorkbench();
611
+
final IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage();
612
+
613
+
workbench.addWorkbenchListener( new IWorkbenchListener()
614
+
{
615
+
public boolean preShutdown( IWorkbench workbench, boolean forced )
The example below shows how to close an editor that is programmatically opened.
629
+
630
+
IWorkbench workbench = PlatformUI.getWorkbench();
631
+
final IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage();
632
+
633
+
final IEditorPart editorPart = IDE.openEditorOnFileStore( activePage, fileStore );
634
+
635
+
workbench.addWorkbenchListener( new IWorkbenchListener() {
636
+
public boolean preShutdown( IWorkbench workbench, boolean forced ) {
637
+
activePage.closeEditor(editorPart, true);
638
+
return true;
639
+
}
640
+
641
+
public void postShutdown( IWorkbench workbench )
642
+
{
643
+
644
+
}
645
+
});
646
+
647
+
588
648
589
649
### How do I prevent a particular editor from being restored on the next workbench startup?
590
650
@@ -668,7 +728,56 @@ Now you can either run it directly in Eclipse...
668
728
669
729
config.doSave();
670
730
671
-
See also [FAQ How do I launch a Java program?](http://wiki.eclipse.org/FAQ_How_do_I_launch_a_Java_program%3F)
731
+
732
+
733
+
JDT has support for launching Java programs. First, add the following plug-ins to your dependent list:
734
+
735
+
736
+
* org.eclipse.debug.core
737
+
* org.eclipse.jdt.core
738
+
* org.eclipse.jdt.launching
739
+
740
+
With those plug-ins added to your dependent plug-in list, your Java program can be launched using the JDT in two ways. In the first approach, an IVMRunner uses the currently installed VM, sets up its classpath, and asks the VM runner to run the program:
741
+
742
+
void launch(IJavaProject proj, String main) {
743
+
IVMInstall vm = JavaRuntime.getVMInstall(proj);
744
+
if (vm == null) vm = JavaRuntime.getDefaultVMInstall();
The second approach is to create a new launch configuration, save it, and run it. The cfg parameter to this method is the name of the launch configuration to use:
0 commit comments