当前位置: 首页>>代码示例>>Java>>正文


Java StatusInfo.setWarning方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.ui.dialogs.StatusInfo.setWarning方法的典型用法代码示例。如果您正苦于以下问题:Java StatusInfo.setWarning方法的具体用法?Java StatusInfo.setWarning怎么用?Java StatusInfo.setWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.ui.dialogs.StatusInfo的用法示例。


在下文中一共展示了StatusInfo.setWarning方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validatePath

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
private IStatus validatePath() {
	StatusInfo status= new StatusInfo();
	String val= fPathField.getText();
	if (val.length() == 0) {
		return status;
	}
	Path path= new Path(val);
	if (path.isAbsolute()) {
		if (!path.toFile().isDirectory()) {
			status.setWarning(NewWizardMessages.NativeLibrariesDialog_error_external_not_existing);
			return status;
		}
	} else {
		if (!(ResourcesPlugin.getWorkspace().getRoot().findMember(path) instanceof IContainer)) {
			status.setWarning(NewWizardMessages.NativeLibrariesDialog_error_internal_not_existing);
			return status;
		}
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:NativeLibrariesConfigurationBlock.java

示例2: doValidation

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
final void doValidation(int VALIDATE) {
	switch (VALIDATE) {
		case STYLESHEETSTATUS :
			fStyleSheetStatus= new StatusInfo();
			if (fStyleSheetButton.getSelection()) {
				String filename= fStyleSheetText.getText();
				if (filename.length() == 0) {
					fStyleSheetStatus.setError(JavadocExportMessages.JavadocSpecificsWizardPage_overviewnotfound_error);
				} else {
					File file= new File(filename);
					String ext= filename.substring(filename.lastIndexOf('.') + 1);
					if (!file.isFile()) {
						fStyleSheetStatus.setError(JavadocExportMessages.JavadocStandardWizardPage_stylesheetnopath_error);
					} else if (!ext.equalsIgnoreCase("css")) { //$NON-NLS-1$
						fStyleSheetStatus.setError(JavadocExportMessages.JavadocStandardWizardPage_stylesheetnotcss_error);
					}
				}
			}
			break;
		case LINK_REFERENCES:
			fLinkRefStatus= new StatusInfo();
			List<JavadocLinkRef> list= fListDialogField.getCheckedElements();
			for (int i= 0; i < list.size(); i++) {
				JavadocLinkRef curr= list.get(i);
				URL url= curr.getURL();
				if (url == null) {
					fLinkRefStatus.setWarning(JavadocExportMessages.JavadocStandardWizardPage_nolinkref_error);
					break;
				} else if ("jar".equals(url.getProtocol())) { //$NON-NLS-1$
					fLinkRefStatus.setWarning(JavadocExportMessages.JavadocStandardWizardPage_nojarlinkref_error);
					break;
				}
			}
			break;
	}

	updateStatus(findMostSevereStatus());

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:40,代码来源:JavadocStandardWizardPage.java

示例3: pathUpdated

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
private StatusInfo pathUpdated() {
	StatusInfo status= new StatusInfo();

	String path= fPathField.getText();
	if (path.length() > 0) { // empty path is ok
		if (!Path.ROOT.isValidPath(path)) {
			status.setError(NewWizardMessages.VariableCreationDialog_error_invalidpath);
		} else if (!new File(path).exists()) {
			status.setWarning(NewWizardMessages.VariableCreationDialog_warning_pathnotexists);
		}
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:VariableCreationDialog.java

示例4: packageChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
protected IStatus packageChanged() {
	StatusInfo status = new StatusInfo();
	IPackageFragmentRoot root = getPackageFragmentRoot();
	IJavaProject project = root != null ? root.getJavaProject() : null;

	String packName = getPackageText().getText();
	if (packName.length() > 0) {
		IStatus val = validatePackageName(packName, project);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
			// continue
		}
	} else {
		status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
	}

	if (project != null) {
		if (project.exists() && packName.length() > 0) {
			try {
				IPath rootPath = root.getPath();
				IPath outputPath = project.getOutputLocation();
				if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
					// if the bin folder is inside of our root, don't allow
					// to name a package
					// like the bin folder
					IPath packagePath = rootPath.append(packName.replace('.', '/'));
					if (outputPath.isPrefixOf(packagePath)) {
						status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
						return status;
					}
				}
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
				// let pass
			}
		}

		fCurrPackage = root.getPackageFragment(packName);
		IResource resource = fCurrPackage.getResource();
		if (resource != null) {
			if (resource.isVirtual()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
				return status;
			}
			if (!ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageNameFiltered);
				return status;
			}
		}
	} else {
		status.setError("");
	}
	return status;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:58,代码来源:ExportToJavaBeanWizardPage.java

示例5: getPackageStatus

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
/**
 * Validates the package name and returns the status of the validation.
 * 
 * @param packName the package name
 * 
 * @return the status of the validation
 */
private IStatus getPackageStatus(String packName) {
	StatusInfo status= new StatusInfo();
	if (packName.length() > 0) {
		IStatus val= validatePackageName(packName);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewPackageWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewPackageWizardPage_warning_DiscouragedPackageName, val.getMessage()));
		}
	} else {
		status.setError(NewWizardMessages.NewPackageWizardPage_error_EnterName);
		return status;
	}

	IPackageFragmentRoot root= getPackageFragmentRoot();
	if (root != null && root.getJavaProject().exists()) {
		IPackageFragment pack= root.getPackageFragment(packName);
		try {
			IPath rootPath= root.getPath();
			IPath outputPath= root.getJavaProject().getOutputLocation();
			if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
				// if the bin folder is inside of our root, don't allow to name a package
				// like the bin folder
				IPath packagePath= pack.getPath();
				if (outputPath.isPrefixOf(packagePath)) {
					status.setError(NewWizardMessages.NewPackageWizardPage_error_IsOutputFolder);
					return status;
				}
			}
			if (pack.exists()) {
				// it's ok for the package to exist as long we want to create package level documentation
				// and the package level documentation doesn't exist
				if (!isCreatePackageDocumentation() || packageDocumentationAlreadyExists(pack)) {
					if (pack.containsJavaResources() || !pack.hasSubpackages()) {
						status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageExists);
					} else {
						status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageNotShown);
					}
				}
			} else {
				IResource resource= pack.getResource();
				if (resource != null && !ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
					status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageNameFiltered);
					return status;
				}
				URI location= pack.getResource().getLocationURI();
				if (location != null) {
					IFileStore store= EFS.getStore(location);
					if (store.fetchInfo().exists()) {
						status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageExistsDifferentCase);
					}
				}
			}
		} catch (CoreException e) {
			JavaPlugin.log(e);
		}
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:68,代码来源:NewPackageWizardPage.java

