diff options
author | Vivian Kong | 2009-05-12 15:31:32 +0000 |
---|---|---|
committer | Vivian Kong | 2009-05-12 15:31:32 +0000 |
commit | f9dc42c4657c98e309ed38948b5670cb628c1ab7 (patch) | |
tree | 783b1ac609ffa1576011d5f2f199b4b5059874fb | |
parent | 18250db2050ec4d8f3c3fb60e66cb55514711ba7 (diff) | |
download | org.eclipse.cdt-f9dc42c4657c98e309ed38948b5670cb628c1ab7.tar.gz org.eclipse.cdt-f9dc42c4657c98e309ed38948b5670cb628c1ab7.tar.xz org.eclipse.cdt-f9dc42c4657c98e309ed38948b5670cb628c1ab7.zip |
bug 268840
4 files changed, 62 insertions, 52 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java new file mode 100644 index 00000000000..3ec898a764d --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.make.core.messages; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.make.core.messages.messages"; //$NON-NLS-1$ + public static String SCMarkerGenerator_0; + public static String SCMarkerGenerator_1; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/messages.properties b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/messages.properties new file mode 100644 index 00000000000..70ad243548d --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/messages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +SCMarkerGenerator_0=Add markers to project +SCMarkerGenerator_1=Error adding markers. diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java index 3a9b53c23b4..aee6dfd21b2 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,7 @@ import org.eclipse.core.runtime.Path; public class SCDMakefileGenerator extends DefaultRunSIProvider { private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$ private static final String DENDL = ENDL+ENDL; - private String fMakeCommand = "-f ${project_name}_scd.mk "; //$NON-NLS-1$ + private String fMakeCommand = "-f ${project_name}_scd.mk "; /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize() @@ -44,7 +44,7 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider { protected boolean initialize() { String args = buildInfo.getProviderRunArguments(providerId); if (null == args) - args = " -E -P -v -dD "; //$NON-NLS-1$ + args = " -E -P -v -dD "; else { int nPos = args.indexOf('|'); if(nPos > 0) { @@ -106,7 +106,7 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider { buffer.append(DENDL); } - File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName)); + File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName)); //$NON-NLS-1$ try { PrintStream ps = new PrintStream(new FileOutputStream(makefile)); ps.println(buffer.toString()); @@ -128,10 +128,10 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider { for(String arg : makeArgs) { if(found) return arg; - if(arg.equals("-f")) //$NON-NLS-1$ + if(arg.equals("-f")) found = true; } - return projectName+"_scd.mk"; //$NON-NLS-1$ + return projectName+"_scd.mk"; } @@ -143,18 +143,18 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider { resource.getProject().getName()); string = string.replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$ MakeCorePlugin.getWorkingDirectory().toString()); - string = string.replaceAll("\\$\\{specs_file\\}", //$NON-NLS-1$ - GCCScannerConfigUtil.C_SPECS_FILE ); + string = string.replaceAll("\\$\\{specs_file\\}", + GCCScannerConfigUtil.C_SPECS_FILE ); //$NON-NLS-1$ return string; } @Override protected String[] getCommandLineOptions() { - return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\""); //$NON-NLS-1$ + return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\""); } @Override protected IPath getCommandToLaunch() { - return new Path("make"); //$NON-NLS-1$ + return new Path("make"); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java index 5d82155895e..0f52988d3c3 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,16 +17,10 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IMarkerGenerator; import org.eclipse.cdt.core.ProblemMarkerInfo; import org.eclipse.cdt.core.model.ICModelMarker; -import org.eclipse.cdt.make.core.MakeCorePlugin; -import org.eclipse.cdt.make.core.messages.Messages; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; /** * Scanner config discovery related marker generator @@ -55,7 +49,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo) */ - public void addMarker(final ProblemMarkerInfo problemMarkerInfo) { + public void addMarker(ProblemMarkerInfo problemMarkerInfo) { try { IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE); /* @@ -71,41 +65,19 @@ public class SCMarkerGenerator implements IMarkerGenerator { } } } - - // we have to add the marker in the job or we can deadlock other - // threads that are responding to a resource delta by doing something - // that accesses the project description - Job markerJob = new Job(Messages.SCMarkerGenerator_0) { - @Override - protected IStatus run(IProgressMonitor monitor) { - IMarker marker; - try { - marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description); - marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity)); - marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber); - marker.setAttribute(IMarker.CHAR_START, -1); - marker.setAttribute(IMarker.CHAR_END, -1); - - if (problemMarkerInfo.variableName != null) { - marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName); - } - if (problemMarkerInfo.externalPath != null) { - marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString()); - } - } catch (CoreException e) { - return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_1, e); - } - - return Status.OK_STATUS; - } - - }; - - markerJob.setRule(problemMarkerInfo.file); - markerJob.schedule(); - + IMarker marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER); + marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description); + marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity)); + marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber); + marker.setAttribute(IMarker.CHAR_START, -1); + marker.setAttribute(IMarker.CHAR_END, -1); + if (problemMarkerInfo.variableName != null) { + marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName); + } + if (problemMarkerInfo.externalPath != null) { + marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString()); + } } catch (CoreException e) { CCorePlugin.log(e.getStatus()); |