Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2009-05-12 14:05:17 -0400
committerVivian Kong2009-05-12 14:05:17 -0400
commitd8ecb7cb4dafe143b5ccf348958652aeb0f4807f (patch)
tree1a3f6648500692d7405da161406acd0ee0604601
parent4114e7e2dde956f12168229f19ee16685b037a69 (diff)
downloadorg.eclipse.cdt-d8ecb7cb4dafe143b5ccf348958652aeb0f4807f.tar.gz
org.eclipse.cdt-d8ecb7cb4dafe143b5ccf348958652aeb0f4807f.tar.xz
org.eclipse.cdt-d8ecb7cb4dafe143b5ccf348958652aeb0f4807f.zip
bug 268840 (finally)
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java26
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/messages.properties12
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java20
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java56
4 files changed, 90 insertions, 24 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 0000000000..3ec898a764
--- /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 0000000000..70ad243548
--- /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 aee6dfd21b..3a9b53c23b 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, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -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 ";
+ private String fMakeCommand = "-f ${project_name}_scd.mk "; //$NON-NLS-1$
/* (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 ";
+ args = " -E -P -v -dD "; //$NON-NLS-1$
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)); //$NON-NLS-1$
+ File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName));
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"))
+ if(arg.equals("-f")) //$NON-NLS-1$
found = true;
}
- return projectName+"_scd.mk";
+ return projectName+"_scd.mk"; //$NON-NLS-1$
}
@@ -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\\}",
- GCCScannerConfigUtil.C_SPECS_FILE ); //$NON-NLS-1$
+ string = string.replaceAll("\\$\\{specs_file\\}", //$NON-NLS-1$
+ GCCScannerConfigUtil.C_SPECS_FILE );
return string;
}
@Override
protected String[] getCommandLineOptions() {
- return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\"");
+ return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\""); //$NON-NLS-1$
}
@Override
protected IPath getCommandToLaunch() {
- return new Path("make");
+ return new Path("make"); //$NON-NLS-1$
}
}
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 0f52988d3c..5d82155895 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, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -17,10 +17,16 @@ 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
@@ -49,7 +55,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
*/
- public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
+ public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
try {
IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
/*
@@ -65,19 +71,41 @@ 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) {
- 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());
- }
+ @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();
+
}
catch (CoreException e) {
CCorePlugin.log(e.getStatus());

Back to the top