Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.ResourceBundle;

import org.eclipse.compare.internal.CompareContainer;
import org.eclipse.compare.internal.CompareMessages;
import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.ResizableDialog;
import org.eclipse.compare.internal.StructureCreatorDescriptor;
Expand All @@ -37,6 +38,7 @@
import org.eclipse.compare.structuremergeviewer.IStructureCreator;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
Expand Down Expand Up @@ -141,7 +143,7 @@ private String getContent() {
fContent= Utilities.readString(sca);
} catch (CoreException ex) {
// NeedWork
CompareUIPlugin.log(ex);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.eclipse.compare.internal.CompareHandlerService;
import org.eclipse.compare.internal.CompareMessages;
import org.eclipse.compare.internal.ComparePreferencePage;
import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.ICompareUIConstants;
import org.eclipse.compare.internal.IFlushable2;
import org.eclipse.compare.internal.ISavingSaveable;
Expand All @@ -47,6 +46,7 @@
import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.action.Action;
Expand Down Expand Up @@ -135,8 +135,8 @@ public Point computeSize(Composite c, int w, int h, boolean force) {
public void layout(Composite composite, boolean force) {
if (fLeftLabel == null) {
if (composite.isDisposed()) {
CompareUIPlugin
.log(new IllegalArgumentException("Attempted to perform a layout on a disposed composite")); //$NON-NLS-1$
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error,
new IllegalArgumentException("Attempted to perform a layout on a disposed composite")); //$NON-NLS-1$
}
if (Policy.debugContentMergeViewer) {
logTrace("found bad label. Layout = " + System.identityHashCode(this) + ". composite = " //$NON-NLS-1$//$NON-NLS-2$
Expand All @@ -150,7 +150,7 @@ public void layout(Composite composite, boolean force) {

// Allow to test whether doing nothing helps
if (Boolean.getBoolean("ContentMergeViewer.DEBUG")) { //$NON-NLS-1$
CompareUIPlugin.log(npe);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, npe);
return;
}

Expand Down Expand Up @@ -958,7 +958,7 @@ public void run() {
try {
((IPersistentPreferenceStore) preferences).save();
} catch (IOException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
Expand Down Expand Up @@ -628,7 +629,7 @@ public void setEncoding(String encoding) {
try {
fDocumentProvider.resetDocument(fDocumentKey);
} catch (CoreException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
} finally {
update(true);
updateStructure(fLeg);
Expand Down Expand Up @@ -915,7 +916,7 @@ private IDocument connectToSharedDocument() {
return newDoc;
} catch (CoreException e) {
// Connection failed. Log the error and continue without a shared document
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
}
}
}
Expand Down Expand Up @@ -3737,7 +3738,7 @@ private void doDiff() {
try {
fMerger.doDiff();
} catch (CoreException e) {
CompareUIPlugin.log(e.getStatus());
ILog.of(getClass()).log(e.getStatus());
String title= Utilities.getString(getResourceBundle(), "tooComplexError.title"); //$NON-NLS-1$
String msg= Utilities.getString(getResourceBundle(), "tooComplexError.message"); //$NON-NLS-1$
MessageDialog.openError(fComposite.getShell(), title, msg);
Expand All @@ -3750,7 +3751,7 @@ private Diff findDiff(char type, int pos) {
try {
return fMerger.findDiff(type, pos);
} catch (CoreException e) {
CompareUIPlugin.log(e.getStatus());
ILog.of(getClass()).log(e.getStatus());
String title= Utilities.getString(getResourceBundle(), "tooComplexError.title"); //$NON-NLS-1$
String msg= Utilities.getString(getResourceBundle(), "tooComplexError.message"); //$NON-NLS-1$
MessageDialog.openError(fComposite.getShell(), title, msg);
Expand Down Expand Up @@ -5616,7 +5617,7 @@ private void handleException(Throwable throwable) {
handleException(ite.getTargetException());
return;
}
CompareUIPlugin.log(throwable);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, throwable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
Expand Down Expand Up @@ -112,7 +113,7 @@ public void setInput(Object input) {
}
} catch (CoreException | IOException ex) {
message = Utilities.getString(fBundle, "errorMessage"); //$NON-NLS-1$
CompareUIPlugin.log(ex);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, ex);
}
if (message != null) {
fMessage.setText(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
Expand Down Expand Up @@ -589,12 +590,12 @@ private Saveable[] internalGetSaveables(boolean init) {
} else {
for (Saveable saveable : sourceSaveables) {
if (!knownSaveables.contains(saveable)) {
CompareUIPlugin.logErrorMessage(NLS.bind("Saveable {0} was not added using a saveables lifecycle event.", saveable.getName())); //$NON-NLS-1$
ILog.of(getClass()).error(NLS.bind("Saveable {0} was not added using a saveables lifecycle event.", saveable.getName())); //$NON-NLS-1$
knownSaveables.add(saveable);
}
}
if (sourceSaveables.length != knownSaveables.size()) {
CompareUIPlugin.logErrorMessage("Saveables were removed without an appropriate event"); //$NON-NLS-1$
ILog.of(getClass()).error("Saveables were removed without an appropriate event"); //$NON-NLS-1$
knownSaveables.clear();
recordSaveables(sourceSaveables);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
Expand Down Expand Up @@ -95,7 +96,7 @@ public ICompareFilter createCompareFilter() {
return (ICompareFilter) fConfiguration
.createExecutableExtension(CLASS_ATTRIBUTE);
} catch (CoreException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
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 @@ -166,7 +167,7 @@ void createBinding(IConfigurationElement element, String idAttributeName) {
String type= element.getAttribute(CONTENT_TYPE_ID_ATTRIBUTE);
String id= element.getAttribute(idAttributeName);
if (id == null) {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.targetIdAttributeMissing", idAttributeName)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.targetIdAttributeMissing", idAttributeName)); //$NON-NLS-1$
}
if (type != null && id != null && fIdMap != null) {
T o= fIdMap.get(id);
Expand All @@ -182,10 +183,10 @@ void createBinding(IConfigurationElement element, String idAttributeName) {
}
l.add(o);
} else {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.contentTypeNotFound", type)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.contentTypeNotFound", type)); //$NON-NLS-1$
}
} else {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.targetNotFound", id)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.targetNotFound", id)); //$NON-NLS-1$
}
}
}
Expand Down Expand Up @@ -410,7 +411,7 @@ private void registerExtensions() {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!STRUCTURE_CREATOR.equals(name)) {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, STRUCTURE_CREATOR)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, STRUCTURE_CREATOR)); //$NON-NLS-1$
}
fStructureCreators.register(element, new StructureCreatorDescriptor(element));
}
Expand All @@ -427,7 +428,7 @@ private void registerExtensions() {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!VIEWER_TAG.equals(name)) {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, VIEWER_TAG)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, VIEWER_TAG)); //$NON-NLS-1$
}
fStructureMergeViewers.register(element, new ViewerDescriptor(element));
}
Expand All @@ -444,7 +445,7 @@ private void registerExtensions() {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!VIEWER_TAG.equals(name)) {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, VIEWER_TAG)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, VIEWER_TAG)); //$NON-NLS-1$
}
fContentMergeViewers.register(element, new ViewerDescriptor(element));
}
Expand All @@ -462,7 +463,7 @@ private void registerExtensions() {
String name = element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!FILTER_TAG.equals(name)) {
logErrorMessage(Utilities.getFormattedString(
ILog.of(getClass()).error(Utilities.getFormattedString(
"CompareUIPlugin.unexpectedTag", name, FILTER_TAG)); //$NON-NLS-1$
}
fCompareFilters.register(element, new CompareFilterDescriptor(element));
Expand All @@ -481,7 +482,7 @@ private void registerExtensions() {
String name= element.getName();
if (!CONTENT_TYPE_BINDING.equals(name)) {
if (!VIEWER_TAG.equals(name)) {
logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, VIEWER_TAG)); //$NON-NLS-1$
ILog.of(getClass()).error(Utilities.getFormattedString("CompareUIPlugin.unexpectedTag", name, VIEWER_TAG)); //$NON-NLS-1$
}
fContentViewers.register(element, new ViewerDescriptor(element));
}
Expand Down Expand Up @@ -659,7 +660,7 @@ private boolean openUnifiedDiffInEditor(final CompareEditorInput input, final IW
}
}
} catch (PartInitException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
}
}
return false;
Expand Down Expand Up @@ -693,7 +694,7 @@ private String getSourceOf(IStreamContentAccessor right) {
String result = toString(right.getContents());
return result;
} catch (CoreException | IOException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
}
// UnifiedDiff.Builder requires a non-null source. Return an empty string so
// the unified diff path can still attempt to open and the fallback to the
Expand Down Expand Up @@ -785,7 +786,7 @@ private LeftEditorInputAndRightStreamContentAccessor canShowInUnifiedDiff(Compar
return new LeftEditorInputAndRightStreamContentAccessor(leftEditorInput, left, leftSa, rightEditorInput,
right, rightSa, documentMergerInput);
} catch (InvocationTargetException | InterruptedException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
}
return null;
}
Expand Down Expand Up @@ -1791,21 +1792,6 @@ public static IEditorPart[] getDirtyEditors() {
return result.toArray(new IEditorPart[result.size()]);
}

