本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JavaModelUtil.isEditable方法的典型用法代码示例。如果您正苦于以下问题:Java JavaModelUtil.isEditable方法的具体用法?Java JavaModelUtil.isEditable怎么用?Java JavaModelUtil.isEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.util.JavaModelUtil
的用法示例。
在下文中一共展示了JavaModelUtil.isEditable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enclosingTypeChanged
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
/**
* Hook method that gets called when the enclosing type name has changed. The method
* validates the enclosing type and returns the status of the validation. It also updates the
* enclosing type model.
* <p>
* Subclasses may extend this method to perform their own validation.
* </p>
*
* @return the status of the validation
*/
protected IStatus enclosingTypeChanged() {
StatusInfo status= new StatusInfo();
fCurrEnclosingType= null;
IPackageFragmentRoot root= getPackageFragmentRoot();
fEnclosingTypeDialogField.enableButton(root != null);
if (root == null) {
status.setError(""); //$NON-NLS-1$
return status;
}
String enclName= getEnclosingTypeText();
if (enclName.length() == 0) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingTypeEnterName);
return status;
}
try {
IType type= findType(root.getJavaProject(), enclName);
if (type == null) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingTypeNotExists);
return status;
}
if (type.getCompilationUnit() == null) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingNotInCU);
return status;
}
if (!JavaModelUtil.isEditable(type.getCompilationUnit())) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingNotEditable);
return status;
}
fCurrEnclosingType= type;
IPackageFragmentRoot enclosingRoot= JavaModelUtil.getPackageFragmentRoot(type);
if (!enclosingRoot.equals(root)) {
status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_EnclosingNotInSourceFolder);
}
return status;
} catch (JavaModelException e) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingTypeNotExists);
JavaPlugin.log(e);
return status;
}
}
示例2: isEditable
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
/**
* Tells whether the given Java element can be edited.
*
* @param javaElement the element to test
* @return <code>true</code> if the element can be edited, <code>false</code> otherwise
* @since 3.5
*/
private boolean isEditable(IJavaElement javaElement) {
return (javaElement instanceof ICompilationUnit) && JavaModelUtil.isEditable((ICompilationUnit)javaElement);
}