Skip to content

Commit 15efa2a

Browse files
committed
FAQ - Coding and link adjustments
1 parent 9a0f4fc commit 15efa2a

File tree

109 files changed

+1134
-1236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1134
-1236
lines changed

docs/FAQ/FAQ_How_do_I_configure_an_Eclipse_Java_project_to_use_SWT.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ The easiest way to configure a Java project in Eclipse to use SWT is as follows:
77

88
1. Download the SWT stable release for your Eclipse version and your operating system from [Eclipse SWT Project Page](https://www.eclipse.org/swt). For example, for Eclipse version 3.3 and Windows, select the Windows link under Releases / Stable, as shown in the screenshot below.
99

10-
![Swt web page.png](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Swt_web_page.png)
10+
![Swt web page.png](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Swt_web_page.png)
1111

1212
2. This will download a zip file that contains our org.eclipes.swt project. (For example, for Eclipse 3.3 and Windows, the file is called swt-3.3.1.1-win32-win32-x86.zip.) Do not unzip this file. Just download it and note the directory where you saved it.
1313
3. Inside Eclipse, select Import / Existing Projects into Workspace, as shown below.
1414

15-
![Import wizard1.png](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Import_wizard1.png)
15+
![Import wizard1.png](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Import_wizard1.png)
1616

1717
4. Press Next and select the option Select archive file. Browse to the zip file you just downloaded. A project called org.eclipse.swt will display in the Projects list. Make sure it is checked, as shown below, and press Finish.
1818

19-
![Import wizard2.png](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Import_wizard2.png)
19+
![Import wizard2.png](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Import_wizard2.png)
2020

2121
5. Eclipse will create the project org.eclipse.swt in your workspace. This project already has the required SWT JAR file, including source code for the SWT classes.
2222
6. Select the project that will be used to develop SWT programs (for example, "MyProject) and select Project / Properties / Java Build Path.
2323
7. Select the Projects tab. Press Add. The org.eclipse.swt project will display in the Select projects to add: list. Select this project by checking the box. The screen should display as shown below.
2424

25-
![Required project selection.png](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Required_project_selection.png)
25+
![Required project selection.png](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Required_project_selection.png)
2626

2727
8. Press OK to return to the Projects tab of the Java Build Path dialog. The screen should show the org.eclipse.swt project as shown below.
2828

29-
![Myproject build path.png](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Myproject_build_path.png)
29+
![Myproject build path.png](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Myproject_build_path.png)
3030

3131

3232
At this point, your project has access to all of the SWT packages and to the SWT source code.

docs/FAQ/FAQ_How_do_I_create_an_application.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ FAQ How do I create an application?
55

66
To create an application, you need a plug-in that adds an extension to the org.eclipse.core.runtime.applications extension point. An example application definition from a plugin.xml file is as follows:
77

8-
<extension id="helloworld" point="org.eclipse.core.runtime.applications">
9-
<application>
10-
<run class="org.eclipse.faq.HelloWorld"/>
11-
</application>
12-
</extension>
8+
<extension id="helloworld" point="org.eclipse.core.runtime.applications">
9+
<application>
10+
<run class="org.eclipse.faq.HelloWorld"/>
11+
</application>
12+
</extension>
1313

1414

1515
The class attribute of the run element must specify a class that implements org.eclipse.core.boot.IPlatformRunnable. Here is the source of a trivial application:
1616

17-
public class HelloWorld implements IPlatformRunnable {
18-
public Object run(Object args) throws Exception {
19-
System.out.println("Hello from Eclipse application");
20-
return EXIT_OK;
17+
public class HelloWorld implements IPlatformRunnable {
18+
public Object run(Object args) throws Exception {
19+
System.out.println("Hello from Eclipse application");
20+
return EXIT_OK;
21+
}
2122
}
22-
}
2323

2424
To run the application, you need to specify the fully qualified ID of your application extension definition, using the application command-line argument when launching Eclipse:
2525

26-
eclipse -application org.eclipse.faq.helloworld.helloworld
26+
eclipse -application org.eclipse.faq.helloworld.helloworld
2727

2828
The fully qualified extension ID is computed by prepending the plug-in ID to the simple extension ID from the plugin.xml file. In this example, the plug-in ID is org.eclipse.faq.helloworld, and the simple extension ID is helloworld.
2929

docs/FAQ/FAQ_How_do_I_create_an_external_tool_builder.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ An external tool builder is an external tool that runs every time the projects i
1111

1212
As with ordinary external tools, you can define your own type of external tool builder by creating a new launch configuration type. In your launch configuration declaration, you must specify the category for external tool builder launch configurations:
1313

14-
<launchConfigurationType
15-
name="%AntBuild"
16-
delegate="com.xyz.MyLaunchDelegate"
17-
'''category="org.eclipse.ui.externaltools.builder"'''
18-
modes="run"
19-
id="com.xyz.MyLaunchType">
20-
</launchConfigurationType>
14+
<launchConfigurationType
15+
name="%AntBuild"
16+
delegate="com.xyz.MyLaunchDelegate"
17+
'''category="org.eclipse.ui.externaltools.builder"'''
18+
modes="run"
19+
id="com.xyz.MyLaunchType">
20+
</launchConfigurationType>
2121

2222
See Also:
2323
---------

docs/FAQ/FAQ_How_do_I_create_an_image_registry_for_my_plug-in.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ FAQ How do I create an image registry for my plug-in?
55

66
If you're writing a plug-in with UI components, it should be a subclass of AbstractUIPlugin. This superclass already provides you with an empty image registry accessible by calling getImageRegistry. When the registry is first accessed, the hook method initializeImageRegistry will be called. You should override this method to populate your image registry with the image descriptors you need. You don't have to use this registry if you don't need it, and because it is created lazily on first access, there is no performance overhead if you never use it. Here is an example of a plug-in that adds a sample.gif image to its image registry:
77

8-
public class ExamplesPlugin extends AbstractUIPlugin {
9-
public static final String PLUGIN_ID = "org.eclipse.faq.examples";
10-
public static final String IMAGE_ID = "sample.image";
11-
...
12-
protected void initializeImageRegistry(ImageRegistry registry) {
13-
Bundle bundle = Platform.getBundle(PLUGIN_ID);
14-
IPath path = new Path("icons/sample.gif");
15-
URL url = FileLocator.find(bundle, path, null);
16-
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
17-
registry.put(IMAGE_ID, desc);
8+
public class ExamplesPlugin extends AbstractUIPlugin {
9+
public static final String PLUGIN_ID = "org.eclipse.faq.examples";
10+
public static final String IMAGE_ID = "sample.image";
11+
...
12+
protected void initializeImageRegistry(ImageRegistry registry) {
13+
Bundle bundle = Platform.getBundle(PLUGIN_ID);
14+
IPath path = new Path("icons/sample.gif");
15+
URL url = FileLocator.find(bundle, path, null);
16+
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
17+
registry.put(IMAGE_ID, desc);
18+
}
1819
}
19-
}
2020

2121

2222

docs/FAQ/FAQ_How_do_I_create_an_update_site_(site.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ First create a new plugin project
1212

1313
New -> Plug-in Development -> Plug-in Project
1414

15-
![Plugin.jpg](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Plugin.jpg)
15+
![Plugin.jpg](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Plugin.jpg)
1616

1717
You can select a template for creating your project or even just create a blank one in case you know how things work.
1818

1919
Now you have to create your feature project.
2020

2121
New -> Plug-in Development -> Feature Project
2222

23-
![Feature.jpg](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Feature.jpg)
23+
![Feature.jpg](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Feature.jpg)
2424

2525
Here is the point where you link your Plugin project with your Feature Project.
2626

2727
Open the feature.xml file on your Feature project.
2828

2929
On plugins tab click on add and select your project then save the file.
3030

31-
![Feature-plugin.jpg](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Feature-plugin.jpg)
31+
![Feature-plugin.jpg](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Feature-plugin.jpg)
3232

3333
The last piece is the Update site project. See below
3434

@@ -39,15 +39,15 @@ To create it go to
3939

4040
New -> Plug-in Development -> Update Site Project
4141

42-
![Site.jpg](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Site.jpg)
42+
![Site.jpg](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Site.jpg)
4343

4444
Now we just have to link the Feature project with the Update site, and you're good to go.
4545

4646
To do that, open the site.xml file on your Site project.
4747

4848
Add Feature -> Select your project.
4949

50-
![Site-feature.jpg](https://raw.githubusercontent.com/eclipse/gef-classic/master/docs/images/Site-feature.jpg)
50+
![Site-feature.jpg](https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQimages/Site-feature.jpg)
5151

5252
In case you want to add a category for your feature, just click on New Category,
5353

docs/FAQ/FAQ_How_do_I_get_a_Display_instance.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Most users deploy Eclipse as one top-level window and manage their code in persp
77

88
If you call Display.getCurrent, it returns the display that was created in that thread, if any. Here is an example:
99

10-
public static Display getDisplay() {
11-
Display display = Display.getCurrent();
12-
//may be null if outside the UI thread
13-
if (display == null)
14-
display = Display.getDefault();
15-
return display;
16-
}
10+
public static Display getDisplay() {
11+
Display display = Display.getCurrent();
12+
//may be null if outside the UI thread
13+
if (display == null)
14+
display = Display.getDefault();
15+
return display;
16+
}
1717

1818
A calling thread that does not have an active display will return null. Therefore, this method is useful only when you are absolutely certain that you are in the thread that created the display. This brings us to the second way you can obtain a display instance: Display.getDefault(). It will return the first display that was created. If your application has only one display, this is an acceptable way of obtaining the display.
1919

docs/FAQ/FAQ_How_do_I_get_started_with_creating_a_custom_text_editor.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ The FAQs in this chapter will use a running example of a simple HTML editor. We
2323

2424
Here is the skeleton of the HTMLEditor class, showing the customization entry points:
2525

26-
public class HTMLEditor extends AbstractTextEditor {
27-
public HTMLEditor() {
28-
//install the source configuration
29-
setSourceViewerConfiguration(new HTMLConfiguration());
30-
//install the document provider
31-
setDocumentProvider(new HTMLDocumentProvider());
26+
public class HTMLEditor extends AbstractTextEditor {
27+
public HTMLEditor() {
28+
//install the source configuration
29+
setSourceViewerConfiguration(new HTMLConfiguration());
30+
//install the document provider
31+
setDocumentProvider(new HTMLDocumentProvider());
32+
}
33+
protected void createActions() {
34+
super.createActions();
35+
//... add other editor actions here
36+
}
3237
}
33-
protected void createActions() {
34-
super.createActions();
35-
//... add other editor actions here
36-
}
37-
}
3838

3939
See Also:
4040
---------

docs/FAQ/FAQ_How_do_I_handle_setup_problems_for_a_given_builder.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ FAQ How do I handle setup problems for a given builder?
55

66
When running a build in a runtime workbench, you might get the following message:
77

8-
 !MESSAGE Skipping builder com.xyz.builder for project P.
9-
Either the builder is missing from the install, or it
10-
belongs to a project nature that is missing or disabled.
8+
 !MESSAGE Skipping builder com.xyz.builder for project P.
9+
Either the builder is missing from the install, or it
10+
belongs to a project nature that is missing or disabled.
1111

1212
This message means that something is wrong with the builder plug-in or with the attribution of the builder specification in the .project file. The builder plug-in might load fine but still be broken, perhaps because it is missing an ID in the extension point declaration.
1313

docs/FAQ/FAQ_How_do_I_hook_into_global_actions,_such_as_Copy_and_Delete.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Certain standard toolbar and menu entries can be shared among several views and
77

88
A view typically registers its global action handlers in the createPartControl method:
99

10-
IActionBars actionBars= getViewSite().getActionBars();
11-
actionBars.setGlobalActionHandler(
12-
ActionFactory.COPY.getId(),
13-
copyAction);
10+
IActionBars actionBars= getViewSite().getActionBars();
11+
actionBars.setGlobalActionHandler(
12+
ActionFactory.COPY.getId(),
13+
copyAction);
1414

1515
You have to do this only once for each view that is created. The platform remembers your action handler and retargets the action each time the view becomes active. To unregister from a global action, simply invoke setGlobalActionHandler again and pass in a null value for the handler.
1616

docs/FAQ/FAQ_How_do_I_hook_my_editor_to_the_Back_and_Forward_buttons.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ A navigation location can also choose to support persistence. When an editor clo
1616

1717
Now we know how to create and restore editor locations, but how are entries added to the navigation history in the first place? Anyone can mark an interesting location in an open editor by calling the markLocation method on INavigationHistory. Code that causes the cursor or selection to jump to another location in an editor should call this method both before and after performing the jump. As mentioned, implementations of restoreLocation should also mark the current location before restoring an old one. Regardless of whether the specific editor has any support for navigation history, markLocation will work. If the editor doesn't implement INavigationLocationProvider, a history entry will be added, allowing the user to jump back to that editor but without returning to any particular location. The following snippet shows an action that is added to the sample HTML editor. When the action is invoked, it will add the current cursor position to the navigation history:
1818

19-
public class MarkLocationAction extends Action {
20-
private IEditorPart editor;
21-
public MarkLocationAction(IEditorPart editor) {
22-
super("Mark Location in History", null);
23-
this.editor = editor;
19+
public class MarkLocationAction extends Action {
20+
private IEditorPart editor;
21+
public MarkLocationAction(IEditorPart editor) {
22+
super("Mark Location in History", null);
23+
this.editor = editor;
24+
}
25+
public void run() {
26+
IWorkbenchPage page = editor.getSite().getPage();
27+
page.getNavigationHistory().markLocation(editor);
28+
}
2429
}
25-
public void run() {
26-
IWorkbenchPage page = editor.getSite().getPage();
27-
page.getNavigationHistory().markLocation(editor);
28-
}
29-
}
3030

0 commit comments

Comments
 (0)