Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2020-10-28 09:11:09 +0000
committerLars Vogel2020-10-29 11:59:30 +0000
commitf58e7b5cdd34536044d15bcbaf27d105969b836f (patch)
treec76da2fd6198e3ea5e335038fb951f9added61ba
parentdfece32a7316d832340fe5c2fe7f58c42b6db708 (diff)
downloadeclipse.platform.text-f58e7b5cdd34536044d15bcbaf27d105969b836f.tar.gz
eclipse.platform.text-f58e7b5cdd34536044d15bcbaf27d105969b836f.tar.xz
eclipse.platform.text-f58e7b5cdd34536044d15bcbaf27d105969b836f.zip
Bug 568328 - Change org.eclipse.core.filebuffers to use an util classY20201030-1200Y20201029-1200I20201029-1800
instead of an activator As other plug-ins may also access the string constant the name FileBuffersPlugin is left as is. The logging via the activator has been replaced by standard platform logging. Also the access to the ITextFileBufferManager has been moved to a static method and field, so the activator is not required anymore. Change-Id: I394e121d7a65f82788231bb6b59287d6438cdb7a Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.core.filebuffers/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java3
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java2
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java4
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java33
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java7
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java6
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java6
8 files changed, 15 insertions, 48 deletions
diff --git a/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF b/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF
index 1ef96fc55..25e350d68 100644
--- a/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF
+++ b/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF
@@ -3,8 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.filebuffers; singleton:=true
Bundle-Version: 3.6.1100.qualifier
-Bundle-Activator: org.eclipse.core.internal.filebuffers.FileBuffersPlugin
-Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package:
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
index ec5443023..fe52256fe 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
@@ -82,8 +82,7 @@ public final class FileBuffers {
* @return the text file buffer manager or <code>null</code>
*/
public static ITextFileBufferManager getTextFileBufferManager() {
- FileBuffersPlugin plugin= FileBuffersPlugin.getDefault();
- return plugin != null ? plugin.getFileBufferManager() : null;
+ return FileBuffersPlugin.getFileBufferManager();
}
/**
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
index 0fa233ce5..0edb7c4dc 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
@@ -40,7 +40,7 @@ public interface ITextFileBufferManager extends IFileBufferManager {
* The default text file buffer manager.
* @since 3.3
*/
- ITextFileBufferManager DEFAULT= FileBuffersPlugin.getDefault().getFileBufferManager();
+ ITextFileBufferManager DEFAULT= FileBuffersPlugin.getFileBufferManager();
/**
* Returns the text file buffer managed for the file at the given location
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
index c23158ed4..6a9c46085 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
@@ -26,7 +26,6 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
@@ -176,8 +175,7 @@ public class ExtensionsRegistry {
* @param status the status to log
*/
private void log(IStatus status) {
- ILog log= FileBuffersPlugin.getDefault().getLog();
- log.log(status);
+ Platform.getLog(ExtensionsRegistry.class).log(status);
}
/**
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java
index affccbe74..890c7362b 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java
@@ -15,51 +15,24 @@ package org.eclipse.core.internal.filebuffers;
import org.osgi.framework.Bundle;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
-/**
- * The plug-in runtime class for the file buffers plug-in (id <code>"org.eclipse.core.filebuffers"</code>).
- *
- * @since 3.0
- */
-public class FileBuffersPlugin extends Plugin {
+public class FileBuffersPlugin {
public static final String PLUGIN_ID= "org.eclipse.core.filebuffers"; //$NON-NLS-1$
- /** The shared plug-in instance */
- private static FileBuffersPlugin fgPlugin;
- /** The file buffer manager */
- private ITextFileBufferManager fTextFileBufferManager;
-
- /**
- * Creates a plug-in instance.
- */
- public FileBuffersPlugin() {
- Assert.isTrue(fgPlugin == null);
- fgPlugin= this;
- }
-
- /**
- * Returns the shared instance.
- *
- * @return the default plug-in instance
- */
- public static FileBuffersPlugin getDefault() {
- return fgPlugin;
- }
+ private static ITextFileBufferManager fTextFileBufferManager;
/**
* Returns the text file buffer manager of this plug-in.
*
* @return the text file buffer manager of this plug-in
*/
- public synchronized ITextFileBufferManager getFileBufferManager() {
+ public static synchronized ITextFileBufferManager getFileBufferManager() {
if (fTextFileBufferManager == null) {
Bundle resourcesBundle= Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
if (resourcesBundle != null)
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
index 49371841e..ca6eaa482 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
@@ -19,12 +19,12 @@ import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
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;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
@@ -85,7 +85,7 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
try {
execute();
} catch (Exception x) {
- FileBuffersPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "Exception when synchronizing", x)); //$NON-NLS-1$
+ Platform.getLog(ResourceFileBuffer.class).error("Exception when synchronizing", x); //$NON-NLS-1$
fManager.fireStateChangeFailed(ResourceFileBuffer.this);
}
}
@@ -451,8 +451,7 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
* @param exception the exception to be logged
*/
protected void handleCoreException(CoreException exception) {
- ILog log= FileBuffersPlugin.getDefault().getLog();
- log.log(exception.getStatus());
+ Platform.getLog(ResourceFileBuffer.class).log(exception.getStatus());
}
@Override
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
index 0e74e44c6..c4822424f 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
@@ -152,13 +152,13 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
if (document.getDocumentPartitioner() != null) {
String message= NLSUtility.format(FileBuffersMessages.TextFileBufferManager_warning_documentSetupInstallsDefaultPartitioner, participant.getClass());
IStatus status= new Status(IStatus.WARNING, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, message, null);
- FileBuffersPlugin.getDefault().getLog().log(status);
+ Platform.getLog(ResourceTextFileBufferManager.class).log(status);
}
}
@Override
public void handleException(Throwable t) {
IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentSetupFailed, t);
- FileBuffersPlugin.getDefault().getLog().log(status);
+ Platform.getLog(ResourceTextFileBufferManager.class).log(status);
}
};
SafeRunner.run(runnable);
@@ -189,7 +189,7 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
@Override
public void handleException(Throwable t) {
IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t);
- FileBuffersPlugin.getDefault().getLog().log(status);
+ Platform.getLog(ResourceTextFileBufferManager.class).log(status);
}
};
SafeRunner.run(runnable);
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
index 885f9cbd4..25b2af215 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
@@ -463,13 +463,13 @@ public class TextFileBufferManager implements ITextFileBufferManager {
if (document.getDocumentPartitioner() != null) {
String message= NLSUtility.format(FileBuffersMessages.TextFileBufferManager_warning_documentSetupInstallsDefaultPartitioner, participant.getClass());
IStatus status= new Status(IStatus.WARNING, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, message, null);
- FileBuffersPlugin.getDefault().getLog().log(status);
+ Platform.getLog(ResourceTextFileBufferManager.class).log(status);
}
}
@Override
public void handleException(Throwable t) {
IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentSetupFailed, t);
- FileBuffersPlugin.getDefault().getLog().log(status);
+ Platform.getLog(ResourceTextFileBufferManager.class).log(status);
}
};
SafeRunner.run(runnable);
@@ -502,7 +502,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
@Override
public void handleException(Throwable t) {
IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t);
- FileBuffersPlugin.getDefault().getLog().log(status);
+ Platform.getLog(ResourceTextFileBufferManager.class).log(status);
}
};
SafeRunner.run(runnable);

Back to the top