Skip to content

Commit

Permalink
Use new ILog.of(...) method instead of Platform.getLog(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jun 26, 2023
1 parent 65bdb41 commit b85b3cd
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion ant/org.eclipse.ant.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Export-Package: org.eclipse.ant.core,
org.eclipse.ant.internal.core.ant;x-friends:="org.eclipse.ant.launching",
org.eclipse.ant.internal.core.contentDescriber;x-internal:=true
Require-Bundle: org.eclipse.core.variables;bundle-version="[3.1.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.25.0,4.0.0)"
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)"
Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.ant.internal.core.contentDescriber"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ClassPath: .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import org.eclipse.ant.core.AntCorePlugin;
import org.eclipse.ant.core.AntSecurityException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;

/**
Expand Down Expand Up @@ -415,10 +415,10 @@ public boolean getInCheck() {
}

private static void logDeprecatedAccess(Throwable e) {
Platform.getLog(AntCorePlugin.getPlugin().getBundle()).log(new Status(IStatus.WARNING, AntCorePlugin.PI_ANTCORE, InternalCoreAntMessages.AntSecurityManager_0, e));
ILog.of(AntCorePlugin.getPlugin().getBundle()).log(new Status(IStatus.WARNING, AntCorePlugin.PI_ANTCORE, InternalCoreAntMessages.AntSecurityManager_0, e));
}

private static void logException(Throwable e) {
Platform.getLog(AntCorePlugin.getPlugin().getBundle()).log(new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, e.getLocalizedMessage(), e));
ILog.of(AntCorePlugin.getPlugin().getBundle()).log(new Status(IStatus.ERROR, AntCorePlugin.PI_ANTCORE, e.getLocalizedMessage(), e));
}
}
2 changes: 1 addition & 1 deletion platform/org.eclipse.platform/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui.intro;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.cheatsheets;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
org.eclipse.core.runtime;bundle-version="[3.16.0,4.0.0)"
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: org.eclipse.platform.internal;x-internal:=true
Eclipse-BundleShape: dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ boolean executeUpdateCommand(String command) {
try {
cmd.executeWithChecks(executionEvent);
} catch (ExecutionException e) {
Platform.getLog(LaunchUpdateIntroAction.class).error("Exception executing command: " + command, e); //$NON-NLS-1$
ILog.of(LaunchUpdateIntroAction.class).error("Exception executing command: " + command, e); //$NON-NLS-1$
} catch (NotDefinedException e) {
return false;
} catch (NotEnabledException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Export-Package: org.eclipse.core.internal.dtree;x-internal:=true,
Require-Bundle: org.eclipse.ant.core;bundle-version="[3.1.0,4.0.0)";resolution:=optional,
org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.runtime;bundle-version="[3.26.0,4.0.0)"
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/ResourceChangeListenerRegistrar.xml,
OSGI-INF/org.eclipse.core.internal.resources.CheckMissingNaturesListener.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static void log(IStatus status) {
final Bundle bundle = Platform.getBundle(ResourcesPlugin.PI_RESOURCES);
if (bundle == null)
return;
Platform.getLog(bundle).log(status);
ILog.of(bundle).log(status);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.core.tools.resources,
org.eclipse.core.tools.resources.markers
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)",
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.workbench.texteditor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public String getText(Object obj) {
return message == null ? type : message + " : " + type;
}
} catch (CoreException e) {
Platform.getLog(MarkerView.class).log(e.getStatus());
ILog.of(MarkerView.class).log(e.getStatus());
}
return obj.toString();
}
Expand Down Expand Up @@ -402,7 +402,7 @@ public Image getImage(Object obj) {
imageKey = SharedImages.IMG_OBJS_TASK_TSK;
}
} catch (CoreException e) {
Platform.getLog(MarkerView.class).log(e.getStatus());
ILog.of(MarkerView.class).log(e.getStatus());
}
}
return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private void findDeclaredPropertyDescriptorsFor(MarkerExtensionModel.MarkerInfo
for (String superId : anInfo.declaredSupers) {
MarkerExtensionModel.MarkerInfo superInfo = model.getInfo(superId);
if (superInfo == null) {
Platform.getLog(ReadOnlyMarkerPropertySource.class).log(new Status(IStatus.ERROR,ReadOnlyMarkerPropertySource.class,"internal error. could not find supertype" + superId + "of marker" + info.id));
ILog.of(ReadOnlyMarkerPropertySource.class).log(new Status(IStatus.ERROR,ReadOnlyMarkerPropertySource.class,"internal error. could not find supertype" + superId + "of marker" + info.id));
continue;
}
findDeclaredPropertyDescriptorsFor(superInfo, descriptorList, actualAttributeSet);
Expand All @@ -101,7 +101,7 @@ public Object getPropertyValue(Object id) {
try {
return marker.getAttribute(name);
} catch (CoreException e) {
Platform.getLog(ReadOnlyMarkerPropertySource.class).log(e.getStatus());
ILog.of(ReadOnlyMarkerPropertySource.class).log(e.getStatus());
return "exception occured accessing: " + name;
}
}
Expand All @@ -114,7 +114,7 @@ public boolean isPropertySet(Object id) {
try {
return marker.getAttribute(name) != null;
} catch (CoreException e) {
Platform.getLog(ReadOnlyMarkerPropertySource.class).log(e.getStatus());
ILog.of(ReadOnlyMarkerPropertySource.class).log(e.getStatus());
return false;
}
}
Expand All @@ -138,7 +138,7 @@ public void setSourceMarker(IMarker marker) {
try {
this.info = model.getInfo(marker.getType());
} catch (CoreException e) {
Platform.getLog(ReadOnlyMarkerPropertySource.class).log(e.getStatus());
ILog.of(ReadOnlyMarkerPropertySource.class).log(e.getStatus());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Require-Bundle: org.eclipse.core.filesystem,
org.eclipse.ui.ide,
org.eclipse.ui,
org.eclipse.osgi,
org.eclipse.core.runtime
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private Policy() {
}

public static void log(IStatus status) {
Platform.getLog(Platform.getBundle(PI_FILESYSTEM_EXAMPLE)).log(status);
ILog.of(Platform.getBundle(PI_FILESYSTEM_EXAMPLE)).log(status);
}

public static IStatus createStatus(Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ private static Bundle getBundle() {
}

public static void log(IStatus status) {
Platform.getLog(getBundle()).log(status);
ILog.of(getBundle()).log(status);
}

public static void log(String message, IStatus status) {
final ILog log = Platform.getLog(getBundle());
final ILog log = ILog.of(getBundle());
log.log(new Status(status.getSeverity(), PI_FILESYSTEM_EXAMPLE, 1, message, null));
log.log(status);
}

public static void log(String message, Throwable t) {
final ILog log = Platform.getLog(getBundle());
final ILog log = ILog.of(getBundle());
log.log(new Status(IStatus.ERROR, PI_FILESYSTEM_EXAMPLE, 1, message, t));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Export-Package: org.eclipse.core.expressions,
org.eclipse.core.internal.expressions;x-internal:=true,
org.eclipse.core.internal.expressions.propertytester;x-internal:=true,
org.eclipse.core.internal.expressions.util;x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: org.w3c.dom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionDelta;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.Platform;
Expand Down Expand Up @@ -190,7 +191,7 @@ public synchronized Property getProperty(Object receiver, String namespace, Stri
try {
result[i]= new PropertyTesterDescriptor(config);
} catch (CoreException e) {
Platform.getLog(TypeExtensionManager.class).log(e.getStatus());
ILog.of(TypeExtensionManager.class).log(e.getStatus());
result[i]= NULL_PROPERTY_TESTER;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Export-Package: org.eclipse.core.tools;x-internal:=true,
org.eclipse.core.tools.metadata;x-internal:=true,
org.eclipse.core.tools.runtime;x-internal:=true
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.1.0,4.0.0)";resolution:=optional,
org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)",
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.views,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static void logException(Exception exception, String userMessage) {
if (userMessage == null)
userMessage = exception.getMessage();
IStatus status = new Status(IStatus.ERROR, ErrorUtil.class, -1, userMessage, exception);
Platform.getLog(ErrorUtil.class).log(status);
ILog.of(ErrorUtil.class).log(status);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void setFile(File file) {
if (dump.isFailed()) {
Status status = new Status(IStatus.ERROR, DumpContentsView.class, 0, "Error during file dump", //$NON-NLS-1$
dump.getFailureReason());
Platform.getLog(DumpContentsView.class).log(status);
ILog.of(DumpContentsView.class).log(status);
String message = "File dumping did not complete successfully. Reason: " + dump.getFailureReason(); //$NON-NLS-1$
ErrorUtil.showErrorMessage(message, "Error during file dump"); //$NON-NLS-1$
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Export-Package: org.eclipse.core.tests.harness;version="2.0",
org.eclipse.core.tests.session;version="2.0"
Require-Bundle: org.junit,
org.eclipse.test.performance,
org.eclipse.core.runtime,
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)",
org.eclipse.jdt.junit.runtime,
org.eclipse.jdt.junit4.runtime,
org.eclipse.pde.junit.runtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Expand Down Expand Up @@ -88,7 +89,7 @@ private static void indent(OutputStream output, int indent) {
}

public static void log(String pluginID, IStatus status) {
Platform.getLog(Platform.getBundle(pluginID)).log(status);
ILog.of(Platform.getBundle(pluginID)).log(status);
}

public static void log(String pluginID, Throwable e) {
Expand Down
2 changes: 1 addition & 1 deletion team/bundles/org.eclipse.compare.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare.core
Bundle-Version: 3.8.100.qualifier
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)"
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.compare.internal.core;x-friends:="org.eclipse.compare",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public static InputStream asInputStream(String contents, String charSet) {
try {
bytes = contents.getBytes(charSet);
} catch (UnsupportedEncodingException e) {
Platform.getLog(FileDiffResult.class).error(Messages.Activator_1, e);
ILog.of(FileDiffResult.class).error(Messages.Activator_1, e);
}
}
if (bytes == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static List<String> load(ReaderCreator content, boolean create) {
try (BufferedReader bufferedReader = new BufferedReader(content.createReader())) {
lines = readLines(bufferedReader);
} catch (CoreException ex) {
Platform.getLog(LineReader.class).error(Messages.Activator_1, ex);
ILog.of(LineReader.class).error(Messages.Activator_1, ex);
} catch (IOException closeException) {
// silently ignored
}
Expand Down
2 changes: 1 addition & 1 deletion team/tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Require-Bundle: org.junit,
org.eclipse.compare,
org.eclipse.jface.text,
org.eclipse.jface,
org.eclipse.core.runtime,
org.eclipse.core.runtime;bundle-version="[3.28.0,4.0.0)",
org.eclipse.test.performance,
org.eclipse.ui,
org.eclipse.core.resources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public void testPatchdataSubfolders() throws IOException, CoreException {
// both copy-pasted from CoreTest

private void log(String pluginID, IStatus status) {
Platform.getLog(Platform.getBundle(pluginID)).log(status);
ILog.of(Platform.getBundle(pluginID)).log(status);
}

private void log(String pluginID, Throwable e) {
Expand Down

0 comments on commit b85b3cd

Please sign in to comment.