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


Java Status类代码示例

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


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

示例1: resfreshFileInContainer

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * @param folder
 * @param filetorefresh
 * @return
 * @throws CoreException
 * @throws InterruptedException
 */
public static IResource resfreshFileInContainer(IContainer folder, String filetorefresh)
		throws CoreException, InterruptedException {
	final IResource buildfile = find(folder, filetorefresh);
	Job job = new WorkspaceJob("Refresh folders") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			if (buildfile != null && buildfile.exists()) {
				try {
					buildfile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
				} catch (CoreException e) {
					ResourceManager.logException(e);
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.schedule();

	return buildfile;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:28,代码来源:ResourceManager.java

示例2: enableOnce

import org.eclipse.core.runtime.Status; //导入依赖的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: openQueueMonitor

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
private void openQueueMonitor() throws UnsupportedEncodingException {

		final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		String bundle = store.getString(BUNDLE);
		String bean   = store.getString(BEAN);
		String sqn    = store.getString(STATUS_QUEUE);
		String stn    = store.getString(STATUS_TOPIC);
		String submit = store.getString(SUBMIT_QUEUE);
		String part   = store.getString(PART_NAME);

		String queueViewId = QueueViews.createSecondaryId(bundle,bean, sqn, stn, submit);
		queueViewId = queueViewId+"partName="+part;
		try {
			Util.getPage().showView(StatusQueueView.ID, queueViewId, IWorkbenchPage.VIEW_VISIBLE);
		} catch (PartInitException e) {
			ErrorDialog.openError(Display.getDefault().getActiveShell(), "Cannot open view", "Cannot open view "+queueViewId,
					new Status(Status.ERROR, "org.eclipse.scanning.event.ui", e.getMessage()));
			logger.error("Cannot open view", e);
		}
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:21,代码来源:StatusQueueLaunchView.java

示例4: showErrorDialogWithStackTrace

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * Shows JFace ErrorDialog but improved by constructing full stack trace in detail area.
 *
 * @return true if OK was pressed
 */
public static boolean showErrorDialogWithStackTrace(String msg, Throwable throwable) {

	// Temporary holder of child statuses
	List<Status> childStatuses = new ArrayList<>();

	for (StackTraceElement stackTraceElement : throwable.getStackTrace()) {
		childStatuses.add(new Status(IStatus.ERROR, "N4js-plugin-id", stackTraceElement.toString()));
	}

	MultiStatus ms = new MultiStatus("N4js-plugin-id", IStatus.ERROR,
			childStatuses.toArray(new Status[] {}), // convert to array of statuses
			throwable.getLocalizedMessage(), throwable);

	final AtomicBoolean result = new AtomicBoolean(true);
	Display.getDefault()
			.syncExec(
					() -> result.set(
							ErrorDialog.openError(null, "Error occurred while organizing ", msg, ms) == Window.OK));

	return result.get();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:ErrorDialogWithStackTraceUtil.java

示例5: handleChangedContents

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
private void handleChangedContents(Delta delta, IProject aProject, ResourceSet resourceSet) throws CoreException {
	// TODO: we will run out of memory here if the number of deltas is large enough
	Resource resource = resourceSet.getResource(delta.getUri(), true);
	if (shouldGenerate(resource, aProject)) {
		try {
			compositeGenerator.doGenerate(resource, access);
		} catch (RuntimeException e) {
			if (e instanceof GeneratorException) {
				N4JSActivator
						.getInstance()
						.getLog()
						.log(new Status(IStatus.ERROR, N4JSActivator.getInstance().getBundle().getSymbolicName(), e
								.getMessage(), e.getCause()));
			}
			if (e.getCause() instanceof CoreException) {
				throw (CoreException) e.getCause();
			}
			throw e;
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:BuildInstruction.java

示例6: run

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
@Override
protected IStatus run(IProgressMonitor monitor) {
	try {
		if (editor!=null) editor.setSafeEnabled(false);
	    scannable.setPosition(value); // Blocking call
	    if (editor!=null && value instanceof Number) {
		editor.setSafeValue(((Number)value).doubleValue());
	    }
	    return Status.OK_STATUS;

	} catch (Exception e) {
		editor.setSafeText(e.getMessage());
		logger.error("Cannot set position!", e);
	    return Status.CANCEL_STATUS;

	} finally {
		editor.setSafeEnabled(true);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:20,代码来源:ControlValueJob.java

示例7: toRunConfiguration

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * Converts an {@link ILaunchConfiguration} to a {@link RunConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see RunConfiguration#writePersistentValues(Map)
 */
public RunConfiguration toRunConfiguration(ILaunchConfiguration launchConfig) throws CoreException {
	try {
		final Map<String, Object> properties = launchConfig.getAttributes();
		// special treatment of name required:
		// name is already included in 'properties', but we have to make sure that the name is up-to-date
		// in case the name of the launch configuration has been changed after the launch configuration
		// was created via method #toLaunchConfiguration()
		properties.put(RunConfiguration.NAME, launchConfig.getName());
		return runnerFrontEnd.createConfiguration(properties);
	} catch (Exception e) {
		String msg = "Error occurred while trying to launch module.";
		if (null != e.getMessage()) {
			msg += "\nReason: " + e.getMessage();
		}
		throw new CoreException(new Status(ERROR, PLUGIN_ID, msg, e));
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:RunConfigurationConverter.java

示例8: save

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * Stash using appropriate messages to the user.
 * @param models
 * @param shell
 */
@Override
public void save(Object object) {
	try {

		if (file.exists()) {
			boolean ok = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Confirm Overwrite", "Are you sure that you would like to overwrite '"+file.getName()+"'?");
			if (!ok) return;
		}

		stash(object);

	} catch (Exception e) {
		ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Error Saving Information", "An exception occurred while writing the "+getStashName()+" to file.",
				              new Status(IStatus.ERROR, "org.eclipse.scanning.device.ui", e.getMessage()));
	    logger.error("Error Saving Information", e);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:Stashing.java

示例9: log

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * This method dispatches the messages between the console and error log view
 * DevError and DevWarning go in both
 * UserError and UserWarning go only in the colsole
 */
@Override
public void log(Kind msgKind, String message, String messageGroup) {
	
	// some error message should go to the eclipse error view
	switch (msgKind) {
	case DevWARNING:
		if(messageGroup ==  null || !messageGroup.isEmpty())
			Activator.getDefault().getLog().log(new Status(IStatus.WARNING, messageGroup, IStatus.WARNING, message != null ? message : "<null>",null));
		break;
	case DevERROR:
		if(messageGroup ==  null || !messageGroup.isEmpty())
			Activator.getDefault().getLog().log(new Status(IStatus.ERROR, messageGroup, IStatus.ERROR, message != null ? message : "<null>",null));
		break;
	default:
		break;
	}
	
	if(ConsoleLogLevel.isLevelEnoughToLog(ConsoleLogLevel.kind2Level(msgKind), getConsoleLogLevel())){
		getConsoleIO().print(getConsoleMessageFor(msgKind,message));
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:27,代码来源:EclipseMessagingSystem.java

示例10: validate

import org.eclipse.core.runtime.Status; //导入依赖的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

示例11: removeResource

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * Remove a resource (i.e. all its properties) from the builder's preferences.
 * 
 * @param prefs the preferences
 * @param resource the resource
 * @throws BackingStoreException
 */
public static void removeResource(Preferences prefs, IResource resource) 
		throws CoreException {
	try {
		String[] keys = prefs.keys();
		for (String key: keys) {
			if (key.endsWith("//" + resource.getProjectRelativePath().toPortableString())) {
				prefs.remove(key);
			}
		}
		prefs.flush();
	} catch (BackingStoreException e) {
		throw new CoreException(new Status(
				IStatus.ERROR, MinifyBuilder.BUILDER_ID, e.getMessage(), e));
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:23,代码来源:PrefsAccess.java

示例12: execute

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.sirius.tools.api.ui.IExternalJavaAction#execute(java.util.Collection, java.util.Map)
 */
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
	final ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurationType(getLaunchConfigurationTypeID());
	Set<String> modes = new HashSet<String>();
	modes.add("debug");
	try {
		ILaunchDelegate[] delegates = launchConfigType.getDelegates(modes);
		if (delegates.length != 0
				&& delegates[0].getDelegate() instanceof AbstractDSLLaunchConfigurationDelegateUI) {
			AbstractDSLLaunchConfigurationDelegateUI delegate = (AbstractDSLLaunchConfigurationDelegateUI)delegates[0]
					.getDelegate();
			delegate.launch(delegate.getLaunchableResource(PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getActivePage().getActiveEditor()),
					getFirstInstruction(selections), "debug");
		}
	} catch (CoreException e) {
		DebugSiriusIdeUiPlugin.getPlugin().getLog().log(
				new Status(IStatus.ERROR, DebugSiriusIdeUiPlugin.ID, e.getLocalizedMessage(), e));
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:26,代码来源:AbstractDebugAsAction.java

示例13: apply

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
public void apply() throws CoreException {
	Job job = new WorkspaceJob("GW4E Conversion Job") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				_apply(monitor);
			} catch (Exception e) {
				DialogManager.displayErrorMessage(MessageUtil.getString("project_conversion"), MessageUtil.getString("an_error_has_occured_while_configuring_the_project"), e);
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(testInterface.getJavaProject().getProject());
	job.setUser(true);
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:18,代码来源:TestConvertor.java

示例14: computeCamelLanguageServerJarPath

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
private static String computeCamelLanguageServerJarPath() {
	String camelLanguageServerJarPath = "";
	Bundle bundle = Platform.getBundle(ActivatorCamelLspClient.ID);
	URL fileURL = bundle.findEntries("/libs", "camel-lsp-server-*.jar", false).nextElement();
	try {
	    File file = new File(FileLocator.resolve(fileURL).toURI());
	    if(Platform.OS_WIN32.equals(Platform.getOS())) {
	    	camelLanguageServerJarPath = "\"" + file.getAbsolutePath() + "\"";
	    } else {
	    	camelLanguageServerJarPath = file.getAbsolutePath();
	    }
	} catch (URISyntaxException | IOException exception) {
	    ActivatorCamelLspClient.getInstance().getLog().log(new Status(IStatus.ERROR, ActivatorCamelLspClient.ID, "Cannot get the Camel LSP Server jar.", exception)); //$NON-NLS-1$
	}
	return camelLanguageServerJarPath;
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:17,代码来源:CamelLSPStreamConnectionProvider.java

示例15: refreshRepresentations

import org.eclipse.core.runtime.Status; //导入依赖的package包/类
/**Refreshes given {@link DRepresentation} in the given {@link TransactionalEditingDomain}.
 * @param transactionalEditingDomain the {@link TransactionalEditingDomain}
 * @param representations the {@link List} of {@link DRepresentation} to refresh
 */
public void refreshRepresentations(
		final TransactionalEditingDomain transactionalEditingDomain,
		final List<DRepresentation> representations) {
	// TODO prevent the editors from getting dirty
	if (representations.size() != 0) {
		final RefreshRepresentationsCommand refresh = new RefreshRepresentationsCommand(
				transactionalEditingDomain,
				new NullProgressMonitor(),
				representations);
		try {
			CommandExecution.execute(transactionalEditingDomain, refresh);
		} catch (Exception e){
			String repString = representations.stream().map(r -> r.getName()).collect(Collectors.joining(", "));
			Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Failed to refresh Sirius representation(s)["+repString+"], we hope to be able to do it later", e));
		}
		
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:AbstractGemocAnimatorServices.java


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