本文整理匯總了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;
}
示例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 );
}
}
示例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 );
}
}
示例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;
}
示例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."));
}
}
}
}
示例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."));
}
}
}
}
示例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);
}
示例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 );
}
}
}
示例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;
}
示例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();
}
}
示例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);
}
});
}
}
示例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);
}
示例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);
}
示例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;
}
示例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());
}
}