示例6: packageChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
/**
 * A hook method that gets called when the package field has changed. The method
 * validates the package name and returns the status of the validation. The validation
 * also updates the package fragment model.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 *
 * @return the status of the validation
 */
protected IStatus packageChanged() {
	StatusInfo status= new StatusInfo();
	IPackageFragmentRoot root= getPackageFragmentRoot();
	fPackageDialogField.enableButton(root != null);

	IJavaProject project= root != null ? root.getJavaProject() : null;

	String packName= getPackageText();
	if (packName.length() > 0) {
		IStatus val= validatePackageName(packName, project);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
			// continue
		}
	} else {
		status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
	}

	if (project != null) {
		if (project.exists() && packName.length() > 0) {
			try {
				IPath rootPath= root.getPath();
				IPath outputPath= project.getOutputLocation();
				if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
					// if the bin folder is inside of our root, don't allow to name a package
					// like the bin folder
					IPath packagePath= rootPath.append(packName.replace('.', '/'));
					if (outputPath.isPrefixOf(packagePath)) {
						status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
						return status;
					}
				}
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
				// let pass
			}
		}

		fCurrPackage= root.getPackageFragment(packName);
		IResource resource= fCurrPackage.getResource();
		if (resource != null){
			if (resource.isVirtual()){
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
				return status;
			}
			if (!ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageNameFiltered);
				return status;
			}
		}
	} else {
		status.setError(""); //$NON-NLS-1$
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:69,代码来源:NewTypeWizardPage.java

示例7: enclosingTypeChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的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;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:56,代码来源:NewTypeWizardPage.java

示例8: packageChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
private IStatus packageChanged() {
	StatusInfo status= new StatusInfo();
	String packName= getPackageText();
	if (packName.length() > 0) {
		IStatus val= validatePackageName(packName);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewPackageWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewPackageWizardPage_warning_DiscouragedPackageName, val.getMessage()));
		}
	} else {
		status.setError(NewWizardMessages.NewPackageWizardPage_error_EnterName);
		return status;
	}

	IPackageFragmentRoot root= getPackageFragmentRoot();
	if (root != null && root.getJavaProject().exists()) {
		IPackageFragment pack= root.getPackageFragment(packName);
		try {
			IPath rootPath= root.getPath();
			IPath outputPath= root.getJavaProject().getOutputLocation();
			if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
				// if the bin folder is inside of our root, don't allow to name a package
				// like the bin folder
				IPath packagePath= pack.getPath();
				if (outputPath.isPrefixOf(packagePath)) {
					status.setError(NewWizardMessages.NewPackageWizardPage_error_IsOutputFolder);
					return status;
				}
			}
			if (pack.exists()) {
				// it's ok for the package to exist as long we want to create package level documentation
				// and the package level documentation doesn't exist
				if (!isCreatePackageDocumentation() || packageDocumentationAlreadyExists(pack)) {
					if (pack.containsJavaResources() || !pack.hasSubpackages()) {
						status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageExists);
					} else {
						status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageNotShown);
					}
				}
			} else {
				IResource resource= pack.getResource();
				if (resource != null && !ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
					status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageNameFiltered);
					return status;
				}
				URI location= pack.getResource().getLocationURI();
				if (location != null) {
					IFileStore store= EFS.getStore(location);
					if (store.fetchInfo().exists()) {
						status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageExistsDifferentCase);
					}
				}
			}
		} catch (CoreException e) {
			JavaPlugin.log(e);
		}
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:62,代码来源:NewPackageWizardPage.java

