當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。