I am trying to create a RCP application in which, I want to bind a variable from a bean to view. Code for bean #
public class SaveFileBean implements PropertyChangeListener {
private String text;
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
this);
@Override
public void propertyChange(PropertyChangeEvent arg0) {
propertyChangeSupport.firePropertyChange("text", null, text);
}
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(listener);
}
public String getText() {
return text;
}
}
The code for VIew
public class NewView extends ViewPart {
private DataBindingContext m_bindingContext;
public static final String ID = "com.app.Editor.newView";
SaveFileBean bean = new SaveFileBean();
private StyledText text;
public NewView() {
}
@Override
public void createPartControl(Composite parent) {
text = new StyledText(parent, SWT.BORDER);
bindValues();
}
private void bindValues() {
}
@Override
public void setFocus() {
// create new Context
DataBindingContext ctx = new DataBindingContext();
// define the IObservables
IObservableValue target = WidgetProperties.text(SWT.Modify).
observe(text);
IObservableValue model= BeanProperties.
value(SaveFileBean.class,"text").observe(text);
// connect them
ctx.bindValue(target, model);
}
}
I added the following dependencies in manifest.mf Here is my MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Editor
Bundle-SymbolicName: com.app.Editor;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.app.editor.Activator
Bundle-Vendor: APP
Require-Bundle: org.eclipse.ui,
com.ibm.icu,
org.eclipse.core.runtime,
org.eclipse.core.databinding;bundle-version="1.4.2",
org.eclipse.jface.databinding;bundle-version="1.6.200",
org.eclipse.core.databinding.property,
org.eclipse.core.databinding.beans;bundle-version="1.2.200"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy. Here is
Export-Package: com.app.editor,
com.app.editor.actions,
com.app.editor.beans,
com.app.editor.commands,
com.app.editor.functionalities,
com.app.editor.perspectives,
com.app.editor.views
While running the code, I am getting error -
org.osgi.framework.BundleException: Could not resolve module: com.app.Editor [81]
Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans; bundle-version="1.2.200"
But, I have added this dependency in MANIFEST and I can see this jar in the project. Any idea?
Thanks!
Edit : the full log file is :
!SESSION 2015-08-19 08:53:21.748 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -application com.app.Editor.application
Command-line arguments: -application com.app.Editor.application -data C:\Srijani\Personal Workspace\RCP/../runtime-com.app.Editor.application -dev file:C:/Srijani/Personal Workspace/RCP/.metadata/.plugins/org.eclipse.pde.core/com.app.Editor.application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog
!ENTRY com.app.Editor 4 0 2015-08-19 08:53:22.559
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.app.Editor [87]
Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans
at org.eclipse.osgi.container.Module.start(Module.java:434)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
!ENTRY com.app.Editor 2 0 2015-08-19 08:53:22.888
!MESSAGE Could not resolve module: com.app.Editor [87]
Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans
!ENTRY org.eclipse.osgi 4 0 2015-08-19 08:53:22.888
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "com.app.Editor.application" could not be found in the registry. The applications available are: org.eclipse.ant.core.antRunner, org.eclipse.e4.ui.workbench.swt.E4Application, org.eclipse.e4.ui.workbench.swt.GenTopic, org.eclipse.equinox.app.error.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Target Platform State
. Is the mentioned plugin listed in there? You can filter for the name. If so, check theRun Configuation
if the plugin is getting loaded. – Pacifica