Eclipse RCP view not coming on the left side on the screen

筅森魡賤 提交于 2019-12-13 21:09:06

问题


After taking cue from this ques. I ended up here but the problem is, view is coming on right hand side of the screen and not occupying the full space. Here is the current screenshot .

and the code is

public class MonitorView extends CoreView 
{
    public MonitorView(final Composite parent)
    {
        super(parent);
        setDisplayName(I18N("Visual Monitoring of iCommand"));
       // setLayout(new FillLayout());
        final Composite composite=GUIToolkit.newComposite(parent, SWT.FILL, new GridData(SWT.TOP,SWT.LEFT,true,true,1,1));
        FillLayout layout=new FillLayout();
        composite.setLayout(layout);
        CreatePartControl(composite);


    }

    private void CreatePartControl(Composite parent) 
    {
        // TODO Auto-generated method stub
        final Canvas canvas=new Canvas(parent,SWT.NONE);
        Color white = display.getSystemColor(SWT.COLOR_WHITE);
        canvas.setBackground(white);
        canvas.addPaintListener(new PaintListener() {
            @Override 
            public void paintControl(PaintEvent event)
            {
                int offset_x=130;
                int offset_y=70;
                int j=0,i=0,n=3,x,y;

                DrawRoundedRectangle d= new DrawRoundedRectangle();
                //for loop for column 1.Placing elements column wise. 

                for(i=0;i<n;i++)
                { x=0;y=offset_y*j;
                  d.drawrectangle(event, x, y, j);
                  j++;
                  x=0;y=offset_y*j;
                  d.drawrectangle(event, x, y, j);
                  j++;
                }

            j=0;int flag=6;
            //for loop for drawing column 2
                for(i=0;i<n;i++)
                { 
                  x=offset_x; y=offset_y*j;
                  d.drawrectangle(event, x, y, flag);
                  j++;flag++;
                  x=offset_x;y=offset_y*j;
                  d.drawrectangle(event, x, y, flag);
                  flag++;
                  j++;
                }
            }
        });

    }
}

How do i bring the view on the left hand side and onto full screen

Solution. See comment thread of question for discussion

public MonitorView(final Composite parent)
    {
        super(parent);
        setDisplayName(I18N("Visual Monitoring of iCommand"));
        setLayout(new FillLayout());
        CreatePartControl(this);
   }

Rest everything is same for above. Hope it helps :)

来源:https://stackoverflow.com/questions/29385501/eclipse-rcp-view-not-coming-on-the-left-side-on-the-screen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!