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


Java NLS类代码示例

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


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

示例1: validateDestinationGroup

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Answer a boolean indicating whether the receivers destination specification widgets currently all contain valid
 * values.
 */
private boolean validateDestinationGroup() {
	String destinationValue = getTargetDirectory();
	if (destinationValue.length() == 0) {
		setMessage(destinationEmptyMessage());
		return false;
	}

	String conflictingContainer = getConflictingContainerNameFor(destinationValue);
	if (conflictingContainer == null) {
		// // no error message, but warning may exists
		// String threatenedContainer = getOverlappingProjectName(destinationValue);
		// if (threatenedContainer == null)
		setMessage(null);
		// else
		// setMessage(NLS.bind(NFARExportMessages.FileExport_damageWarning, threatenedContainer), WARNING);

	} else {
		setErrorMessage(NLS.bind(N4ExportMessages.FileExport_conflictingContainer, conflictingContainer));
		giveFocusToDestination();
		return false;
	}

	return true;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:AbstractExportToSingleFileWizardPage.java

示例2: flagMissingRequiredOption

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Locates the page that this option is presented in and flags that the
 * option is required and is currently not set. The flagging is done by
 * setting the page incomplete and setting the error message that uses
 * option's message label.
 * 
 * @param option
 *            the option that is required and currently not set
 */
protected void flagMissingRequiredOption(TemplateOption option) {
	WizardPage page = null;
	for (int i = 0; i < pages.size(); i++) {
		TemplatePage tpage = pages.get(i);
		ArrayList<TemplateOption> list = tpage.options;
		if (list.contains(option)) {
			page = tpage.page;
			break;
		}
	}
	if (page != null) {
		page.setPageComplete(false);
		String message = NLS.bind(PDEUIMessages.OptionTemplateSection_mustBeSet, option.getMessageLabel());
		page.setErrorMessage(message);
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:26,代码来源:OptionTemplateSection.java

示例3: getDisplayStringWithStatus

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
   * Get the display string based on the current status and the name of the
   * job.
   * @param showProgress a boolean to indicate if we should
   * show progress or not.
   *
   * @return String
   */
  private String getDisplayStringWithStatus(boolean showProgress) {
      if (isCanceled()) {
	return NLS.bind(ProgressMessages.JobInfo_Cancelled, (new Object[] { getJob().getName() }));
}
      if (isBlocked()) {
	return NLS.bind(ProgressMessages.JobInfo_Blocked, (new Object[] { getJob().getName(),
	blockedStatus.getMessage() }));
}
      if (getJob().getState() == Job.RUNNING) {
      	TaskInfo info = getTaskInfo();
          if (info == null) {
		return getJob().getName();
	}
          return info.getDisplayString(showProgress);
      }
      if (getJob().getState() == Job.SLEEPING) {
	return NLS.bind(ProgressMessages.JobInfo_Sleeping, (new Object[] { getJob().getName() }));
}

      return NLS.bind(ProgressMessages.JobInfo_Waiting, (new Object[] { getJob().getName() }));

  }
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:31,代码来源:JobInfo.java

示例4: fixIllegalDefaultSeverity

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Fixes an illegally set default severity. The default severity must be within given severity range.
 *
 * @param issue
 *          the issue
 * @param acceptor
 *          the acceptor
 */
@Fix(IssueCodes.DEFAULT_SEVERITY_NOT_IN_RANGE)
public void fixIllegalDefaultSeverity(final Issue issue, final IssueResolutionAcceptor acceptor) {
  if (issue.getData() != null) {
    for (final String severityProposal : issue.getData()) {
      final String label = NLS.bind(Messages.CheckQuickfixProvider_DEFAULT_SEVERITY_FIX_LABEL, severityProposal);
      final String descn = NLS.bind(Messages.CheckQuickfixProvider_DEFAULT_SEVERITY_FIX_DESCN, severityProposal);

      acceptor.accept(issue, label, descn, NO_IMAGE, new IModification() {
        @Override
        public void apply(final IModificationContext context) throws BadLocationException {
          IXtextDocument xtextDocument = context.getXtextDocument();
          xtextDocument.replace(issue.getOffset(), issue.getLength(), severityProposal);
        }
      });
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:26,代码来源:CheckQuickfixProvider.java

示例5: validatePage

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
@Override
protected IStatus validatePage(Event event) {
	grammarInfoWidget.refresh(null);
	String path = grammarFileText.getText();
	if (path.length() == 0) {
		return new Status(IStatus.ERROR, TMUIPlugin.PLUGIN_ID,
				TMUIMessages.SelectGrammarWizardPage_file_error_required);
	}
	File f = new File(path);
	Registry registry = new Registry();
	try {
		IGrammar grammar = registry.loadGrammarFromPathSync(f.getName(), new FileInputStream(f));
		if (grammar == null || grammar.getScopeName() == null) {
			return new Status(IStatus.ERROR, TMUIPlugin.PLUGIN_ID,
					TMUIMessages.SelectGrammarWizardPage_file_error_invalid);
		}
		grammarInfoWidget.refresh(grammar);
	} catch (Exception e) {
		return new Status(IStatus.ERROR, TMUIPlugin.PLUGIN_ID,
				NLS.bind(TMUIMessages.SelectGrammarWizardPage_file_error_load, e.getMessage()), e);
	}
	return null;
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:24,代码来源:SelectGrammarWizardPage.java

示例6: getText

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
@Override
public String getText() {
  final ICounter branches = line.getBranchCounter();
  switch (branches.getStatus()) {
  case ICounter.NOT_COVERED:
    return NLS.bind(UIMessages.AnnotationTextAllBranchesMissed_message,
        Integer.valueOf(branches.getMissedCount()));
  case ICounter.FULLY_COVERED:
    return NLS.bind(UIMessages.AnnotationTextAllBranchesCovered_message,
        Integer.valueOf(branches.getTotalCount()));
  case ICounter.PARTLY_COVERED:
    return NLS.bind(UIMessages.AnnotationTextSomeBranchesMissed_message,
        Integer.valueOf(branches.getMissedCount()),
        Integer.valueOf(branches.getTotalCount()));
  default:
    return null;
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:19,代码来源:CoverageAnnotation.java

示例7: fixSeverityToMaxSeverity

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Fix severity by setting it to a legal value as is defined by severity range of referenced check. Legal
 * severities are passed as issue data (org.eclipse.xtext.validation.Issue#getData()).
 * 
 * @param issue
 *          the issue
 * @param acceptor
 *          the acceptor
 */
@Fix(IssueCodes.SEVERITY_NOT_ALLOWED)
public void fixSeverityToMaxSeverity(final Issue issue, final IssueResolutionAcceptor acceptor) {
  if (issue.getData() != null) {
    for (final String severityProposal : issue.getData()) {
      final String label = NLS.bind(Messages.CheckCfgQuickfixProvider_CORRECT_SEVERITY_LABEL, severityProposal);
      final String descn = NLS.bind(Messages.CheckCfgQuickfixProvider_CORRECT_SEVERITY_DESCN, severityProposal);

      acceptor.accept(issue, label, descn, NO_IMAGE, new IModification() {
        public void apply(final IModificationContext context) throws BadLocationException {
          IXtextDocument xtextDocument = context.getXtextDocument();
          xtextDocument.replace(issue.getOffset(), issue.getLength(), severityProposal);
        }
      });
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:26,代码来源:CheckCfgQuickfixProvider.java

示例8: checkConfigurationEqualsDefault

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Checks whether a configured check's configuration equals the default. Emits an info if this is the case.
 *
 * @param configuredCheck
 *          the configured check
 */
@Check
public void checkConfigurationEqualsDefault(final ConfiguredCheck configuredCheck) {
  final com.avaloq.tools.ddk.check.check.Check check = configuredCheck.getCheck();
  if (!isParameterConfigured(configuredCheck) || check == null || check.eIsProxy()) {
    return; // only interesting if check configured and resolvable
  }

  Iterable<FormalParameter> formalParameters = check.getFormalParameters();
  for (final ConfiguredParameter configParam : configuredCheck.getParameterConfigurations()) {
    try {
      FormalParameter param = Iterables.find(formalParameters, new Predicate<FormalParameter>() {
        @Override
        public boolean apply(final FormalParameter input) {
          return input == configParam.getParameter();
        }
      });
      if (parameterValuesEqual(configParam.getNewValue(), param.getRight())) {
        info(NLS.bind(Messages.CheckCfgJavaValidator_CONFIGURED_PARAM_EQUALS_DEFAULT, param.getName()), configParam, CheckcfgPackage.Literals.CONFIGURED_PARAMETER__NEW_VALUE, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, IssueCodes.CONFIGURED_PARAM_EQUALS_DEFAULT);
      }
    } catch (NoSuchElementException e) {
      LOGGER.debug("Could not find referenced formal parameter");
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:31,代码来源:CheckCfgJavaValidator.java

示例9: createTempDirectory

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Creates the temp directory.
 *
 * @param name
 *          the name of the directory, must not be {@code null}
 * @return the file, never {@code null}
 * @throws DeployException
 *           Signals that an I/O exception has occurred.
 */
private static File createTempDirectory(final String name) throws DeployException {
  final File temp;
  try {
    temp = File.createTempFile(name, null);
  } catch (IOException e) {
    LOGGER.error(e.getMessage());
    throw new DeployException(e);
  }
  if (!(temp.delete())) {
    LOGGER.error(NLS.bind(Messages.DeployJob_CouldNotCreateTemporaryDirectoryForJar, temp.getAbsolutePath()));
    throw new DeployException();
  }
  if (!(temp.mkdir())) {
    LOGGER.error(NLS.bind(Messages.DeployJob_CouldNotCreateTemporaryDirectoryForJar, temp.getAbsolutePath()));
    throw new DeployException();
  }
  return temp;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:28,代码来源:DeployJob.java

示例10: validateNgProjectName

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/** Validates the name of the Angular-CLI Project. */
private IStatus validateNgProjectName(String name) {
	IStatus status = Status.OK_STATUS;
	for (int i = 0, cnt = unsupportedProjectNames.length; i < cnt; i++) {
		if (unsupportedProjectNames[i].equals(name)) {
			status = new Status(IStatus.WARNING, AngularCLIPlugin.PLUGIN_ID,
					NLS.bind(AngularCLIMessages.NewAngularProjectWizard_unsupportedProjectNames, name));
			break;
		}
	}
	if (status.isOK()) {
		String[] parts = name.split("-");
		for (int i = 0, cnt = parts.length; i < cnt; i++) {
			if (!parts[i].matches(projectNameRegexp)) {
				status = new Status(IStatus.WARNING, AngularCLIPlugin.PLUGIN_ID,
						NLS.bind(AngularCLIMessages.NewAngularProjectWizard_invalidProjectName, name));
				break;
			}
		}
	}
	return status;
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:23,代码来源:WizardNewNgProjectCreationPage.java

示例11: checkExtensions

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Verifies that all referenced extensions can be found.
 *
 * @param model
 *          scope model to check
 */
@Check
public void checkExtensions(final ScopeModel model) {
  ResourceManager resourceManager = null;
  if (Platform.isRunning()) {
    IXtendXpandProject project = Activator.getExtXptModelManager().findProject(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(model.eResource().getURI().toPlatformString(true))).getProject());
    if (project != null) {
      resourceManager = new XpandPluginExecutionContext(project).getResourceManager();
    }
  } else {
    resourceManager = new ResourceManagerDefaultImpl();
  }
  if (resourceManager == null) {
    return;
  }
  for (Extension ext : model.getExtensions()) {
    final Resource res = resourceManager.loadResource(ext.getExtension(), XtendFile.FILE_EXTENSION);
    if (res == null) {
      error(NLS.bind(Messages.extensionNotFound, ext.getExtension()), ext, ScopePackage.Literals.EXTENSION__EXTENSION, null);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:28,代码来源:ScopeJavaValidator.java

示例12: apply

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void apply(final IModificationContext context) throws BadLocationException {
  final IXtextDocument xtextDocument = context.getXtextDocument();
  xtextDocument.readOnly(new IUnitOfWork.Void<XtextResource>() {
    @Override
    public void process(final XtextResource state) throws Exception { // NOPMD
      final EObject target = EcoreUtil2.getContainerOfType(state.getEObject(issue.getUriToProblem().fragment()), type);
      if (type.isInstance(target)) {
        int offset = NodeModelUtils.findActualNodeFor(target).getOffset();
        int lineOfOffset = xtextDocument.getLineOfOffset(offset);
        int lineOffset = xtextDocument.getLineOffset(lineOfOffset);
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < (offset - lineOffset); i++) {
          buffer.append(' ');
        }
        xtextDocument.replace(offset, 0, NLS.bind(autodocumentation, buffer.toString()));
      }
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:22,代码来源:CheckQuickfixProvider.java

示例13: checkDataTypeOrEnumRule

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Verify that only rule self directives are used for terminal, enum and data type rules.
 *
 * @param model
 *          the GrammarRule
 */
@Check
public void checkDataTypeOrEnumRule(final GrammarRule model) {
  if (model.getTargetRule() instanceof TerminalRule || model.getTargetRule() instanceof EnumRule
      || (model.getTargetRule() instanceof ParserRule && GrammarUtil.isDatatypeRule((ParserRule) model.getTargetRule()))) {
    Iterator<EObject> grammarElementAccessors = collectGrammarElementAccessors(model);
    boolean selfAccessOnly = Iterators.all(grammarElementAccessors, new Predicate<EObject>() {
      @Override
      public boolean apply(final EObject input) {
        return input instanceof GrammarElementReference && ((GrammarElementReference) input).getSelf() != null;
      }
    });
    if (!selfAccessOnly) {
      error(NLS.bind("For data type, enum or terminal rule {0} only ''rule'' directive may be used", model.getTargetRule().getName()), FormatPackage.Literals.GRAMMAR_RULE__DIRECTIVES, ILLEGAL_DIRECTIVE_CODE);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:23,代码来源:FormatJavaValidator.java

示例14: checkExtensions

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Verifies that all referenced extensions can be found.
 *
 * @param model
 *          export model to check
 */
@Check
public void checkExtensions(final ExportModel model) {
  ResourceManager resourceManager = null;
  if (Platform.isRunning()) {
    IXtendXpandProject project = Activator.getExtXptModelManager().findProject(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(model.eResource().getURI().toPlatformString(true))).getProject());
    if (project != null) {
      resourceManager = new XpandPluginExecutionContext(project).getResourceManager();
    }
  } else {
    resourceManager = new ResourceManagerDefaultImpl();
  }
  if (resourceManager == null) {
    return;
  }
  for (Extension ext : model.getExtensions()) {
    final Resource res = resourceManager.loadResource(ext.getExtension(), XtendFile.FILE_EXTENSION);
    if (res == null) {
      error(NLS.bind("Extension ''{0}'' not found", ext.getExtension()), ext, ExportPackage.Literals.EXTENSION__EXTENSION, null);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:28,代码来源:ExportJavaValidator.java

示例15: checkCheckNamesAreUnique

import org.eclipse.osgi.util.NLS; //导入依赖的package包/类
/**
 * Checks that Check names are unique. A Check name may only occur once in a Check Catalog.
 *
 * @param catalog
 *          the check catalog
 */
@Check
public void checkCheckNamesAreUnique(final CheckCatalog catalog) {
  Function<com.avaloq.tools.ddk.check.check.Check, QualifiedName> function = new Function<com.avaloq.tools.ddk.check.check.Check, QualifiedName>() {
    @Override
    public QualifiedName apply(final com.avaloq.tools.ddk.check.check.Check from) {
      return QualifiedName.create(from.getName()); // no need to create a fully qualified name with check catalog here, it is only used for
                                                   // comparing check instances
    }
  };
  UniquenessJavaValidationHelper<com.avaloq.tools.ddk.check.check.Check> helper = //
      new UniquenessJavaValidationHelper<com.avaloq.tools.ddk.check.check.Check>(function, getMessageAcceptor()) {
        @Override
        public String getMessage(final com.avaloq.tools.ddk.check.check.Check duplicate) {
          return NLS.bind("Duplicate Check name: {0}", duplicate.getName()); //$NON-NLS-1$
        }
      };

  final Iterable<com.avaloq.tools.ddk.check.check.Check> allChecksWithName = Iterables.filter(catalog.getAllChecks(), new Predicate<com.avaloq.tools.ddk.check.check.Check>() {
    @Override
    public boolean apply(final com.avaloq.tools.ddk.check.check.Check input) {
      return input.getName() != null;
    }
  });
  helper.errorOnDuplicates(allChecksWithName, locationInFileProvider::getIdentifierFeature, IssueCodes.DUPLICATE_CHECK);
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:32,代码来源:CheckJavaValidator.java


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