本文整理匯總了Java中com.intellij.refactoring.safeDelete.ImportSearcher類的典型用法代碼示例。如果您正苦於以下問題:Java ImportSearcher類的具體用法?Java ImportSearcher怎麽用?Java ImportSearcher使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ImportSearcher類屬於com.intellij.refactoring.safeDelete包,在下文中一共展示了ImportSearcher類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteElement
import com.intellij.refactoring.safeDelete.ImportSearcher; //導入依賴的package包/類
public void deleteElement() throws IncorrectOperationException {
if (isSafeDelete()) {
PsiElement element = getElement();
LOG.assertTrue(element != null);
PsiElement importStatement = ImportSearcher.getImport(element, false);
if (importStatement != null) {
if (element instanceof PsiImportStaticReferenceElement) {
if (((PsiImportStaticReferenceElement)element).multiResolve(false).length < 2) {
importStatement.delete();
}
} else {
importStatement.delete();
}
}
else {
if (element instanceof PsiExpressionStatement && RefactoringUtil.isLoopOrIf(element.getParent())) {
final PsiStatement emptyTest = JavaPsiFacade.getInstance(getProject()).getElementFactory().createStatementFromText(";", null);
element.replace(emptyTest);
} else {
element.delete();
}
}
}
}
示例2: deleteElement
import com.intellij.refactoring.safeDelete.ImportSearcher; //導入依賴的package包/類
public void deleteElement() throws IncorrectOperationException {
if (isSafeDelete()) {
PsiElement element = getElement();
LOG.assertTrue(element != null);
PsiElement importStatement = ImportSearcher.getImport(element, false);
if (importStatement != null) {
importStatement.delete();
}
else {
element.delete();
}
}
}
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:14,代碼來源:SafeDeleteReferenceJavaDeleteUsageInfo.java