未解决的要求:Require-Bundle:org.eclipse.core.databinding.beans;束版本=“1.2.200”

时间:2015-08-18 16:10:38

标签: java eclipse-plugin eclipse-rcp rcp

我正在尝试创建一个RCP应用程序,其中,我想将bean中的变量绑定到视图。 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;
}

}

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);
}
}

我在manifest.mf中添加了以下依赖项。这是我的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

运行代码时,我收到错误 -

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"

但是,我在MANIFEST中添加了这个依赖项,我可以在项目中看到这个jar。 有什么想法吗?

谢谢!

编辑:完整的日志文件是:

!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)

2 个答案:

答案 0 :(得分:17)

我已经解决了这个问题。虽然我不确定为什么会这样。

运行方式 - >运行配置... - >插件选项卡 - >添加必需的插件 - >验证插件 - >运行

这解决了我的问题!

答案 1 :(得分:0)

对我来说,删除插件并再次添加它们... Preferences > Plug-in Development > Target Platform,请尝试删除正在运行的平台目标定义 - > Click Apply,然后恢复默认值或添加您要添加​​的所需插件。