Trying to open an editor in RCP - eclipse-rcp

I am developing an RCP application where I am trying to open the graphiti editor through tool bar menu ,but its giving me the exceptions mentioned below...
please help
java.lang.IllegalArgumentException:
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:47)
org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElements(ModelServiceImp.
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3112)
at org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:3034)
at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:3016)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3012)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2976)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2959)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:628)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:826)
at org.eclipse.jface.window.Window.open(Window.java:802)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

Open an Editor using RCP Eclipse
package rcp_demo.Editor;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
public class UserCommand extends AbstractHandler{
public static final String ID = "rcp_demo.Editor.UserCommand";
#Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage page = window.getActivePage();
//create UserEditorInput Class
//public class UserEditorInput implements IEditorInput{}
UserEditorInput input = new UserEditorInput();
try {
//Create UserEditor class
//public class UserEditor extends EditorPart { public static final String ID = "rcp_demo.Editor.user";}
page.openEditor(input, UserEditor.ID);
} catch (PartInitException e) {
System.out.println("Error:" + this.getClass().getName() + ":" + e);
e.printStackTrace();
throw new ExecutionException("Error open UserEditor");
}
return null;
}
}
plugin.xml file
perspectives id and perspectiveExtensions targetID are same like this
// perspectives
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="RCP Perspective"
class="rcp_demo.Perspective"
id="RCP_Demo.perspective">
</perspective>
</extension>
// perspectiveExtensions
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="RCP_Demo.perspective">
<view
closeable="true"
id="RCP_Demo.Views.task"
minimized="false"
moveable="true"
relationship="right"
relative="org.eclipse.ui.editorss"
showTitle="true">
</view>
</perspectiveExtension>
</extension>
//User Command
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="rcp_demo.Editor.UserCommand"
id="rcp_demo.Editor.UserCommand"
name="Call UserEditor">
</command>
</extension>
/// user Editor
<extension
point="org.eclipse.ui.editors">
<editor
class="rcp_demo.Editor.UserEditor"
default="false"
id="rcp_demo.Editor.user"
name="UserEditor">
</editor>
</extension>

Related

class GoogleMapView and javaFX

i'm try a write a simple javafx program using the GmapsFX. this is the code that i copied from internet for learn the main rudiments of this library.
this is the file .fxml
<?import com.lynden.gmapsfx.GoogleMapView?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
<children>
<GoogleMapView fx:id="mapView" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Label alignment="CENTER" contentDisplay="CENTER" text="Map" AnchorPane.bottomAnchor="376.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
this is the controller:
package application;
import com.lynden.gmapsfx.GoogleMapView;
import com.lynden.gmapsfx.MapComponentInitializedListener;
import com.lynden.gmapsfx.javascript.object.GoogleMap;
import com.lynden.gmapsfx.javascript.object.InfoWindow;
import com.lynden.gmapsfx.javascript.object.InfoWindowOptions;
import com.lynden.gmapsfx.javascript.object.LatLong;
import com.lynden.gmapsfx.javascript.object.MapOptions;
import com.lynden.gmapsfx.javascript.object.MapTypeIdEnum;
import com.lynden.gmapsfx.javascript.object.Marker;
import com.lynden.gmapsfx.javascript.object.MarkerOptions;
import javafx.fxml.FXML;
public class SampleController implements MapComponentInitializedListener {
#FXML
private GoogleMapView mapView;
private GoogleMap map = null;
#Override
public void mapInitialized() {
MapOptions mapOptions = new MapOptions();
LatLong latLong = new LatLong(47.6097, -122.3331);
mapOptions.center(latLong)
.mapType(MapTypeIdEnum.ROADMAP)
.overviewMapControl(false)
.panControl(false)
.rotateControl(false)
.scaleControl(false)
.streetViewControl(false)
.zoomControl(false)
.zoom(12);
map = mapView.createMap(mapOptions);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLong);
Marker marker = new Marker(markerOptions);
map.addMarker(marker);
InfoWindowOptions infoWindowOptions = new InfoWindowOptions();
infoWindowOptions.content("<h2>ROMA</h2>Location di Roma<br>");
InfoWindow infoWindow = new InfoWindow(infoWindowOptions);
infoWindow.open(map, marker);
}
#FXML
public void initialize() {
assert mapView != null : "fx:id=\"mapView\" was not injected: check your FXML file 'Sample.fxml'.";
mapView.addMapInializedListener(this);
}
}
and the answer from eclipse is:
1866 [JavaFX Application Thread] INFO com.lynden.gmapsfx.GoogleMapView - Alert: Hide directions called
is there anyone that can help me, please

