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


Java MultiStatus.isOK方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.MultiStatus.isOK方法的典型用法代码示例。如果您正苦于以下问题:Java MultiStatus.isOK方法的具体用法?Java MultiStatus.isOK怎么用?Java MultiStatus.isOK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.MultiStatus的用法示例。


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

示例1: performOk

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

示例2: run

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public void run ( final IAction action )
{
    final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, this.message, null );
    for ( final Item item : this.items )
    {
        try
        {
            processItem ( item );
        }
        catch ( final PartInitException e )
        {
            status.add ( e.getStatus () );
        }
    }
    if ( !status.isOK () )
    {
        showError ( status );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:AbstractItemAction.java

示例3: handleRemove

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
protected void handleRemove ()
{
    final MultiStatus ms = new MultiStatus ( Activator.PLUGIN_ID, 0, "Removing key providers", null );

    for ( final KeyProvider provider : this.selectedProviders )
    {
        try
        {
            this.factory.remove ( provider );
        }
        catch ( final Exception e )
        {
            ms.add ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
        }
    }
    if ( !ms.isOK () )
    {
        ErrorDialog.openError ( getShell (), "Error", null, ms );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:PreferencePage.java

示例4: execute

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MultiStatus ms = new MultiStatus ( HivesPlugin.PLUGIN_ID, 0, getLabel (), null );

    for ( final ServerLifecycle server : SelectionHelper.iterable ( getSelection (), ServerLifecycle.class ) )
    {
        try
        {
            process ( server );
        }
        catch ( final CoreException e )
        {
            ms.add ( e.getStatus () );
        }
    }
    if ( !ms.isOK () )
    {
        StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
    }
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:AbstractServerHandler.java

示例5: widgetSelected

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent e) {
	final MultiStatus multistatus = statusHelper.createMultiStatus("Status of installing npm dependencies.");

	InstallNpmDependencyDialog dialog = new InstallNpmDependencyDialog(getShell(),
			packageNameValidator.get(), packageVersionValidator.get());
	dialog.open();
	final String packageName = dialog.getPackageName();
	if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
		try {
			final String packageVersion = dialog.getVersionConstraint();
			new ProgressMonitorDialog(getShell()).run(true, false, monitor -> {
				multistatus
						.merge(installAction.apply(Collections.singletonMap(packageName, packageVersion), monitor));
			});
		} catch (final InvocationTargetException | InterruptedException exc) {
			multistatus.merge(
					statusHelper.createError("Error while installing npm dependency: '" + packageName + "'.",
							exc));
		} finally {
			if (!multistatus.isOK()) {
				N4JSActivator.getInstance().getLog().log(multistatus);
				getDisplay().asyncExec(() -> openError(
						UIUtils.getShell(),
						"npm Install Failed",
						"Error while installing '" + packageName
								+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:32,代码来源:InstallNpmDependencyButtonListener.java

示例6: widgetSelected

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent e) {
	final MultiStatus multistatus = statusHelper.createMultiStatus("Status of uninstalling npm dependencies.");

	final InputDialog dialog = new InputDialog(UIUtils.getShell(), "npm Uninstall",
			"Specify an npm package name to uninstall:", initalValue.get(), validator.get());

	dialog.open();
	final String packageName = dialog.getValue();
	if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
		try {
			new ProgressMonitorDialog(UIUtils.getShell()).run(true, false, monitor -> {
				multistatus.merge(uninstallAction.apply(Arrays.asList(packageName), monitor));
			});
		} catch (final InvocationTargetException | InterruptedException exc) {
			multistatus.merge(
					statusHelper.createError("Error while uninstalling npm dependency: '" + packageName + "'.",
							exc));
		} finally {
			if (!multistatus.isOK()) {
				N4JSActivator.getInstance().getLog().log(multistatus);
				getDisplay().asyncExec(() -> openError(
						UIUtils.getShell(),
						"npm Uninstall Failed",
						"Error while uninstalling '" + packageName
								+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:UninstallNpmDependencyButtonListener.java

示例7: cleanBuildDependencies

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
private void cleanBuildDependencies(final IProgressMonitor monitor, final MultiStatus status,
		final Iterable<java.net.URI> toBeDeleted, final Collection<File> adaptedPackages,
		boolean triggerCleanbuild) {

	logger.logInfo("Registering new projects... [step 4 of 4]");
	monitor.setTaskName("Registering new projects... [step 4 of 4]");
	// nothing to do in the headless case. TODO inject logic instead?
	if (Platform.isRunning()) {
		logger.logInfo("Platform is running.");
		final Iterable<java.net.URI> toBeUpdated = from(adaptedPackages).transform(file -> file.toURI());
		final NpmProjectAdaptionResult adaptionResult = NpmProjectAdaptionResult.newOkResult(toBeUpdated,
				toBeDeleted);
		logger.logInfo("Call " + externalLibraryWorkspace + " to register " + toBeUpdated + " and de-register "
				+ toBeDeleted);

		externalLibraryWorkspace.registerProjects(adaptionResult, monitor, triggerCleanbuild);
	} else {
		logger.logInfo("Platform is not running.");
	}
	logger.logInfo("Finished registering projects.");

	if (status.isOK())
		logger.logInfo("Successfully finished installing  packages.");
	else
		logger.logInfo("There were errors during installation, see logs for details.");

	logger.logInfo(LINE_DOUBLE);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:NpmManager.java

示例8: throwMultiStatus

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
public void throwMultiStatus ( final MultiStatus ms ) throws CoreException
{
    if ( !ms.isOK () )
    {
        if ( ms.getChildren ().length == 1 )
        {
            throw new CoreException ( ms.getChildren ()[0] );
        }
        else
        {
            throw new CoreException ( ms );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:15,代码来源:ServerDescriptorImpl.java

示例9: execute

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MultiStatus ms = new MultiStatus ( Activator.PLUGIN_ID, 0, "Opening preview", null );

    for ( final IFile file : SelectionHelper.iterable ( getSelection (), IFile.class ) )
    {
        final IEditorInput input = new FileEditorInput ( file );
        try
        {
            getActivePage ().openEditor ( input, PreviewEditorImpl.EDITOR_ID, true, IWorkbenchPage.MATCH_ID );
        }
        catch ( final PartInitException e )
        {
            ms.add ( e.getStatus () );
        }
    }

    if ( !ms.isOK () )
    {
        final IStatus[] childs = ms.getChildren ();
        if ( childs.length < 2 )
        {
            StatusManager.getManager ().handle ( childs[0], StatusManager.SHOW );
        }
        else
        {
            StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
        }
    }

    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:34,代码来源:PreviewHandler.java

示例10: delete

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
public void delete(int options, IProgressMonitor monitor) throws CoreException {
  if (monitor == null) monitor = new NullProgressMonitor();
  //		else
  //			monitor = new InfiniteProgress(monitor);
  try {
    monitor.beginTask(NLS.bind(Messages.deleting, this), 200);
    String message = Messages.deleteProblem;
    MultiStatus result = new MultiStatus(Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null);
    internalDelete(file, filePath, result, monitor);
    if (!result.isOK()) throw new CoreException(result);
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:LocalFile.java

示例11: createTypeMembers

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
@Override
protected void createTypeMembers(IType newType, ImportsManager imports,
    IProgressMonitor monitor) throws CoreException {
  boolean addComments = isAddComments();
  final MultiStatus status = new MultiStatus(GWTPlugin.PLUGIN_ID, 0,
      "Click the Details button for more information", null);

  // Create an accessor method for each bundled resource
  for (ClientBundleResource resource : bundledResourcesBlock.getResources()) {
    try {
      resource.addToClientBundle(newType, imports, addComments, monitor);
    } catch (CoreException e) {
      status.add(e.getStatus());
    }
  }

  // We want to handle any errors here, since if we let it escape this method
  // it short-circuits NewTypeWizardPage.createType, which ends up creating
  // a new ClientBundle source file with no content.
  if (!status.isOK()) {
    Display.getDefault().syncExec(new Runnable() {
      public void run() {
        ErrorDialog.openError(
            getShell(),
            "Error Adding Resources",
            "One or more selected resources could not be added to the ClientBundle.",
            status);
      }
    });
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:32,代码来源:NewClientBundleWizardPage.java

示例12: handleDropMove

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
void handleDropMove() {
	final List<IResource> elements= getResources();
	if (elements == null || elements.size() == 0)
		return;

	WorkspaceModifyOperation op= new WorkspaceModifyOperation() {
		@Override
		public void execute(IProgressMonitor monitor) throws CoreException {
			try {
				monitor.beginTask(PackagesMessages.DragAdapter_deleting, elements.size());
				MultiStatus status= createMultiStatus();
				Iterator<IResource> iter= elements.iterator();
				while(iter.hasNext()) {
					IResource resource= iter.next();
					try {
						monitor.subTask(BasicElementLabels.getPathLabel(resource.getFullPath(), true));
						resource.delete(true, null);

					} catch (CoreException e) {
						status.add(e.getStatus());
					} finally {
						monitor.worked(1);
					}
				}
				if (!status.isOK()) {
					throw new CoreException(status);
				}
			} finally {
				monitor.done();
			}
		}
	};
	runOperation(op, true, false);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:FileTransferDragAdapter.java

示例13: handleRefresh

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
private void handleRefresh() {
	final Set<IResource> roots= collectRoots(getResources());

	WorkspaceModifyOperation op= new WorkspaceModifyOperation() {
		@Override
		public void execute(IProgressMonitor monitor) throws CoreException {
			try {
				monitor.beginTask(PackagesMessages.DragAdapter_refreshing, roots.size());
				MultiStatus status= createMultiStatus();
				Iterator<IResource> iter= roots.iterator();
				while (iter.hasNext()) {
					IResource r= iter.next();
					try {
						r.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(monitor, 1));
					} catch (CoreException e) {
						status.add(e.getStatus());
					}
				}
				if (!status.isOK()) {
					throw new CoreException(status);
				}
			} finally {
				monitor.done();
			}
		}
	};

	runOperation(op, true, false);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:FileTransferDragAdapter.java

示例14: isChangedRegionsRequired

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
/**
 * Tells whether one of the active post save listeners needs to be informed about the changed
 * region in this save cycle.
 * 
 * @param unit the unit which is about to be saved
 * @return true if the change regions need do be determined
 * @throws CoreException if something went wrong
 * @since 3.4
 */
public static boolean isChangedRegionsRequired(final ICompilationUnit unit) throws CoreException {
	String message= SaveParticipantMessages.SaveParticipantRegistry_needsChangedRegionFailed;
	final MultiStatus errorStatus= new MultiStatus(JavaUI.ID_PLUGIN, IJavaStatusConstants.EDITOR_CHANGED_REGION_CALCULATION, message, null);

	IPostSaveListener[] listeners= JavaPlugin.getDefault().getSaveParticipantRegistry().getEnabledPostSaveListeners(unit.getJavaProject().getProject());
	try {
		final boolean result[]= new boolean[] {false};
		for (int i= 0; i < listeners.length; i++) {
			final IPostSaveListener listener= listeners[i];
			SafeRunner.run(new ISafeRunnable() {

				public void run() throws Exception {
					if (listener.needsChangedRegions(unit))
						result[0]= true;
				}

				public void handleException(Throwable ex) {
					String msg= Messages.format("The save participant ''{0}'' caused an exception.", new String[] { listener.getId() }); //$NON-NLS-1$
					JavaPlugin.log(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IJavaStatusConstants.EDITOR_POST_SAVE_NOTIFICATION, msg, ex));

					final String participantName= listener.getName();
					msg= Messages.format(SaveParticipantMessages.SaveParticipantRegistry_needsChangedRegionCausedException, new String[] { participantName, ex.toString() });
					errorStatus.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IJavaStatusConstants.EDITOR_CHANGED_REGION_CALCULATION, msg, null));
				}

			});
			if (result[0])
				return true;
		}
	} finally {
		if (!errorStatus.isOK())
			throw new CoreException(errorStatus);
	}

	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:46,代码来源:SaveParticipantRegistry.java

示例15: runOnMultiple

import org.eclipse.core.runtime.MultiStatus; //导入方法依赖的package包/类
private void runOnMultiple(final ICompilationUnit[] cus) {
	ICleanUp[] cleanUps= getCleanUps(cus);
	if (cleanUps == null)
		return;

	MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.OK, ActionMessages.CleanUpAction_MultiStateErrorTitle, null);
	for (int i= 0; i < cus.length; i++) {
		ICompilationUnit cu= cus[i];

		if (!ActionUtil.isOnBuildPath(cu)) {
			String cuLocation= BasicElementLabels.getPathLabel(cu.getPath(), false);
			String message= Messages.format(ActionMessages.CleanUpAction_CUNotOnBuildpathMessage, cuLocation);
			status.add(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, IStatus.ERROR, message, null));
		}
	}
	if (!status.isOK()) {
		ErrorDialog.openError(getShell(), getActionName(), null, status);
		return;
	}

	try {
		performRefactoring(cus, cleanUps);
	} catch (InvocationTargetException e) {
		JavaPlugin.log(e);
		if (e.getCause() instanceof CoreException)
			showUnexpectedError((CoreException)e.getCause());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:CleanUpAction.java


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