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


Java IStatus类代码示例

本文整理汇总了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));
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:29,代码来源:PrefsAccess.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:EclipseGracefulUIShutdownEnabler.java

示例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();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:AbstractBuilderParticipantTest.java

示例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());
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:N4jscBase.java

示例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;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:AbstractN4JSPreferencePage.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:ExternalLibraryPreferencePage.java

示例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;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:PortValidator.java

示例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
        }*/
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:21,代码来源:ApplicationStandalone.java

示例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();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:27,代码来源:GraphWalkerContextManager.java

示例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 );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:PreviewPage.java

示例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 );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ConnectionManager.java

示例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();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:WorkingSetManagerImpl.java

示例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 ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:Activator.java

示例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;
	}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:WorkingSetManagerBrokerImpl.java

示例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();
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:JPFProjectNature.java


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