How to replace eclipse's default renderer?

I have created a eclipse plugin which implement a new WorkbenchRendererFactory.
public class MyRendererFactory extends WorkbenchRendererFactory {
private MyStackRenderer stackRenderer;
#Override
public AbstractPartRenderer getRenderer(MUIElement uiElement, Object parent) {
if (uiElement instanceof MPartStack) {
if (stackRenderer == null) {
stackRenderer = new MyStackRenderer();
super.initRenderer(stackRenderer);
}
return stackRenderer;
}
return super.getRenderer(uiElement, parent);
}
}
But I do not know to how to replace the default renderfactory with my new renderfactory.
I tried to register it in the plugin.xml
<extension
id="product"
name="stacker"
point="org.eclipse.core.runtime.products">
<product
name="com.fakecoder.stackrenderer"
application="org.eclipse.e4.ui.workbench.swt.E4Application">
<property
name="appName"
value="com.fakecoder.stackrenderer">
</property>
<property
name="rendererFactoryUri"
value="bundleclass://com.fakecoder.stackrenderer/com.fakecoder.stackrenderer.swt.MyRendererFactory">
</property>
</product>
</extension>
but failed.
How could I change the default render of eclipse in a eclipse plugin?

GWTP, PresenterWidget and Google Visualisation API won't display PieChart

