Beanからビューに変数をバインドしたいRCPアプリケーションを作成しようとしています。 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)
私はこの問題を解決しました。なぜこれが起こったのかはわかりませんが。
実行->構成の実行...->プラグインタブ->必要なプラグインの追加->プラグインの検証->実行
これで私の問題は解決しました!
私にとって、プラグインを削除して再度追加することはうまくいきました... Preferences > Plug-in Development > Target Platform
、実行中のプラットフォームのターゲット定義を削除してみてください-> Click Apply
、次にデフォルトに戻すか、追加したい必要なプラグインを追加します。