本文整理匯總了Java中org.eclipse.jdt.core.IPackageFragmentRoot.close方法的典型用法代碼示例。如果您正苦於以下問題:Java IPackageFragmentRoot.close方法的具體用法?Java IPackageFragmentRoot.close怎麽用?Java IPackageFragmentRoot.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.IPackageFragmentRoot
的用法示例。
在下文中一共展示了IPackageFragmentRoot.close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: attachSource
import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
public static void attachSource(final IPackageFragmentRoot fragment, final IPath newSourcePath,
IProgressMonitor monitor) {
try {
if (fragment == null || fragment.getKind() != IPackageFragmentRoot.K_BINARY) {
return;
}
if (!Objects.equals(fragment.getSourceAttachmentPath(), newSourcePath)) {
// would be so cool if it refreshed the UI automatically
fragment.attachSource(newSourcePath, null, monitor);
// close the root so that source attachment cache is flushed. Else UI
// won't update
fragment.close();
// we have to manually fire a delta to notify the UI about the source
// attachment.
JavaModelManager manager = JavaModelManager.getJavaModelManager();
JavaElementDelta attachedSourceDelta = new JavaElementDelta(fragment.getJavaModel());
attachedSourceDelta.sourceAttached(fragment);
manager.getDeltaProcessor().fire(attachedSourceDelta, ElementChangedEvent.POST_CHANGE);
}
} catch (CoreException e) {
// ignore
}
}