I'm new at GWT-P, but there is very little material on this topic. I'm trying to make simple pie chart widget, for testing purpose. I've made Widget presenter, view, and UiBinder.
package com.rs.gwtp.gametestingyou.client;
import com.gwtplatform.mvp.client.PresenterWidget;
import com.gwtplatform.mvp.client.View;
import com.google.inject.Inject;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.HTMLPanel;
public class PieChartPresenter extends
PresenterWidget<PieChartPresenter.MyView> {
public interface MyView extends View {
public HTMLPanel getChartPanel();
public void drawPieChart();
}
#Inject
public PieChartPresenter(final EventBus eventBus, final MyView view) {
super(eventBus, view);
}
#Override
protected void onBind() {
super.onBind();
}
/*Ovde prmeniti method*/
#Override
protected void onReset() {
super.onReset();
/*MyView v = getView();
v.drawPieChart();*/
getView().drawPieChart();
}
}
Then View.
package com.rs.gwtp.gametestingyou.client;
import com.gwtplatform.mvp.client.ViewImpl;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.visualization.client.AbstractDataTable;
import com.google.gwt.visualization.client.AbstractDataTable.ColumnType;
import com.google.gwt.visualization.client.DataTable;
import com.google.gwt.visualization.client.visualizations.corechart.Options;
import com.google.gwt.visualization.client.visualizations.corechart.PieChart;
import com.google.inject.Inject;
public class PieChartView extends ViewImpl implements PieChartPresenter.MyView {
private final Widget widget;
#UiField HTMLPanel chartPanel;
#UiField (provided=true) PieChart pieChart;
public interface Binder extends UiBinder<Widget, PieChartView> {
}
#Inject
public #UiConstructor PieChartView(final Binder binder) {
widget = binder.createAndBindUi(this);
pieChart = new PieChart(createTable(), createOptions());
chartPanel.add(pieChart);
}
#Override
public Widget asWidget() {
return widget;
}
public HTMLPanel getChartPanel(){
return chartPanel;
}
#Override
public void drawPieChart() {
// OVAJ POKUSAJ
pieChart.draw(createTable(),createOptions());
}
private Options createOptions() {
Options options = Options.create();
options.setWidth(400);
options.setHeight(240);
options.setTitle("My Daily Activities");
return options;
}
private AbstractDataTable createTable() {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Task");
data.addColumn(ColumnType.NUMBER, "Hours per Day");
data.addRows(2);
data.setValue(0, 0, "Work");
data.setValue(0, 1, 14);
data.setValue(1, 0, "Sleep");
data.setValue(1, 1, 10);
return data;
}
}
And last UiBinder
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
ui:generateLocales='default'
xmlns:c="urn:import:com.google.gwt.visualization.client.visualizations.corechart" xmlns:v="urn:import:com.google.gwt.visualization.client.visualizations">
<g:HTMLPanel ui:field="chartPanel">
<c:PieChart ui:field="pieChart" ></c:PieChart>
</g:HTMLPanel>
</ui:UiBinder>
When I load this code I get Error:
[ERROR] [gametestingyou] - Unable to load module entry point class com.rs.gwtp.gametestingyou.client.GameTestingYou (see associated exception for details) and Umbrella exception.
Help please :) !
This is full Exception:
19:14:34.890 [ERROR] [gametestingyou] Unable to load module entry point class com.rs.gwtp.gametestingyou.client.GameTestingYou (see associated exception for details)
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
at com.google.gwt.user.client.impl.HistoryImpl.fireEvent(HistoryImpl.java:75)
at com.google.gwt.event.logical.shared.ValueChangeEvent.fire(ValueChangeEvent.java:43)
at com.google.gwt.user.client.impl.HistoryImpl.fireHistoryChangedImpl(HistoryImpl.java:82)
at com.google.gwt.user.client.History.fireCurrentHistoryState(History.java:121)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.revealCurrentPlace(PlaceManagerImpl.java:310)
at com.rs.gwtp.gametestingyou.client.GameTestingYou.onModuleLoad(GameTestingYou.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.EventBus.castFireEventFromSource(EventBus.java:77)
at com.google.gwt.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:67)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.fireEvent(PlaceManagerImpl.java:146)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.doRevealPlace(PlaceManagerImpl.java:121)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.revealPlace(PlaceManagerImpl.java:339)
at com.rs.gwtp.gametestingyou.client.place.ClientPlaceManager.revealDefaultPlace(ClientPlaceManager.java:24)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.onValueChange(PlaceManagerImpl.java:264)
at com.google.gwt.event.logical.shared.ValueChangeEvent.dispatch(ValueChangeEvent.java:128)
at com.google.gwt.event.logical.shared.ValueChangeEvent.dispatch(ValueChangeEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.impl.HistoryImpl.fireEvent(HistoryImpl.java:75)
at com.google.gwt.event.logical.shared.ValueChangeEvent.fire(ValueChangeEvent.java:43)
at com.google.gwt.user.client.impl.HistoryImpl.fireHistoryChangedImpl(HistoryImpl.java:82)
at com.google.gwt.user.client.History.fireCurrentHistoryState(History.java:121)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.revealCurrentPlace(PlaceManagerImpl.java:310)
at com.rs.gwtp.gametestingyou.client.GameTestingYou.onModuleLoad(GameTestingYou.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null
at com.google.gwt.user.client.ui.HTMLPanel.addAndReplaceElement(HTMLPanel.java:197)
at com.rs.gwtp.gametestingyou.client.PieChartView_BinderImpl.createAndBindUi(PieChartView_BinderImpl.java:33)
at com.rs.gwtp.gametestingyou.client.PieChartView_BinderImpl.createAndBindUi(PieChartView_BinderImpl.java:1)
at com.rs.gwtp.gametestingyou.client.PieChartView.(PieChartView.java:27)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.com$rs$gwtp$gametestingyou$client$PieChartView_PieChartView_methodInjection(ClientGinjectorImpl.java:555)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.create_Key$type$com$rs$gwtp$gametestingyou$client$PieChartView$_annotation$$none$$(ClientGinjectorImpl.java:559)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.get_Key$type$com$rs$gwtp$gametestingyou$client$PieChartView$_annotation$$none$$(ClientGinjectorImpl.java:570)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.create_Key$type$com$rs$gwtp$gametestingyou$client$PieChartPresenter$MyView$_annotation$$none$$(ClientGinjectorImpl.java:1726)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.get_Key$type$com$rs$gwtp$gametestingyou$client$PieChartPresenter$MyView$_annotation$$none$$(ClientGinjectorImpl.java:1735)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.create_Key$type$com$rs$gwtp$gametestingyou$client$PieChartPresenter$_annotation$$none$$(ClientGinjectorImpl.java:1522)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.get_Key$type$com$rs$gwtp$gametestingyou$client$PieChartPresenter$_annotation$$none$$(ClientGinjectorImpl.java:1533)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.memberInject_Key$type$com$rs$gwtp$gametestingyou$client$ShowTestResultsPresenter$_annotation$$none$$(ClientGinjectorImpl.java:2069)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.create_Key$type$com$rs$gwtp$gametestingyou$client$ShowTestResultsPresenter$_annotation$$none$$(ClientGinjectorImpl.java:2079)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.get_Key$type$com$rs$gwtp$gametestingyou$client$ShowTestResultsPresenter$_annotation$$none$$(ClientGinjectorImpl.java:2092)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.memberInject_Key$type$com$rs$gwtp$gametestingyou$client$HomePagePresenter$_annotation$$none$$(ClientGinjectorImpl.java:1341)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.create_Key$type$com$rs$gwtp$gametestingyou$client$HomePagePresenter$_annotation$$none$$(ClientGinjectorImpl.java:1352)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.get_Key$type$com$rs$gwtp$gametestingyou$client$HomePagePresenter$_annotation$$none$$(ClientGinjectorImpl.java:1365)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl.access$4(ClientGinjectorImpl.java:1363)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl$5$1.onSuccess(ClientGinjectorImpl.java:1413)
at com.google.gwt.core.client.GWT.runAsync(GWT.java:255)
at com.rs.gwtp.gametestingyou.client.gin.ClientGinjectorImpl$5.get(ClientGinjectorImpl.java:1411)
at com.gwtplatform.common.client.CodeSplitProvider.get(CodeSplitProvider.java:48)
at com.gwtplatform.mvp.client.proxy.ProxyImpl.getPresenter(ProxyImpl.java:46)
at com.gwtplatform.mvp.client.proxy.ProxyPlaceAbstract.handleRequest(ProxyPlaceAbstract.java:193)
at com.gwtplatform.mvp.client.proxy.ProxyPlaceAbstract.access$0(ProxyPlaceAbstract.java:192)
at com.gwtplatform.mvp.client.proxy.ProxyPlaceAbstract$1.onPlaceRequest(ProxyPlaceAbstract.java:143)
at com.gwtplatform.mvp.client.proxy.PlaceRequestInternalEvent.dispatch(PlaceRequestInternalEvent.java:134)
at com.gwtplatform.mvp.client.proxy.PlaceRequestInternalEvent.dispatch(PlaceRequestInternalEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:96)
at com.google.gwt.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:62)
at com.google.gwt.event.shared.EventBus.castFireEventFromSource(EventBus.java:75)
at com.google.gwt.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:67)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.fireEvent(PlaceManagerImpl.java:146)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.doRevealPlace(PlaceManagerImpl.java:121)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.revealPlace(PlaceManagerImpl.java:339)
at com.rs.gwtp.gametestingyou.client.place.ClientPlaceManager.revealDefaultPlace(ClientPlaceManager.java:24)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.onValueChange(PlaceManagerImpl.java:264)
at com.google.gwt.event.logical.shared.ValueChangeEvent.dispatch(ValueChangeEvent.java:128)
at com.google.gwt.event.logical.shared.ValueChangeEvent.dispatch(ValueChangeEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.impl.HistoryImpl.fireEvent(HistoryImpl.java:75)
at com.google.gwt.event.logical.shared.ValueChangeEvent.fire(ValueChangeEvent.java:43)
at com.google.gwt.user.client.impl.HistoryImpl.fireHistoryChangedImpl(HistoryImpl.java:82)
at com.google.gwt.user.client.History.fireCurrentHistoryState(History.java:121)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.revealCurrentPlace(PlaceManagerImpl.java:310)
at com.rs.gwtp.gametestingyou.client.GameTestingYou.onModuleLoad(GameTestingYou.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
package com.rs.gwtp.gametestingyou.client;
import com.google.gwt.core.client.EntryPoint;
import com.rs.gwtp.gametestingyou.client.gin.ClientGinjector;
import com.google.gwt.core.client.GWT;
import com.gwtplatform.mvp.client.DelayedBindRegistry;
public class GameTestingYou implements EntryPoint {
private final ClientGinjector ginjector = GWT.create(ClientGinjector.class);
#Override
public void onModuleLoad() {
// This is required for Gwt-Platform proxy's generator
DelayedBindRegistry.bind(ginjector);
ginjector.getPlaceManager().revealCurrentPlace();
}
}
In your constructor try to initialize pieChart before calling createAndBindUi
#Inject
public #UiConstructor PieChartView(final Binder binder) {
pieChart = new PieChart(createTable(), createOptions());
widget = binder.createAndBindUi(this);
chartPanel.add(pieChart);
}
Ok I found out that this issue is specific for GWT-P because EntryPoint class doesn't load needed PACKAGE. It need to be loaded with this method
VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);
and add Runnable interface to class which implements EntryPoint class, like this sample:
Runnable onLoadCallback = new Runnable() {
#Override
public void run() {
PieChart pieChart = new PieChart(createTable(), createOptions());
Panel panel = RootPanel.get();
panel.add(pieChart);
}
private AbstractDataTable createTable() {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Task");
data.addColumn(ColumnType.NUMBER, "Hours per Day");
data.addRows(2);
data.setValue(0, 0, "Work");
data.setValue(0, 1, 14);
data.setValue(1, 0, "Sleep");
data.setValue(1, 1, 10);
return data;
}
private Options createOptions() {
Options options = Options.create();
options.setWidth(400);
options.setHeight(240);
options.setTitle("My Daily Activities");
return options;
}
};
but this will add, in this example pieChart, to RootPanel, just now to figure out how to add this object pieChart to specific PresenterWidget. When I do this I will made a tutorial :)
Success!!! This is how I FINALLY done what I intended: To add some chart to existing GWT-P project. When I was sure API set up was fine I figure out that this is solution:
UiBinder just need to have HTML table:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
ui:generateLocales='default' xmlns:c="urn:import:com.google.gwt.visualization.client.visualizations.corechart"
xmlns:v="urn:import:com.google.gwt.visualization.client.visualizations">
<g:HTMLPanel ui:field="chartPanel">
</g:HTMLPanel>
</ui:UiBinder>
Then View should be simple as this:
public class PieChartView extends ViewImpl implements PieChartPresenter.MyView {
private final Widget widget;
#UiField HTMLPanel chartPanel;
public interface Binder extends UiBinder<Widget, PieChartView> {
}
#Inject
public #UiConstructor PieChartView(final Binder binder) {
widget = binder.createAndBindUi(this);
}
#Override
public Widget asWidget() {
return widget;
}
public HTMLPanel getChartPanel(){
return chartPanel;
}
}
And Then PresenterWidget, need to load appropriate PACKAGE via VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE); like this:
public class PieChartPresenter extends
PresenterWidget<PieChartPresenter.MyView> {
public interface MyView extends View {
public HTMLPanel getChartPanel();
}
#Inject
public PieChartPresenter(final EventBus eventBus, final MyView view) {
super(eventBus, view);
}
#Override
protected void onBind() {
super.onBind();
Runnable onLoadCallback = new Runnable() {
#Override
public void run() {
PieChart pieChart = new PieChart(createTable(), createOptions());
/*Panel panel = RootPanel.get();*/
/*panel.add(pieChart);*/
Panel panel = getView().getChartPanel();
panel.add(pieChart);
}
private AbstractDataTable createTable() {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Task");
data.addColumn(ColumnType.NUMBER, "Hours per Day");
data.addRows(2);
data.setValue(0, 0, "Work");
data.setValue(0, 1, 14);
data.setValue(1, 0, "Sleep");
data.setValue(1, 1, 10);
return data;
}
private Options createOptions() {
Options options = Options.create();
options.setWidth(400);
options.setHeight(240);
options.setTitle("My Daily Activities");
return options;
}
};
VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);
}
/*Ovde prmeniti method*/
#Override
protected void onReset() {
super.onReset();
}
}
Now this is for testing purpose only, and it was a result which I intended: To place PieChart in PresenterWidget and present it on call.

