use of org.eclipse.osgi.util.NLS in project linuxtools by eclipse.
the class AbstractTest method buildProject.
protected void buildProject(IProject proj) throws CoreException {
IWorkspace wsp = ResourcesPlugin.getWorkspace();
final IProject curProject = proj;
ISchedulingRule rule = wsp.getRuleFactory().buildRule();
Job buildJob = new // $NON-NLS-1$
Job(// $NON-NLS-1$
"project build job") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
curProject.build(IncrementalProjectBuilder.FULL_BUILD, null);
} catch (CoreException e) {
fail(e.getStatus().getMessage());
} catch (OperationCanceledException e) {
fail(NLS.bind(Messages.getString("AbstractTest.Build_cancelled"), curProject.getName(), // $NON-NLS-1$
e.getMessage()));
}
return Status.OK_STATUS;
}
};
buildJob.setRule(rule);
buildJob.schedule();
try {
buildJob.join();
} catch (InterruptedException e) {
fail(NLS.bind(Messages.getString("AbstractTest.Build_interrupted"), curProject.getName(), // $NON-NLS-1$
e.getMessage()));
}
IStatus status = buildJob.getResult();
if (status.getCode() != IStatus.OK) {
fail(NLS.bind(Messages.getString("AbstractTest.Build_failed"), curProject.getName(), // $NON-NLS-1$
status.getMessage()));
}
IWorkspaceRunnable runnable = monitor -> curProject.refreshLocal(IResource.DEPTH_INFINITE, null);
wsp.run(runnable, wsp.getRoot(), IWorkspace.AVOID_UPDATE, null);
}
use of org.eclipse.osgi.util.NLS in project linuxtools by eclipse.
the class ValgrindOptionsTab method createErrorOptions.
private void createErrorOptions(Composite top) {
Group errorGroup = new Group(top, SWT.NONE);
errorGroup.setLayout(new GridLayout());
errorGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-1$
errorGroup.setText(Messages.getString("ValgrindOptionsTab.Error_Options"));
Composite errorTop = new Composite(errorGroup, SWT.NONE);
errorTop.setLayout(new GridLayout(2, true));
errorTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
demangleButton = new Button(errorTop, SWT.CHECK);
// $NON-NLS-1$
demangleButton.setText(Messages.getString("ValgrindOptionsTab.demangle"));
demangleButton.addSelectionListener(selectListener);
demangleButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite numCallersTop = new Composite(errorTop, SWT.NONE);
numCallersTop.setLayout(new GridLayout(2, false));
Label numCallersLabel = new Label(numCallersTop, SWT.NONE);
// $NON-NLS-1$
numCallersLabel.setText(Messages.getString("ValgrindOptionsTab.num_callers"));
numCallersSpinner = new Spinner(numCallersTop, SWT.BORDER);
numCallersSpinner.setMaximum(50);
numCallersSpinner.addModifyListener(modifyListener);
numCallersSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
errorLimitButton = new Button(errorTop, SWT.CHECK);
// $NON-NLS-1$
errorLimitButton.setText(Messages.getString("ValgrindOptionsTab.limit_errors"));
errorLimitButton.addSelectionListener(selectListener);
errorLimitButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
showBelowMainButton = new Button(errorTop, SWT.CHECK);
// $NON-NLS-1$
showBelowMainButton.setText(Messages.getString("ValgrindOptionsTab.show_errors_below_main"));
showBelowMainButton.addSelectionListener(selectListener);
showBelowMainButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite maxStackFrameTop = new Composite(errorTop, SWT.NONE);
maxStackFrameTop.setLayout(new GridLayout(2, false));
Label maxStackFrameLabel = new Label(maxStackFrameTop, SWT.NONE);
// $NON-NLS-1$
maxStackFrameLabel.setText(Messages.getString("ValgrindOptionsTab.max_size_of_stack_frame"));
maxStackFrameSpinner = new Spinner(maxStackFrameTop, SWT.BORDER);
maxStackFrameSpinner.setMaximum(Integer.MAX_VALUE);
maxStackFrameSpinner.addModifyListener(modifyListener);
maxStackFrameSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Option only visible for valgrind > 3.4.0
mainStackSizeTop = new Composite(errorTop, SWT.NONE);
GridLayout mainStackSizeLayout = new GridLayout(2, false);
mainStackSizeLayout.marginHeight = mainStackSizeLayout.marginWidth = 0;
mainStackSizeTop.setLayout(mainStackSizeLayout);
mainStackSizeButton = new Button(mainStackSizeTop, SWT.CHECK);
// $NON-NLS-1$
mainStackSizeButton.setText(Messages.getString("ValgrindOptionsTab.Main_stack_size"));
mainStackSizeButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
checkMainStackEnablement();
updateLaunchConfigurationDialog();
}));
mainStackSizeSpinner = new Spinner(mainStackSizeTop, SWT.BORDER);
mainStackSizeSpinner.setMaximum(Integer.MAX_VALUE);
mainStackSizeSpinner.addModifyListener(modifyListener);
mainStackSizeSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mainStackSizeTop.setVisible(false);
// Option only visible for valgrind > 3.6.0
dSymUtilButton = new Button(errorTop, SWT.CHECK);
// $NON-NLS-1$
dSymUtilButton.setText(Messages.getString("ValgrindOptionsTab.dsymutil"));
dSymUtilButton.addSelectionListener(selectListener);
dSymUtilButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
dSymUtilButton.setVisible(false);
}
use of org.eclipse.osgi.util.NLS in project linuxtools by eclipse.
the class AbstractRegistry method retrieveTagsFromRegistryV1.
/**
* Retrieves the list of tags for a given repository, assuming that the
* target registry is a registry v2 instance.
*
* @param client
* the client to use
* @param repository
* the repository to look-up
* @return the list of tags for the given repository
* @throws CancellationException
* - if the computation was cancelled
* @throws ExecutionException
* - if the computation threw an exception
* @throws InterruptedException
* - if the current thread was interrupted while waiting
*/
private List<IRepositoryTag> retrieveTagsFromRegistryV1(final Client client, final String repository) throws InterruptedException, ExecutionException {
final GenericType<Map<String, String>> REPOSITORY_TAGS_RESULT_LIST = new GenericType<Map<String, String>>() {
};
final WebTarget queryTagsResource = client.target(getHTTPServerAddress()).path(// $NON-NLS-1$
"v1").path("repositories").path(repository).path(// $NON-NLS-1$ //$NON-NLS-2$
"tags");
return queryTagsResource.request(APPLICATION_JSON_TYPE).async().method(GET, REPOSITORY_TAGS_RESULT_LIST).get().entrySet().stream().map(e -> new RepositoryTag(e.getKey(), e.getValue())).collect(Collectors.toList());
}
use of org.eclipse.osgi.util.NLS in project linuxtools by eclipse.
the class AbstractRegistry method getImages.
@Override
public List<IDockerImageSearchResult> getImages(String term) throws DockerException {
final Client client = ClientBuilder.newClient(DEFAULT_CONFIG);
List<IDockerImageSearchResult> result = new ArrayList<>();
WebTarget queryImagesResource;
if (isVersion2()) {
final GenericType<ImageSearchResultV2> IMAGE_SEARCH_RESULT_LIST = new GenericType<ImageSearchResultV2>() {
};
ImageSearchResultV2 cisr = null;
queryImagesResource = client.target(getHTTPServerAddress()).path("v2").path(// $NON-NLS-1$ //$NON-NLS-2$
"_catalog");
try {
cisr = queryImagesResource.request(APPLICATION_JSON_TYPE).async().method(GET, IMAGE_SEARCH_RESULT_LIST).get();
} catch (InterruptedException | ExecutionException e) {
throw new DockerException(e);
}
List<ImageSearchResult> tmp = cisr.getRepositories().stream().filter(e -> e.name().contains(term)).collect(Collectors.toList());
result.addAll(tmp.stream().map(r -> new DockerImageSearchResult(r.description(), r.official(), r.automated(), r.name(), r.starCount())).collect(Collectors.toList()));
} else {
ImageSearchResultV1 pisr = null;
final GenericType<ImageSearchResultV1> IMAGE_SEARCH_RESULT_LIST = new GenericType<ImageSearchResultV1>() {
};
int page = 0;
try {
while (pisr == null || pisr.getPage() < pisr.getTotalPages()) {
page++;
queryImagesResource = client.target(getHTTPServerAddress()).path("v1").path(// $NON-NLS-1$ //$NON-NLS-2$
"search").queryParam("q", // $NON-NLS-1$
term).queryParam("page", // $NON-NLS-1$
page);
pisr = queryImagesResource.request(APPLICATION_JSON_TYPE).async().method(GET, IMAGE_SEARCH_RESULT_LIST).get();
List<ImageSearchResult> tmp = pisr.getResult();
result.addAll(tmp.stream().map(r -> new DockerImageSearchResult(r.description(), r.official(), r.automated(), r.name(), r.starCount())).collect(Collectors.toList()));
}
} catch (InterruptedException | ExecutionException e) {
throw new DockerException(e);
}
}
return result;
}
use of org.eclipse.osgi.util.NLS in project rt.equinox.framework by eclipse.
the class BundleContextImpl method getService.
/**
* Get a service's service object.
* Retrieves the service object for a service.
* A bundle's use of a service is tracked by a
* use count. Each time a service's service object is returned by
* {@link #getService}, the context bundle's use count for the service
* is incremented by one. Each time the service is release by
* {@link #ungetService}, the context bundle's use count
* for the service is decremented by one.
* When a bundle's use count for a service
* drops to zero, the bundle should no longer use the service.
* See {@link #getBundle()} for a definition of context bundle.
*
* <p>This method will always return <code>null</code> when the
* service associated with this reference has been unregistered.
*
* <p>The following steps are followed to get the service object:
* <ol>
* <li>If the service has been unregistered,
* <code>null</code> is returned.
* <li>The context bundle's use count for this service is incremented by one.
* <li>If the context bundle's use count for the service is now one and
* the service was registered with a {@link ServiceFactory},
* the {@link ServiceFactory#getService ServiceFactory.getService} method
* is called to create a service object for the context bundle.
* This service object is cached by the framework.
* While the context bundle's use count for the service is greater than zero,
* subsequent calls to get the services's service object for the context bundle
* will return the cached service object.
* <br>If the service object returned by the {@link ServiceFactory}
* is not an <code>instanceof</code>
* all the classes named when the service was registered or
* the {@link ServiceFactory} throws an exception,
* <code>null</code> is returned and a
* {@link FrameworkEvent} of type {@link FrameworkEvent#ERROR} is broadcast.
* <li>The service object for the service is returned.
* </ol>
*
* @param reference A reference to the service whose service object is desired.
* @return A service object for the service associated with this
* reference, or <code>null</code> if the service is not registered.
* @exception java.lang.SecurityException If the caller does not have
* {@link ServicePermission} permission to "get" the service
* using at least one of the named classes the service was registered under
* and the Java runtime environment supports permissions.
* @exception java.lang.IllegalStateException
* If the bundle context has stopped.
* @see #ungetService
* @see ServiceFactory
*/
public <S> S getService(ServiceReference<S> reference) {
checkValid();
if (reference == null)
// $NON-NLS-1$
throw new NullPointerException("A null service reference is not allowed.");
provisionServicesInUseMap();
S service = container.getServiceRegistry().getService(this, (ServiceReferenceImpl<S>) reference);
return service;
}
Aggregations