public static void logErrorMessage(String message) {
if (message == null) {
message= ""; //$NON-NLS-1$
}
log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, message, null));
}

public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, CompareMessages.ComparePlugin_internal_error, e));
}

public static void log(IStatus status) {
getDefault().getLog().log(status);
}

String findContentTypeNameOrType(ICompareInput input, ViewerDescriptor vd, CompareConfiguration cc) {
IContentType ctype= getCommonType(input);
if (ctype != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
Expand Down Expand Up @@ -649,7 +650,7 @@ private IResource linkResource(IPath path) {
((IFolder)r).createLink(path, IResource.REPLACE, null);
}
} catch (CoreException e) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
MessageDialog.openError(getShell(),
CompareMessages.CompareWithOtherResourceDialog_externalFile_errorTitle,
CompareMessages.CompareWithOtherResourceDialog_externalFile_errorMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.lang.reflect.InvocationTargetException;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
Expand All @@ -39,7 +40,7 @@ public class ExceptionHandler {
* logged as an error with the error code <code>JavaStatusConstants.INTERNAL_ERROR</code>.
*/
public static void log(Throwable t, String message) {
CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(),
ILog.of(ExceptionHandler.class).log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(),
CompareUIPlugin.INTERNAL_ERROR, message, t));
}

Expand Down Expand Up @@ -94,7 +95,7 @@ public static void handle(InvocationTargetException e, Shell parent, String titl
//---- Hooks for subclasses to control exception handling ------------------------------------

protected void perform(CoreException e, Shell shell, String title, String message) {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
IStatus status= e.getStatus();
if (status != null) {
ErrorDialog.openError(shell, title, message, status);
Expand All @@ -108,7 +109,7 @@ protected void perform(InvocationTargetException e, Shell shell, String title, S
if (target instanceof CoreException) {
perform((CoreException)target, shell, title, message);
} else {
CompareUIPlugin.log(e);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, e);
if (e.getMessage() != null && e.getMessage().length() > 0) {
displayMessageDialog(e, e.getMessage(), shell, title, message);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -63,7 +64,7 @@ private String getString(Object input) {
return Utilities.readString((IStreamContentAccessor) input);
} catch (CoreException ex) {
// NeedWork
CompareUIPlugin.log(ex);
ILog.of(getClass()).error(CompareMessages.ComparePlugin_internal_error, ex);
}
}
return ""; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.compare.structuremergeviewer.IStructureCreator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.ILog;

/**
* A factory proxy for creating a StructureCreator.
Expand All @@ -41,7 +42,7 @@ public IStructureCreator createStructureCreator() {
try {
return (IStructureCreator)fElement.createExecutableExtension(CLASS_ATTRIBUTE);
} catch (CoreException ex) {
CompareUIPlugin.log(ex.getStatus());
ILog.of(getClass()).log(ex.getStatus());
//ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$
return null;
} catch (ClassCastException ex) {
Expand Down
Loading
Loading