mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
I am removing the logging feature from the plugin, and will replace it latter with proper console debugging messages. There wwere a raft of tester bugs that I caused by using the log to report non-critical exceptions I was handling.
This commit is contained in:
parent
b163fa15a6
commit
b2c2d72f23
2 changed files with 20 additions and 60 deletions
|
@ -19,7 +19,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
|
@ -114,47 +113,6 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
|
|||
return ResourcesPlugin.getWorkspace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to log an exception without displaying a
|
||||
* message dialog
|
||||
* @param e
|
||||
*/
|
||||
public static void logException(Throwable e) {
|
||||
logException(e, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exception
|
||||
* @param string
|
||||
* @param string2
|
||||
*/
|
||||
public static void logException(Throwable exception, final String title, String message) {
|
||||
if (exception instanceof InvocationTargetException) {
|
||||
exception = ((InvocationTargetException) exception).getTargetException();
|
||||
}
|
||||
IStatus status = null;
|
||||
if (exception instanceof CoreException)
|
||||
status = ((CoreException) exception).getStatus();
|
||||
else {
|
||||
if (message == null)
|
||||
message = exception.getMessage();
|
||||
if (message == null)
|
||||
message = exception.toString();
|
||||
status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, message, exception);
|
||||
}
|
||||
ResourcesPlugin.getPlugin().getLog().log(status);
|
||||
Display display;
|
||||
display = Display.getCurrent();
|
||||
if (display == null)
|
||||
display = Display.getDefault();
|
||||
final IStatus fstatus = status;
|
||||
display.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
ErrorDialog.openError(null, title, null, fstatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Answers the <code>Shell</code> associated with the active workbench, or
|
||||
* one of the windows associated with the workbench.
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
|||
import javax.xml.parsers.FactoryConfigurationError;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
|
@ -373,7 +374,7 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
|
|||
convertConfiguration(newTarget, newParent, (Element) configNodes.item(configIndex), monitor);
|
||||
}
|
||||
} catch (BuildException e) {
|
||||
ManagedBuilderUIPlugin.logException(e);
|
||||
// Probably just a mismatch between option value and option
|
||||
}
|
||||
|
||||
monitor.worked(1);
|
||||
|
@ -500,20 +501,23 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
|
|||
IProject[] projects = ManagedBuilderUIPlugin.getWorkspace().getRoot().getProjects();
|
||||
Vector result = new Vector();
|
||||
for (int index = projects.length - 1; index >=0 ; --index) {
|
||||
IProjectDescription description;
|
||||
try {
|
||||
description = projects[index].getDescription();
|
||||
} catch (CoreException e) {
|
||||
continue;
|
||||
}
|
||||
// Make sure it has a managed nature
|
||||
if (description == null || !description.hasNature(ManagedCProjectNature.MNG_NATURE_ID)) {
|
||||
continue;
|
||||
}
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[index]);
|
||||
if (info != null && info.getVersion()== null) {
|
||||
// This is a pre-2.0 file (no version info)
|
||||
result.add(projects[index]);
|
||||
if (projects[index].isAccessible()) {
|
||||
IProjectDescription description;
|
||||
try {
|
||||
description = projects[index].getDescription();
|
||||
} catch (CoreException e) {
|
||||
// This can only mean that something really bad has happened
|
||||
continue;
|
||||
}
|
||||
// Make sure it has a managed nature
|
||||
if (description == null || !description.hasNature(ManagedCProjectNature.MNG_NATURE_ID)) {
|
||||
continue;
|
||||
}
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[index]);
|
||||
if (info != null && info.getVersion()== null) {
|
||||
// This is a pre-2.0 file (no version info)
|
||||
result.add(projects[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -562,9 +566,7 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
|
|||
} catch (InterruptedException e) {
|
||||
return;
|
||||
} catch (InvocationTargetException e) {
|
||||
ManagedBuilderUIPlugin.logException(e,
|
||||
ManagedBuilderUIMessages.getResourceString("ManagedBuilderStartup.update.exception.error"), //$NON-NLS-1$
|
||||
ManagedBuilderUIMessages.getFormattedString("ManagedBuilderStartup.update.exception.message", project.getName())); //$NON-NLS-1$
|
||||
CCorePlugin.log(e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue