代码之家  ›  专栏  ›  技术社区  ›  Ar3s

制作我自己的Eclipse简介页面

  •  4
  • Ar3s  · 技术社区  · 16 年前

    我在制作自己的Eclipse简介页面时遇到了困难( as shown here ).

    我的产品ID似乎有问题,但我不知道如何获取产品ID,我曾尝试扩展org.eclipse.core.runtime.products,但当它问我想注册哪个应用程序时,我不知道该回答什么,这似乎是问题的一部分。有人知道吗?

    2 回复  |  直到 10 年前
        1
  •  1
  •   Rich Seller    16 年前

    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;
        }
    }

    使用的图片是我的,当你显示欢迎页面时,它会作为标签图标。..

    奇怪的是,标题和图像没有默认值。..但是呵呵。…这就是生活。

    希望这会有所帮助^^

        2
  •  5
  •   Ar3s    16 年前

    你需要定义一个新的id,还是只想要一个只显示你的内容的最小配置?

    如果是后者,你看过同一帮助的后面部分吗? Defining a minimal intro configuration ,建议使用org.eclipse.intro.minimal,这样它只会显示您的内容。