我在制作自己的 Eclipse 介绍页面时遇到了困难(如图所示)。
我的产品 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,或者您只是想要一个仅显示您的内容的最小配置?
如果是后者,您是否看过相同帮助的后面部分?定义一个最小的介绍配置,建议使用 org.eclipse.intro.minimal 以便它只显示您的内容。