示例9: packageChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入方法依赖的package包/类
/**
 * A hook method that gets called when the package field has changed. The method
 * validates the package name and returns the status of the validation. The validation
 * also updates the package fragment model.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 *
 * @return the status of the validation
 */
protected IStatus packageChanged() {
	StatusInfo status= new StatusInfo();
	IPackageFragmentRoot root= getPackageFragmentRoot();
	fPackageDialogField.enableButton(root != null);

	IJavaProject project= root != null ? root.getJavaProject() : null;

	String packName= getPackageText();
	if (packName.length() > 0) {
		IStatus val= validatePackageName(packName, project);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
			// continue
		}
	} else {
		status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
	}

	if (project != null) {
		if (project.exists() && packName.length() > 0) {
			try {
				IPath rootPath= root.getPath();
				IPath outputPath= project.getOutputLocation();
				if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
					// if the bin folder is inside of our root, don't allow to name a package
					// like the bin folder
					IPath packagePath= rootPath.append(packName.replace('.', '/'));
					if (outputPath.isPrefixOf(packagePath)) {
						status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
						return status;
					}
				}
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
				// let pass
			}
		}

		fCurrPackage= root.getPackageFragment(packName);
		IResource resource= fCurrPackage.getResource();
		if (resource != null){
			if (resource.isVirtual()){
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
				return status;
			}			
			if (!ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageNameFiltered);
				return status;
			}
		}
	} else {
		status.setError(""); //$NON-NLS-1$
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:69,代码来源:NewTypeWizardPage.java


注:本文中的org.eclipse.jdt.internal.ui.dialogs.StatusInfo.setWarning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。