I am looking to add a ContextMenu to a TreeViewer following the example set out here: http://www.vogella.com/articles/EclipseCommands/article.html#contextmenu however I get a NPE at the line
getSite().registerContextMenu(menuManager, viewer);
getSite() returns null rather than the IWorkbenchPartSite. Can anyone explain why the IWorkbenchPartSite is null or how I could initialise it?
Any help is appreciated.
There is no method getSite() in preference pages. So I assume you are in an editor or a view.
The site is injected by the platform using the init method. When you call getSite() you have to make sure that you do it after the platform has called the init method.
A good place for context menu registration is the createPartControl method.
Related
I have implemented Action to create customized method url.
getURL(){ "sampleURL"}
doBuildNow(){//Method implementation}
So Here URL : http://hostserver/job/jobName/sampleURL/buildNow
I would like to use this method as POST which doesn't work by default, I didn't find any clue from google search. Can any one please help me on this.
In order to force a Jenkins action method to only accept a post, add the '#RequirePOST' annotation to the method.
#RequirePOST
doBuildNow(){//Method implementation}
This has the added benefit of automatically providing a 'Try POSTing' button when someone does a get via the browswer.
This is the behavior seen in Jenkins when accessing the '/exit' url.
I've got an Eclipse RCP application and a strange behaviour while using a wizard page. Following situation:
I've got a wizard page which is part of a multi-page-wizard. At this page I override the createContent(...) method to create my widgets, etc. After creating my widgets 2 private methods addListeners() and init() are called which initializes my widgets out of the model and add some listeners (e.g. a ModifyListener). The obscure behaviour is the following: When I first call init() and after that call addListeners() everything works fine. But if I do it the vice versa I got a NullPointerException in the WizardDialog.updateButtons() method which is part of RCP framework: There is a variable called currentPage as the following code excerpt shows. This variable causes the NPE mentioned above. If I do it the right way, the variable is correctly set.
...
if (backButton != null) {
backButton.setEnabled(currentPage.getPreviousPage() != null);
}
...
I don't get this behaviour. Can someony explain it to me? Within the 2 private methods mentioned above no framework-calls are done. Maybe it's some timing issue?
Best regards,
AnarchoEnte
In my App (Fusion Web) exist a ViewObject from Oracle DB.
I created the java classes and build a specific method (makeUniqueSearchByDate(String)) to process the data.
This method appears in "Data controls" that I can drag to the "view" and use as any other function. When I try to use it in a "bean" (instead of dragging directly):
public void setDate(ActionEvent actionEvent) {
ApplicationModule appMod =
Configuration.createRootApplicationModule("com.svr.model.AppModule", "AppModuleLocal");
ViewModelosByDataImpl fo = (ViewModelosByDataImpl) appMod.findViewObject("ViewModelosByData1");
String dateV = "07-01-2013";
fo.makeUniqueSearchByDate(dateV);
}
This code has no effect on the table. Can anyone see why?
Btw, the program does not throw any exception. Just does not work. The table remains the same. But if I use the button, automatically generated by "drag and drop" the function runs normally. I know I should study ADF, but unfortunately I have no time.
i think after you have exposed the method written at VO as Client interface, you need to create a method binding in pageDef file of you page. after creating the method binding, you need to access the method in bean through binding layer something like this :
OperationBinding op=((DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry()).getOperationBinding("Method Binding");
op.execute();
i think the method used by you to call VO method from bean is not right.
i think one more thing you need to do in your bean after calling the VO method is that you need to do refresh the table / perform PPR programatically :
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(component binding for your table component);
you can try setting autosubmit to true for command button which invokes action event, and set partial trigger for table to component id of the command button.
can you post VO method code as well ?
does the method get called and data gets committed / updated when you execute it through bean ? is it only a table refresh issue ? do you see changes to data if you manually refresh the page ?
I'm developing with zk framework in java (with eclipse ) .
I'm trying to link some textbox (view) to controller throught wired variable .
The problem is that in the controller the wired variable is null when the submit event is called .
Index:Index.zul
Login :Login.java
In your doAfterCompose method add this line or you can use doAfterCompose method like
this
#AfterCompose
public void afterCompose(#ContextParam(ContextType.VIEW) Component view){
Selectors.wireComponents(view, this, false);
}
Don't use CSS selectors in the #Wire parameter, just use the ZK component id. That is to say, leave off the #.
Also, if the Java variable name is the same as the ZK component id (eg "win") you can leave off the #Wire parameter all together and it'll still work fine.
Edit:
There is another problem in your code. The Textbox you're importing is from the POI package =X
I have created a stateless component in Wicket 1.5, by extending the component and giving the #StatelessComponent annotation,
I was trying to check the component being stateful/stateless with the StatelessChecker.
But i am not able to check, here is the code which i was trying .
#StatelessComponent
public class StatelessText extends TextField
//Client Class
StatelessText test = new StatelessText("test");
StatelessChecker sc = new StatelessChecker();
sc.onBeforeRender(test);
I dont see anything on console or any exceptions/errors.
Maybe i am not using the correct way, Can anybody please guide me here.
Appreciate the Help.
you have to register the StatelessChecker during the init of the WicketApplication.
/**
* #see org.apache.wicket.Application#init()
*/
#Override
public void init() {
super.init();
// might want to check if you're in dev mode or not...
getComponentPreOnBeforeRenderListeners().add(new StatelessChecker());
}
You dont need to explicitly call the Statelesschecker in your class. As Throsten said you need to add that in your WebApplications init and annotate your - class to be checked - as Statelesscomponent. If your Application is confidured to be in development mode in you web.xml you will get a runtime error when calling this page if it is Statefull.
Im not sure I understood what you are trying to do there. why are you holding an instance of your class in itself? are you trying to build a singleton? And what purpose does StatelessText has anyway? the Textfield in an usual form will be Stateless as long theres no explicitly added Ajax behaviour to it.