RCPアプリケーションで、ローカルファイルシステム上のリソースから始めて、CommonNavigatorFrameworkビューを作成したいと思います。
私はorg.eclipse.ui.ideプラグインを含む1つのプロジェクトでそれを行いました。ただし、これにより、このアプリケーションには複雑すぎて不適切なUIが作成されます。(たとえば、ビルドとバージョン管理に関連するものもあり、約20の設定パネルが追加されます。)
だから今私は〜.ideプラグインなしでそれをやろうとしています-そしてそれに依存するorg.eclipse.ui.navigator.resourcesプラグインなしで。
RCPアプリでは、以下に示す〜navigator.viewer拡張機能を備えたプラグインで、以下のコードを使用して新しいワークスペースプロジェクト(私は思う)を作成することができました。ただし、CNFビューには何も表示されません。
質問:
- org.eclipse.ui.navigator.resourcesプラグインを除外しているので、独自のコンテンツプロバイダーを定義する必要がありますか?
- org.eclipse.ui.navigator.resourcesプラグインのクラスResourceExtensionContentProviderは、コンテンツバインディングorg.eclipse.ui.navigator.resourceContentを実装するために使用されますか?
plugin.xmlの抜粋
<extension
point="org.eclipse.ui.navigator.viewer">
<viewerActionBinding
viewerId="com.mycompany.app.gen.workspace">
<includes>
<actionExtension pattern="org.eclipse.ui.navigator.resources.*" />
</includes>
</viewerActionBinding>
<viewerContentBinding
viewerId="com.dnastar.app.gen.workspace">
<includes>
<contentExtension pattern="org.eclipse.ui.navigator.resourceContent" />
<contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"/>
<contentExtension pattern="org.eclipse.ui.navigator.resources.linkHelper"/>
<contentExtension pattern="org.eclipse.ui.navigator.resources.workingSets"/>
</includes>
</viewerContentBinding>
</extension>
新しいプロジェクトの作成に使用されるコード(完全を期すために含まれています):
Path path = new Path( sPath );
File filePath = new File( sPath );
String fileBaseName = filePath.getName();
String projectName = fileBaseName; // For now
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProjectDescription projDescr = workspace.newProjectDescription( projectName );
projDescr.setLocation( path );
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject( projectName );
try {
project.create( projDescr, null );
if ( ! project.isOpen() ) {
project.open( null );
}
} catch (CoreException e) {
MessageDialog.openError( Display.getCurrent().getActiveShell(),
"New Project Error", "Could not create new project." + "\n[" + e + "]");
}