【发布时间】:2009-07-13 09:08:59
【问题描述】:
我在制作自己的 Eclipse 介绍页面 (as shown here) 时遇到困难。
我的产品 ID 似乎有些问题,但我不知道如何获取产品 ID,我尝试扩展 org.eclipse.core.runtime.products 但当它询问我要注册哪个应用程序时我不知道该回答什么,这似乎是问题的一部分……有人知道吗?
【问题讨论】:
我在制作自己的 Eclipse 介绍页面 (as shown here) 时遇到困难。
我的产品 ID 似乎有些问题,但我不知道如何获取产品 ID,我尝试扩展 org.eclipse.core.runtime.products 但当它询问我要注册哪个应用程序时我不知道该回答什么,这似乎是问题的一部分……有人知道吗?
【问题讨论】:
这是我最终所做的......
public class IntroPart implements IIntroPart {
//VITAL : you must implement
public void createPartControl(Composite container) {
Composite outerContainer = new Composite(container, SWT.NONE);
GridLayout gridLayout = new GridLayout();
outerContainer.setLayout(gridLayout);
outerContainer.setBackground(outerContainer.getDisplay()
.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
Label label = new Label(outerContainer, SWT.CENTER);
label.setText("WELCOME TO ECLIPSE");
GridData gd = new GridData(GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL);
gd.horizontalAlignment = GridData.CENTER;
gd.verticalAlignment = GridData.CENTER;
label.setLayoutData(gd);
label.setBackground(outerContainer.getDisplay().getSystemColor(
SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
}
//VITAL : you must implement
public String getTitle() {
return "My Title";
}
//VITAL : you must implement
public Image getTitleImage() {
return new Image(Display.getCurrent(), this.getClass()
.getResourceAsStream("splash.bmp"));
}
public void addPropertyListener(IPropertyListener listener) {
//NON-VITAL : implement accordingly to your needs
}
public void dispose() {
//NON-VITAL : implement accordingly to your needs
}
public IIntroSite getIntroSite() {
//NON-VITAL : implement accordingly to your needs
return null;
}
public void init(IIntroSite site, IMemento memento)
throws PartInitException {
//NON-VITAL : implement accordingly to your needs
}
public void removePropertyListener(IPropertyListener listener) {
//NON-VITAL : implement accordingly to your needs
}
public void saveState(IMemento memento) {
//NON-VITAL : implement accordingly to your needs
}
public void setFocus() {
//NON-VITAL : implement accordingly to your needs
}
public void standbyStateChanged(boolean standby) {
//NON-VITAL : implement accordingly to your needs
}
public Object getAdapter(Class adapter) {
//NON-VITAL : implement accordingly to your needs
return null;
}
}
使用的图片是我的一张,当您显示欢迎页面时,它会作为标签图标...
很奇怪,title 和 image 没有默认值……但是嘿……这就是生活。
希望对你有所帮助^^
【讨论】:
您需要定义一个新的 id,还是只想要一个仅显示您的内容的最小配置?
如果是后者,您是否看过相同帮助的后面部分? Defining a minimal intro configuration,建议使用 org.eclipse.intro.minimal,这样它只会显示您的内容。
【讨论】: