本文整理汇总了Java中org.eclipse.osgi.util.NLS.bind方法的典型用法代码示例。如果您正苦于以下问题:Java NLS.bind方法的具体用法?Java NLS.bind怎么用?Java NLS.bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.osgi.util.NLS
的用法示例。
在下文中一共展示了NLS.bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: typeNameChanged
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public IStatus typeNameChanged() {
super.typeNameChanged();
IStatus status = validator.checkCatalogName(getCatalogName());
if (!previousPageIsProjectPage()) {
IPackageFragment packageFragment = getPackageFragment();
if (packageFragment != null && catalogExists(packageFragment.getResource())) {
return new Status(IStatus.ERROR, status.getPlugin(), NLS.bind(com.avaloq.tools.ddk.check.validation.Messages.CheckJavaValidator_CATALOG_NAME_STATUS, com.avaloq.tools.ddk.check.validation.Messages.CheckJavaValidator_EXISTS));
}
}
if (!status.matches(IStatus.ERROR)) {
projectInfo.setCatalogName(getCatalogName());
}
return status;
}
示例3: 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;
}
}
示例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);
}
});
}
}
}
示例5: displayErrorDialog
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
/**
* Display an error dialog with the information from the supplied exception.
*/
private void displayErrorDialog(Throwable exception) {
String message = exception.getMessage();
// Some system exceptions have no message
if (message == null) {
message = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_exceptionMessage, exception);
}
displayErrorDialog(message);
}
示例6: performQuery
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
@Override
public @NonNull IStatus performQuery(@NonNull TaskRepository repository, @NonNull IRepositoryQuery query,
@NonNull TaskDataCollector collector, @Nullable ISynchronizationSession session,
@NonNull IProgressMonitor monitor) {
try {
List<CharmQueryResult> charmTasks = getClient(repository).queryTasks(monitor, query).getQueryResults();
SubMonitor subMonitor = SubMonitor.convert(monitor, charmTasks.size());
for (CharmQueryResult charmTask : charmTasks) {
TaskData taskData = this.taskDataHandler.parseQueryResults(repository, charmTask, monitor);
taskData.setPartial(true);
collector.accept(taskData);
subMonitor.split(1);
}
} catch (CharmException | CoreException e) {
return new Status(IStatus.ERROR, CharmCorePlugin.PLUGIN_ID, NLS.bind("Query failed: ''{0}''", e.getMessage()),
e);
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
示例7: getContent
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
@Override
public InputStream getContent(@NonNull TaskRepository repository, @NonNull ITask task,
@NonNull TaskAttribute attachmentAttribute, @Nullable IProgressMonitor monitor) throws CoreException {
try {
return connector.getClient(repository).getAttachment(task, attachmentAttribute, monitor);
} catch (CharmException e) {
throw new CoreException(new Status(IStatus.ERROR, CharmCorePlugin.PLUGIN_ID,
NLS.bind("Downloading attachment failed: {0}", e.getMessage(), e)));
}
}
示例8: postContent
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
@Override
public void postContent(@NonNull TaskRepository repository, @NonNull ITask task,
@NonNull AbstractTaskAttachmentSource source, @Nullable String comment,
@Nullable TaskAttribute attachmentAttribute, @Nullable IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Uploading attachment", 1);
CharmClient client = connector.getClient(repository);
try {
byte attachment[] = readData(source, monitor);
String filename = source.getName();
String description = source.getDescription();
if (CONTEXT_DESCRIPTION.equals(source.getDescription()))
filename = CONTEXT_DESCRIPTION + "-" + dateFormat.format(new Date()) + ".zip";
else if (attachmentAttribute != null) {
TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute);
if (mapper.getFileName() != null)
filename = mapper.getFileName();
if (mapper.getDescription() != null)
description = mapper.getDescription();
}
client.putAttachmentData(task, filename, source.getContentType(), description, attachment, monitor);
Policy.advance(monitor, 1);
} catch (IOException | CharmHttpException e) {
throw new CoreException(new Status(IStatus.ERROR, CharmCorePlugin.PLUGIN_ID,
NLS.bind("Uploading attachment failed: {0}", e.getMessage(), e)));
} finally {
monitor.done();
}
}
示例9: checkValidWorkspace
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
/**
* Return true if the argument directory is ok to use as a workspace and
* false otherwise. A version check will be performed, and a confirmation
* box may be displayed on the argument shell if an older version is
* detected.
*
* @return true if the argument URL is ok to use as a workspace and false
* otherwise.
*/
private boolean checkValidWorkspace(Shell shell, URL url) {
// a null url is not a valid workspace
if (url == null) {
return false;
}
String version = readWorkspaceVersion(url);
// if the version could not be read, then there is not any existing
// workspace data to trample, e.g., perhaps its a new directory that
// is just starting to be used as a workspace
if (version == null) {
return true;
}
final int ide_version = Integer.parseInt(WORKSPACE_VERSION_VALUE);
int workspace_version = Integer.parseInt(version);
// equality test is required since any version difference (newer
// or older) may result in data being trampled
if (workspace_version == ide_version) {
return true;
}
// At this point workspace has been detected to be from a version
// other than the current ide version -- find out if the user wants
// to use it anyhow.
String title = IDEWorkbenchMessages.IDEApplication_versionTitle_newerWorkspace;
String message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage_newerWorkspace, url.getFile());
MessageBox mbox = new MessageBox(shell, SWT.OK | SWT.CANCEL
| SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
mbox.setText(title);
mbox.setMessage(message);
return mbox.open() == SWT.OK;
}
示例10: getResultLabel
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
@Override
public String getResultLabel(int nMatches) {
long time = 0;
if (startTime > 0) {
time = System.currentTimeMillis() - startTime;
}
if (nMatches == 1) {
return NLS.bind(EditorConfigMessages.EditorConfigSearchQuery_singularReference,
new Object[] { section.getGlob(), time });
}
return NLS.bind(EditorConfigMessages.EditorConfigSearchQuery_pluralReferences,
new Object[] { section.getGlob(), nMatches, time });
}
示例11: getValidModel
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
/**
* Gets the valid model.
*
* @param grammar
* the grammar
* @return the valid model
*/
private ValidModel getValidModel(final Grammar grammar) {
if (model != null) {
return model;
}
Resource resource = null;
final String name = GrammarUtil.getName(grammar) + '.' + XTEXT_EXTENSION;
URI uri;
for (final Resource res : grammar.eResource().getResourceSet().getResources()) {
if (res.getURI() != null && name.equals(EmfResourceUtil.getFileName(res.getURI()))) {
resource = res;
break;
}
}
if (getValidURI() == null) {
Assert.isNotNull(resource, NLS.bind(Messages.RESOURCE_NOT_FOUND, name));
uri = resource.getURI().trimFileExtension().appendFileExtension(VALID_EXTENSION);
} else {
uri = URI.createURI(getValidURI());
}
resource = resource.getResourceSet().getResource(uri, true);
final List<Issue> issues = VALIDATOR.validate(resource, LOGGER);
for (final Issue issue : issues) {
if (issue.isSyntaxError() || issue.getSeverity() == Severity.ERROR) {
throw new WorkflowInterruptedException(NLS.bind(Messages.ERROR_FOUND, uri.toString()));
}
}
model = (ValidModel) resource.getContents().get(0);
return model;
}
示例12: clickButton
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
/**
* Click the given button as soon as it is enabled.
*
* @param button
* the {@link SWTBotButton} to be clicked
* @param timeout
* the timeout to wait for. When timeout is reached, a WrappedException is thrown.
*/
public void clickButton(final SWTBotButton button, final long timeout) {
final long endTimeMillis = System.currentTimeMillis() + timeout;
while (!button.isEnabled() && System.currentTimeMillis() < endTimeMillis) {
sleep(SWTBotPreferences.DEFAULT_POLL_DELAY);
}
if (button.isEnabled()) {
new SwtBotButton(button).click();
} else {
throw new WrappedException(NLS.bind(TIMEOUT_MSG, timeout, button.getText()), null);
}
}
示例13: extractName
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
protected String extractName(String attrName) throws NgBindingTypeException {
if (endsWith == null) {
return attrName.substring(startsWith.length(), attrName.length());
} else {
if (!attrName.endsWith(endsWith)) {
throw new NgBindingTypeException(
NLS.bind(AngularCoreMessages.AttributeBindingSyntax_error, attrName, endsWith),
ValidationMessage.ERROR);
}
return attrName.substring(startsWith.length(), attrName.length() - endsWith.length());
}
}
示例14: getArtifactScope
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
protected int getArtifactScope(ILaunchConfiguration configuration) throws CoreException {
String typeid = configuration.getType().getAttribute("id"); //$NON-NLS-1$
if(JDT_JAVA_APPLICATION.equals(typeid) || "org.jboss.tools.servers.wildfly.swarm.core.serverLaunchConfig".equals(typeid)) {
IResource[] resources = configuration.getMappedResources();
// MNGECLIPSE-530: NPE starting openarchitecture workflow
if(resources == null || resources.length == 0) {
return IClasspathManager.CLASSPATH_RUNTIME;
}
// ECLIPSE-33: applications from test sources should use test scope
final Set<IPath> testSources = new HashSet<>();
IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
IMavenProjectFacade facade = projectManager.create(javaProject.getProject(), new NullProgressMonitor());
if(facade == null) {
return IClasspathManager.CLASSPATH_RUNTIME;
}
testSources.addAll(Arrays.asList(facade.getTestCompileSourceLocations()));
for(int i = 0; i < resources.length; i++ ) {
for(IPath testPath : testSources) {
if(testPath.isPrefixOf(resources[i].getProjectRelativePath())) {
return IClasspathManager.CLASSPATH_TEST;
}
}
}
return IClasspathManager.CLASSPATH_RUNTIME;
} else if(JDT_JUNIT_TEST.equals(typeid) || JDT_TESTNG_TEST.equals(typeid)) {
return IClasspathManager.CLASSPATH_TEST;
} else {
throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, 0, NLS.bind(
Messages.MavenRuntimeClasspathProvider_error_unsupported, typeid), null));
}
}
示例15: run
import org.eclipse.osgi.util.NLS; //导入方法依赖的package包/类
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
File currentNgFile = ngFile;
if (currentNgFile == null) {
return Status.CANCEL_STATUS;
}
String version = null;
String errorMessage = null;
try {
version = CLIProcessHelper.getNgVersion(currentNgFile, nodeFile);
} catch (IOException e) {
errorMessage = e.getMessage();
}
final CLIStatus status = StringUtils.isEmpty(version) ? new CLIStatus(null,
errorMessage != null ? errorMessage
: NLS.bind(AngularCLIMessages.AngularCLIConfigurationBlock_ngCustomFile_invalid_error,
FileUtils.getPath(currentNgFile)))
: new CLIStatus(currentNgFile, null);
status.setVersion(version);
if (monitor.isCanceled() || !currentNgFile.equals(ngFile)) {
return Status.CANCEL_STATUS;
}
return status;
}