Skip to content

Commit 0e42c68

Browse files
committed
Replace Plugin.getLog() with static ILog.of(Class)
Switch the six single-call-site static log(IStatus) helpers to use ILog.of(SomeClass.class) instead of routing through the plugin singleton. This removes the last logging-only reason these bundles rely on getDefault()/getPlugin() and works even before the activator has stored the singleton. Affected bundles: - org.eclipse.compare.win32 - org.eclipse.unittest.ui - org.eclipse.ui.console - org.eclipse.core.variables - org.eclipse.ant.core - org.eclipse.ant.ui All of these already require org.eclipse.core.runtime >= 3.29, which is when ILog.of(Class) was introduced, so no MANIFEST changes are needed.
1 parent 61d50fa commit 0e42c68

6 files changed

Lines changed: 12 additions & 6 deletions

File tree

ant/org.eclipse.ant.core/src/org/eclipse/ant/core/AntCorePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.eclipse.ant.internal.core.AntCoreUtil;
2323
import org.eclipse.core.runtime.IConfigurationElement;
2424
import org.eclipse.core.runtime.IExtensionPoint;
25+
import org.eclipse.core.runtime.ILog;
2526
import org.eclipse.core.runtime.IStatus;
2627
import org.eclipse.core.runtime.Platform;
2728
import org.eclipse.core.runtime.Plugin;
@@ -302,6 +303,6 @@ public URLClassLoader getNewClassLoader(boolean allowLoading, URL[] urls) {
302303
*/
303304
public static void log(Throwable t) {
304305
IStatus status = new Status(IStatus.ERROR, PI_ANTCORE, INTERNAL_ERROR, "Error logged from Ant Core: ", t); //$NON-NLS-1$
305-
getPlugin().getLog().log(status);
306+
ILog.of(AntCorePlugin.class).log(status);
306307
}
307308
}

ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.eclipse.ant.internal.core.IAntCoreConstants;
2020
import org.eclipse.ant.internal.ui.editor.DecayCodeCompletionDataStructuresThread;
2121
import org.eclipse.ant.internal.ui.editor.text.AntEditorDocumentProvider;
22+
import org.eclipse.core.runtime.ILog;
2223
import org.eclipse.core.runtime.IStatus;
2324
import org.eclipse.core.runtime.Status;
2425
import org.eclipse.jface.preference.IPreferenceStore;
@@ -124,7 +125,7 @@ public static void log(Throwable t) {
124125
* status
125126
*/
126127
public static void log(IStatus status) {
127-
getDefault().getLog().log(status);
128+
ILog.of(AntUIPlugin.class).log(status);
128129
}
129130

130131
/**

debug/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.eclipse.core.variables;
1616

1717
import org.eclipse.core.internal.variables.StringVariableManager;
18+
import org.eclipse.core.runtime.ILog;
1819
import org.eclipse.core.runtime.IStatus;
1920
import org.eclipse.core.runtime.Plugin;
2021
import org.eclipse.core.runtime.Status;
@@ -96,7 +97,7 @@ public static void logMessage(String message, Throwable throwable) {
9697
* @param status status to log
9798
*/
9899
public static void log(IStatus status) {
99-
getDefault().getLog().log(status);
100+
ILog.of(VariablesPlugin.class).log(status);
100101
}
101102

102103
/**

debug/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.eclipse.ui.console;
1616

1717
import org.eclipse.core.runtime.CoreException;
18+
import org.eclipse.core.runtime.ILog;
1819
import org.eclipse.core.runtime.IStatus;
1920
import org.eclipse.core.runtime.Status;
2021
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -83,7 +84,7 @@ public static String getUniqueIdentifier() {
8384
* @param status status to log
8485
*/
8586
public static void log(IStatus status) {
86-
getDefault().getLog().log(status);
87+
ILog.of(ConsolePlugin.class).log(status);
8788
}
8889

8990
/**

debug/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.eclipse.unittest.internal.model.UnitTestModel;
2020
import org.eclipse.unittest.internal.ui.history.History;
2121

22+
import org.eclipse.core.runtime.ILog;
2223
import org.eclipse.core.runtime.IStatus;
2324
import org.eclipse.core.runtime.Status;
2425
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -73,7 +74,7 @@ public static void log(Throwable e) {
7374
* @param status the status to log
7475
*/
7576
public static void log(IStatus status) {
76-
getDefault().getLog().log(status);
77+
ILog.of(UnitTestPlugin.class).log(status);
7778
}
7879

7980
@Override

team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/Activator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*******************************************************************************/
1414
package org.eclipse.compare.internal.win32;
1515

16+
import org.eclipse.core.runtime.ILog;
1617
import org.eclipse.core.runtime.IStatus;
1718
import org.eclipse.core.runtime.Plugin;
1819
import org.eclipse.core.runtime.Status;
@@ -66,6 +67,6 @@ public static void log(Throwable e) {
6667
}
6768

6869
public static void log(IStatus status) {
69-
getDefault().getLog().log(status);
70+
ILog.of(Activator.class).log(status);
7071
}
7172
}

0 commit comments

Comments
 (0)