MessageBox doesnt appear when eclipse plugin has been deployed?

I have written an Eclipse plugin and I have added option for help in Eclipse "Help" menu. On click of that help the MessageBox appears.
This MessageBox appears when i run or debug by Eclipse application however when i deploy this plugin on other PC and click help the MessageBox doesnt appear.
This is my code:
public class MyHelp implements IWorkbenchWindowActionDelegate {
public void run(IAction arg0) {
try {
String message = "This is demo data";
// TODO Auto-generated method stub
MessageBox box = new MessageBox(new Shell(), SWT.OK);
box.setMessage(message);
box.setText("Help title");
box.open();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Can anyone help me out with this one ..?
For help I have added an ActionSet in my plugin as :
<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="com.my.plugin.actionSet"
label="My ActionSet"
visible="true">
<menu
id="mymenu"
label="My Menu"
path="help/helpStart">
<groupMarker
name="start">
</groupMarker>
<separator
name="additions">
</separator>
</menu>
<action
class="com.myexample.MyHelp"
id="MyHelp"
label="Use Help"
icon="icons/plugin_help.png"
menubarPath="help/mymenu/start"
style="push">
</action>
</actionSet>
</extension>
Do I need to do anything else ?
If you are running eclipse >= 3.3 then you may drop it to plugins folder. Also, try to restart your eclipse with -clean option.
I'd suggest you to user dropins folder for manual installation. Please, refer to the documentation: http://wiki.eclipse.org/Equinox_p2_Getting_Started#Dropins
Upd1:
In order to run your code I had to add some unimplemented methods (I am using eclipse version 3.6):
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class MyHelp implements IWorkbenchWindowActionDelegate {
public void run(final IAction arg0) {
final String message = "This is demo data";
// TODO Auto-generated method stub
final MessageBox box = new MessageBox(new Shell(), SWT.OK);
box.setMessage(message);
box.setText("Help title");
box.open();
}
public void selectionChanged(final IAction action, final ISelection selection) {
// TODO Auto-generated method stub
}
public void dispose() {
// TODO Auto-generated method stub
}
public void init(final IWorkbenchWindow window) {
// TODO Auto-generated method stub
}
}
Also, check your plugin MANIFEST to have following line:
Bundle-SymbolicName: your_plugin_id;singleton:=true
I've just copied plugin from the workspace into the dropins folder of my eclipse instance and it was working out of the box.
Are you sure, that plugin manifest is in the jar file? Check out the Bin tab or build.properties to be sure, that everything is exported correctly.
Hope this helps

error when I use GWT RPC

I have a problem with Eclipse when I use an RPC..
If I use a single method call it's all in the right direction but if I add a new method to handle the server I get the following error:
com.google.gwt.core.client.JavaScriptException: (null): null
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:184)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
at com.google.gwt.user.client.rpc.impl.RpcStatsContext.isStatsAvailable(RpcStatsContext.java)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:221)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
Can I have more services in an asynchronous call right? Where am I wrong?
This is my implementation MyService:
package de.vogella.gwt.helloworld.client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface MyService extends RemoteService {
//chiamo i metodi presenti sul server
public void creaXML(String nickname,String pass,String email2,String gio,String mes, String ann);
public void setWeb(String userCorrect,String query, String titolo,String snippet,String url);
}
MyServiceAsync
package de.vogella.gwt.helloworld.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface MyServiceAsync {
void creaXML(String nickname,String pass,String email2,String gio,String mes, String ann,AsyncCallback<Void> callback);
void setWeb(String userCorrect,String query, String titolo,String snippet,String url, AsyncCallback<Void> callback);
}
RPCService:
package de.vogella.gwt.helloworld.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.FlexTable;
public class RPCService implements MyServiceAsync {
MyServiceAsync service = (MyServiceAsync) GWT.create(MyService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
public RPCService()
{
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "rpc");
}
public void creaXML(String nickname,String pass,String email2,String gio,String mes, String ann,AsyncCallback callback)
{
service.creaXML(nickname, pass, email2, gio, mes, ann, callback);
}
public void setWeb(String userCorrect,String query, String titolo,String snippet,String url,AsyncCallback callback) {
service.setWeb(userCorrect,query, titolo,snippet,url,callback);
}
}
MyServiceImpl
package de.vogella.gwt.helloworld.server;
import java.io.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import de.vogella.gwt.helloworld.client.MyService;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.NodeList;
public class MyServiceImpl extends RemoteServiceServlet implements MyService {
//metodo che inserisce il nuovo iscritto
public void creaXML(String nickname,String pass,String email2,String gio,String mes, String ann){
.......
}
public void setWeb(String userCorrect,String query, String titolo,String snippet,String url) {
.....
}
In the app in client-side I do
RPCService rpc2 = New RPCService()
rpc2.setWeb(..,...,...,...,callback);
and
RPCService rpc = New RPCService()
rpc.creaXML(..,...,...,...,callback); (in other posizions in the code...)
and..
AsyncCallback callback = new AsyncCallback()
{
public void onFailure(Throwable caught)
{
Window.alert("Failure!");
}
public void onSuccess(Object result)
{
Window.alert("Successoooooo");
}
};
Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Servlets -->
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>De_vogella_gwt_helloworld.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>rPCImpl</servlet-name>
<servlet-class>de.vogella.gwt.helloworld.server.MyServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>rPCImpl</servlet-name>
<url-pattern>/de_vogella_gwt_helloworld/rpc</url-pattern>
</servlet-mapping>
</web-app>
Thank you all for your attention
Sebe
You seem to be invoking your RPC services in a strange way.
There is a tutorial in GWT web page showing how this should be done.
EDIT:
This bug reported in GWT bugs database may be related to your problem (the stack trace is very similar). Some information about the bug can be also found here.
I lost my pass and I recreate the account... I see your board..it's a problem with my browser web... If I use Internet Explorer it work fine, but If I use Firefox (my predefinite browser) throw the exception (but It compile fine). I have not found anything that I can fix it...