本文整理匯總了Java中org.eclipse.core.runtime.IStatus類的典型用法代碼示例。如果您正苦於以下問題:Java IStatus類的具體用法?Java IStatus怎麽用?Java IStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IStatus類屬於org.eclipse.core.runtime包,在下文中一共展示了IStatus類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: moveResource
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
/**
* Associate one resource's properties with another resource.
*
* @param fromPrefs the preferences to take the properties from
* @param fromResource the resource to take the properties from
* @param toPrefs the preferences to move the properties to
* @param toResource the resource to associated with the properties
* @throws BackingStoreException
*/
public static void moveResource(Preferences fromPrefs, IResource fromResource,
Preferences toPrefs, IResource toResource)
throws CoreException {
try {
String[] keys = fromPrefs.keys();
for (String key: keys) {
if (key.endsWith("//" + fromResource.getProjectRelativePath().toPortableString())) {
String resourcePreference = key.substring(0, key.indexOf('/'));
toPrefs.put(preferenceKey(toResource, resourcePreference), fromPrefs.get(key, ""));
fromPrefs.remove(key);
}
}
fromPrefs.flush();
toPrefs.flush();
} catch (BackingStoreException e) {
throw new CoreException(new Status(
IStatus.ERROR, MinifyBuilder.BUILDER_ID, e.getMessage(), e));
}
}
示例2: enableOnce
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
/**
* Called to eagerly configure the logging-mechanism.
*/
public static void enableOnce() {
if (logged)
return;
// workaround for shutdown-stack-traces due to non-initialized loggers.
// @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=460863
ResourcesPlugin.getPlugin().getLog()
.log(new Status(IStatus.OK, ResourcesPlugin.PI_RESOURCES,
"Place holder to init log-system. Loaded by " + EclipseGracefulUIShutdownEnabler.class.getName()
+ " @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=460863 "));
// without actual logging the following line is enough (but restricted):
// StatusHandlerRegistry.getDefault().getDefaultHandlerDescriptor();
logged = true;
}
示例3: tearDownExternalLibraries
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
/** Tears down the external libraries. */
protected void tearDownExternalLibraries(boolean tearDownShippedCode) throws Exception {
((TypeDefinitionGitLocationProviderImpl) gitLocationProvider).setGitLocation(PUBLIC_DEFINITION_LOCATION);
final URI nodeModulesLocation = locationProvider.getTargetPlatformNodeModulesLocation();
externalLibraryPreferenceStore.remove(nodeModulesLocation);
final IStatus result = externalLibraryPreferenceStore.save(new NullProgressMonitor());
assertTrue("Error while saving external library preference changes.", result.isOK());
if (tearDownShippedCode) {
shippedCodeInitializeTestHelper.teardowneBuiltIns();
}
// cleanup leftovers in the file system
File nodeModuleLocationFile = new File(nodeModulesLocation);
assertTrue("Provided npm location does not exist.", nodeModuleLocationFile.exists());
assertTrue("Provided npm location is not a folder.", nodeModuleLocationFile.isDirectory());
FileDeleter.delete(nodeModuleLocationFile);
assertFalse("Provided npm location should be deleted.", nodeModuleLocationFile.exists());
waitForAutoBuild();
super.tearDown();
}
示例4: validateBinaries
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
private void validateBinaries() throws ExitCodeException {
IStatus status = nodeJsBinaryProvider.get().validate();
if (!status.isOK()) {
System.out.println(status.getMessage());
if (null != status.getException()) {
dumpThrowable(status.getException());
}
throw new ExitCodeException(EXITCODE_CONFIGURATION_ERROR, status.getMessage(), status.getException());
}
if (null != targetPlatformFile) {
status = npmBinaryProvider.get().validate();
if (!status.isOK()) {
System.out.println(status.getMessage());
if (null != status.getException()) {
dumpThrowable(status.getException());
}
throw new ExitCodeException(EXITCODE_CONFIGURATION_ERROR, status.getMessage(), status.getException());
}
}
}
示例5: applyToStatusLine
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
/** copied from PropertyAndPreferencePage */
private static void applyToStatusLine(DialogPage page, IStatus status) {
String message = status.getMessage();
if (message != null && message.length() == 0) {
message = null;
}
switch (status.getSeverity()) {
case IStatus.OK:
page.setMessage(message, IMessageProvider.NONE);
page.setErrorMessage(null);
break;
case IStatus.WARNING:
page.setMessage(message, IMessageProvider.WARNING);
page.setErrorMessage(null);
break;
case IStatus.INFO:
page.setMessage(message, IMessageProvider.INFORMATION);
page.setErrorMessage(null);
break;
default:
page.setMessage(null);
page.setErrorMessage(message);
break;
}
}
示例6: performOk
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
@Override
public boolean performOk() {
final MultiStatus multistatus = statusHelper
.createMultiStatus("Status of importing target platform.");
try {
new ProgressMonitorDialog(getShell()).run(true, false, monitor -> {
final IStatus status = store.save(monitor);
if (!status.isOK()) {
setMessage(status.getMessage(), ERROR);
multistatus.merge(status);
} else {
updateInput(viewer, store.getLocations());
}
});
} catch (final InvocationTargetException | InterruptedException exc) {
multistatus.merge(statusHelper.createError("Error while building external libraries.", exc));
}
if (multistatus.isOK())
return super.performOk();
else
return false;
}
示例7: validate
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
@Override
public IStatus validate ( final Object value )
{
if ( ! ( value instanceof Number ) )
{
return new Status ( IStatus.ERROR, Activator.PLUGIN_ID, "Value must be a number" );
}
final int port = ( (Number)value ).intValue ();
if ( port < MIN || port > MAX )
{
return new Status ( IStatus.ERROR, Activator.PLUGIN_ID, String.format ( "Port number must be between %s and %s (inclusive)", MIN, MAX ) );
}
if ( port < 1024 && isUnix () )
{
return new Status ( IStatus.WARNING, Activator.PLUGIN_ID, String.format ( "Port numbers below 1024 are reserved for privileged users (root) and may not be available for use." ) );
}
return Status.OK_STATUS;
}
示例8: start
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
@Override
public Object start(IApplicationContext context) {
try {
return Main.main(Platform.getApplicationArgs()) ? EXIT_OK : EXIT_ERROR;
} catch (Exception e) {
e.printStackTrace(System.err);
Status error = new Status(IStatus.ERROR, ApgdiffConsts.APGDIFF_PLUGIN_ID,
"pgCodeKeeper error", e);
Platform.getLog(Activator.getContext().getBundle()).log(error);
return EXIT_ERROR;
} finally {
// only needed when org.apache.felix.gogo.shell bundle is present
/*try {
// see bug #514338
Thread.sleep(110);
} catch (InterruptedException ex) {
// no action
}*/
}
}
示例9: generateOffline
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
public static void generateOffline(final IResource resource, IPackageFragment pkg, String classfile , BuildPolicy[] generators, int timeout, IWorkbenchWindow aww) {
Job job = new Job("GW4E Offline Generation Source Job") {
@Override
public IStatus run(IProgressMonitor monitor) {
try {
if (resource instanceof IFile) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
IFile file = (IFile) resource;
if (PreferenceManager.isGraphModelFile(file)) {
AbstractPostConversion converter = getOfflineConversion(file,pkg,classfile,generators,timeout);
ConversionRunnable runnable = converter.createConversionRunnable(aww);
subMonitor.subTask("Processing converter ");
SubMonitor child = subMonitor.split(1);
runnable.run(child);
}
}
} catch (Exception e) {
e.printStackTrace();
ResourceManager.logException(e);
}
return Status.OK_STATUS;
}
};
job.setUser(true);
job.schedule();
}
示例10: setVisible
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
@Override
public void setVisible ( final boolean visible )
{
super.setVisible ( visible );
if ( visible )
{
try
{
getContainer ().run ( false, false, new IRunnableWithProgress () {
@Override
public void run ( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
{
setMergeResult ( PreviewPage.this.mergeController.merge ( wrap ( monitor ) ) );
}
} );
}
catch ( final Exception e )
{
final Status status = new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.PreviewPage_StatusErrorFailedToMerge, e );
StatusManager.getManager ().handle ( status );
ErrorDialog.openError ( getShell (), Messages.PreviewPage_TitleErrorFailedToMerge, Messages.PreviewPage_MessageErrorFailedToMerge, status );
}
}
}
示例11: showError
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
private void showError ( final IStatus status )
{
if ( !status.matches ( IStatus.ERROR ) )
{
return;
}
final Display display = PlatformUI.getWorkbench ().getDisplay ();
if ( !display.isDisposed () )
{
display.asyncExec ( new Runnable () {
@Override
public void run ()
{
if ( !display.isDisposed () )
{
ErrorDialog.openError ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getShell (), "Connection error", "Connection failed", status, IStatus.ERROR );
}
}
} );
}
}
示例12: saveState
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
@Override
public IStatus saveState(final IProgressMonitor monitor) {
final Preferences node = getPreferences();
// Save ordered labels.
node.put(ORDERED_IDS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetIds));
// Save visible labels.
node.put(VISIBLE_IDS_KEY, Joiner.on(SEPARATOR).join(visibleWorkingSetIds));
try {
node.flush();
} catch (final BackingStoreException e) {
final String message = "Error occurred while saving state to preference store.";
LOGGER.error(message, e);
return statusHelper.createError(message, e);
}
return statusHelper.OK();
}
示例13: fillFactories
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
private void fillFactories ( final Collection<LoginFactory> factories, final IConfigurationElement ele )
{
for ( final IConfigurationElement child : ele.getChildren ( "factory" ) ) //$NON-NLS-1$
{
try
{
final LoginFactory factory = (LoginFactory)child.createExecutableExtension ( "class" );//$NON-NLS-1$
if ( factory != null )
{
factories.add ( factory );
}
}
catch ( final Exception e )
{
getLog ().log ( new Status ( IStatus.WARNING, PLUGIN_ID, Messages.Activator_ErrorParse, e ) );
}
}
}
示例14: restoreState
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
private IStatus restoreState() {
final Preferences node = getPreferences();
// Top level element.
workingSetTopLevel.set(node.getBoolean(IS_WORKINGSET_TOP_LEVEL_KEY, false));
// Active working set manager.
final String value = node.get(ACTIVE_MANAGER_KEY, "");
WorkingSetManager workingSetManager = contributions.get().get(value);
if (workingSetManager == null) {
if (!contributions.get().isEmpty()) {
workingSetManager = contributions.get().values().iterator().next();
}
}
if (workingSetManager != null) {
setActiveManager(workingSetManager);
}
return Status.OK_STATUS;
}
示例15: configure
import org.eclipse.core.runtime.IStatus; //導入依賴的package包/類
@Override
public void configure() throws CoreException
{
IProjectDescription description = project.getDescription();
JPFManifestBuilder.addBuilderToProject(description);
project.setDescription(description, null);
JPFClasspathContainer.addToProject(JavaCore.create(project));
new Job("Check JPF Manifest")
{
@Override
protected IStatus run(IProgressMonitor monitor)
{
try
{
project.build(IncrementalProjectBuilder.FULL_BUILD, JPFManifestBuilder.BUILDER_ID, null, monitor);
}
catch( CoreException e )
{
JPFClasspathLog.logError(e);
}
return Status.OK_STATUS;
}
}.schedule();
}