本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil.isDefaultPackage方法的典型用法代码示例。如果您正苦于以下问题:Java JavaElementUtil.isDefaultPackage方法的具体用法?Java JavaElementUtil.isDefaultPackage怎么用?Java JavaElementUtil.isDefaultPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil
的用法示例。
在下文中一共展示了JavaElementUtil.isDefaultPackage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cannotUpdateReferencesForDestination
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
/**
* @return <code>true</code> if the user could expect that we update references, but we don't
* @since 3.5
*/
private boolean cannotUpdateReferencesForDestination() {
if (getCus().length == 0)
return false;
IPackageFragment pack= getDestinationAsPackageFragment();
if (pack == null || pack.isDefaultPackage())
return true;
IJavaElement destination= getJavaElementDestination();
if (destination instanceof IPackageFragmentRoot && getCus().length > 0) {
return false;
}
Object commonParent= getCommonParent();
return JavaElementUtil.isDefaultPackage(commonParent);
}
示例2: createNamePattern
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
private static String createNamePattern(IJavaElement element) throws JavaModelException {
switch (element.getElementType()) {
case IJavaElement.CLASS_FILE:
return RefactoringCoreMessages.ReorgUtils_3;
case IJavaElement.COMPILATION_UNIT:
return RefactoringCoreMessages.ReorgUtils_4;
case IJavaElement.FIELD:
return RefactoringCoreMessages.ReorgUtils_5;
case IJavaElement.IMPORT_CONTAINER:
return RefactoringCoreMessages.ReorgUtils_6;
case IJavaElement.IMPORT_DECLARATION:
return RefactoringCoreMessages.ReorgUtils_7;
case IJavaElement.INITIALIZER:
return RefactoringCoreMessages.ReorgUtils_8;
case IJavaElement.JAVA_PROJECT:
return RefactoringCoreMessages.ReorgUtils_9;
case IJavaElement.METHOD:
if (((IMethod) element).isConstructor()) return RefactoringCoreMessages.ReorgUtils_10;
else return RefactoringCoreMessages.ReorgUtils_11;
case IJavaElement.PACKAGE_DECLARATION:
return RefactoringCoreMessages.ReorgUtils_12;
case IJavaElement.PACKAGE_FRAGMENT:
if (JavaElementUtil.isDefaultPackage(element)) return RefactoringCoreMessages.ReorgUtils_13;
else return RefactoringCoreMessages.ReorgUtils_14;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
if (((IPackageFragmentRoot) element).isArchive())
return RefactoringCoreMessages.ReorgUtils_21;
if (isSourceFolder(element)) return RefactoringCoreMessages.ReorgUtils_15;
if (isClassFolder(element)) return RefactoringCoreMessages.ReorgUtils_16;
return RefactoringCoreMessages.ReorgUtils_17;
case IJavaElement.TYPE:
IType type = (IType) element;
if (type.isAnonymous()) return RefactoringCoreMessages.ReorgUtils_20;
return RefactoringCoreMessages.ReorgUtils_18;
default:
Assert.isTrue(false);
return null;
}
}
示例3: cannotUpdateReferencesForDestination
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
/**
* @return <code>true</code> if the user could expect that we update references, but we don't
* @since 3.5
*/
private boolean cannotUpdateReferencesForDestination() {
if (getCus().length == 0) return false;
IPackageFragment pack = getDestinationAsPackageFragment();
if (pack == null || pack.isDefaultPackage()) return true;
IJavaElement destination = getJavaElementDestination();
if (destination instanceof IPackageFragmentRoot && getCus().length > 0) {
return false;
}
Object commonParent = getCommonParent();
return JavaElementUtil.isDefaultPackage(commonParent);
}
示例4: canEnable
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
@Override
public boolean canEnable() throws JavaModelException {
if (fPackageFragments.length == 0) return false;
for (int i = 0; i < fPackageFragments.length; i++) {
if (JavaElementUtil.isDefaultPackage(fPackageFragments[i])
|| fPackageFragments[i].isReadOnly()) return false;
}
if (ReorgUtils.containsLinkedResources(fPackageFragments)) return false;
return true;
}
示例5: canEnable
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
@Override
public boolean canEnable() throws JavaModelException {
if (fPackageFragments.length == 0)
return false;
for (int i= 0; i < fPackageFragments.length; i++) {
if (JavaElementUtil.isDefaultPackage(fPackageFragments[i]) || fPackageFragments[i].isReadOnly())
return false;
}
if (ReorgUtils.containsLinkedResources(fPackageFragments))
return false;
return true;
}
示例6: canCopyToClipboard
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
private static boolean canCopyToClipboard(IJavaElement element) {
if (element == null || ! element.exists())
return false;
if (JavaElementUtil.isDefaultPackage(element))
return false;
return true;
}
示例7: isDefaultPackageWithLinkedFiles
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
private static boolean isDefaultPackageWithLinkedFiles(Object firstElement) throws JavaModelException {
if (!JavaElementUtil.isDefaultPackage(firstElement))
return false;
IPackageFragment defaultPackage= (IPackageFragment)firstElement;
ICompilationUnit[] cus= defaultPackage.getCompilationUnits();
for (int i= 0; i < cus.length; i++) {
if (isLinkedResource(cus[i]))
return true;
}
return false;
}
示例8: canEnableQualifiedNameUpdating
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
public boolean canEnableQualifiedNameUpdating() {
return getCus().length > 0 && !JavaElementUtil.isDefaultPackage(getCommonParent());
}
示例9: createNamePattern
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
private static String createNamePattern(IJavaElement element) throws JavaModelException {
switch(element.getElementType()){
case IJavaElement.CLASS_FILE:
return RefactoringCoreMessages.ReorgUtils_3;
case IJavaElement.COMPILATION_UNIT:
return RefactoringCoreMessages.ReorgUtils_4;
case IJavaElement.FIELD:
return RefactoringCoreMessages.ReorgUtils_5;
case IJavaElement.IMPORT_CONTAINER:
return RefactoringCoreMessages.ReorgUtils_6;
case IJavaElement.IMPORT_DECLARATION:
return RefactoringCoreMessages.ReorgUtils_7;
case IJavaElement.INITIALIZER:
return RefactoringCoreMessages.ReorgUtils_8;
case IJavaElement.JAVA_PROJECT:
return RefactoringCoreMessages.ReorgUtils_9;
case IJavaElement.METHOD:
if (((IMethod)element).isConstructor())
return RefactoringCoreMessages.ReorgUtils_10;
else
return RefactoringCoreMessages.ReorgUtils_11;
case IJavaElement.PACKAGE_DECLARATION:
return RefactoringCoreMessages.ReorgUtils_12;
case IJavaElement.PACKAGE_FRAGMENT:
if (JavaElementUtil.isDefaultPackage(element))
return RefactoringCoreMessages.ReorgUtils_13;
else
return RefactoringCoreMessages.ReorgUtils_14;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
if (((IPackageFragmentRoot) element).isArchive())
return RefactoringCoreMessages.ReorgUtils_21;
if (isSourceFolder(element))
return RefactoringCoreMessages.ReorgUtils_15;
if (isClassFolder(element))
return RefactoringCoreMessages.ReorgUtils_16;
return RefactoringCoreMessages.ReorgUtils_17;
case IJavaElement.TYPE:
IType type= (IType)element;
if (type.isAnonymous())
return RefactoringCoreMessages.ReorgUtils_20;
return RefactoringCoreMessages.ReorgUtils_18;
default:
Assert.isTrue(false);
return null;
}
}
示例10: canEnableQualifiedNameUpdating
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
public boolean canEnableQualifiedNameUpdating() {
return getCus().length > 0 && !JavaElementUtil.isDefaultPackage(getCommonParent());
}
示例11: createNamePattern
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; //导入方法依赖的package包/类
private static String createNamePattern(IJavaElement element) throws JavaModelException {
switch(element.getElementType()){
case IJavaElement.CLASS_FILE:
return RefactoringCoreMessages.ReorgUtils_3;
case IJavaElement.COMPILATION_UNIT:
return RefactoringCoreMessages.ReorgUtils_4;
case IJavaElement.FIELD:
return RefactoringCoreMessages.ReorgUtils_5;
case IJavaElement.IMPORT_CONTAINER:
return RefactoringCoreMessages.ReorgUtils_6;
case IJavaElement.IMPORT_DECLARATION:
return RefactoringCoreMessages.ReorgUtils_7;
case IJavaElement.INITIALIZER:
return RefactoringCoreMessages.ReorgUtils_8;
case IJavaElement.JAVA_PROJECT:
return RefactoringCoreMessages.ReorgUtils_9;
case IJavaElement.METHOD:
if (((IMethod)element).isConstructor())
return RefactoringCoreMessages.ReorgUtils_10;
else
return RefactoringCoreMessages.ReorgUtils_11;
case IJavaElement.PACKAGE_DECLARATION:
return RefactoringCoreMessages.ReorgUtils_12;
case IJavaElement.PACKAGE_FRAGMENT:
if (JavaElementUtil.isDefaultPackage(element))
return RefactoringCoreMessages.ReorgUtils_13;
else
return RefactoringCoreMessages.ReorgUtils_14;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
if (((IPackageFragmentRoot) element).isArchive())
return RefactoringCoreMessages.ReorgUtils_21;
if (isSourceFolder(element))
return RefactoringCoreMessages.ReorgUtils_15;
if (isClassFolder(element))
return RefactoringCoreMessages.ReorgUtils_16;
return RefactoringCoreMessages.ReorgUtils_17;
case IJavaElement.TYPE:
IType type= (IType)element;
if (type.getElementName().length() == 0 && type.isAnonymous())
return RefactoringCoreMessages.ReorgUtils_20;
return RefactoringCoreMessages.ReorgUtils_18;
default:
Assert.isTrue(false);
return null;
}
}