本文整理了Java中org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin.createErrorStatus()
方法的一些代码示例,展示了WTPCommonPlugin.createErrorStatus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WTPCommonPlugin.createErrorStatus()
方法的具体详情如下:
包路径:org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin
类名称:WTPCommonPlugin
方法名:createErrorStatus
暂无
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui
public IStatus validate(Object[] selection) {
if (selection != null && selection[0] != null && !(selection[0] instanceof IProject))
return WTPCommonPlugin.OK_STATUS;
return WTPCommonPlugin.createErrorStatus(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG);
}
};
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks
/**
* @param string
* @return
*/
public static IStatus createErrorStatus(String message) {
return createErrorStatus(message, null);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
protected IStatus validateJndiName(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0) {
String msg = IEJBAnnotationConstants.ERR_JNDI_NAME_EMPTY;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (prop.indexOf(" ") >= 0) {
String msg = IEJBAnnotationConstants.ERR_JNDI_NAME_VALUE;
return WTPCommonPlugin.createErrorStatus(msg);
}
return WTPCommonPlugin.OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
private IStatus validateEJBName(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0) {
String msg = IEJBAnnotationConstants.ERR_EJB_NAME_EMPTY;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (prop.indexOf("Bean") >= 0) {
String msg = IEJBAnnotationConstants.ERR_EJB_NAME_ENDS_WITH_BEAN;
return WTPCommonPlugin.createErrorStatus(msg);
}
return WTPCommonPlugin.OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
protected IStatus validateVersion(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0 || prop.indexOf(" ") >= 0) {
String msg = IEJBAnnotationConstants.ERR_CMP_INVALID_VERSION;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (!(ContainerManagedEntity.VERSION_1_X.equals(prop) || ContainerManagedEntity.VERSION_2_X.equals(prop))) {
String msg = IEJBAnnotationConstants.ERR_CMP_INVALID_VERSION;
return WTPCommonPlugin.createErrorStatus(msg);
}
return WTPCommonPlugin.OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
private IStatus validateDestinationType(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0) {
String msg = IEJBAnnotationConstants.ERR_DESTINATIONTYPE_EMPTY;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (prop.indexOf("Queue") >= 0 || prop.indexOf("Topic") >= 0) {
return WTPCommonPlugin.OK_STATUS;
}
String msg = IEJBAnnotationConstants.ERR_DESTINATIONTYPE_VALUE;
return WTPCommonPlugin.createErrorStatus(msg);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
private IStatus validateTransaction(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0) {
String msg = IEJBAnnotationConstants.ERR_TRANSACTION_EMPTY;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (prop.indexOf("Container") >= 0 || prop.indexOf("Bean") >= 0) {
return WTPCommonPlugin.OK_STATUS;
}
String msg = IEJBAnnotationConstants.ERR_TRANSACTION_VALUE;
return WTPCommonPlugin.createErrorStatus(msg);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
protected IStatus validateTable(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0 || prop.indexOf(" ") >= 0) {
String msg = IEJBAnnotationConstants.ERR_CMP_INVALID_TABLE;
return WTPCommonPlugin.createErrorStatus(msg);
}
return WTPCommonPlugin.OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
private IStatus validateStateless(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0) {
String msg = IEJBAnnotationConstants.ERR_STATELESS_EMPTY;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (prop.indexOf("Stateless") >= 0 || prop.indexOf("Stateful") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
return WTPCommonPlugin.OK_STATUS;
}
String msg = IEJBAnnotationConstants.ERR_STATELESS_VALUE;
return WTPCommonPlugin.createErrorStatus(msg);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
private IStatus validateEJBType(String prop) {
// check for empty
if (prop == null || prop.trim().length() == 0) {
String msg = IEJBAnnotationConstants.ERR_EJB_TYPE_EMPTY;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (prop.indexOf("SessionBean") >= 0 || prop.indexOf("MessageDrivenBean") >= 0 || prop.indexOf("EntityBean") >= 0) {
return WTPCommonPlugin.OK_STATUS;
}
String msg = IEJBAnnotationConstants.ERR_EJB_TYPE_VALUE;
return WTPCommonPlugin.createErrorStatus(msg);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
protected IStatus validateEAR(String earName) {
if (earName == null || earName.equals("")) { //$NON-NLS-1$
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME);
return WTPCommonPlugin.createErrorStatus(errorMessage);
} else if (earName.indexOf("#") != -1 || earName.indexOf("/") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_INVALID_CHARS);
return WTPCommonPlugin.createErrorStatus(errorMessage);
}
return (ProjectCreationDataModelProviderNew.validateProjectName(earName));
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
protected IStatus validateClassName(String className) {
IStatus status = this.validateJavaClassName(className);
if (status.isOK())
status = canCreateTypeInClasspath(className);
if (status != WTPCommonPlugin.OK_STATUS)
return status;
if (className.equals("Bean") || className.equals("EJB")) {
} else if ((className.endsWith("Bean") || className.endsWith("EJB")))
return status;
String msg = IEJBAnnotationConstants.ERR_CLASS_NAME_MUSTEND_WITH_BEAN;
return WTPCommonPlugin.createErrorStatus(msg);
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks
public static IStatus validateProjectName(String projectName) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IStatus status = workspace.validateName(projectName, IResource.PROJECT);
if (!status.isOK())
return status;
if (projectName.endsWith(" ")) //$NON-NLS-1$
return WTPCommonPlugin.createErrorStatus(WTPResourceHandler.getString("41")); //$NON-NLS-1$
return OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
public IStatus validate(String property) {
if (property.equals(PROJECT_NAME)) {
final String projectName = getStringProperty(PROJECT_NAME);
if (projectName == null) {
final String msg = J2EECommonMessages.ERR_EMPTY_PROJECT_NAME;
return WTPCommonPlugin.createErrorStatus(msg);
}
if (!getProject().isAccessible()) {
final String msg = J2EECommonMessages.getResourceString(J2EECommonMessages.ERR_PROJECT_INACCESSIBLE, new String[]{projectName});
return WTPCommonPlugin.createErrorStatus(msg);
}
}
return Status.OK_STATUS;
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
public IStatus validate(String propertyName) {
if (FILE_NAME.equals(propertyName) && !isPropertySet(ARCHIVE_WRAPPER)) {
String fileName = getStringProperty(propertyName);
if (fileName == null || fileName.length() == 0) {
return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.ARCHIVE_FILE_NAME_EMPTY_ERROR, new Object[]{ArchiveUtil.getModuleFileTypeName(getType())}));
} else if (archiveOpenFailure != null) {
return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(archiveOpenFailure.getMessage()));
} else if (fileName != null && !archiveExistsOnFile()) {
return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.FILE_DOES_NOT_EXIST_ERROR, new Object[]{ArchiveUtil.getModuleFileTypeName(getType())}));
}
} else if (NESTED_MODEL_J2EE_COMPONENT_CREATION.equals(propertyName) ) {
return getDataModel().getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION).validate(true);
} else if(FACET_RUNTIME.equals(propertyName)){
return validateVersionSupportedByServer();
}
return OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
protected IStatus validateEAR(String earName) {
if (earName.indexOf("#") != -1 || earName.indexOf("/") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_INVALID_CHARS);
return WTPCommonPlugin.createErrorStatus(errorMessage);
} else if (earName == null || earName.equals("")) { //$NON-NLS-1$
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME);
return WTPCommonPlugin.createErrorStatus(errorMessage);
}
IStatus status = ProjectCreationDataModelProviderNew.validateProjectName(earName);
//check for the deleted case, the project is deleted from the workspace but still exists in the
//file system.
if( status.isOK()){
IProject earProject = ProjectUtilities.getProject(getStringProperty(EAR_PROJECT_NAME));
if( !earProject.exists() ){
IPath path = ResourcesPlugin.getWorkspace().getRoot().getLocation();
path = path.append(earName);
status = ProjectCreationDataModelProviderNew.validateExisting(earName, path.toOSString());
}
}
return status;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks
public static IStatus validateName(String name) {
IStatus status = validateProjectName(name);
if (!status.isOK())
return status;
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
if (project.exists()) {
return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_EXISTS_SAMENAME_ERROR, new Object[]{name}));
}
if (!WTPPlugin.isPlatformCaseSensitive()) {
// now look for a matching case variant in the tree
IResource variant = ((Resource) project).findExistingResourceVariant(project.getFullPath());
if (variant != null) {
return WTPCommonPlugin.createErrorStatus(WTPResourceHandler.getString("42")); //$NON-NLS-1$
}
}
return OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
public IStatus validate(String propertyName) {
if (ADD_TO_EAR.equals(propertyName) || EAR_PROJECT_NAME.equals(propertyName) || FACET_PROJECT_NAME.equals(propertyName)) {
if (model.getBooleanProperty(ADD_TO_EAR)) {
IStatus status = validateEAR(model.getStringProperty(EAR_PROJECT_NAME));
if (!status.isOK())
return status;
if (getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME).equals(getStringProperty(EAR_PROJECT_NAME))) {
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.SAME_MODULE_AND_EAR_NAME, new Object[]{getStringProperty(EAR_PROJECT_NAME)});
return WTPCommonPlugin.createErrorStatus(errorMessage);
}
}
}
return super.validate(propertyName);
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks
private IStatus validateName() {
String name = getStringProperty(PROJECT_NAME);
IStatus status = validateProjectName(name);
if (!status.isOK())
return status;
if (getProject().exists())
return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_EXISTS_ERROR, new Object[]{name}));
if (!WTPPlugin.isPlatformCaseSensitive()) {
// now look for a matching case variant in the tree
IResource variant = ((Resource) getProject()).findExistingResourceVariant(getProject().getFullPath());
if (variant != null) {
// TODO Fix this string
return WTPCommonPlugin.createErrorStatus("Resource already exists with a different case."); //$NON-NLS-1$
}
}
return OK_STATUS;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb.annotation.model
protected IStatus validateJavaClassName(String prop) {
IStatus status = super.validateJavaClassName(prop);
if( status == WTPCommonPlugin.OK_STATUS && getTargetProject() != null ){
try {
IJavaProject jProject = JavaCore.create(getTargetProject());
String pName = getStringProperty(JAVA_PACKAGE);
IType type = jProject.findType(pName + "." + prop);
if(type != null ){
String msg = IEJBAnnotationConstants.ERR_EJB_TYPE_EXISTS;
return WTPCommonPlugin.createErrorStatus(msg);
}
} catch (JavaModelException e) {
}
}
return status;
}