Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2004, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.core.runtime.internal.adaptor;
 
Internal class.
 
 public class EclipseCommandProvider implements CommandProvider {
 
 	private static final String POLICY_CONSOLE = "org.eclipse.osgi.framework.console"//$NON-NLS-1$
 	private BundleContext context;
 
 	public EclipseCommandProvider(BundleContext context) {
 		this. = context;
 	}
 
 	public String getHelp() {
 		StringBuffer help = new StringBuffer(512);
 		help.append("---"); //$NON-NLS-1$
 		help.append("---"); //$NON-NLS-1$
 		help.append("\tenableBundle - " + .);//$NON-NLS-1$
 		help.append("\tdisableBundle - " + .);//$NON-NLS-1$
 		help.append("\tdisabledBundles - " + .);//$NON-NLS-1$
 		return help.toString();
 	}
 
 		try {
 			long id = Long.parseLong(token);
 			return state.getBundle(id);
 		} catch (NumberFormatException nfe) {
 			BundleDescription[] allBundles = state.getBundles(token);
 			if (allBundles.length > 0)
 				return allBundles[0];
 		}
 		return null;
 	}
 
 		if ( == null) {
 			if (platformAdminRef == null) {
 				ci.print("  "); //$NON-NLS-1$
 				return null;
 			}
 			 = (PlatformAdmin.getService(platformAdminRef);
 		}
 		return ;
 	}
 
 	private void ungetPlatformAdmin() {
 		.ungetService(platformAdminRef);
 	}
 
 	public void _diag(CommandInterpreter cithrows Exception {
 		String nextArg = ci.nextArgument();
 		if (nextArg == null) {
 			return;
 		}
 		try {
 			State systemState = getPlatformAdmin(ci).getState(false);
 			while (nextArg != null) {
 				BundleDescription bundle = getBundleDescriptionFromToken(systemStatenextArg);
 				if (bundle == null) {
 					nextArg = ci.nextArgument();
 					continue;
 				}
 				ci.println(bundle.getLocation() + " [" + bundle.getBundleId() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
 				ResolverError[] resolverErrors = .getState(false).getResolverErrors(bundle);
 				for (int i = 0; i < resolverErrors.lengthi++) {
						continue;
					ci.print("  "); //$NON-NLS-1$
					ci.println(resolverErrors[i].toString());
				}
				if (unsatisfied.length == 0 && resolverErrors.length == 0) {
					ci.print("  "); //$NON-NLS-1$
				}
				if (unsatisfied.length > 0) {
					ci.print("  "); //$NON-NLS-1$
				}
				for (int i = 0; i < unsatisfied.lengthi++) {
					ci.print("    "); //$NON-NLS-1$
					ci.println(MessageHelper.getResolutionFailureMessage(unsatisfied[i]));
				}
				boolean foundLeaf = false;
				for (int i = 0; i < unsatisfiedLeaves.lengthi++) {
					if (unsatisfiedLeaves[i].getBundle() == bundle)
						continue;
					if (!foundLeaf) {
						foundLeaf = true;
						ci.print("  "); //$NON-NLS-1$
					}
					ci.print("    "); //$NON-NLS-1$
					ci.println(unsatisfiedLeaves[i].getBundle().getLocation() + " [" + unsatisfiedLeaves[i].getBundle().getBundleId() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
					ci.print("      "); //$NON-NLS-1$
					ci.println(MessageHelper.getResolutionFailureMessage(unsatisfiedLeaves[i]));
				}
				nextArg = ci.nextArgument();
			}
finally {
		}
	}
	public void _enableBundle(CommandInterpreter cithrows Exception {
		String nextArg = ci.nextArgument();
		if (nextArg == null) {
			return;
		}
		try {
			State systemState = getPlatformAdmin(ci).getState(false);
			while (nextArg != null) {
				BundleDescription bundleDesc = getBundleDescriptionFromToken(systemStatenextArg);
				if (bundleDesc == null) {
					nextArg = ci.nextArgument();
					continue;
				}
				DisabledInfo[] infos = systemState.getDisabledInfos(bundleDesc);
				for (int i = 0; i < infos.lengthi++) {
				}
				nextArg = ci.nextArgument();
			}
finally {
		}
	}
	public void _disableBundle(CommandInterpreter cithrows Exception {
		String nextArg = ci.nextArgument();
		if (nextArg == null) {
			return;
		}
		try {
			State systemState = getPlatformAdmin(ci).getState(false);
			while (nextArg != null) {
				BundleDescription bundleDesc = getBundleDescriptionFromToken(systemStatenextArg);
				if (bundleDesc == null) {
					nextArg = ci.nextArgument();
					continue;
				}
				nextArg = ci.nextArgument();
			}
finally {
		}
	}
	public void _disabledBundles(CommandInterpreter cithrows Exception {
		try {
			State systemState = getPlatformAdmin(ci).getState(false);
			BundleDescription[] disabledBundles = systemState.getDisabledBundles();
			if (disabledBundles.length > 0) {
				ci.println();
			}
			for (int i = 0; i < disabledBundles.lengthi++) {
				DisabledInfo[] disabledInfos = systemState.getDisabledInfos(disabledBundles[i]);
				ci.println(NLS.bind(.formatBundleName(disabledBundles[i]), String.valueOf(disabledBundles[i].getBundleId())));
				for (int j = 1; j < disabledInfos.lengthj++) {
					ci.print(NLS.bind(.disabledInfos[j].getMessage(), String.valueOf(disabledInfos[j].getPolicyName())));
				}
				ci.println();
			}
finally {
		}
	}
		String label = b.getSymbolicName();
		if (label == null || label.length() == 0)
			label = b.toString();
		else
			label = label + "_" + b.getVersion(); //$NON-NLS-1$
		return label;
	}
New to GrepCode? Check out our FAQ X