From b2c2d72f23385909e7e6f7ff2d874dec6785cfcf Mon Sep 17 00:00:00 2001 From: Sean Evoy Date: Fri, 25 Jun 2004 18:20:46 +0000 Subject: [PATCH] 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. --- .../internal/ui/ManagedBuilderUIPlugin.java | 42 ------------------- .../actions/UpdateManagedProjectAction.java | 38 +++++++++-------- 2 files changed, 20 insertions(+), 60 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIPlugin.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIPlugin.java index 9b32e9765d3..6f6225272e3 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIPlugin.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIPlugin.java @@ -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 Shell associated with the active workbench, or * one of the windows associated with the workbench. diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java index e9a0bdea0df..35b568bf141 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java @@ -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$ } }