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


Java StatusInfo类代码示例

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


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

示例1: checkExpressionCondition

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private IStatus checkExpressionCondition() {
  Expression expression = getForStatement().getExpression();
  if (!(expression instanceof MethodInvocation)) return SEMANTIC_CHANGE_WARNING_STATUS;

  MethodInvocation invoc = (MethodInvocation) expression;
  IMethodBinding methodBinding = invoc.resolveMethodBinding();
  if (methodBinding == null) return ERROR_STATUS;

  ITypeBinding declaringClass = methodBinding.getDeclaringClass();
  if (declaringClass == null) return ERROR_STATUS;

  String qualifiedName = declaringClass.getQualifiedName();
  String methodName = invoc.getName().getIdentifier();
  if (qualifiedName.startsWith("java.util.Enumeration")) { // $NON-NLS-1$
    if (!methodName.equals("hasMoreElements")) // $NON-NLS-1$
    return SEMANTIC_CHANGE_WARNING_STATUS;
  } else if (qualifiedName.startsWith("java.util.Iterator")) { // $NON-NLS-1$
    if (!methodName.equals("hasNext")) // $NON-NLS-1$
    return SEMANTIC_CHANGE_WARNING_STATUS;
    return checkIteratorCondition();
  } else {
    return SEMANTIC_CHANGE_WARNING_STATUS;
  }

  return StatusInfo.OK_STATUS;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ConvertIterableLoopOperation.java

示例2: checkIteratorCondition

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private IStatus checkIteratorCondition() {

    List<Expression> initializers = getForStatement().initializers();
    if (initializers.size() != 1) return SEMANTIC_CHANGE_WARNING_STATUS;

    Expression expression = initializers.get(0);
    if (!(expression instanceof VariableDeclarationExpression))
      return SEMANTIC_CHANGE_WARNING_STATUS;

    VariableDeclarationExpression declaration = (VariableDeclarationExpression) expression;
    List<VariableDeclarationFragment> variableDeclarationFragments = declaration.fragments();
    if (variableDeclarationFragments.size() != 1) return SEMANTIC_CHANGE_WARNING_STATUS;

    VariableDeclarationFragment declarationFragment = variableDeclarationFragments.get(0);

    Expression initializer = declarationFragment.getInitializer();
    if (!(initializer instanceof MethodInvocation)) return SEMANTIC_CHANGE_WARNING_STATUS;

    MethodInvocation methodInvocation = (MethodInvocation) initializer;
    String methodName = methodInvocation.getName().getIdentifier();
    if (!"iterator".equals(methodName) || methodInvocation.arguments().size() != 0) // $NON-NLS-1$
    return SEMANTIC_CHANGE_WARNING_STATUS;

    return StatusInfo.OK_STATUS;
  }
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ConvertIterableLoopOperation.java

示例3: NewEntryPointWizardPage

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
public NewEntryPointWizardPage() {
  super(true, "Entry Point Class");
  setTitle("Entry Point Class");
  setDescription("Create a new entry point class.");

  moduleField = new ModuleSelectionDialogButtonField(this,
      new ModuleFieldAdapter());

  String[] buttonNames = new String[] {
      NewWizardMessages.NewClassWizardPage_methods_constructors,
      NewWizardMessages.NewClassWizardPage_methods_inherited};
  methodStubsButtons = new SelectionButtonDialogFieldGroup(SWT.CHECK,
      buttonNames, 1);
  methodStubsButtons.setLabelText(NewWizardMessages.NewClassWizardPage_methods_label);

  moduleStatus = new StatusInfo();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:18,代码来源:NewEntryPointWizardPage.java

示例4: moduleChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private IStatus moduleChanged() {
  StatusInfo status = new StatusInfo();
  module = null;

  moduleField.enableButton(getPackageFragmentRoot() != null
      && getPackageFragmentRoot().exists()
      && JavaProjectUtilities.isJavaProjectNonNullAndExists(getJavaProject())
      && GWTNature.isGWTProject(getJavaProject().getProject()));

  IStatus fieldStatus = moduleField.getStatus();
  if (!fieldStatus.isOK()) {
    status.setError(fieldStatus.getMessage());
    return status;
  }

  // TODO: verify that package is in client source path of module

  module = moduleField.getModule();
  return status;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:NewEntryPointWizardPage.java

示例5: typeNameChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
@Override
protected IStatus typeNameChanged() {
  IStatus ownerClassNameStatus = super.typeNameChanged();
  if (ownerClassNameStatus.getSeverity() == IStatus.ERROR) {
    return ownerClassNameStatus;
  }

  StatusInfo uiXmlNameStatus = new StatusInfo();
  IPath uiXmlFilePath = getUiXmlFilePath();
  if (uiXmlFilePath != null) {
    // Make sure there's not already a ui.xml file with the same name
    if (ResourcesPlugin.getWorkspace().getRoot().exists(uiXmlFilePath)) {
      uiXmlNameStatus.setError(MessageFormat.format("{0} already exists.",
          uiXmlFilePath.lastSegment()));
    }
  } else {
    // Don't need to worry about this case since the ui.xml path should only
    // be null if the package fragment is invalid, in which case that error
    // will supersede ours.
  }

  return StatusUtil.getMostSevere(new IStatus[] {
      ownerClassNameStatus, uiXmlNameStatus});
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:NewUiBinderWizardPage.java

示例6: setVisible

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
@Override
public void setVisible(boolean visible) {
  super.setVisible(visible);
  pageVisible = visible;

  // Wizards are not allowed to start up with an error message
  if (visible) {
    setFocus();

    if (pageStatus.matches(IStatus.ERROR)) {
      StatusInfo status = new StatusInfo();
      status.setError("");
      pageStatus = status;
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:17,代码来源:NewHostPageWizardPage.java

示例7: typeNameChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
@Override
protected IStatus typeNameChanged() {
	StatusInfo status = (StatusInfo) super.typeNameChanged();
	String message = status.getMessage();

	if (message != null) {
		if (message.startsWith(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_TypeNameDiscouraged, ""))
				|| message.equals(NewWizardMessages.NewTypeWizardPage_error_TypeNameExists)) {
			status.setOK();
		} else if (message
				.startsWith(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidTypeName, ""))
				|| message.equals(NewWizardMessages.NewTypeWizardPage_error_QualifiedName)) {
			status.setError(message.replace("Type name", "Name").replace("Java type name", "name")
					.replace("type name", "name"));
			// errors about *type* names would be confusing here
		}
	}

	return status;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:21,代码来源:NewTxtUMLFileElementWizardPage.java

示例8: typeNameChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
@Override
protected IStatus typeNameChanged() {
	StatusInfo status = (StatusInfo) super.typeNameChanged();
	String message = status.getMessage();

	if (message != null && message.equals(NewWizardMessages.NewTypeWizardPage_error_EnterTypeName)) {
		status.setError("Filename is empty.");
	}

	if (getPackageFragment() != null && getTypeName() != null) {
		IFolder folder = (IFolder) getPackageFragment().getResource();
		IFile file = folder.getFile(getTypeName() + getSelectedExtension());
		if (file.exists()) {
			status.setError("File already exists.");
		}
	}

	return status;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:20,代码来源:NewXtxtUMLFileWizardPage.java

示例9: validatePath

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private void validatePath() {
	StatusInfo status= new StatusInfo();
	String str= fEntryField.getText();
	if (str.length() == 0) {
		status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_enterpath);
	} else if (!Path.ROOT.isValidPath(str)) {
		status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_invalidpath);
	} else {
		IPath path= new Path(str);
		if (path.segmentCount() == 0) {
			status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_needssegment);
		} else if (fUsedPaths.contains(path)) {
			status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_alreadyexists);
		}
	}
	updateStatus(status);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:ClasspathContainerDefaultPage.java

示例10: superInterfacesChanged

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
/**
 * Hook method that gets called when the list of super interface has changed. The method
 * validates the super interfaces and returns the status of the validation.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 *
 * @return the status of the validation
 */
protected IStatus superInterfacesChanged() {
	StatusInfo status= new StatusInfo();

	IPackageFragmentRoot root= getPackageFragmentRoot();
	fSuperInterfacesDialogField.enableButton(0, root != null);

	if (root != null) {
		List<InterfaceWrapper> elements= fSuperInterfacesDialogField.getElements();
		int nElements= elements.size();
		for (int i= 0; i < nElements; i++) {
			String intfname= elements.get(i).interfaceName;
			Type type= TypeContextChecker.parseSuperInterface(intfname);
			if (type == null) {
				status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperInterfaceName, BasicElementLabels.getJavaElementName(intfname)));
				return status;
			}
			if (type instanceof ParameterizedType && ! JavaModelUtil.is50OrHigher(root.getJavaProject())) {
				status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_SuperInterfaceNotParameterized, BasicElementLabels.getJavaElementName(intfname)));
				return status;
			}
		}
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:NewTypeWizardPage.java

示例11: createMaxEntriesField

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private void createMaxEntriesField() {
	fMaxEntriesField= new StringDialogField();
	fMaxEntriesField.setLabelText(fHistory.getMaxEntriesMessage());
	fMaxEntriesField.setDialogFieldListener(new IDialogFieldListener() {
		public void dialogFieldChanged(DialogField field) {
			String maxString= fMaxEntriesField.getText();
			boolean valid;
			try {
				fMaxEntries= Integer.parseInt(maxString);
				valid= fMaxEntries > 0 && fMaxEntries < MAX_MAX_ENTRIES;
			} catch (NumberFormatException e) {
				valid= false;
			}
			if (valid)
				updateStatus(StatusInfo.OK_STATUS);
			else
				updateStatus(new StatusInfo(IStatus.ERROR, Messages.format(JavaUIMessages.HistoryListAction_max_entries_constraint, Integer.toString(MAX_MAX_ENTRIES))));
		}
	});
	fMaxEntriesField.setText(Integer.toString(fHistory.getMaxEntries()));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:HistoryListAction.java

示例12: validate

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
public IStatus validate(Object[] selection) {
	int selectedCount= 0;
	int duplicateCount= 0;
	if (selection != null && selection.length > 0) {

		HashSet<String> signatures= new HashSet<String>(selection.length);
		for (int index= 0; index < selection.length; index++) {
			if (selection[index] instanceof DelegateEntry) {
				DelegateEntry delegateEntry= (DelegateEntry) selection[index];
				if (!signatures.add(getSignature(delegateEntry.delegateMethod)))
					duplicateCount++;
				selectedCount++;
			}
		}
	}
	if (duplicateCount > 0) {
		return new StatusInfo(IStatus.ERROR, duplicateCount == 1
				? ActionMessages.AddDelegateMethodsAction_duplicate_methods_singular
				: Messages.format(ActionMessages.AddDelegateMethodsAction_duplicate_methods_plural, String.valueOf(duplicateCount)));
	}
	return new StatusInfo(IStatus.INFO, Messages.format(ActionMessages.AddDelegateMethodsAction_selectioninfo_more, new Object[] { String.valueOf(selectedCount), String.valueOf(fEntries) }));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:AddDelegateMethodsAction.java

示例13: addSelectedInterfaces

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private void addSelectedInterfaces() {
	StructuredSelection selection= getSelectedItems();
	if (selection == null)
		return;
	for (Iterator<?> iter= selection.iterator(); iter.hasNext();) {
		Object obj= iter.next();
		if (obj instanceof TypeNameMatch) {
			accessedHistoryItem(obj);
			TypeNameMatch type= (TypeNameMatch) obj;
			String qualifiedName= getNameWithTypeParameters(type.getType());
			String message;

			if (fTypeWizardPage.addSuperInterface(qualifiedName)) {
				message= Messages.format(NewWizardMessages.SuperInterfaceSelectionDialog_interfaceadded_info, BasicElementLabels.getJavaElementName(qualifiedName));
			} else {
				message= Messages.format(NewWizardMessages.SuperInterfaceSelectionDialog_interfacealreadyadded_info, BasicElementLabels.getJavaElementName(qualifiedName));
			}
			updateStatus(new StatusInfo(IStatus.INFO, message));
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:SuperInterfaceSelectionDialog.java

示例14: doValidation

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
private void doValidation() {
	StatusInfo status= new StatusInfo();
	String newText= fNameDialogField.getText();
	if (newText.length() == 0) {
		status.setError(""); //$NON-NLS-1$
	} else {
		if (newText.equals("*")) { //$NON-NLS-1$
			if (doesExist("", fIsStatic)) { //$NON-NLS-1$
				status.setError(PreferencesMessages.ImportOrganizeInputDialog_error_entryExists);
			}
		} else {
			IStatus val= JavaConventions.validateJavaTypeName(newText, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3);
			if (val.matches(IStatus.ERROR)) {
				status.setError(PreferencesMessages.ImportOrganizeInputDialog_error_invalidName);
			} else {
				if (doesExist(newText, fIsStatic)) {
					status.setError(PreferencesMessages.ImportOrganizeInputDialog_error_entryExists);
				}
			}
		}
	}
	updateStatus(status);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:24,代码来源:ImportOrganizeInputDialog.java

示例15: validateAbsoluteFilePath

import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; //导入依赖的package包/类
/**
 * Validates that the file with the specified absolute path exists and can
 * be opened.
 *
 * @param path
 *                   The path of the file to validate
 * @return a status without error if the path is valid
 */
protected static IStatus validateAbsoluteFilePath(String path) {

	final StatusInfo status= new StatusInfo();
	IStringVariableManager variableManager= VariablesPlugin.getDefault().getStringVariableManager();
	try {
		path= variableManager.performStringSubstitution(path);
		if (path.length() > 0) {

			final File file= new File(path);
			if (!file.exists() && (!file.isAbsolute() || !file.getParentFile().canWrite()))
				status.setError(PreferencesMessages.SpellingPreferencePage_dictionary_error);
			else if (file.exists() && (!file.isFile() || !file.isAbsolute() || !file.canRead() || !file.canWrite()))
				status.setError(PreferencesMessages.SpellingPreferencePage_dictionary_error);
		}
	} catch (CoreException e) {
		status.setError(e.getLocalizedMessage());
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:28,代码来源:SpellingConfigurationBlock.java


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