Skip to content

Commit

Permalink
ctf.core: Remove direct Eclipse platform dependency from ctf.core
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
bhufmann committed Mar 11, 2024
1 parent ea8e9ed commit 3c0c642
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 95 deletions.
3 changes: 1 addition & 2 deletions ctf/org.eclipse.tracecompass.ctf.core/META-INF/MANIFEST.MF
Expand Up @@ -7,8 +7,7 @@ Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.ctf.core;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.tracecompass.common.core,
Require-Bundle: org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.ctf.parser,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
Export-Package: org.eclipse.tracecompass.ctf.core,
Expand Down
Expand Up @@ -17,10 +17,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;

/**
* The class for adding logging Utility to the CTF plug-in.
*/
Expand All @@ -33,21 +29,7 @@ public class CtfCoreLoggerUtil {
/**
* Flag to indicate if platform is running
*/
public static final boolean IS_PLATFORM_RUNNING;
private static Logger LOGGER;
static {
boolean result = false;
try {
result = Platform.isRunning();
} catch (Exception exception) {
// Assume that we aren't running.
}
IS_PLATFORM_RUNNING = result;
if (!result) {
LOGGER = Logger.getLogger(CtfCoreLoggerUtil.class.getName());
}
}

private static Logger LOGGER = Logger.getLogger(CtfCoreLoggerUtil.class.getName());

/**
* The plug-in ID
Expand Down Expand Up @@ -76,11 +58,7 @@ private CtfCoreLoggerUtil() {
* The message
*/
public static void logInfo(String msg) {
if (IS_PLATFORM_RUNNING) {
Platform.getLog(CtfCoreLoggerUtil.class).log(new Status(IStatus.INFO, PLUGIN_ID, msg));
} else {
LOGGER.log(Level.INFO, msg);
}
LOGGER.log(Level.INFO, msg);
}

/**
Expand All @@ -92,11 +70,7 @@ public static void logInfo(String msg) {
* The cause
*/
public static void logError(String msg, Exception e) {
if (IS_PLATFORM_RUNNING) {
Platform.getLog(CtfCoreLoggerUtil.class).log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e));
} else {
LOGGER.log(Level.SEVERE, msg, e);
}
LOGGER.log(Level.SEVERE, msg, e);
}

/**
Expand All @@ -106,10 +80,6 @@ public static void logError(String msg, Exception e) {
* The error message
*/
public static void logWarning(String msg) {
if (IS_PLATFORM_RUNNING) {
Platform.getLog(CtfCoreLoggerUtil.class).log(new Status(IStatus.WARNING, PLUGIN_ID, msg));
} else {
LOGGER.log(Level.WARNING, msg);
}
LOGGER.log(Level.WARNING, msg);
}
}

This file was deleted.

This file was deleted.

Expand Up @@ -29,7 +29,6 @@
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.CTFJsonMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.ICommonTreeParser;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.JsonStructureFieldMemberMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.Messages;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.MetadataStrings;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.ParseException;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.tsdl.AlignmentParser;
Expand Down Expand Up @@ -204,7 +203,7 @@ public IntegerDeclaration parse(ICTFMetadataNode integer, ICommonTreeParserParam
clock = ClockMapParser.INSTANCE.parse(rightNode, null);
break;
default:
CtfCoreLoggerUtil.logWarning(Messages.IOStructGen_UnknownIntegerAttributeWarning + " " + left); //$NON-NLS-1$
CtfCoreLoggerUtil.logWarning("Unknown integer attribute: " + left); //$NON-NLS-1$
break;
}
} else {
Expand Down
Expand Up @@ -28,7 +28,6 @@
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.CTFJsonMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.JsonDataStreamMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.JsonStructureFieldMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.Messages;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.MetadataStrings;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.ParseException;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.tsdl.TypeSpecifierListParser;
Expand Down Expand Up @@ -242,7 +241,7 @@ public CTFStream parse(ICTFMetadataNode streamDecl, ICommonTreeParserParameter p

stream.setPacketContext((StructDeclaration) packetContextDecl);
} else {
CtfCoreLoggerUtil.logWarning(Messages.IOStructGen_UnknownStreamAttributeWarning + ' ' + left);
CtfCoreLoggerUtil.logWarning("Unknown stream attribute: " + left); //$NON-NLS-1$
}
}
return stream;
Expand Down
Expand Up @@ -32,7 +32,6 @@
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.AbstractScopedCommonTreeParser;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.CTFAntlrMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.JsonPreambleMetadataNode;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.Messages;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.MetadataStrings;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.ParseException;
import org.eclipse.tracecompass.internal.ctf.core.event.metadata.tsdl.ByteOrderParser;
Expand Down Expand Up @@ -219,7 +218,7 @@ public CTFTrace parse(ICTFMetadataNode traceDecl, ICommonTreeParserParameter par

trace.setPacketHeader((StructDeclaration) packetHeaderDecl);
} else {
CtfCoreLoggerUtil.logWarning(Messages.IOStructGen_UnknownTraceAttributeWarning + " " + left); //$NON-NLS-1$
CtfCoreLoggerUtil.logWarning("Unknown trace attribute: " + left); //$NON-NLS-1$
}
}
return trace;
Expand Down

0 comments on commit 3c0c642

Please sign in to comment.