eclipse plugin - Calling a ViewPart(SWT) from void main -


i new eclipse plugin , swt. designing view part functionalities. problem have launch eclipse plugin check. there way can call main(string[] args) method?

i posting sample viewpart code

public class view extends viewpart { public static display display=new display(); public static final string id = "test.view"; //$non-nls-1$ private final formtoolkit toolkit = new formtoolkit(display.getcurrent());  public view() { }  /**  * create contents of view part.  * @param parent  */ @override public void createpartcontrol(composite parent) {     composite container = toolkit.createcomposite(parent, swt.none);     toolkit.paintbordersfor(container);     {         label lblnewlabel = new label(container, swt.none);         lblnewlabel.setbounds(25, 46, 49, 13);         toolkit.adapt(lblnewlabel, true, true);         lblnewlabel.settext("new label");     }      spinner spinner = new spinner(container, swt.border);     spinner.setbounds(88, 105, 47, 21);     toolkit.adapt(spinner);     toolkit.paintbordersfor(spinner);      dragsource dragsource = new dragsource(container, dnd.drop_move);      droptarget droptarget = new droptarget(container, dnd.drop_move);      canvas canvas = new canvas(container, swt.none);     canvas.setbounds(94, 161, 174, 148);     toolkit.adapt(canvas);     toolkit.paintbordersfor(canvas);      createactions();     initializetoolbar();     initializemenu(); }  public void dispose() {     toolkit.dispose();     super.dispose(); }  /**  * create actions.  */ private void createactions() {     // create actions }  /**  * initialize toolbar.  */ private void initializetoolbar() {     itoolbarmanager tbm = getviewsite().getactionbars().gettoolbarmanager(); }  /**  * initialize menu.  */ private void initializemenu() {     imenumanager manager = getviewsite().getactionbars().getmenumanager(); }  @override public void setfocus() {     // set focus }  

can write like

public static void main(string[] args){     view v=new view();      shell shell=new shell(display);     v.createpartcontrol(shell); } 

  1. not really, eclipse views part of rcp , depend on infrastructure. can create small rcp application shows view instead.

  2. having public static display display=new display(); in view wrong! there display time code runs, can accessed display.getdefault() (on thread) or display.getcurrent() (on gui thread).


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -