mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added simplified global console (MessageConsole) for
AbstractBuiltinSpecsDetector
This commit is contained in:
parent
7be2df0dde
commit
e314ac4b68
8 changed files with 241 additions and 33 deletions
|
@ -35,7 +35,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
||||||
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
||||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||||
|
org.eclipse.ui.console;bundle-version="3.5.100"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||||
Import-Package: com.ibm.icu.text
|
Import-Package: com.ibm.icu.text
|
||||||
|
|
|
@ -563,4 +563,11 @@
|
||||||
class="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole">
|
class="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole">
|
||||||
</CBuildConsole>
|
</CBuildConsole>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.CBuildConsole">
|
||||||
|
<CBuildConsole
|
||||||
|
id="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryGlobalConsole"
|
||||||
|
class="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryGlobalConsole">
|
||||||
|
</CBuildConsole>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011, 2011 Andrew Gvozdev 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:
|
||||||
|
* Andrew Gvozdev - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.make.internal.ui.scannerconfig;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||||
|
import org.eclipse.cdt.internal.core.ICConsole;
|
||||||
|
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderAssociation;
|
||||||
|
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.Assert;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.ui.console.ConsolePlugin;
|
||||||
|
import org.eclipse.ui.console.IConsole;
|
||||||
|
import org.eclipse.ui.console.IConsoleManager;
|
||||||
|
import org.eclipse.ui.console.MessageConsole;
|
||||||
|
import org.eclipse.ui.console.MessageConsoleStream;
|
||||||
|
|
||||||
|
public class ScannerDiscoveryGlobalConsole implements ICConsole {
|
||||||
|
private MessageConsole console;
|
||||||
|
private ConsoleOutputStreamAdapter stream;
|
||||||
|
|
||||||
|
private class ConsoleOutputStreamAdapter extends ConsoleOutputStream {
|
||||||
|
private MessageConsoleStream fConsoleStream;
|
||||||
|
public ConsoleOutputStreamAdapter(MessageConsoleStream stream) {
|
||||||
|
fConsoleStream = stream;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void write(int arg0) throws IOException {
|
||||||
|
fConsoleStream.write(arg0);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public synchronized void write(byte[] b, int off, int len) throws IOException {
|
||||||
|
fConsoleStream.write(b, off, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush() throws IOException {
|
||||||
|
fConsoleStream.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
fConsoleStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start(IProject project) {
|
||||||
|
Assert.isTrue(project == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsoleOutputStream getOutputStream() throws CoreException {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsoleOutputStream getInfoStream() throws CoreException {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsoleOutputStream getErrorStream() throws CoreException {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(String consoleId, String name, URL defaultIconUrl) {
|
||||||
|
console = null;
|
||||||
|
|
||||||
|
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
|
||||||
|
IConsole[] allConsoles = consoleManager.getConsoles();
|
||||||
|
for (IConsole con : allConsoles) {
|
||||||
|
if (name.equals(con.getName()) && con instanceof MessageConsole) {
|
||||||
|
console = (MessageConsole) con;
|
||||||
|
console.clearConsole();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (console==null) {
|
||||||
|
URL iconUrl = LanguageSettingsProviderAssociation.getImageUrl(consoleId);
|
||||||
|
if (iconUrl==null) {
|
||||||
|
iconUrl = defaultIconUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
console = new MessageConsole(name, CDTSharedImages.getImageDescriptor(iconUrl.toString()));
|
||||||
|
console.activate();
|
||||||
|
consoleManager.addConsoles(new IConsole[]{ console });
|
||||||
|
}
|
||||||
|
|
||||||
|
stream = new ConsoleOutputStreamAdapter(console.newMessageStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -617,14 +617,6 @@
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
id="headlessSettings"
|
|
||||||
name="HeadlessBuilder Additional Settings"
|
|
||||||
point="org.eclipse.cdt.core.externalSettingsProvider">
|
|
||||||
<provider
|
|
||||||
class="org.eclipse.cdt.managedbuilder.internal.core.HeadlessBuilderExternalSettingsProvider">
|
|
||||||
</provider>
|
|
||||||
</extension>
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
<provider
|
<provider
|
||||||
|
@ -633,5 +625,24 @@
|
||||||
name="CDT Managed Build Setting Entries">
|
name="CDT Managed Build Setting Entries">
|
||||||
</provider>
|
</provider>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="scanner.discovery.problem"
|
||||||
|
name="C/C++ Scanner Discovery Problem"
|
||||||
|
point="org.eclipse.core.resources.markers">
|
||||||
|
<super
|
||||||
|
type="org.eclipse.core.resources.problemmarker">
|
||||||
|
</super>
|
||||||
|
<persistent
|
||||||
|
value="true">
|
||||||
|
</persistent>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="headlessSettings"
|
||||||
|
name="HeadlessBuilder Additional Settings"
|
||||||
|
point="org.eclipse.cdt.core.externalSettingsProvider">
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.managedbuilder.internal.core.HeadlessBuilderExternalSettingsProvider">
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -423,7 +423,7 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
|
|
||||||
if(clParserList.size() != 0){
|
if(clParserList.size() != 0){
|
||||||
IConsoleParser[] parsers = clParserList.toArray(new IConsoleParser[clParserList.size()]);
|
IConsoleParser[] parsers = clParserList.toArray(new IConsoleParser[clParserList.size()]);
|
||||||
return new ConsoleOutputSniffer(outputStream, errorStream, parsers, epm);
|
return new ConsoleOutputSniffer(outputStream, errorStream, parsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -4825,7 +4825,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
||||||
if (detector.getLanguageScope()==null || detector.getLanguageScope().contains(languageId)) {
|
if (detector.getLanguageScope()==null || detector.getLanguageScope().contains(languageId)) {
|
||||||
try {
|
try {
|
||||||
if (isWorkspaceProvider) {
|
if (isWorkspaceProvider) {
|
||||||
detector.run(project, languageId, workingDirectory, env, monitor);
|
detector.run((IProject)null, languageId, workingDirectory, env, monitor);
|
||||||
} else {
|
} else {
|
||||||
detector.run(cfgDescription, languageId, workingDirectory, env, monitor);
|
detector.run(cfgDescription, languageId, workingDirectory, env, monitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import org.eclipse.cdt.core.CommandLauncher;
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.ICommandLauncher;
|
import org.eclipse.cdt.core.ICommandLauncher;
|
||||||
import org.eclipse.cdt.core.IConsoleParser;
|
import org.eclipse.cdt.core.IConsoleParser;
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.LanguageManager;
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
import org.eclipse.cdt.core.resources.IConsole;
|
||||||
|
@ -35,7 +37,6 @@ import org.eclipse.cdt.make.core.scannerconfig.AbstractLanguageSettingsOutputSca
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ILanguageSettingsBuiltinSpecsDetector;
|
import org.eclipse.cdt.make.core.scannerconfig.ILanguageSettingsBuiltinSpecsDetector;
|
||||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
import org.eclipse.cdt.make.internal.core.StreamMonitor;
|
import org.eclipse.cdt.make.internal.core.StreamMonitor;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCMarkerGenerator;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
@ -43,8 +44,11 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.utils.CommandLineUtil;
|
import org.eclipse.cdt.utils.CommandLineUtil;
|
||||||
import org.eclipse.cdt.utils.PathUtil;
|
import org.eclipse.cdt.utils.PathUtil;
|
||||||
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.Assert;
|
import org.eclipse.core.runtime.Assert;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -55,6 +59,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSettingsOutputScanner implements ILanguageSettingsBuiltinSpecsDetector {
|
public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSettingsOutputScanner implements ILanguageSettingsBuiltinSpecsDetector {
|
||||||
|
@ -72,6 +77,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
private String currentCommandResolved = null;
|
private String currentCommandResolved = null;
|
||||||
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
||||||
|
protected int collected = 0;
|
||||||
|
|
||||||
private boolean runOnce = true;
|
private boolean runOnce = true;
|
||||||
private boolean isConsoleEnabled = false;
|
private boolean isConsoleEnabled = false;
|
||||||
|
@ -81,6 +87,67 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
protected URI mappedRootURI = null;
|
protected URI mappedRootURI = null;
|
||||||
protected URI buildDirURI = null;
|
protected URI buildDirURI = null;
|
||||||
|
|
||||||
|
private class SDMarkerGenerator implements IMarkerGenerator {
|
||||||
|
protected static final String SCANNER_DISCOVERY_PROBLEM_MARKER = ManagedBuilderCorePlugin.PLUGIN_ID + ".scanner.discovery.problem"; //$NON-NLS-1$
|
||||||
|
protected static final String PROVIDER = "provider"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||||
|
ProblemMarkerInfo info = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar);
|
||||||
|
addMarker(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
|
||||||
|
final String providerName = getName();
|
||||||
|
final String providerId = getId();
|
||||||
|
// 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("Adding Scanner Discovery markers") {
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
// Try to find matching markers and don't put in duplicates
|
||||||
|
try {
|
||||||
|
IMarker[] cur = problemMarkerInfo.file.findMarkers(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
|
if ((cur != null) && (cur.length > 0)) {
|
||||||
|
for (int i = 0; i < cur.length; i++) {
|
||||||
|
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
|
||||||
|
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
||||||
|
if (sev == problemMarkerInfo.severity && mesg.equals(problemMarkerInfo.description)) {
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), "Error removing markers.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add new marker
|
||||||
|
try {
|
||||||
|
IMarker marker = problemMarkerInfo.file.createMarker(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER);
|
||||||
|
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||||
|
marker.setAttribute(IMarker.SEVERITY, problemMarkerInfo.severity);
|
||||||
|
marker.setAttribute(SDMarkerGenerator.PROVIDER, providerId);
|
||||||
|
|
||||||
|
if (problemMarkerInfo.file instanceof IWorkspaceRoot) {
|
||||||
|
marker.setAttribute(IMarker.LOCATION, "SD90 Providers, [" + providerName + "] options in Preferences");
|
||||||
|
} else {
|
||||||
|
marker.setAttribute(IMarker.LOCATION, "SD90 Providers, [" + providerName + "] options in project properties");
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), "Error adding markers.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
markerJob.setRule(problemMarkerInfo.file);
|
||||||
|
markerJob.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
|
@ -178,6 +245,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
detectedSettingEntries = new ArrayList<ICLanguageSettingEntry>();
|
detectedSettingEntries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
collected = 0;
|
||||||
currentCommandResolved = customParameter;
|
currentCommandResolved = customParameter;
|
||||||
|
|
||||||
specFile = null;
|
specFile = null;
|
||||||
|
@ -195,6 +263,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
if (detectedSettingEntries!=null && detectedSettingEntries.size()>0) {
|
if (detectedSettingEntries!=null && detectedSettingEntries.size()>0) {
|
||||||
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, detectedSettingEntries);
|
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, detectedSettingEntries);
|
||||||
|
collected = detectedSettingEntries.size();
|
||||||
|
|
||||||
IStatus status = new Status(IStatus.INFO, MakeCorePlugin.PLUGIN_ID, getClass().getSimpleName()
|
IStatus status = new Status(IStatus.INFO, MakeCorePlugin.PLUGIN_ID, getClass().getSimpleName()
|
||||||
+ " collected " + detectedSettingEntries.size() + " entries" + " for language " + currentLanguageId);
|
+ " collected " + detectedSettingEntries.size() + " entries" + " for language " + currentLanguageId);
|
||||||
|
@ -248,17 +317,30 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
if (isConsoleEnabled) {
|
if (isConsoleEnabled) {
|
||||||
console = startProviderConsole();
|
console = startProviderConsole();
|
||||||
} else {
|
} else {
|
||||||
// that looks in extension points registry and won't find the id
|
// that looks in extension points registry and won't find the id, this console is not shown
|
||||||
console = CCorePlugin.getDefault().getConsole(MakeCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
console = CCorePlugin.getDefault().getConsole(MakeCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
console.start(currentProject);
|
console.start(currentProject);
|
||||||
OutputStream cos = console.getOutputStream();
|
OutputStream cos = console.getOutputStream();
|
||||||
|
|
||||||
ErrorParserManager epm = null;
|
// Using GMAKE_ERROR_PARSER_ID as it can handle shell error messages
|
||||||
if (currentProject!=null) {
|
ErrorParserManager epm = new ErrorParserManager(currentProject, new SDMarkerGenerator(), new String[] {GMAKE_ERROR_PARSER_ID});
|
||||||
epm = new ErrorParserManager(currentProject, new SCMarkerGenerator(), new String[] {GMAKE_ERROR_PARSER_ID});
|
|
||||||
epm.setOutputStream(cos);
|
epm.setOutputStream(cos);
|
||||||
|
|
||||||
|
IResource markersResource = currentProject!= null ? currentProject : ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
|
// clear old markers
|
||||||
|
try {
|
||||||
|
IMarker[] cur = markersResource.findMarkers(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
|
for (IMarker marker : cur) {
|
||||||
|
if (getId().equals(marker.getAttribute(SDMarkerGenerator.PROVIDER))) {
|
||||||
|
marker.delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (monitor==null) {
|
if (monitor==null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
@ -323,8 +405,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
// Before launching give visual cues via the monitor
|
// Before launching give visual cues via the monitor
|
||||||
monitor.subTask("Invoking command " + command);
|
monitor.subTask("Invoking command " + command);
|
||||||
if (launcher.waitAndRead(consoleOut, consoleErr, new SubProgressMonitor(monitor, 0))
|
if (launcher.waitAndRead(consoleOut, consoleErr, new SubProgressMonitor(monitor, 0)) != ICommandLauncher.OK) {
|
||||||
!= ICommandLauncher.OK) {
|
|
||||||
errMsg = launcher.getErrorMessage();
|
errMsg = launcher.getErrorMessage();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -352,6 +433,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printLine(consoleOut, NEWLINE + "**** Collected " + collected + " entries. ****");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,13 +448,18 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
private IConsole startProviderConsole() {
|
private IConsole startProviderConsole() {
|
||||||
|
String extConsoleId;
|
||||||
|
if (currentProject != null) {
|
||||||
|
extConsoleId = "org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole";
|
||||||
|
} else {
|
||||||
|
extConsoleId = "org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryGlobalConsole";
|
||||||
|
}
|
||||||
ILanguage ld = LanguageManager.getInstance().getLanguage(currentLanguageId);
|
ILanguage ld = LanguageManager.getInstance().getLanguage(currentLanguageId);
|
||||||
|
|
||||||
String consoleId = MakeCorePlugin.PLUGIN_ID + '.' + getId() + '.' + currentLanguageId;
|
String consoleId = MakeCorePlugin.PLUGIN_ID + '.' + getId() + '.' + currentLanguageId;
|
||||||
String consoleName = getName() + ", " + ld.getName();
|
String consoleName = getName() + ", " + ld.getName();
|
||||||
URL defaultIcon = Platform.getBundle(PLUGIN_CDT_MAKE_UI_ID).getEntry("icons/obj16/inspect_system.gif");
|
URL defaultIcon = Platform.getBundle(PLUGIN_CDT_MAKE_UI_ID).getEntry("icons/obj16/inspect_system.gif");
|
||||||
|
|
||||||
IConsole console = CCorePlugin.getDefault().getConsole("org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole", consoleId, consoleName, defaultIcon);
|
IConsole console = CCorePlugin.getDefault().getConsole(extConsoleId, consoleId, consoleName, defaultIcon);
|
||||||
return console;
|
return console;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +468,14 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
if (envStrings!=null) {
|
if (envStrings!=null) {
|
||||||
String varPrefix = envVar+'=';
|
String varPrefix = envVar+'=';
|
||||||
for (String envStr : envStrings) {
|
for (String envStr : envStrings) {
|
||||||
if (envStr.startsWith(varPrefix)) {
|
boolean found = false;
|
||||||
|
// need to convert "Path" to "PATH" on Windows
|
||||||
|
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||||
|
found = envStr.substring(0,varPrefix.length()).toUpperCase().startsWith(varPrefix);
|
||||||
|
} else {
|
||||||
|
found = envStr.startsWith(varPrefix);
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
envPath = envStr.substring(varPrefix.length());
|
envPath = envStr.substring(varPrefix.length());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,8 +130,6 @@ public class ConsoleOutputSniffer {
|
||||||
private OutputStream consoleErrorStream;
|
private OutputStream consoleErrorStream;
|
||||||
private IConsoleParser[] parsers;
|
private IConsoleParser[] parsers;
|
||||||
|
|
||||||
private ErrorParserManager errorParserManager = null;
|
|
||||||
|
|
||||||
public ConsoleOutputSniffer(IConsoleParser[] parsers) {
|
public ConsoleOutputSniffer(IConsoleParser[] parsers) {
|
||||||
this.parsers = parsers;
|
this.parsers = parsers;
|
||||||
}
|
}
|
||||||
|
@ -142,11 +140,6 @@ public class ConsoleOutputSniffer {
|
||||||
this.consoleErrorStream = errorStream;
|
this.consoleErrorStream = errorStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsoleOutputSniffer(OutputStream outputStream, OutputStream errorStream, IConsoleParser[] parsers, ErrorParserManager epm) {
|
|
||||||
this(outputStream, errorStream, parsers);
|
|
||||||
this.errorParserManager = epm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an output stream that will be sniffed.
|
* Returns an output stream that will be sniffed.
|
||||||
* This stream should be hooked up so the command
|
* This stream should be hooked up so the command
|
||||||
|
@ -195,10 +188,10 @@ public class ConsoleOutputSniffer {
|
||||||
private synchronized void processLine(String line) {
|
private synchronized void processLine(String line) {
|
||||||
for (IConsoleParser parser : parsers) {
|
for (IConsoleParser parser : parsers) {
|
||||||
try {
|
try {
|
||||||
if (parser instanceof IErrorParser) {
|
if (consoleOutputStream instanceof ErrorParserManager && parser instanceof IErrorParser ) {
|
||||||
// IErrorParser interface is used here only to pass ErrorParserManager
|
// IErrorParser interface is used here only with purpose to pass ErrorParserManager
|
||||||
// which keeps track of CWD and provides useful methods for locating files
|
// which keeps track of CWD and provides useful methods for locating files
|
||||||
((IErrorParser)parser).processLine(line, errorParserManager);
|
((IErrorParser)parser).processLine(line, (ErrorParserManager) consoleOutputStream);
|
||||||
} else {
|
} else {
|
||||||
parser.processLine(line);
|
parser.processLine(line);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue