Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavid_williams2005-10-17 01:47:12 +0000
committerdavid_williams2005-10-17 01:47:12 +0000
commit571b9c39a37baa1b6a09bbc9e01a9566c96000a2 (patch)
treede1f035c12934fa9b5e2d57e6a584839031ccacb /bundles/org.eclipse.wst.sse.core/src/org/eclipse
parentf9959a29a358cae230bf8a634dc5ce4e9f3be1d8 (diff)
downloadwebtools.sourceediting-571b9c39a37baa1b6a09bbc9e01a9566c96000a2.tar.gz
webtools.sourceediting-571b9c39a37baa1b6a09bbc9e01a9566c96000a2.tar.xz
webtools.sourceediting-571b9c39a37baa1b6a09bbc9e01a9566c96000a2.zip
[112701] clean up Logger (sse.core)
Diffstat (limited to 'bundles/org.eclipse.wst.sse.core/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java36
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/Logger.java230
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/AbstractStructuredModel.java41
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/LifecycleNotificationManager.java17
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java17
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/modelhandler/ModelHandlerRegistry.java8
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java3
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.java6
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/JarUtilities.java2
9 files changed, 176 insertions, 184 deletions
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java
index 7119855602..932534df72 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java
@@ -237,7 +237,7 @@ public class FileBufferModelManager {
ITextFileBuffer textBuffer = (ITextFileBuffer) buffer;
if (!(textBuffer.getDocument() instanceof IStructuredDocument))
return;
- if (debugTextBufferLifeCycle) {
+ if (Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
System.out.println("Learned new buffer: " + buffer.getLocation().toString() + " " + buffer + " " + ((ITextFileBuffer) buffer).getDocument()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
DocumentInfo info = new DocumentInfo();
@@ -253,7 +253,7 @@ public class FileBufferModelManager {
ITextFileBuffer textBuffer = (ITextFileBuffer) buffer;
if (!(textBuffer.getDocument() instanceof IStructuredDocument))
return;
- if (debugTextBufferLifeCycle) {
+ if (Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
System.out.println("Discarded buffer: " + buffer.getLocation().toString() + " " + buffer + " " + ((ITextFileBuffer) buffer).getDocument()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
DocumentInfo info = (DocumentInfo) fDocumentMap.get(textBuffer.getDocument());
@@ -267,7 +267,7 @@ public class FileBufferModelManager {
public void dirtyStateChanged(IFileBuffer buffer, boolean isDirty) {
if (buffer instanceof ITextFileBuffer) {
- if (debugTextBufferLifeCycle) {
+ if (Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
System.out.println("Buffer dirty state changed: (" + isDirty + ") " + buffer.getLocation().toString() + " " + buffer + " " + ((ITextFileBuffer) buffer).getDocument()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
ITextFileBuffer textBuffer = (ITextFileBuffer) buffer;
@@ -276,7 +276,7 @@ public class FileBufferModelManager {
DocumentInfo info = (DocumentInfo) fDocumentMap.get(textBuffer.getDocument());
if (info != null && info.model != null) {
String msg = "Updating model dirty state for" + info.buffer.getLocation(); //$NON-NLS-1$
- if (debugFileBufferModelManagement || debugTextBufferLifeCycle) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT || Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
System.out.println(msg);
}
info.model.setDirtyState(isDirty);
@@ -300,7 +300,7 @@ public class FileBufferModelManager {
public void underlyingFileDeleted(IFileBuffer buffer) {
if (buffer instanceof ITextFileBuffer) {
- if (debugTextBufferLifeCycle) {
+ if (Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
System.out.println("Deleted buffer: " + buffer.getLocation().toOSString() + " " + buffer); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -308,7 +308,7 @@ public class FileBufferModelManager {
public void underlyingFileMoved(IFileBuffer buffer, IPath path) {
if (buffer instanceof ITextFileBuffer) {
- if (debugTextBufferLifeCycle) {
+ if (Logger.DEBUG_TEXTBUFFERLIFECYCLE) {
System.out.println("Moved buffer from: " + buffer.getLocation().toOSString() + " " + buffer); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("Moved buffer to: " + path.toOSString() + " " + buffer); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -316,10 +316,6 @@ public class FileBufferModelManager {
}
}
- static final boolean debugFileBufferModelManagement = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/filebuffers/modelmanagement")); //$NON-NLS-1$ //$NON-NLS-2$
-
- static final boolean debugTextBufferLifeCycle = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/filebuffers/lifecycle")); //$NON-NLS-1$ //$NON-NLS-2$
-
private static FileBufferModelManager instance;
public static FileBufferModelManager getInstance() {
@@ -331,7 +327,7 @@ public class FileBufferModelManager {
static final void shutdown() {
if (instance != null) {
- if (debugFileBufferModelManagement) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
IDocument[] danglingDocuments = (IDocument[]) instance.fDocumentMap.keySet().toArray(new IDocument[0]);
for (int i = 0; i < danglingDocuments.length; i++) {
DocumentInfo info = (DocumentInfo) instance.fDocumentMap.get(danglingDocuments[i]);
@@ -481,7 +477,7 @@ public class FileBufferModelManager {
ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
try {
IPath location = new Path(file.getAbsolutePath());
- if (debugFileBufferModelManagement) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
System.out.println("FileBufferModelManager connecting to File " + location); //$NON-NLS-1$
}
bufferManager.connect(location, getProgressMonitor());
@@ -493,7 +489,7 @@ public class FileBufferModelManager {
}
}
catch (CoreException e) {
- Logger.log(Logger.ERROR, "Error getting model for " + file.getPath(), e); //$NON-NLS-1$
+ Logger.logException("Error getting model for " + file.getPath(), e); //$NON-NLS-1$
}
return model;
}
@@ -502,7 +498,7 @@ public class FileBufferModelManager {
IStructuredModel model = null;
ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
try {
- if (debugFileBufferModelManagement) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
System.out.println("FileBufferModelManager connecting to IFile " + file.getLocation()); //$NON-NLS-1$
}
bufferManager.connect(file.getLocation(), getProgressMonitor());
@@ -534,7 +530,7 @@ public class FileBufferModelManager {
}
}
catch (CoreException e) {
- Logger.log(Logger.ERROR, "Error getting model for " + file.getLocation(), e); //$NON-NLS-1$
+ Logger.logException("Error getting model for " + file.getLocation(), e); //$NON-NLS-1$
}
return model;
}
@@ -545,7 +541,7 @@ public class FileBufferModelManager {
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
if (info != null && info.model == null) {
- if (debugFileBufferModelManagement) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
System.out.println("FileBufferModelManager creating model for " + info.buffer.getLocation() + " " + info.buffer.getDocument()); //$NON-NLS-1$ //$NON-NLS-2$
}
info.modelReferenceCount++;
@@ -568,7 +564,7 @@ public class FileBufferModelManager {
}
}
catch (ResourceInUse e) {
- Logger.log(Logger.ERROR, "attempted to create new model with existing ID", e); //$NON-NLS-1$
+ Logger.logException("attempted to create new model with existing ID", e); //$NON-NLS-1$
model = null;
}
}
@@ -596,13 +592,13 @@ public class FileBufferModelManager {
public void releaseModel(IDocument document) {
DocumentInfo info = (DocumentInfo) fDocumentMap.get(document);
if (info != null) {
- if (debugFileBufferModelManagement) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
System.out.println("FileBufferModelManager noticed full release of model for " + info.buffer.getLocation() + " " + info.buffer.getDocument()); //$NON-NLS-1$ //$NON-NLS-2$
}
info.model = null;
info.modelReferenceCount--;
if (info.selfConnected) {
- if (debugFileBufferModelManagement) {
+ if (Logger.DEBUG_FILEBUFFERMODELMANAGEMENT) {
System.out.println("FileBufferModelManager disconnecting from " + info.buffer.getLocation() + " " + info.buffer.getDocument()); //$NON-NLS-1$ //$NON-NLS-2$
}
IPath location = info.buffer.getLocation();
@@ -610,7 +606,7 @@ public class FileBufferModelManager {
FileBuffers.getTextFileBufferManager().disconnect(info.buffer.getLocation(), getProgressMonitor());
}
catch (CoreException e) {
- Logger.log(Logger.ERROR, "Error releasing model for " + location, e); //$NON-NLS-1$
+ Logger.logException("Error releasing model for " + location, e); //$NON-NLS-1$
}
}
}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/Logger.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/Logger.java
index 061d863d32..2b65d7e960 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/Logger.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/Logger.java
@@ -14,11 +14,8 @@ package org.eclipse.wst.sse.core.internal;
-import java.util.StringTokenizer;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.Bundle;
@@ -28,150 +25,157 @@ import org.osgi.framework.Bundle;
* plugin. Other plugins should make their own copy, with appropriate ID.
*/
public class Logger {
- public static final boolean DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/debug")); //$NON-NLS-1$
-
private static final String PLUGIN_ID = "org.eclipse.wst.sse.core"; //$NON-NLS-1$
- public static final int ERROR = IStatus.ERROR; // 4
- public static final int ERROR_DEBUG = 200 + ERROR;
- public static final int INFO = IStatus.INFO; // 1
- public static final int INFO_DEBUG = 200 + INFO;
-
- public static final int OK = IStatus.OK; // 0
-
- public static final int OK_DEBUG = 200 + OK;
+ /**
+ * true if both platform and this plugin are in debug mode
+ */
+ public static final boolean DEBUG = Platform.inDebugMode() && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/debug")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging adapter
+ * notification time
+ */
+ public static final boolean DEBUG_ADAPTERNOTIFICATIONTIME = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/dom/adapter/notification/time")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging structured
+ * document
+ */
+ public static final boolean DEBUG_DOCUMENT = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/structureddocument")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging file buffer
+ * model management
+ */
+ public static final boolean DEBUG_FILEBUFFERMODELMANAGEMENT = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/filebuffers/modelmanagement")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging text buffer
+ * lifecycle
+ */
+ public static final boolean DEBUG_TEXTBUFFERLIFECYCLE = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/filebuffers/lifecycle")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging model
+ * lifecycle
+ */
+ public static final boolean DEBUG_LIFECYCLE = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/structuredmodel/lifecycle")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging model state
+ */
+ public static final boolean DEBUG_MODELSTATE = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/structuredmodel/state")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging model lock
+ * state
+ */
+ public static final boolean DEBUG_MODELLOCK = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/structuredmodel/locks")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging model
+ * manager
+ */
+ public static final boolean DEBUG_MODELMANAGER = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/structuredmodel/modelmanager")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ */
+ public static final boolean DEBUG_TASKS = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ * content type detection
+ */
+ public static final boolean DEBUG_TASKSCONTENTTYPE = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/detection")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ * jobs
+ */
+ public static final boolean DEBUG_TASKSJOB = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/job")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ * overall performance
+ */
+ public static final boolean DEBUG_TASKSOVERALLPERF = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/overalltime")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ * performance
+ */
+ public static final boolean DEBUG_TASKSPERF = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/time")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ * preferences
+ */
+ public static final boolean DEBUG_TASKSPREFS = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/preferences")); //$NON-NLS-1$ //$NON-NLS-2$
+ /**
+ * true if platform and plugin are in debug mode and debugging task tags
+ * registry
+ */
+ public static final boolean DEBUG_TASKSREGISTRY = DEBUG && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/registry")); //$NON-NLS-1$ //$NON-NLS-2$
- private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
- public static final int WARNING = IStatus.WARNING; // 2
- public static final int WARNING_DEBUG = 200 + WARNING;
+ /*
+ * Keep our own copy in case we want to add other severity levels
+ */
+ public static final int OK = IStatus.OK;
+ public static final int INFO = IStatus.INFO;
+ public static final int WARNING = IStatus.WARNING;
+ public static final int ERROR = IStatus.ERROR;
/**
* Adds message to log.
*
* @param level
* severity level of the message (OK, INFO, WARNING, ERROR,
- * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
* @param message
* text to add to the log
* @param exception
* exception thrown
*/
- protected static void _log(int level, String message, Throwable exception) {
- if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
- if (!isDebugging())
- return;
- }
-
- int severity = IStatus.OK;
- switch (level) {
- case INFO_DEBUG :
- case INFO :
- severity = IStatus.INFO;
- break;
- case WARNING_DEBUG :
- case WARNING :
- severity = IStatus.WARNING;
- break;
- case ERROR_DEBUG :
- case ERROR :
- severity = IStatus.ERROR;
- }
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- Status statusObj = new Status(severity, PLUGIN_ID, severity, message, exception);
+ private static void _log(int level, String message, Throwable exception) {
+ message = (message != null) ? message : ""; //$NON-NLS-1$
+ Status statusObj = new Status(level, PLUGIN_ID, level, message, exception);
Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
+ if (bundle != null)
Platform.getLog(bundle).log(statusObj);
}
/**
- * Prints message to log if category matches /debug/tracefilter option.
+ * Write a message to the log with the given severity level
*
+ * @param level
+ * ERROR, WARNING, INFO, OK
* @param message
- * text to print
- * @param category
- * category of the message, to be compared with
- * /debug/tracefilter
- */
- protected static void _trace(String category, String message, Throwable exception) {
- if (isTracing(category)) {
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- Status statusObj = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
- }
- }
-
- /**
- * @deprecated Logger is not responsible for returning plugin
+ * message to add to the log
*/
- public static Plugin getPlugin() {
- return SSECorePlugin.getDefault();
+ public static void log(int level, String message) {
+ _log(level, message, null);
}
/**
- * @deprecated Logger is not responsible for returning plugin id
- * @return
+ * Writes a message and exception to the log with the given severity level
+ *
+ * @param level
+ * ERROR, WARNING, INFO, OK
+ * @param message
+ * message to add to the log
+ * @param exception
+ * exception to add to the log
*/
- public static String getPluginId() {
- return PLUGIN_ID;
+ public static void log(int level, String message, Throwable exception) {
+ _log(level, message, exception);
}
/**
- * @return true if the platform is debugging
+ * Writes the exception as an error in the log along with an accompanying
+ * message
+ *
+ * @param message
+ * message to add to the log
+ * @param exception
+ * exception to add to the log
*/
- public static boolean isDebugging() {
- return Platform.inDebugMode();
+ public static void logException(String message, Throwable exception) {
+ _log(IStatus.ERROR, message, exception);
}
/**
- * Determines if currently tracing a category
+ * Writes the exception as an error in the log
*
- * @param category
- * @return true if tracing category, false otherwise
+ * @param exception
+ * exception to add to the log
*/
- public static boolean isTracing(String category) {
- if (!isDebugging())
- return false;
-
- String traceFilter = Platform.getDebugOption(PLUGIN_ID + TRACEFILTER_LOCATION);
- if (traceFilter != null) {
- StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String cat = tokenizer.nextToken().trim();
- if (category.equals(cat)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static void log(int level, String message) {
- _log(level, message, null);
- }
-
- public static void log(int level, String message, Throwable exception) {
- _log(level, message, exception);
- }
-
- public static void logException(String message, Throwable exception) {
- _log(ERROR, message, exception);
- }
-
public static void logException(Throwable exception) {
- _log(ERROR, exception.getMessage(), exception);
+ _log(IStatus.ERROR, exception.getMessage(), exception);
}
-
- public static void trace(String category, String message) {
- _trace(category, message, null);
- }
-
- public static void traceException(String category, String message, Throwable exception) {
- _trace(category, message, exception);
- }
-
- public static void traceException(String category, Throwable exception) {
- _trace(category, exception.getMessage(), exception);
- }
-
}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/AbstractStructuredModel.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/AbstractStructuredModel.java
index 0b66c2b470..ac59c7e862 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/AbstractStructuredModel.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/AbstractStructuredModel.java
@@ -179,11 +179,6 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
}
- static final String DEBUG_STATE_TRACE_CATEGORY = "org.eclipse.wst.sse.core/structuredmodel/state"; //$NON-NLS-1$
- static final String DEBUG_LOCK_TRACE_CATEGORY = "org.eclipse.wst.sse.core/structuredmodel/locks"; //$NON-NLS-1$
- static final boolean DEBUG_STATE = "true".equalsIgnoreCase(Platform.getDebugOption(DEBUG_STATE_TRACE_CATEGORY)); //$NON-NLS-1$
- static final boolean DEBUG_LOCK = "true".equalsIgnoreCase(Platform.getDebugOption(DEBUG_LOCK_TRACE_CATEGORY)); //$NON-NLS-1$
-
private FactoryRegistry factoryRegistry;
private String fBaseLocation;
boolean fDirtyState;
@@ -349,7 +344,7 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
if (fLockObject != null && fLockObject != documentLock) {
fLockObject.release();
if (Logger.DEBUG) {
- Logger.log(Logger.INFO_DEBUG, "Model lock released early" + fLockObject + " apparently document switched?");
+ Logger.log(Logger.INFO, "Model lock released early" + fLockObject + " apparently document switched?");
}
}
@@ -357,7 +352,7 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
if (fLockObject != null) {
fLockObject.acquire();
if (Logger.DEBUG) {
- Logger.log(Logger.INFO_DEBUG, "Model lock acquired: " + fLockObject);
+ Logger.log(Logger.INFO, "Model lock acquired: " + fLockObject);
}
}
}
@@ -508,7 +503,7 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
if (fLockObject != null) {
fLockObject.release();
if (Logger.DEBUG) {
- Logger.log(Logger.INFO_DEBUG, "Model lock released: " + fLockObject);
+ Logger.log(Logger.INFO, "Model lock released: " + fLockObject);
}
}
@@ -554,8 +549,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// methods can change the actual instance of the listener array from
// another thread
if (fModelStateListeners != null) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelAboutToBeReinitialized"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelAboutToBeReinitialized"); //$NON-NLS-1$ //$NON-NLS-2$
}
Object[] holdListeners = fModelStateListeners;
for (int i = 0; i < holdListeners.length; i++) {
@@ -608,8 +603,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// methods can change the actual instance of the listener array from
// another thread
if (fModelStateListeners != null) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelDirtyStateChanged"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelDirtyStateChanged"); //$NON-NLS-1$ //$NON-NLS-2$
}
Object[] holdListeners = fModelStateListeners;
for (int i = 0; i < holdListeners.length; i++) {
@@ -626,8 +621,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// methods can change the actual instance of the listener array from
// another thread
if (fModelStateListeners != null) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelReinitialized"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelReinitialized"); //$NON-NLS-1$ //$NON-NLS-2$
}
Object[] holdListeners = fModelStateListeners;
for (int i = 0; i < holdListeners.length; i++) {
@@ -649,8 +644,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// methods can change the actual instance of the listener array from
// another thread
if (fModelStateListeners != null) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelResourceDeleted"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelResourceDeleted"); //$NON-NLS-1$ //$NON-NLS-2$
}
Object[] holdListeners = fModelStateListeners;
for (int i = 0; i < holdListeners.length; i++) {
@@ -672,8 +667,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// methods can change the actual instance of the listener array from
// another thread
if (fModelStateListeners != null) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelResourceMoved"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelResourceMoved"); //$NON-NLS-1$ //$NON-NLS-2$
}
Object[] holdListeners = fModelStateListeners;
for (int i = 0; i < holdListeners.length; i++) {
@@ -852,8 +847,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// already in a model state changing sequence
if (fModelStateChanging == 0) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelAboutToBeChanged"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelAboutToBeChanged"); //$NON-NLS-1$ //$NON-NLS-2$
}
try {
@@ -901,8 +896,8 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
// That is, if we've received the same number of modelChanged as
// we have aboutToChangeModel.
if (fModelStateChanging == 0) {
- if (Logger.DEBUG && DEBUG_STATE) {
- Logger.log(Logger.INFO_DEBUG, "IModelStateListener event for " + getId() + " : modelChanged"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELSTATE) {
+ Logger.log(Logger.INFO, "IModelStateListener event for " + getId() + " : modelChanged"); //$NON-NLS-1$ //$NON-NLS-2$
}
endLock();
@@ -1033,7 +1028,7 @@ public abstract class AbstractStructuredModel implements IStructuredModel {
}
else {
if (Logger.DEBUG) {
- Logger.log(Logger.INFO_DEBUG, "indeed!!!"); //$NON-NLS-1$
+ Logger.log(Logger.INFO, "indeed!!!"); //$NON-NLS-1$
}
}
return result;
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/LifecycleNotificationManager.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/LifecycleNotificationManager.java
index 92a267181c..ee2a932f51 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/LifecycleNotificationManager.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/LifecycleNotificationManager.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.wst.sse.core.internal.model;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.sse.core.internal.Logger;
import org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener;
import org.eclipse.wst.sse.core.internal.util.Utilities;
@@ -23,10 +22,6 @@ import org.eclipse.wst.sse.core.internal.util.Utilities;
*/
class LifecycleNotificationManager {
- static final String DEFAULT_TRACE_CATEGORY = "org.eclipse.wst.sse.core/structuredmodel/lifecycle"; //$NON-NLS-1$
- static final boolean DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption(DEFAULT_TRACE_CATEGORY)); //$NON-NLS-1$
-
-
private Object[] fListeners;
LifecycleNotificationManager() {
@@ -45,8 +40,8 @@ class LifecycleNotificationManager {
* @param listener
*/
void addListener(IModelLifecycleListener listener) {
- if (Utilities.contains(fListeners, listener)) {
- Logger.log(Logger.WARNING_DEBUG, "IModelLifecycleListener " + listener + " listening more than once"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG && Utilities.contains(fListeners, listener)) {
+ Logger.log(Logger.WARNING, "IModelLifecycleListener " + listener + " listening more than once"); //$NON-NLS-1$ //$NON-NLS-2$
}
int oldSize = 0;
if (fListeners != null) {
@@ -93,14 +88,14 @@ class LifecycleNotificationManager {
// one
fListeners = newListeners;
}
- if (Utilities.contains(fListeners, listener)) {
- Logger.log(Logger.WARNING_DEBUG, "IModelLifecycleListener " + listener + " removed once but still listening"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG && Utilities.contains(fListeners, listener)) {
+ Logger.log(Logger.WARNING, "IModelLifecycleListener " + listener + " removed once but still listening"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
void signalLifecycleEvent(ModelLifecycleEvent event) {
- if (DEBUG) {
- Logger.trace(DEFAULT_TRACE_CATEGORY, "ModelLifecycleEvent fired for " + event.getModel().getId() + ": " + event.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_LIFECYCLE) {
+ Logger.log(Logger.INFO, "ModelLifecycleEvent fired for " + event.getModel().getId() + ": " + event.toString()); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("ModelLifecycleEvent fired for " + event.getModel().getId() + ": " + event.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
// We must assign listeners to local variable, since the add and
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java
index 28ab7f8444..f1c2cf1b8f 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java
@@ -136,8 +136,7 @@ public class ModelManagerImpl implements IModelManager {
referenceCountForEdit = 0;
}
}
-
- private static final String IMODELMANAGER_TRACE_CATEGORY = "IModelManager"; //$NON-NLS-1$
+
private Exception debugException = null;
/**
@@ -779,7 +778,8 @@ public class ModelManagerImpl implements IModelManager {
// impossible, since we're not sharing
// (even if it really is in use ... we don't care)
// this may need to be re-examined.
- Logger.trace(IMODELMANAGER_TRACE_CATEGORY, "ModelMangerImpl::createUnManagedStructuredModelFor. Model unexpectedly in use."); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELMANAGER)
+ Logger.log(Logger.INFO, "ModelMangerImpl::createUnManagedStructuredModelFor. Model unexpectedly in use."); //$NON-NLS-1$ //$NON-NLS-2$
}
return result;
@@ -824,7 +824,8 @@ public class ModelManagerImpl implements IModelManager {
// impossible, since we're not sharing
// (even if it really is in use ... we don't care)
// this may need to be re-examined.
- Logger.trace(IMODELMANAGER_TRACE_CATEGORY, "ModelMangerImpl::createUnManagedStructuredModelFor. Model unexpectedly in use."); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELMANAGER)
+ Logger.log(Logger.INFO, "ModelMangerImpl::createUnManagedStructuredModelFor. Model unexpectedly in use."); //$NON-NLS-1$ //$NON-NLS-2$
}
return result;
}
@@ -1566,8 +1567,8 @@ public class ModelManagerImpl implements IModelManager {
* Common trace method
*/
private void trace(String msg, Object id) {
- if (Logger.isTracing(IMODELMANAGER_TRACE_CATEGORY)) {
- Logger.trace(IMODELMANAGER_TRACE_CATEGORY, msg + " " + Utilities.makeShortId(id)); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_MODELMANAGER) {
+ Logger.log(Logger.INFO, msg + " " + Utilities.makeShortId(id)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -1575,8 +1576,8 @@ public class ModelManagerImpl implements IModelManager {
* Common trace method
*/
private void trace(String msg, Object id, int value) {
- if (Logger.isTracing(IMODELMANAGER_TRACE_CATEGORY)) {
- Logger.trace(IMODELMANAGER_TRACE_CATEGORY, msg + Utilities.makeShortId(id) + " (" + value + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (Logger.DEBUG_MODELMANAGER) {
+ Logger.log(Logger.INFO, msg + Utilities.makeShortId(id) + " (" + value + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/modelhandler/ModelHandlerRegistry.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/modelhandler/ModelHandlerRegistry.java
index df4dca88ed..0bd167934f 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/modelhandler/ModelHandlerRegistry.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/modelhandler/ModelHandlerRegistry.java
@@ -102,8 +102,8 @@ public class ModelHandlerRegistry {
}
}
}
- else {
- Logger.log(Logger.WARNING_DEBUG, "There were no Model Handler found in registry"); //$NON-NLS-1$
+ else if (Logger.DEBUG){
+ Logger.log(Logger.WARNING, "There were no Model Handler found in registry"); //$NON-NLS-1$
}
return found;
}
@@ -259,8 +259,8 @@ public class ModelHandlerRegistry {
}
}
}
- else {
- Logger.log(Logger.WARNING_DEBUG, "There were no Model Handler found in registry"); //$NON-NLS-1$
+ else if (Logger.DEBUG){
+ Logger.log(Logger.WARNING, "There were no Model Handler found in registry"); //$NON-NLS-1$
}
if (exactContentTypeElement != null) {
handler = reader.getInstance(exactContentTypeElement);
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java
index 9603640ef8..1014270cea 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java
@@ -30,7 +30,6 @@ import org.eclipse.wst.sse.core.internal.model.FactoryRegistry;
* Implementers of this INodeNotifier must subclass this class.
*/
public abstract class AbstractNotifier implements INodeNotifier {
- private final static boolean debugAdapterNotificationTime = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/dom/adapter/notification/time")); //$NON-NLS-1$ //$NON-NLS-2$
private final static int growthConstant = 3;
private int adapterCount = 0;
@@ -186,7 +185,7 @@ public abstract class AbstractNotifier implements INodeNotifier {
for (int i = 0; i < localAdapterCount; i++) {
INodeAdapter a = localAdapters[i];
- if (debugAdapterNotificationTime) {
+ if (Logger.DEBUG_ADAPTERNOTIFICATIONTIME) {
long getAdapterTimeCriteria = getAdapterTimeCriteria();
long startTime = System.currentTimeMillis();
// ** keep this line identical with non-debug version!!
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.java
index ab519d0215..6c2412e6f9 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.java
@@ -1483,7 +1483,8 @@ public class BasicStructuredDocument implements IStructuredDocument, IDocumentEx
result = getTracker().getLineNumberOfOffset(offset);
}
catch (BadLocationException e) {
- Logger.traceException("IStructuredDocument", "Dev. Program Info Only: IStructuredDocument::getLineOfOffset: offset out of range, zero assumed. offset = " + offset, e); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_DOCUMENT)
+ Logger.log(Logger.INFO, "Dev. Program Info Only: IStructuredDocument::getLineOfOffset: offset out of range, zero assumed. offset = " + offset, e); //$NON-NLS-1$ //$NON-NLS-2$
result = 0;
}
return result;
@@ -2492,7 +2493,8 @@ public class BasicStructuredDocument implements IStructuredDocument, IDocumentEx
preferedDelimiter = delimiter;
}
else {
- Logger.trace("IStructuredDocument", "Attempt to set linedelimiter to non-legal delimiter"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Logger.DEBUG_DOCUMENT)
+ Logger.log(Logger.INFO, "Attempt to set linedelimiter to non-legal delimiter"); //$NON-NLS-1$ //$NON-NLS-2$
preferedDelimiter = PlatformLineDelimiter;
}
}
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/JarUtilities.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/JarUtilities.java
index df43773e16..b9463b9c72 100644
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/JarUtilities.java
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/JarUtilities.java
@@ -50,7 +50,7 @@ public class JarUtilities {
}
catch (IOException ioe) {
// no cleanup can be done
- Logger.log(Logger.ERROR, "JarUtilities: Could not close file " + file.getName()); //$NON-NLS-1$
+ Logger.logException("JarUtilities: Could not close file " + file.getName(), ioe); //$NON-NLS-1$
}
}

Back to the top