Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2020-03-25 10:14:18 +0000
committerLars Vogel2020-03-30 10:59:26 +0000
commit72e8f3dcb79dda11d4bee0830e356afd38e55f1c (patch)
treec66c9d3700199aac45db361664e37ec98f506b78
parent47be4acb187f7f8e810c035585d4d06f791c9e98 (diff)
downloadeclipse.platform.ua-72e8f3dcb79dda11d4bee0830e356afd38e55f1c.tar.gz
eclipse.platform.ua-72e8f3dcb79dda11d4bee0830e356afd38e55f1c.tar.xz
eclipse.platform.ua-72e8f3dcb79dda11d4bee0830e356afd38e55f1c.zip
Bug 560168 - [CheatSheet] Refactor logging to more modern and less
verbose way For org.eclipse.intro Change-Id: Id17e135e6b91c0f802fd620400364cfd6bb4b1c1 Signed-off-by: George Suaridze <suag@1c.ru>
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java27
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java41
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java27
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java12
4 files changed, 23 insertions, 84 deletions
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
index 1a0fc6f71..cc19f336a 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * George Suaridze <suag@1c.ru> (1C-Soft LLC) - Bug 560168
*******************************************************************************/
package org.eclipse.ui.internal.intro.universal.util;
@@ -71,11 +72,7 @@ public class Log implements IUniversalIntroConstants {
* already be localized to proper local. Errors are always logged.
*/
public static synchronized void error(String message, Throwable ex) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
- pluginLog.log(errorStatus);
+ pluginLog.error(message, ex);
}
/**
@@ -88,11 +85,7 @@ public class Log implements IUniversalIntroConstants {
// logging of info messages is not enabled.
return;
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
+ pluginLog.info(message);
}
/**
@@ -102,11 +95,7 @@ public class Log implements IUniversalIntroConstants {
* controlled by the public flags in this class.
*/
public static synchronized void forcedInfo(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
+ pluginLog.info(message);
}
@@ -121,11 +110,7 @@ public class Log implements IUniversalIntroConstants {
// to not log warning messages.
return;
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
- pluginLog.log(warningStatus);
+ pluginLog.warn(message);
}
/**
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java
index 94ba0f83c..acad5cf7d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,12 +10,11 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * George Suaridze <suag@1c.ru> (1C-Soft LLC) - Bug 560168
*******************************************************************************/
package org.eclipse.ui.internal.intro.impl;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot;
@@ -199,27 +198,6 @@ public class IntroPlugin extends AbstractUIPlugin {
}
/**
- * Logs an Error message. To print errors to console,
- * run eclipse with the -console -consolelog arguments
- */
- public static synchronized void logError(String message) {
- logError(message,null);
- }
-
- /**
- * Logs an Error message with an exception. To print errors to console,
- * run eclipse with the -console -consolelog arguments
- */
- public static synchronized void logError(String message, Throwable ex) {
- if (message == null){
- message = ""; //$NON-NLS-1$
- }
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, message, ex);
- IntroPlugin.getDefault().getLog().log(errorStatus);
- }
-
-
- /**
* Logs a Warning message with an exception. To print warnings to console,
* run eclipse with the -console -consolelog arguments
*
@@ -235,12 +213,8 @@ public class IntroPlugin extends AbstractUIPlugin {
public static synchronized void logWarning(String message,Throwable ex) {
- if (IntroPlugin.getDefault().isDebugging() && LOG_WARN) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, ex);
- getDefault().getLog().log(warningStatus);
+ if (LOG_WARN && IntroPlugin.getDefault().isDebugging()) {
+ getDefault().getLog().warn(message, ex);
}
}
@@ -255,11 +229,8 @@ public class IntroPlugin extends AbstractUIPlugin {
* com.ibm.ccl.welcome.bits/debug/info=true
*/
public static synchronized void logDebug(String message) {
- if (IntroPlugin.getDefault().isDebugging() && LOG_INFO) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status status = new Status(IStatus.INFO, PLUGIN_ID,message);
- getDefault().getLog().log(status);
+ if (LOG_INFO && IntroPlugin.getDefault().isDebugging()) {
+ getDefault().getLog().info(message);
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java
index e8c2bb96a..93c091ffe 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * George Suaridze <suag@1c.ru> (1C-Soft LLC) - Bug 560168
*******************************************************************************/
package org.eclipse.ui.internal.intro.impl.util;
@@ -71,11 +72,7 @@ public class Log implements IIntroConstants {
* already be localized to proper local. Errors are always logged.
*/
public static synchronized void error(String message, Throwable ex) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
- pluginLog.log(errorStatus);
+ pluginLog.error(message, ex);
}
/**
@@ -88,11 +85,7 @@ public class Log implements IIntroConstants {
// logging of info messages is not enabled.
return;
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
+ pluginLog.info(message);
}
/**
@@ -102,11 +95,7 @@ public class Log implements IIntroConstants {
* controlled by the public flags in this class.
*/
public static synchronized void forcedInfo(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
+ pluginLog.info(message);
}
@@ -121,11 +110,7 @@ public class Log implements IIntroConstants {
// to not log warning messages.
return;
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
- pluginLog.log(warningStatus);
+ pluginLog.warn(message);
}
/**
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
index c45dfd16d..f0fa2aa28 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * George Suaridze <suag@1c.ru> (1C-Soft LLC) - Bug 560168
*******************************************************************************/
package org.eclipse.ui.intro.contentproviders;
@@ -179,7 +180,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
try {
url = new URL(getParameter("url")); //$NON-NLS-1$
} catch (MalformedURLException e) {
- IntroPlugin.logError("Bad URL: "+url, e); //$NON-NLS-1$
+ IntroPlugin.getDefault().getLog().error("Bad URL: " + url, e); //$NON-NLS-1$
}
if (url != null) {
out.println("<p><span class=\"rss-feed-link\">"); //$NON-NLS-1$
@@ -509,10 +510,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
}
} catch (Exception e) {
- IntroPlugin.logError(
- NLS.bind(
- Messages.RSS_Malformed_feed,
- getParameter("url"))); //$NON-NLS-1$
+ IntroPlugin.getDefault().getLog().error(NLS.bind(Messages.RSS_Malformed_feed, getParameter("url"))); //$NON-NLS-1$
refresh();
} finally {
threadRunning = false;
@@ -529,7 +527,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
try{
Thread.sleep(SOCKET_TIMEOUT);
}catch(Exception ex){
- IntroPlugin.logError("Timeout failed.", ex); //$NON-NLS-1$
+ IntroPlugin.getDefault().getLog().error("Timeout failed.", ex); //$NON-NLS-1$
}
if (threadRunning)
{

Back to the top