本文整理汇总了Java中org.eclipse.core.runtime.IPath.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java IPath.isEmpty方法的具体用法?Java IPath.isEmpty怎么用?Java IPath.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IPath
的用法示例。
在下文中一共展示了IPath.isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProposalContext
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
* This method should be invoked whenever source folder or project value change, to update the proposal contexts for
* the field source folder and module specifier
*/
private void updateProposalContext() {
IPath projectPath = model.getProject();
IPath sourceFolderPath = model.getSourceFolder();
// Early exit for empty project value
if (projectPath.isEmpty()) {
sourceFolderContentProposalAdapter.setContentProposalProvider(null);
moduleSpecifierContentProposalAdapter.setContentProposalProvider(null);
return;
}
IProject project = ResourcesPlugin.getWorkspace().getRoot()
.getProject(projectPath.toString());
if (null == project || !project.exists()) {
// Disable source folder and module specifier proposals
sourceFolderContentProposalAdapter.setContentProposalProvider(null);
moduleSpecifierContentProposalAdapter.setContentProposalProvider(null);
} else {
// Try to retrieve the source folder and if not specified set it to null
IContainer sourceFolder = sourceFolderPath.segmentCount() != 0 ? project.getFolder(sourceFolderPath) : null;
// If the project exists, enable source folder proposals
sourceFolderContentProposalAdapter
.setContentProposalProvider(sourceFolderContentProviderFactory.createProviderForProject(project));
if (null != sourceFolder && sourceFolder.exists()) {
// If source folder exists as well enable module specifier proposal
moduleSpecifierContentProposalAdapter.setContentProposalProvider(
moduleSpecifierContentProviderFactory.createProviderForPath(sourceFolder.getFullPath()));
} else {
// Otherwise disable module specifier proposals
moduleSpecifierContentProposalAdapter.setContentProposalProvider(null);
}
}
}