java - Eclipse Plugin Help - Displaying result in a custom view -



java - Eclipse Plugin Help - Displaying result in a custom view -

i quite new eclipse plug-in development , please bear me if question trivial. in process of developing eclipse plugin.i have completed it, except stuck in lastly step. have created custom view in plugin.xml file , implementing iaction function perform corresponding action selection. so, logic behind using after user has performed particular action, result of action should displayed in custom view if opened otherwise view should opened through programme , result should displayed in it. code have written below -

public class illustration extends viewpart { private text text; @override public void createpartcontrol(composite parent) { text text = new text(parent,swt.null); this.text = text; } @override public void setfocus() { } @override @override public void printonview(string str) { text.settext(str); } }

the problem every time programme fails nullpointerexeption @ first settext() statement in public void run() function. have tried best , not able find solution. if give settext() statement in same createpartcontrol() function displaying text in view when open view first if seek outside not working. @ wits end here , allow me warn entire approach might wrong since new plugin development. happy if can provide me help or guidance problem. in advance!

eclipse creating 2 instances of object - 1 view , 1 action. view createpartcontrol called, , action run method called , since createpartcontrol has not run text field null.

you should utilize 2 separate classes, 1 view , 1 action.

in action class need find view, like:

iworkbenchpage page = platformui.getworkbench().getactiveworkbenchwindow().getactivepage(); iviewpart viewpart = page.findview("your view id"); myviewclass myviewclass = (myviewclass)viewpart; // todo phone call method in myviewclass set text

this assuming view open. if view not open have open it.

java view eclipse-plugin

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -