本文整理汇总了Java中org.eclipse.core.runtime.ILog.log方法的典型用法代码示例。如果您正苦于以下问题:Java ILog.log方法的具体用法?Java ILog.log怎么用?Java ILog.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.ILog
的用法示例。
在下文中一共展示了ILog.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: msg
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
private void msg(int msgType, String message, Throwable error) {
int ct = squelchTimeout != 0L ? 0 : counter.incrementAndGet();
boolean printSquelchWarning = false;
if (squelchTimeout != 0L) {
long now = System.currentTimeMillis();
if (squelchTimeout > now) return;
squelchTimeout = now + SQUELCH_TIMEOUT;
printSquelchWarning = true;
} else if (ct >= MAX_LOG) {
squelchTimeout = System.currentTimeMillis() + SQUELCH_TIMEOUT;
printSquelchWarning = true;
}
ILog log = Platform.getLog(bundle);
log.log(new Status(msgType, DEFAULT_BUNDLE_NAME, message, error));
if (printSquelchWarning) {
log.log(new Status(IStatus.WARNING, DEFAULT_BUNDLE_NAME, "Lombok has logged too many messages; to avoid memory issues, further lombok logs will be squelched for a while. Restart eclipse to start over."));
}
}
示例2: presentUpdateDetails
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
@Override
public void presentUpdateDetails(Shell shell, String updateSiteUrl, ILog log,
String pluginId) {
try {
InstallUpdateHandler.launch(updateSiteUrl);
} catch (Throwable t) {
// Log, and fallback on dialog
log.log(new Status(IStatus.WARNING, pluginId,
"Could not open install wizard", t));
MessageDialog.openInformation(
shell,
DEFAULT_DIALOG_TITLE,
"An update is available for the GWT Plugin for Eclipse. Go to \"Help > Install New Software\" to install it.");
}
}
示例3: run
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
/**
* Asynchronously executes a {@link Command} in the Eclipse UI thread.
*
* @see Runnable#run()
* @see Display#asyncExec(Runnable)
* @see #runCommand(String)
**/
public void run()
{
try
{
if (command.isHandled() && command.isEnabled())
{
command.executeWithChecks(executionEvent);
}
}
catch (CommandException exception)
{
ILog log = MultiTouchPlugin.getDefault().getLog();
String info = "Unexpected exception while executing " + command; //$NON-NLS-1$
IStatus status = new Status(IStatus.ERROR, MultiTouchPlugin.PLUGIN_ID, info, exception);
log.log(status);
}
}
示例4: runInRealm
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
private void runInRealm(String message, Runnable runnable) {
if (Realm.getDefault() == realm) {
try {
runnable.run();
} catch (Exception e) {
Activator plugin = Activator.getDefault();
ILog log = plugin.getLog();
if (log != null) {
log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "failed to perform " + message, e));
} else {
LogUtil.error(new Exception("failed to perform " + message));
}
}
} else {
realm.asyncExec(runnable);
}
}
示例5: append
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
@Override
protected void append(LoggingEvent event) {
// don't go any further if event is not severe enough.
if (!isAsSevereAsThreshold(event.getLevel())) {
return;
}
ILog log = getBundleILog();
if (log == null) {
return;
}
// if throwable information is available, extract it.
Throwable t = null;
if (event.getThrowableInformation() != null && layout.ignoresThrowable()) {
t = event.getThrowableInformation().getThrowable();
}
// build an Eclipse Status record, map severity and code from Event.
Status s = new Status(getSeverity(event), ForceIdeCorePlugin.getPluginId(), getCode(event),
layout.format(event), t);
log.log(s);
}
示例6: saveGenModel
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
public static void saveGenModel(GenModel gm, Shell parentShell)
{
final Map<Object, Object> opt = new HashMap<Object, Object>();
opt.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
opt.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED);
try
{
gm.eResource().save(opt);
} catch (IOException e)
{
MessageDialog.openInformation(parentShell, "genModel could not be saved",
"The genmodel could not be saved.\nReason is : " + e.getMessage());
Bundle bundle = FrameworkUtil.getBundle(Util.class);
ILog logger = Platform.getLog(bundle);
logger.log(new Status(IStatus.WARNING, bundle.getSymbolicName(),
"Unable to save the genModel in : " + gm.eResource(), e));
}
}
示例7: handleCoreException
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
/**
* Defines the standard procedure to handle <code>CoreExceptions</code>.
* Exceptions are written to the plug-in log.
*
* @param exception
* the exception to be logged
* @param message
* the message to be logged
*/
protected void handleCoreException( CoreException exception, String message )
{
Bundle bundle = Platform.getBundle( PlatformUI.PLUGIN_ID );
ILog log = Platform.getLog( bundle );
if ( message != null )
log.log( new Status( IStatus.ERROR,
PlatformUI.PLUGIN_ID,
0,
message,
exception ) );
else
log.log( exception.getStatus( ) );
}
示例8: writeMessageToErrorLog
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
/**
* Outputs the exception to the Error Log.
*
* @param exception the exception.
*/
public static void writeMessageToErrorLog(DcaseSystemException exception) {
if (enableWrite(exception.getMessageType().getMessageLevel())) {
// sets the status.
int status = getStatus(exception.getMessageType().getMessageLevel());
// outputs.
String message = exception.getMessage();
if (message == null) {
message = Messages.MessageWriter_0;
}
ILog log = DcaseDiagramEditorPlugin.getInstance().getLog();
log.log(new Status(status, DcaseDiagramEditorPlugin.ID, 0, message,
exception));
}
}
示例9: logInfo
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
/**
* @param message
*/
public static void logInfo(String project, String message) {
if (project !=null && !PreferenceManager.isLogInfoEnabled(project))
return;
ILog log = Activator.getDefault().getLog();
log.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, message));
}
示例10: validateState
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
protected void validateState(final IEditorInput input) {
final IDocumentProvider provider = getDocumentProvider();
if (!(provider instanceof IDocumentProviderExtension))
return;
final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
try {
extension.validateState(input, getSite().getShell());
} catch (final CoreException x) {
final IStatus status = x.getStatus();
if (status == null || status.getSeverity() != IStatus.CANCEL) {
final Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
final ILog log = Platform.getLog(bundle);
log.log(x.getStatus());
final Shell shell = getSite().getShell();
final String title = "EditorMessages.Editor_error_validateEdit_title";
final String msg = "EditorMessages.Editor_error_validateEdit_message";
ErrorDialog.openError(shell, title, msg, x.getStatus());
}
return;
}
if (fSourceViewer != null)
fSourceViewer.setEditable(isEditable());
}
示例11: validateState
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
protected void validateState(IEditorInput input) {
IDocumentProvider provider = getDocumentProvider();
if (!(provider instanceof IDocumentProviderExtension))
return;
IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
try {
extension.validateState(input, getSite().getShell());
} catch (CoreException x) {
IStatus status = x.getStatus();
if (status == null || status.getSeverity() != IStatus.CANCEL) {
Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
ILog log = Platform.getLog(bundle);
log.log(x.getStatus());
Shell shell = getSite().getShell();
String title = "EditorMessages.Editor_error_validateEdit_title";
String msg = "EditorMessages.Editor_error_validateEdit_message";
ErrorDialog.openError(shell, title, msg, x.getStatus());
}
return;
}
if (fSourceViewer != null)
fSourceViewer.setEditable(isEditable());
}
示例12: reportErrors
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
@Override
public void reportErrors(String fileName, @SuppressWarnings("rawtypes") List errors) {
ILog log = GroovyCoreActivator.getDefault().getLog();
for (Object error : errors) {
log.log(new Status(Status.ERROR, GroovyCoreActivator.PLUGIN_ID, error.toString()));
}
}
示例13: getString
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
/**
* Gets the string.
*
* @param key
* the key
* @return the string
*/
public static String getString(String key) {
final ILog logger = Activator.getDefault().getLog();
try {
String keyValue = new String(rb.getString(key).getBytes("ISO-8859-1"), "UTF-8");
return keyValue;
} catch (Exception ex) {
IStatus status = new Status(IStatus.WARNING, Activator.PLUGIN_ID, ex.getMessage(), ex);
logger.log(status);
return key;
}
}
示例14: setBundle
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
/**
* Sets the bundle.
*
* @param locale
* the new bundle
*/
public static void setBundle(Locale locale) {
final ILog logger = Activator.getDefault().getLog();
try {
rb = ResourceBundle.getBundle(BUNDLE_NAME, locale);
} catch (Exception ex) {
IStatus status = new Status(IStatus.WARNING, Activator.PLUGIN_ID, ex.getMessage(), ex);
logger.log(status);
rb = ResourceBundle.getBundle(BUNDLE_NAME, Locale.ENGLISH);
}
}
示例15: execute
import org.eclipse.core.runtime.ILog; //导入方法依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
final ILog logger = Activator.getDefault().getLog();
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (!(selection instanceof IStructuredSelection)) {
return null;
}
IStructuredSelection structSel = (IStructuredSelection) selection;
Object element = null;
try {
element = structSel.iterator().next();
} catch (NoSuchElementException e) {
}
if (element != null) {
if (element instanceof CollectionNode) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
IEditorInput editorInput = new NodeEditorInput((INode) element);
try {
page.openEditor(editorInput, CollectionEditor.ID);
} catch (PartInitException ex) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex);
logger.log(status);
}
}
;
}
return null;
}