To create an Eclipse welcome page, you should: Create a plug-in project that contains a welcome page class that inherits from IWorkbenchPageWelcomePage. Add an extension point in the plugin's plugin.xml file, specifying the welcome page ID, name, tag, and class name. Compile and deploy the plug-in, then restart Eclipse and select your welcome page from the Welcome perspective.
How to create an Eclipse welcome page
1. Create a plug-in project
- Open Eclipse IDE.
- Click "File" > "New" > "Others" > "Plug-in Development" > "Plug-in Project".
- Enter a project name (e.g. WelcomePage) and click Next.
- Select "New Activity Page" and click "Next".
- Enter the class name of the welcome page (for example, WelcomePageWelcome).
- Click "Finish".
2. Create a welcome page class
- In the project explorer, right-click the "src" folder and select "New" >"Class".
- Enter the class name (WelcomePageWelcome).
- Inherits from
org.eclipse.ui.part.IWorkbenchPageWelcomePage
.
3. Implement the welcome page interface
- Implement the
initialize(IWorkbenchWindow, IWorkbenchPage)
method, which is on the welcome page Called when created.
- In the
init(IWorkbenchWindow, IWorkbenchPage)
method you can create and display any widget or content you want.
4. Extend extension points
- In the plugin’s
plugin.xml
file, add the following extension points:
<code class="xml"><extension
point="org.eclipse.ui.welcomePage">
<welcomePage
id="欢迎页面ID"
name="欢迎页面名称"
label="欢迎页面Label"
class="欢迎页面类名"
after="org.eclipse.ui.intro.welcome">
</welcomePage>
</extension></code>
-
Among them:
-
Welcome page ID: The ID that uniquely identifies the welcome page.
-
Welcome page name: The name of the welcome page displayed in the menu.
-
Welcome page Label: The label displayed in the tool tip of the welcome page.
-
Welcome page class name: The fully qualified class name of the welcome page class created earlier.
-
after: Specify the order in which the welcome page appears in the menu.
5. Compile and deploy the plug-in
- Save and compile the plug-in project.
- Package the plugin from the plugin folder into a JAR file.
- Deploy the JAR file to the
plugins
folder in the Eclipse installation directory.
6. Enable the welcome page
- Restart Eclipse.
- Click "Window" > "Open Perspective" > "Others".
- Select the Welcome perspective and click Open.
- Select your welcome page in the drop-down menu.
The above is the detailed content of How to create a welcome page in eclipse. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn