mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
auto-clean: @Override annotations + organize imports + unnecessary
casts/$NON-NLS + trailing white spaces
This commit is contained in:
parent
e47db971de
commit
2a1cddd716
372 changed files with 13453 additions and 10533 deletions
|
@ -38,27 +38,27 @@ public class CDataProviderTests extends TestCase {
|
|||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(CDataProviderTests.class);
|
||||
|
||||
|
||||
// // Add the relevant tests to the suite
|
||||
// suite.addTest(new StandardBuildTests("testProjectCreation"));
|
||||
// suite.addTest(new StandardBuildTests("testProjectSettings"));
|
||||
// suite.addTest(new StandardBuildTests("testProjectConversion"));
|
||||
// suite.addTest(new StandardBuildTests("testProjectCleanup"));
|
||||
//
|
||||
//
|
||||
// suite.addTestSuite(ScannerConfigConsoleParserTests.class);
|
||||
// suite.addTestSuite(ScannerConfigDiscoveryTests.class);
|
||||
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
||||
public void testCData() throws Exception {
|
||||
IProject project = createProject("a1");
|
||||
ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
|
||||
assertNotNull("project description should not be null", projDes);
|
||||
|
||||
|
||||
ICConfigurationDescription cfgs[] = projDes.getConfigurations();
|
||||
assertEquals(1, cfgs.length);
|
||||
|
||||
|
||||
int lssNum = cfgs[0].getRootFolderDescription().getLanguageSettings().length;
|
||||
int rcDessNum = cfgs[0].getResourceDescriptions().length;
|
||||
assertTrue(rcDessNum > 0);
|
||||
|
@ -67,9 +67,9 @@ public class CDataProviderTests extends TestCase {
|
|||
assertEquals(2, projDes.getConfigurations().length);
|
||||
assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length);
|
||||
assertEquals(rcDessNum, cfg2.getResourceDescriptions().length);
|
||||
|
||||
|
||||
CCorePlugin.getDefault().setProjectDescription(project, projDes);
|
||||
|
||||
|
||||
projDes = CCorePlugin.getDefault().getProjectDescription(project);
|
||||
assertEquals(2, projDes.getConfigurations().length);
|
||||
cfgs = projDes.getConfigurations();
|
||||
|
@ -89,16 +89,16 @@ public class CDataProviderTests extends TestCase {
|
|||
assertEquals(2, projDes.getConfigurations().length);
|
||||
assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length);
|
||||
assertEquals(rcDessNum, cfg2.getResourceDescriptions().length);
|
||||
|
||||
|
||||
project.delete(false, true, new NullProgressMonitor());
|
||||
|
||||
|
||||
project = ResourcesPlugin.getWorkspace().getRoot().getProject("a1");
|
||||
project.create(new NullProgressMonitor());
|
||||
project.open(new NullProgressMonitor());
|
||||
|
||||
|
||||
projDes = CCorePlugin.getDefault().getProjectDescription(project);
|
||||
assertNotNull("project description should not be null", projDes);
|
||||
|
||||
|
||||
cfgs = projDes.getConfigurations();
|
||||
assertEquals(2, cfgs.length);
|
||||
cfg2 = cfgs[0];
|
||||
|
@ -106,18 +106,19 @@ public class CDataProviderTests extends TestCase {
|
|||
assertEquals(2, projDes.getConfigurations().length);
|
||||
assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length);
|
||||
assertEquals(rcDessNum, cfg2.getResourceDescriptions().length);
|
||||
|
||||
|
||||
cfg2 = cfgs[1];
|
||||
assertNotNull(cfg2);
|
||||
assertEquals(2, projDes.getConfigurations().length);
|
||||
assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length);
|
||||
assertEquals(rcDessNum, cfg2.getResourceDescriptions().length);
|
||||
}
|
||||
|
||||
|
||||
private IProject createProject(final String name) throws CoreException {
|
||||
final Object[] result = new Object[1];
|
||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IProject project = root.getProject(name);
|
||||
|
@ -132,7 +133,7 @@ public class CDataProviderTests extends TestCase {
|
|||
if (!project.isOpen()) {
|
||||
project.open(null);
|
||||
}
|
||||
|
||||
|
||||
description = project.getDescription();
|
||||
// ICommand[] commands = description.getBuildSpec();
|
||||
// for (int i = 0; i < commands.length; ++i) {
|
||||
|
@ -152,6 +153,6 @@ public class CDataProviderTests extends TestCase {
|
|||
result[0] = project;
|
||||
}
|
||||
}, null);
|
||||
return (IProject)result[0];
|
||||
return (IProject)result[0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,43 +50,43 @@ public class StandardBuildTests extends TestCase {
|
|||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(StandardBuildTests.class.getName());
|
||||
|
||||
|
||||
// Add the relevant tests to the suite
|
||||
suite.addTest(new StandardBuildTests("testProjectCreation"));
|
||||
suite.addTest(new StandardBuildTests("testProjectSettings"));
|
||||
suite.addTest(new StandardBuildTests("testProjectConversion"));
|
||||
suite.addTest(new StandardBuildTests("testProjectCleanup"));
|
||||
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
||||
private void checkDefaultProjectSettings(IProject project) throws Exception {
|
||||
assertNotNull(project);
|
||||
|
||||
IMakeBuilderInfo defaultInfo = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, true);
|
||||
|
||||
|
||||
IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID);
|
||||
// Check the rest of the project information
|
||||
assertEquals(defaultInfo.isDefaultBuildCmd(), builderInfo.isDefaultBuildCmd());
|
||||
assertEquals(defaultInfo.isStopOnError(), builderInfo.isStopOnError());
|
||||
assertEquals(defaultInfo.getBuildCommand(), builderInfo.getBuildCommand());
|
||||
assertEquals(defaultInfo.getBuildArguments(), builderInfo.getBuildArguments());
|
||||
assertEquals(defaultInfo.getBuildLocation(), builderInfo.getBuildLocation());
|
||||
assertEquals(defaultInfo.getBuildLocation(), builderInfo.getBuildLocation());
|
||||
|
||||
assertEquals(defaultInfo.isAutoBuildEnable(), builderInfo.isAutoBuildEnable());
|
||||
assertEquals(defaultInfo.getAutoBuildTarget(), builderInfo.getAutoBuildTarget());
|
||||
assertEquals(defaultInfo.isIncrementalBuildEnabled(), builderInfo.isIncrementalBuildEnabled());
|
||||
assertEquals(defaultInfo.getIncrementalBuildTarget(), builderInfo.getIncrementalBuildTarget());
|
||||
assertEquals(defaultInfo.isFullBuildEnabled(), builderInfo.isFullBuildEnabled());
|
||||
assertEquals(defaultInfo.isAutoBuildEnable(), builderInfo.isAutoBuildEnable());
|
||||
assertEquals(defaultInfo.getAutoBuildTarget(), builderInfo.getAutoBuildTarget());
|
||||
assertEquals(defaultInfo.isIncrementalBuildEnabled(), builderInfo.isIncrementalBuildEnabled());
|
||||
assertEquals(defaultInfo.getIncrementalBuildTarget(), builderInfo.getIncrementalBuildTarget());
|
||||
assertEquals(defaultInfo.isFullBuildEnabled(), builderInfo.isFullBuildEnabled());
|
||||
assertEquals(defaultInfo.getFullBuildTarget(), builderInfo.getFullBuildTarget());
|
||||
assertEquals(defaultInfo.isCleanBuildEnabled(), builderInfo.isCleanBuildEnabled());
|
||||
assertEquals(defaultInfo.isCleanBuildEnabled(), builderInfo.isCleanBuildEnabled());
|
||||
assertEquals(defaultInfo.getCleanBuildTarget(), builderInfo.getCleanBuildTarget());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void checkOverriddenProjectSettings(IProject project) throws Exception {
|
||||
assertNotNull(project);
|
||||
|
||||
|
||||
// Check the rest of the project information
|
||||
IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID);
|
||||
assertEquals(OFF, builderInfo.isDefaultBuildCmd());
|
||||
|
@ -97,17 +97,18 @@ public class StandardBuildTests extends TestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new project named <code>name</code> or return the project in
|
||||
* Create a new project named <code>name</code> or return the project in
|
||||
* the workspace of the same name if it exists.
|
||||
*
|
||||
*
|
||||
* @param name The name of the project to create or retrieve.
|
||||
* @return
|
||||
* @return
|
||||
* @throws CoreException
|
||||
*/
|
||||
private IProject createProject(final String name) throws CoreException {
|
||||
final Object[] result = new Object[1];
|
||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IProject project = root.getProject(name);
|
||||
|
@ -116,7 +117,7 @@ public class StandardBuildTests extends TestCase {
|
|||
} else {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
}
|
||||
|
||||
|
||||
if (!project.isOpen()) {
|
||||
project.open(null);
|
||||
}
|
||||
|
@ -124,13 +125,13 @@ public class StandardBuildTests extends TestCase {
|
|||
result[0] = project;
|
||||
}
|
||||
}, null);
|
||||
return (IProject)result[0];
|
||||
return (IProject)result[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the <code>IProject</code> with the name specified in the argument from the
|
||||
* Remove the <code>IProject</code> with the name specified in the argument from the
|
||||
* receiver's workspace.
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
private void removeProject(String name) {
|
||||
|
@ -161,10 +162,10 @@ public class StandardBuildTests extends TestCase {
|
|||
fail("StandardBuildTest testProjectConversion failed opening project: " + e.getLocalizedMessage());
|
||||
}
|
||||
assertNotNull(project);
|
||||
|
||||
|
||||
// Check the settings (they should be the override values)
|
||||
checkOverriddenProjectSettings(project);
|
||||
|
||||
|
||||
// Now convert the project
|
||||
try {
|
||||
CCorePlugin.getDefault().convertProjectFromCtoCC(project, new NullProgressMonitor());
|
||||
|
@ -190,19 +191,19 @@ public class StandardBuildTests extends TestCase {
|
|||
} catch (CoreException e) {
|
||||
fail("StandardBuildTest testProjectConversion failed getting nature: " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
// Nothing should have changed in the settings
|
||||
checkOverriddenProjectSettings(project);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void testProjectCreation() throws Exception {
|
||||
// Create a new project
|
||||
IProject project = null;
|
||||
try {
|
||||
project = createProject(PROJECT_NAME);
|
||||
project = createProject(PROJECT_NAME);
|
||||
// Convert the new project to a standard make project
|
||||
MakeProjectNature.addNature(project, null);
|
||||
} catch (CoreException e) {
|
||||
|
@ -225,7 +226,7 @@ public class StandardBuildTests extends TestCase {
|
|||
// Check the default settings
|
||||
checkDefaultProjectSettings(project);
|
||||
}
|
||||
|
||||
|
||||
public void testProjectSettings() throws Exception {
|
||||
// Get the project
|
||||
IProject project = null;
|
||||
|
@ -235,7 +236,7 @@ public class StandardBuildTests extends TestCase {
|
|||
fail("StandardBuildTest testProjectSettings failed opening project: " + e.getLocalizedMessage());
|
||||
}
|
||||
assertNotNull(project);
|
||||
|
||||
|
||||
// Use the build info for the rest of the settings
|
||||
IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID);
|
||||
builderInfo.setStopOnError(ON);
|
||||
|
@ -253,7 +254,7 @@ public class StandardBuildTests extends TestCase {
|
|||
} catch (CoreException e) {
|
||||
fail ("StandardBuildTest testProjectSettings failed to open project " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
// Retest
|
||||
checkOverriddenProjectSettings(project);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
basePath + "incl"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void testNoReaderProvider() throws Exception {
|
||||
IPath path = new Path("data/Makefile.main");
|
||||
File file = getPluginRelativeFile(path);
|
||||
|
@ -80,13 +80,14 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
|
||||
public void testInputStreamReaderProvider() throws Exception {
|
||||
IPath path = new Path("Makefile.main");
|
||||
|
||||
|
||||
// get base directory for searches
|
||||
final URL url = getPluginRelativeURL(new Path("data").addTrailingSeparator());
|
||||
IMakefile makefile = MakeCorePlugin.createMakefile(
|
||||
URIUtil.toURI(path), true, inclDirs,
|
||||
new IMakefileReaderProvider() {
|
||||
|
||||
@Override
|
||||
public Reader getReader(URI fileURI) throws IOException {
|
||||
URL fileUrl;
|
||||
try {
|
||||
|
@ -97,9 +98,9 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
InputStream is = fileUrl.openStream();
|
||||
return new InputStreamReader(is);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
assertMakefileContents(makefile);
|
||||
}
|
||||
|
||||
|
@ -108,36 +109,38 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
URIUtil.toURI("/memory/Makefile.main"), true, inclDirs,
|
||||
new IMakefileReaderProvider() {
|
||||
|
||||
@Override
|
||||
public Reader getReader(URI fileURI) throws IOException {
|
||||
String name = new File(fileURI).getName();
|
||||
String name = new File(fileURI).getName();
|
||||
if (name.equals("Makefile.main"))
|
||||
return new StringReader(
|
||||
"VAR = foo\r\n" +
|
||||
"\r\n" +
|
||||
"include Makefile.incl\r\n" +
|
||||
"\r\n" +
|
||||
"main: $(VAR)\r\n" +
|
||||
"VAR = foo\r\n" +
|
||||
"\r\n" +
|
||||
"include Makefile.incl\r\n" +
|
||||
"\r\n" +
|
||||
"main: $(VAR)\r\n" +
|
||||
" nothing\r\n");
|
||||
if (name.equals("Makefile.incl"))
|
||||
return new StringReader(
|
||||
"INCLVAR = bar\r\n" +
|
||||
"\r\n" +
|
||||
"foo.o: .PHONY\r\n"
|
||||
"INCLVAR = bar\r\n" +
|
||||
"\r\n" +
|
||||
"foo.o: .PHONY\r\n"
|
||||
);
|
||||
|
||||
|
||||
throw new FileNotFoundException(fileURI.getPath());
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
assertMakefileContents(makefile);
|
||||
}
|
||||
|
||||
|
||||
public void testReaderIsClosed_Bug338936() throws Exception {
|
||||
final boolean[] streamIsClosed = { false };
|
||||
MakeCorePlugin.createMakefile(
|
||||
URIUtil.toURI("Makefile.main"), true, inclDirs,
|
||||
new IMakefileReaderProvider() {
|
||||
@Override
|
||||
public Reader getReader(URI fileURI) throws IOException {
|
||||
return new StringReader("") {
|
||||
@Override
|
||||
|
@ -147,7 +150,7 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
assertTrue("Stream is not closed", streamIsClosed[0]);
|
||||
}
|
||||
|
@ -162,14 +165,14 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
assertEquals(2, macroDefinitions.length);
|
||||
assertEquals("VAR", macroDefinitions[0].getName());
|
||||
assertEquals("INCLVAR", macroDefinitions[1].getName());
|
||||
|
||||
|
||||
IRule[] rules = makefile.getRules();
|
||||
assertEquals(2, rules.length);
|
||||
assertEquals("main", rules[0].getTarget().toString());
|
||||
assertEquals("foo.o", rules[1].getTarget().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Try to get a file in the development version of a plugin --
|
||||
* will return <code>null</code> for a jar-packaged plugin.
|
||||
* @param path
|
||||
|
@ -183,11 +186,11 @@ public class MakefileReaderProviderTests extends TestCase {
|
|||
return new File(url.getPath());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private URL getPluginRelativeURL(IPath path) throws Exception {
|
||||
if (MakeTestsPlugin.getDefault() != null) {
|
||||
URL url = FileLocator.find(
|
||||
MakeTestsPlugin.getDefault().getBundle(),
|
||||
MakeTestsPlugin.getDefault().getBundle(),
|
||||
path, null);
|
||||
return url != null ? FileLocator.toFileURL(url) : null;
|
||||
}
|
||||
|
|
|
@ -33,22 +33,22 @@ import org.eclipse.core.runtime.Path;
|
|||
|
||||
public class StandardBuildTestHelper {
|
||||
/* (non-Javadoc)
|
||||
* Create a new project named <code>name</code> or return the project in
|
||||
* Create a new project named <code>name</code> or return the project in
|
||||
* the workspace of the same name if it exists.
|
||||
*
|
||||
*
|
||||
* @param name The name of the project to create or retrieve.
|
||||
* @return
|
||||
* @return
|
||||
* @throws CoreException
|
||||
*/
|
||||
static public IProject createProject(
|
||||
final String name,
|
||||
final IPath location,
|
||||
final String projectId)
|
||||
final String name,
|
||||
final IPath location,
|
||||
final String projectId)
|
||||
throws CoreException {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
final IProject newProjectHandle = root.getProject(name);
|
||||
IProject project = null;
|
||||
|
||||
|
||||
if (!newProjectHandle.exists()) {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
||||
|
@ -60,19 +60,19 @@ public class StandardBuildTestHelper {
|
|||
} else {
|
||||
project = newProjectHandle;
|
||||
}
|
||||
|
||||
|
||||
// Open the project if we have to
|
||||
if (!project.isOpen()) {
|
||||
project.open(new NullProgressMonitor());
|
||||
}
|
||||
|
||||
return project;
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the <code>IProject</code> with the name specified in the argument from the
|
||||
* Remove the <code>IProject</code> with the name specified in the argument from the
|
||||
* receiver's workspace.
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
static public void removeProject(String name) {
|
||||
|
@ -81,6 +81,7 @@ public class StandardBuildTestHelper {
|
|||
if (project.exists()) {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
|
@ -99,6 +100,7 @@ public class StandardBuildTestHelper {
|
|||
static public boolean compareBenchmarks(final IProject project, IPath testDir, IPath[] files) {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
}
|
||||
|
@ -116,7 +118,7 @@ public class StandardBuildTestHelper {
|
|||
StringBuffer benchmarkBuffer = readContentsStripLineEnds(project, benchmarkFile);
|
||||
if (!testBuffer.toString().equals(benchmarkBuffer.toString())) {
|
||||
Assert.fail("File " + testFile.lastSegment() + " does not match its benchmark.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -124,6 +126,7 @@ public class StandardBuildTestHelper {
|
|||
static public boolean verifyFilesDoNotExist(final IProject project, IPath testDir, IPath[] files) {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
}
|
||||
|
@ -141,7 +144,7 @@ public class StandardBuildTestHelper {
|
|||
if (fullPath.toFile().exists()) {
|
||||
Assert.fail("File " + testFile.lastSegment() + " unexpectedly found.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Assert.fail("File " + fullPath.toString() + " could not be referenced.");
|
||||
}
|
||||
|
@ -174,7 +177,7 @@ public class StandardBuildTestHelper {
|
|||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
||||
static public IPath copyFilesToTempDir(IPath srcDir, IPath tmpSubDir, IPath[] files) {
|
||||
IPath tmpSrcDir = null;
|
||||
String userDirStr = System.getProperty("user.home");
|
||||
|
@ -182,7 +185,7 @@ public class StandardBuildTestHelper {
|
|||
IPath userDir = Path.fromOSString(userDirStr);
|
||||
tmpSrcDir = userDir.append(tmpSubDir);
|
||||
if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) {
|
||||
Assert.fail("Temporary sub-directory cannot be the empty string.");
|
||||
Assert.fail("Temporary sub-directory cannot be the empty string.");
|
||||
} else {
|
||||
File tmpSrcDirFile = tmpSrcDir.toFile();
|
||||
if (tmpSrcDirFile.exists()) {
|
||||
|
@ -238,7 +241,7 @@ public class StandardBuildTestHelper {
|
|||
}
|
||||
return tmpSrcDir;
|
||||
}
|
||||
|
||||
|
||||
static public void deleteTempDir(IPath tmpSubDir, IPath[] files) {
|
||||
IPath tmpSrcDir = null;
|
||||
String userDirStr = System.getProperty("user.home");
|
||||
|
@ -246,11 +249,11 @@ public class StandardBuildTestHelper {
|
|||
IPath userDir = Path.fromOSString(userDirStr);
|
||||
tmpSrcDir = userDir.append(tmpSubDir);
|
||||
if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) {
|
||||
Assert.fail("Temporary sub-directory cannot be the empty string.");
|
||||
Assert.fail("Temporary sub-directory cannot be the empty string.");
|
||||
} else {
|
||||
File tmpSrcDirFile = tmpSrcDir.toFile();
|
||||
if (!tmpSrcDirFile.exists()) {
|
||||
Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist.");
|
||||
Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist.");
|
||||
} else {
|
||||
for (int i=0; i<files.length; i++) {
|
||||
// Delete the file
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.scannerdiscovery;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -31,8 +31,10 @@ import org.eclipse.core.runtime.Path;
|
|||
|
||||
public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests {
|
||||
private final static IMarkerGenerator MARKER_GENERATOR= new IMarkerGenerator() {
|
||||
@Override
|
||||
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||
}
|
||||
@Override
|
||||
public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
|
||||
}
|
||||
};
|
||||
|
@ -66,7 +68,7 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests {
|
|||
CProjectHelper.delete(fCProject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testParsingIfStatement_bug197930() throws Exception {
|
||||
fOutputParser.processLine("if gcc -g -O0 -I\"include abc\" -c impl/testmath.c; then ; fi"); //$NON-NLS-1$
|
||||
|
||||
|
@ -75,7 +77,7 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests {
|
|||
CCommandDSC command= (CCommandDSC) cmds.get(0);
|
||||
assertEquals("gcc", command.getCompilerName());
|
||||
}
|
||||
|
||||
|
||||
public void testResolvingLinkedFolder_Bug213690() throws Exception {
|
||||
File tempRoot= new File(System.getProperty("java.io.tmpdir"));
|
||||
File tempDir= new File(tempRoot, "cdttest_213690").getCanonicalFile();
|
||||
|
@ -116,19 +118,19 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests {
|
|||
tempDir.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testPwdInFilePath_Bug237958() throws Exception {
|
||||
IFile file1= fCProject.getProject().getFile("Bug237958_1.c");
|
||||
IFile file2= fCProject.getProject().getFile("Bug237958_2.c");
|
||||
fOutputParser.processLine("gcc -g -DTEST1 -c `pwd`/Bug237958_1.c");
|
||||
fOutputParser.processLine("gcc -DTEST2=12 -g -ggdb -Wall -c \"`pwd`/./Bug237958_2.c\"");
|
||||
fOutputParser.processLine("gcc -g -DTEST1 -c `pwd`/Bug237958_1.c");
|
||||
fOutputParser.processLine("gcc -DTEST2=12 -g -ggdb -Wall -c \"`pwd`/./Bug237958_2.c\"");
|
||||
|
||||
List<?> cmds = fCollector.getCollectedScannerInfo(file1, ScannerInfoTypes.COMPILER_COMMAND);
|
||||
CCommandDSC cdsc= (CCommandDSC) cmds.get(0);
|
||||
List<?> symbols= cdsc.getSymbols();
|
||||
assertEquals(1, symbols.size());
|
||||
assertEquals("TEST1=1", symbols.get(0).toString());
|
||||
|
||||
|
||||
cmds = fCollector.getCollectedScannerInfo(file2, ScannerInfoTypes.COMPILER_COMMAND);
|
||||
cdsc= (CCommandDSC) cmds.get(0);
|
||||
symbols= cdsc.getSymbols();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.scannerdiscovery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -27,7 +27,8 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
|||
final class TestScannerInfoCollector implements IScannerInfoCollector {
|
||||
private HashMap<ScannerInfoTypes, List> fInfoMap = new HashMap<ScannerInfoTypes, List>();
|
||||
private HashMap<Object, Map<ScannerInfoTypes, List>> fResourceToInfoMap = new HashMap<Object, Map<ScannerInfoTypes, List>>();
|
||||
|
||||
|
||||
@Override
|
||||
public void contributeToScannerConfig(Object resource, Map scannerInfo0) {
|
||||
Map<ScannerInfoTypes, List> scannerInfo = scannerInfo0;
|
||||
Set<Entry<ScannerInfoTypes, List>> entrySet = scannerInfo.entrySet();
|
||||
|
@ -59,6 +60,7 @@ final class TestScannerInfoCollector implements IScannerInfoCollector {
|
|||
target.addAll(col);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
if (resource == null) {
|
||||
List result= fInfoMap.get(type);
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CommandLauncher;
|
||||
|
@ -126,6 +126,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
try {
|
||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) {
|
||||
invokeMake(CLEAN_BUILD, info, monitor);
|
||||
}
|
||||
|
@ -170,7 +171,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
if(pathFromURI == null) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, MakeMessages.getString("MakeBuilder.ErrorWorkingDirectory"), null)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
IPath workingDirectory = new Path(pathFromURI);
|
||||
|
||||
String[] targets = getTargets(kind, info);
|
||||
|
@ -288,7 +289,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
/**
|
||||
* Refresh project. Can be overridden to not call actual refresh or to do something else.
|
||||
* Method is called after build is complete.
|
||||
*
|
||||
*
|
||||
* @since 6.0
|
||||
*/
|
||||
protected void refreshProject(IProject project) {
|
||||
|
@ -297,7 +298,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
// to Eclipse, files may have been created/modified and we will be out-of-sync.
|
||||
// The caveat is for huge projects, it may take sometimes at every build.
|
||||
// project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
|
||||
|
||||
// use the refresh scope manager to refresh
|
||||
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.osgi.framework.BundleContext;
|
|||
|
||||
/**
|
||||
* The main plugin class to be used in the desktop.
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
|
@ -74,13 +74,14 @@ public class MakeCorePlugin extends Plugin {
|
|||
fEncoding = encoding != null ? encoding : ResourcesPlugin.getEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader getReader(URI fileURI) throws IOException {
|
||||
try {
|
||||
final IFileStore store = EFS.getStore(fileURI);
|
||||
final IFileInfo info = store.fetchInfo();
|
||||
if (!info.exists() || info.isDirectory())
|
||||
throw new IOException();
|
||||
|
||||
|
||||
return new InputStreamReader(store.openInputStream(EFS.NONE, null), fEncoding);
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
|
@ -88,7 +89,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final String PLUGIN_ID = "org.eclipse.cdt.make.core"; //$NON-NLS-1$
|
||||
public static final String MAKE_PROJECT_ID = MakeCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
|
||||
public static final String OLD_BUILDER_ID = "org.eclipse.cdt.core.cbuilder"; //$NON-NLS-1$
|
||||
|
@ -229,8 +230,8 @@ public class MakeCorePlugin extends Plugin {
|
|||
|
||||
/**
|
||||
* Create an IMakefile using the given IMakefileReaderProvider to fetch
|
||||
* contents by name.
|
||||
*
|
||||
* contents by name.
|
||||
*
|
||||
* @param fileURI URI of main file
|
||||
* @param makefileReaderProvider may be <code>null</code> for EFS IFileStore reading
|
||||
*/
|
||||
|
@ -263,7 +264,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
|
||||
/**
|
||||
* Create an IMakefile using EFS to fetch contents.
|
||||
*
|
||||
*
|
||||
* @param fileURI URI of main file
|
||||
*/
|
||||
public static IMakefile createMakefile(URI fileURI, boolean isGnuStyle, String[] makefileDirs) {
|
||||
|
@ -273,7 +274,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
public IMakefile createMakefile(IFile file) throws CoreException {
|
||||
return createMakefile(EFS.getStore(file.getLocationURI()), isMakefileGNUStyle(), getMakefileDirs(), file.getCharset());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
try {
|
||||
|
@ -309,7 +310,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
Map<String, String> args, String builderID) {
|
||||
return ScannerConfigInfoFactory.create(args, builderID);
|
||||
}
|
||||
|
||||
|
||||
public static IPath getWorkingDirectory() {
|
||||
return MakeCorePlugin.getDefault().getStateLocation();
|
||||
}
|
||||
|
@ -337,7 +338,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
|
||||
for (int j = 0; j < configElements.length; j++) {
|
||||
IConfigurationElement[] runElement = configElements[j].getChildren("run"); //$NON-NLS-1$
|
||||
if (runElement.length > 0) {
|
||||
if (runElement.length > 0) {
|
||||
IExternalScannerInfoProvider builder = (IExternalScannerInfoProvider) runElement[0].createExecutableExtension("class"); //$NON-NLS-1$
|
||||
return builder;
|
||||
}
|
||||
|
@ -345,7 +346,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
log(e);
|
||||
}
|
||||
|
@ -372,13 +373,13 @@ public class MakeCorePlugin extends Plugin {
|
|||
if (id != null && (id.equals(commandId) || id.equals("all"))) { //$NON-NLS-1$
|
||||
parserIds.add(parserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return parserIds.toArray(empty);
|
||||
}
|
||||
return empty;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return parser - parser object identified by the parserId
|
||||
*/
|
||||
|
@ -402,14 +403,14 @@ public class MakeCorePlugin extends Plugin {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.Plugin#startup()
|
||||
*/
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
|
||||
|
||||
//Set debug tracing options
|
||||
configurePluginDebugOptions();
|
||||
// Scanner config discovery setup
|
||||
|
@ -418,7 +419,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
|
||||
private static final String SCANNER_CONFIG = MakeCorePlugin.getUniqueIdentifier() + "/debug/scdiscovery"; //$NON-NLS-1$
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private void configurePluginDebugOptions() {
|
||||
if (isDebugging()) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
public class MakeProjectNature implements IProjectNature {
|
||||
|
||||
|
||||
public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeNature"; //$NON-NLS-1$
|
||||
private IProject fProject;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the Java command in the build spec (replace existing one if present,
|
||||
* add one first if none).
|
||||
|
@ -78,7 +78,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
// Commit the spec change into the project
|
||||
description.setBuildSpec(newCommands);
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a builder to the build spec for the given project.
|
||||
|
@ -130,6 +130,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
/**
|
||||
* @see IProjectNature#configure
|
||||
*/
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
addBuildSpec();
|
||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
|
||||
|
@ -142,7 +143,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
|
||||
projectInfo.setAutoBuildEnable(info.isAutoBuildEnable());
|
||||
projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "")); //$NON-NLS-1$
|
||||
|
||||
|
||||
projectInfo.setIncrementalBuildEnable(info.isIncrementalBuildEnabled());
|
||||
projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "")); //$NON-NLS-1$
|
||||
|
||||
|
@ -163,6 +164,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
/**
|
||||
* @see IProjectNature#deconfigure
|
||||
*/
|
||||
@Override
|
||||
public void deconfigure() throws CoreException {
|
||||
removeBuildSpec();
|
||||
}
|
||||
|
@ -170,6 +172,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
/**
|
||||
* @see IProjectNature#getProject
|
||||
*/
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return fProject;
|
||||
}
|
||||
|
@ -177,6 +180,7 @@ public class MakeProjectNature implements IProjectNature {
|
|||
/**
|
||||
* @see IProjectNature#setProject
|
||||
*/
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
fProject = project;
|
||||
}
|
||||
|
|
|
@ -69,18 +69,20 @@ public class MakeScannerInfo implements IScannerInfo {
|
|||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
@Override
|
||||
public synchronized String[] getIncludePaths() {
|
||||
return getPathList().toArray(new String[getPathList().size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
@Override
|
||||
public synchronized Map<String, String> getDefinedSymbols() {
|
||||
// Return the defined symbols for the default configuration
|
||||
HashMap<String, String> symbols = new HashMap<String, String>();
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.w3c.dom.Element;
|
|||
|
||||
/**
|
||||
* @deprecated @author DInglis
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
|
@ -100,7 +100,7 @@ public class MakeScannerProvider extends ScannerProvider {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class MakeScannerProvider extends ScannerProvider {
|
|||
* Loads the build file and parses the nodes for build information. The information is then associated with the resource for the
|
||||
* duration of the session.
|
||||
*/
|
||||
private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException {
|
||||
private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException {
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
|
||||
ICStorageElement storage = descriptor.getProjectStorageElement(CDESCRIPTOR_ID);
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class MakeScannerProvider extends ScannerProvider {
|
|||
ICProject cProject = CoreModel.getDefault().create(info.getProject());
|
||||
IPathEntry[] entries = cProject.getRawPathEntries();
|
||||
List<IPathEntry> cPaths = new ArrayList<IPathEntry>(Arrays.asList(entries));
|
||||
|
||||
|
||||
Iterator<IPathEntry> cpIter = cPaths.iterator();
|
||||
while(cpIter.hasNext()) {
|
||||
int kind = cpIter.next().getEntryKind();
|
||||
|
@ -187,7 +187,8 @@ public class MakeScannerProvider extends ScannerProvider {
|
|||
*/
|
||||
public static void updateScannerInfo(final MakeScannerInfo scannerInfo) throws CoreException {
|
||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IProject project = scannerInfo.getProject();
|
||||
|
||||
|
@ -202,6 +203,6 @@ public class MakeScannerProvider extends ScannerProvider {
|
|||
descriptor.saveProjectData();
|
||||
migrateToCPathEntries(scannerInfo);
|
||||
}
|
||||
}, null);
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.make.core.makefile;
|
|||
/**
|
||||
* A Makefile can contain rules, macro definitons and comments.
|
||||
* They are call directives.
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
|
@ -38,10 +38,11 @@ public interface IDirective {
|
|||
|
||||
/**
|
||||
* Returns the makefile where the directive was found.
|
||||
*
|
||||
*
|
||||
* @return <code>IMakefile</code>
|
||||
*/
|
||||
IMakefile getMakefile();
|
||||
|
||||
@Override
|
||||
String toString();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ package org.eclipse.cdt.make.core.makefile;
|
|||
*/
|
||||
public interface ITarget {
|
||||
|
||||
@Override
|
||||
String toString();
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Discovered portion of scanner configuration
|
||||
* @deprecated as of CDT 4.0.
|
||||
* @author vhirsl
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
|
@ -38,16 +38,16 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
|
||||
private ArrayList<String> activePaths;
|
||||
private ArrayList<String> removedPaths;
|
||||
|
||||
|
||||
private ArrayList<String> activeSymbols;
|
||||
private ArrayList<String> removedSymbols;
|
||||
|
||||
private org.eclipse.cdt.make.core.MakeScannerInfo userInfo;
|
||||
|
||||
|
||||
public DiscoveredScannerInfo(IProject project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfo#getDefinedSymbols()
|
||||
*/
|
||||
@Override
|
||||
public synchronized Map<String, String> getDefinedSymbols() {
|
||||
Map<String, String> dSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols);
|
||||
dSymbols.putAll(userInfo.getDefinedSymbols());
|
||||
|
@ -63,6 +64,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
@Override
|
||||
public synchronized String[] getIncludePaths() {
|
||||
String[] iPaths = new String[getUserIncludePaths().length + getActiveIncludePaths().length];
|
||||
System.arraycopy(getUserIncludePaths(), 0, iPaths, 0, getUserIncludePaths().length);
|
||||
|
@ -77,7 +79,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
public synchronized void setUserScannerInfo( org.eclipse.cdt.make.core.MakeScannerInfo info) {
|
||||
userInfo = info;
|
||||
}
|
||||
|
||||
|
||||
public LinkedHashMap<String, Boolean> getDiscoveredIncludePaths() {
|
||||
if (discoveredPaths == null) {
|
||||
return new LinkedHashMap<String, Boolean>();
|
||||
|
@ -88,7 +90,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
discoveredPaths = new LinkedHashMap<String, Boolean>(paths);
|
||||
createPathLists();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populates active and removed include path lists
|
||||
*/
|
||||
|
@ -97,7 +99,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
aPaths.clear();
|
||||
List<String> rPaths = getRemovedPathList();
|
||||
rPaths.clear();
|
||||
|
||||
|
||||
Set<String> paths = discoveredPaths.keySet();
|
||||
for (String path : paths) {
|
||||
Boolean removed = discoveredPaths.get(path);
|
||||
|
@ -120,7 +122,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols);
|
||||
createSymbolsLists();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populates active and removed defined symbols sets
|
||||
*/
|
||||
|
@ -129,7 +131,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
aSymbols.clear();
|
||||
List<String> rSymbols = getRemovedSymbolsList();
|
||||
rSymbols.clear();
|
||||
|
||||
|
||||
aSymbols.addAll(ScannerConfigUtil.scSymbolsSymbolEntryMap2List(discoveredSymbols, true));
|
||||
rSymbols.addAll(ScannerConfigUtil.scSymbolsSymbolEntryMap2List(discoveredSymbols, false));
|
||||
}
|
||||
|
@ -141,12 +143,12 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
return userInfo.getIncludePaths();
|
||||
}
|
||||
public String[] getActiveIncludePaths() {
|
||||
return getActivePathList().toArray(new String[getActivePathList().size()]);
|
||||
return getActivePathList().toArray(new String[getActivePathList().size()]);
|
||||
}
|
||||
public String[] getRemovedIncludePaths() {
|
||||
return getRemovedPathList().toArray(new String[getRemovedPathList().size()]);
|
||||
}
|
||||
|
||||
|
||||
public String[] getUserSymbolDefinitions() {
|
||||
if (userInfo == null) {
|
||||
return new String[0];
|
||||
|
@ -154,10 +156,10 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
return userInfo.getPreprocessorSymbols();
|
||||
}
|
||||
public String[] getActiveSymbolDefinitions() {
|
||||
return getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]);
|
||||
return getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]);
|
||||
}
|
||||
public String[] getRemovedSymbolDefinitions() {
|
||||
return getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]);
|
||||
return getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]);
|
||||
}
|
||||
public String[] getPreprocessorSymbols() {
|
||||
// user specified + active
|
||||
|
@ -168,7 +170,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
System.arraycopy(discActiveSymbols, 0, rv, userSymbols.length, discActiveSymbols.length);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
private List<String> getActivePathList() {
|
||||
if (activePaths == null) {
|
||||
activePaths = new ArrayList<String>();
|
||||
|
@ -189,14 +191,14 @@ public class DiscoveredScannerInfo implements IScannerInfo {
|
|||
}
|
||||
return activeSymbols;
|
||||
}
|
||||
|
||||
|
||||
private List<String> getRemovedSymbolsList() {
|
||||
if (removedSymbols == null) {
|
||||
removedSymbols = new ArrayList<String>();
|
||||
}
|
||||
return removedSymbols;
|
||||
}
|
||||
|
||||
|
||||
public void update() throws CoreException {
|
||||
DiscoveredScannerInfoProvider.updateScannerInfo(this);
|
||||
}
|
||||
|
|
|
@ -30,21 +30,22 @@ import org.eclipse.core.runtime.CoreException;
|
|||
/**
|
||||
* @deprecated as of CDT 4.0. Used by legacy CDT 3.X projects.
|
||||
* Replaced by ScannerConfigNature in org.eclipse.cdt.managedbuilder.core.
|
||||
*
|
||||
*
|
||||
* @see IProjectNature
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ScannerConfigNature implements IProjectNature {
|
||||
|
||||
|
||||
public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ScannerConfigNature"; //$NON-NLS-1$
|
||||
private IProject fProject;
|
||||
|
||||
/**
|
||||
* @see IProjectNature#configure
|
||||
*/
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
IProjectDescription description = getProject().getDescription();
|
||||
ICommand[] commands = description.getBuildSpec();
|
||||
|
@ -60,13 +61,14 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
newCommands[commands.length] = command;
|
||||
description.setBuildSpec(newCommands);
|
||||
getProject().setDescription(description, null);
|
||||
|
||||
|
||||
// set default project scanner config settings
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IProjectNature#deconfigure
|
||||
*/
|
||||
@Override
|
||||
public void deconfigure() throws CoreException {
|
||||
IProjectDescription description = getProject().getDescription();
|
||||
ICommand[] commands = description.getBuildSpec();
|
||||
|
@ -85,6 +87,7 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
/**
|
||||
* @see IProjectNature#getProject
|
||||
*/
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return fProject;
|
||||
}
|
||||
|
@ -92,10 +95,11 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
/**
|
||||
* @see IProjectNature#setProject
|
||||
*/
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
fProject = project;
|
||||
}
|
||||
|
||||
|
||||
public static void addScannerConfigNature(IProject project) throws CoreException {
|
||||
IProjectDescription description = project.getDescription();
|
||||
if (description.hasNature(NATURE_ID))
|
||||
|
@ -106,9 +110,9 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
newIds[ids.length] = NATURE_ID;
|
||||
description.setNatureIds(newIds);
|
||||
project.setDescription(description, null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void removeScannerConfigNature(IProject project) throws CoreException {
|
||||
IProjectDescription description = project.getDescription();
|
||||
if (!description.hasNature(NATURE_ID))
|
||||
|
@ -152,7 +156,7 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
newCommands = new ICommand[oldCommands.length + 1];
|
||||
System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length);
|
||||
newCommands[oldCommands.length] = newCommand;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < oldCommands.length; i++) {
|
||||
if (oldCommands[i] == oldCommand) {
|
||||
|
@ -175,19 +179,19 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
String selectedProfile = scPrefInfo.getSelectedProfileId();
|
||||
IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(
|
||||
project, selectedProfile);
|
||||
|
||||
|
||||
scProjInfo.setAutoDiscoveryEnabled(scPrefInfo.isAutoDiscoveryEnabled());
|
||||
scProjInfo.setProblemReportingEnabled(scPrefInfo.isProblemReportingEnabled());
|
||||
|
||||
|
||||
scProjInfo.setBuildOutputParserEnabled(scPrefInfo.isBuildOutputParserEnabled());
|
||||
scProjInfo.setBuildOutputFileActionEnabled(scPrefInfo.isBuildOutputFileActionEnabled());
|
||||
scProjInfo.setBuildOutputFilePath(scPrefInfo.getBuildOutputFilePath());
|
||||
|
||||
|
||||
ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(selectedProfile);
|
||||
List<String> providerIdList = scPrefInfo.getProviderIdList();
|
||||
for (Iterator<String> i = providerIdList.iterator(); i.hasNext();) {
|
||||
String providerId = i.next();
|
||||
|
||||
|
||||
scProjInfo.setProviderOutputParserEnabled(providerId, scPrefInfo.isProviderOutputParserEnabled(providerId));
|
||||
if (profile.getScannerInfoProviderElement(providerId).getProviderKind().equals(
|
||||
ScannerConfigProfile.ScannerInfoProvider.RUN)) {
|
||||
|
@ -199,7 +203,7 @@ public class ScannerConfigNature implements IProjectNature {
|
|||
}
|
||||
}
|
||||
scProjInfo.save();
|
||||
|
||||
|
||||
// the last step is to add discovered paths container
|
||||
ICProject cProject = CoreModel.getDefault().create(project);
|
||||
IPathEntry[] rawPathEntries = CoreModel.getRawPathEntries(cProject);
|
||||
|
|
|
@ -57,14 +57,16 @@ public class BuildInfoFactory {
|
|||
static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild"; //$NON-NLS-1$
|
||||
static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments"; //$NON-NLS-1$
|
||||
static final String ENVIRONMENT = PREFIX + ".environment"; //$NON-NLS-1$
|
||||
static final String BUILD_APPEND_ENVIRONMENT = PREFIX + ".append_environment"; //$NON-NLS-1$
|
||||
static final String BUILD_APPEND_ENVIRONMENT = PREFIX + ".append_environment"; //$NON-NLS-1$
|
||||
|
||||
private abstract static class AbstractBuildInfo implements IMakeBuilderInfo {
|
||||
|
||||
@Override
|
||||
public void setUseDefaultBuildCmd(boolean on) throws CoreException {
|
||||
putString(USE_DEFAULT_BUILD_CMD, new Boolean(on).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultBuildCmd() {
|
||||
if (getString(USE_DEFAULT_BUILD_CMD) == null) { // if no property
|
||||
// then default to
|
||||
|
@ -74,6 +76,7 @@ public class BuildInfoFactory {
|
|||
return getBoolean(USE_DEFAULT_BUILD_CMD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuildAttribute(String name, String defaultValue) {
|
||||
String value = getString(name);
|
||||
if (value == null ) {
|
||||
|
@ -89,15 +92,17 @@ public class BuildInfoFactory {
|
|||
value = getString(BuildInfoFactory.BUILD_TARGET_CLEAN);
|
||||
} else if (IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL.equals(name)) {
|
||||
value = getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return value != null ? value : defaultValue != null ? defaultValue : ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildAttribute(String name, String value) throws CoreException {
|
||||
putString(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getExpandedEnvironment() {
|
||||
Map<String, String> env = getEnvironment();
|
||||
HashMap<String, String> envMap = new HashMap<String, String>(env.entrySet().size());
|
||||
|
@ -121,11 +126,13 @@ public class BuildInfoFactory {
|
|||
return envMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildCommand(IPath location) throws CoreException {
|
||||
putString(IMakeCommonBuildInfo.BUILD_COMMAND, null);
|
||||
putString(BuildInfoFactory.BUILD_COMMAND, location.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPath getBuildCommand() {
|
||||
if (isDefaultBuildCmd()) {
|
||||
String command = getBuildParameter("defaultCommand"); //$NON-NLS-1$
|
||||
|
@ -163,11 +170,13 @@ public class BuildInfoFactory {
|
|||
|
||||
protected abstract String getBuilderID();
|
||||
|
||||
@Override
|
||||
public void setBuildLocation(IPath location) throws CoreException {
|
||||
putString(IMakeCommonBuildInfo.BUILD_LOCATION, null);
|
||||
putString(BuildInfoFactory.BUILD_LOCATION, location.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPath getBuildLocation() {
|
||||
String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, getString(BuildInfoFactory.BUILD_LOCATION));
|
||||
try {
|
||||
|
@ -177,6 +186,7 @@ public class BuildInfoFactory {
|
|||
return new Path(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuildArguments() {
|
||||
String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, getString(BuildInfoFactory.BUILD_ARGUMENTS));
|
||||
if (result == null) {
|
||||
|
@ -189,24 +199,29 @@ public class BuildInfoFactory {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildArguments(String args) throws CoreException {
|
||||
putString(IMakeCommonBuildInfo.BUILD_ARGUMENTS, null);
|
||||
putString(BuildInfoFactory.BUILD_ARGUMENTS, args);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setStopOnError(boolean enabled) throws CoreException {
|
||||
putString(STOP_ON_ERROR, new Boolean(enabled).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStopOnError() {
|
||||
return getBoolean(STOP_ON_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoBuildTarget(String target) throws CoreException {
|
||||
putString(IMakeBuilderInfo.BUILD_TARGET_AUTO, null);
|
||||
putString(BuildInfoFactory.BUILD_TARGET_AUTO, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAutoBuildTarget() {
|
||||
String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, getString(BuildInfoFactory.BUILD_TARGET_AUTO));
|
||||
try {
|
||||
|
@ -216,11 +231,13 @@ public class BuildInfoFactory {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIncrementalBuildTarget(String target) throws CoreException {
|
||||
putString(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, null);
|
||||
putString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIncrementalBuildTarget() {
|
||||
String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL,
|
||||
getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL));
|
||||
|
@ -231,10 +248,12 @@ public class BuildInfoFactory {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFullBuildTarget(String target) throws CoreException {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullBuildTarget() {
|
||||
String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL));
|
||||
try {
|
||||
|
@ -244,11 +263,13 @@ public class BuildInfoFactory {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCleanBuildTarget(String target) throws CoreException {
|
||||
putString(IMakeBuilderInfo.BUILD_TARGET_CLEAN, null);
|
||||
putString(BuildInfoFactory.BUILD_TARGET_CLEAN, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCleanBuildTarget() {
|
||||
String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, getString(BuildInfoFactory.BUILD_TARGET_CLEAN));
|
||||
try {
|
||||
|
@ -258,38 +279,47 @@ public class BuildInfoFactory {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoBuildEnable(boolean enabled) throws CoreException {
|
||||
putString(BUILD_AUTO_ENABLED, new Boolean(enabled).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoBuildEnable() {
|
||||
return getBoolean(BUILD_AUTO_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIncrementalBuildEnable(boolean enabled) throws CoreException {
|
||||
putString(BUILD_INCREMENTAL_ENABLED, new Boolean(enabled).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIncrementalBuildEnabled() {
|
||||
return getBoolean(BUILD_INCREMENTAL_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFullBuildEnable(boolean enabled) throws CoreException {
|
||||
putString(BUILD_FULL_ENABLED, new Boolean(enabled).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullBuildEnabled() {
|
||||
return getBoolean(BUILD_FULL_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCleanBuildEnable(boolean enabled) throws CoreException {
|
||||
putString(BUILD_CLEAN_ENABLED, new Boolean(enabled).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCleanBuildEnabled() {
|
||||
return getBoolean(BUILD_CLEAN_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getErrorParsers() {
|
||||
String parsers = getString(ErrorParserManager.PREF_ERROR_PARSER);
|
||||
if (parsers != null && parsers.length() > 0) {
|
||||
|
@ -303,6 +333,7 @@ public class BuildInfoFactory {
|
|||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorParsers(String[] parsers) throws CoreException {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int i = 0; i < parsers.length; i++) {
|
||||
|
@ -311,14 +342,17 @@ public class BuildInfoFactory {
|
|||
putString(ErrorParserManager.PREF_ERROR_PARSER, buf.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getEnvironment() {
|
||||
return decodeMap(getString(ENVIRONMENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Map<String, String> env) throws CoreException {
|
||||
putString(ENVIRONMENT, encodeMap(env));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean appendEnvironment() {
|
||||
if (getString(BUILD_APPEND_ENVIRONMENT) != null) {
|
||||
return getBoolean(BUILD_APPEND_ENVIRONMENT);
|
||||
|
@ -326,6 +360,7 @@ public class BuildInfoFactory {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppendEnvironment(boolean append) throws CoreException {
|
||||
putString(BUILD_APPEND_ENVIRONMENT, new Boolean(append).toString());
|
||||
}
|
||||
|
@ -345,7 +380,7 @@ public class BuildInfoFactory {
|
|||
int ndx = 0;
|
||||
while (ndx < envStr.length()) {
|
||||
if (escapeChars.indexOf(envStr.charAt(ndx)) != -1) {
|
||||
if (envStr.charAt(ndx - 1) == escapeChar) {
|
||||
if (envStr.charAt(ndx - 1) == escapeChar) {
|
||||
// escaped '|' - remove '\' and continue on.
|
||||
envStr.deleteCharAt(ndx - 1);
|
||||
if (ndx == envStr.length()) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.runtime.Preferences;
|
|||
@Deprecated
|
||||
public class MakeProject implements ICOwner {
|
||||
|
||||
@Override
|
||||
public void configure(ICDescriptor cDescriptor) throws CoreException {
|
||||
cDescriptor.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
|
||||
cDescriptor.remove(CCorePlugin.BUILDER_MODEL_ID);
|
||||
|
@ -33,6 +34,7 @@ public class MakeProject implements ICOwner {
|
|||
updateIndexers(cDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ICDescriptor cDescriptor, String extensionID) throws CoreException {
|
||||
if (extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) {
|
||||
updateBinaryParsers(cDescriptor);
|
||||
|
|
|
@ -63,14 +63,17 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
isStopOnError = info.isStopOnError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainer(IContainer container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -79,32 +82,39 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return targetAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTargetBuilderID() {
|
||||
return targetBuilderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStopOnError() {
|
||||
return isStopOnError;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStopOnError(boolean stopOnError) throws CoreException {
|
||||
isStopOnError = stopOnError;
|
||||
manager.updateTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultBuildCmd() {
|
||||
return isDefaultBuildCmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseDefaultBuildCmd(boolean useDefault) throws CoreException {
|
||||
isDefaultBuildCmd = useDefault;
|
||||
manager.updateTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPath getBuildCommand() {
|
||||
if (isDefaultBuildCmd()) {
|
||||
IMakeBuilderInfo info;
|
||||
|
@ -122,10 +132,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return new Path(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildCommand(IPath command) throws CoreException {
|
||||
setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, command.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuildArguments() {
|
||||
if (isDefaultBuildCmd()) {
|
||||
IMakeBuilderInfo info;
|
||||
|
@ -134,7 +146,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return info.getBuildArguments();
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); //$NON-NLS-1$
|
||||
try {
|
||||
result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
|
||||
|
@ -143,14 +155,17 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildArguments(String arguments) throws CoreException {
|
||||
setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildTarget(String target) throws CoreException {
|
||||
setBuildAttribute(IMakeTarget.BUILD_TARGET, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuildTarget() {
|
||||
String result = getBuildAttribute(IMakeTarget.BUILD_TARGET, ""); //$NON-NLS-1$
|
||||
try {
|
||||
|
@ -160,33 +175,40 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunAllBuilders(boolean runAllBuilders) throws CoreException {
|
||||
this.runAllBuidlers = runAllBuilders;
|
||||
manager.updateTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runAllBuilders() {
|
||||
return runAllBuidlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildAttribute(String name, String value) throws CoreException {
|
||||
targetAttributes.put(name, value);
|
||||
manager.updateTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuildAttribute(String name, String defaultValue) {
|
||||
String value = targetAttributes.get(name);
|
||||
return value != null ? value : defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPath getBuildLocation() {
|
||||
return container.getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBuildLocation(IPath location) throws CoreException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getErrorParsers() {
|
||||
IMakeBuilderInfo projectInfo;
|
||||
try {
|
||||
|
@ -197,10 +219,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorParsers(String[] parsers) throws CoreException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getExpandedEnvironment() throws CoreException {
|
||||
Map<String, String> env = null;
|
||||
if (appendProjectEnvironment()) {
|
||||
|
@ -232,28 +256,34 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return envMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean appendProjectEnvironment() {
|
||||
return appendProjectEnvironment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppendProjectEnvironment(boolean append) {
|
||||
appendProjectEnvironment = append;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getEnvironment() {
|
||||
return buildEnvironment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Map<String, String> env) throws CoreException {
|
||||
buildEnvironment = new HashMap<String, String>(env);
|
||||
manager.updateTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppendEnvironment(boolean append) throws CoreException {
|
||||
appendEnvironment = append ? 1 : 0;
|
||||
manager.updateTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean appendEnvironment() {
|
||||
return appendEnvironment == USE_PROJECT_ENV_SETTING ? getProjectEnvSetting(): appendEnvironment == 1;
|
||||
}
|
||||
|
@ -268,6 +298,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
|
@ -288,6 +319,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
return container.hashCode() * 17 + name != null ? name.hashCode(): 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(IProgressMonitor monitor) throws CoreException {
|
||||
final String builderID = manager.getBuilderID(targetBuilderID);
|
||||
final HashMap<String, String> infoMap = new HashMap<String, String>();
|
||||
|
@ -314,6 +346,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
|
|||
*
|
||||
* @see org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
if (runAllBuidlers) {
|
||||
ICommand[] commands = project.getDescription().getBuildSpec();
|
||||
|
|
|
@ -14,8 +14,8 @@ package org.eclipse.cdt.make.internal.core;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetListener;
|
||||
|
@ -55,14 +55,17 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
public MakeTargetManager() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMakeTarget createTarget(IProject project, String name, String targetBuilderID) throws CoreException {
|
||||
return new MakeTarget(this, project, targetBuilderID, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTarget(IMakeTarget target) throws CoreException {
|
||||
addTarget(null, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTarget(IContainer container, IMakeTarget target) throws CoreException {
|
||||
if (container instanceof IWorkspaceRoot) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
|
||||
|
@ -82,6 +85,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, target));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTargets(IContainer container, IMakeTarget[] targets) throws CoreException {
|
||||
if (container instanceof IWorkspaceRoot) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
|
||||
|
@ -104,6 +108,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, targets[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean targetExists(IMakeTarget target) {
|
||||
ProjectTargets projectTargets = projectMap.get(target.getProject());
|
||||
if (projectTargets == null) {
|
||||
|
@ -112,6 +117,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
return projectTargets.contains(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTarget(IMakeTarget target) throws CoreException {
|
||||
ProjectTargets projectTargets = projectMap.get(target.getProject());
|
||||
if (projectTargets == null) {
|
||||
|
@ -128,6 +134,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameTarget(IMakeTarget target, String name) throws CoreException {
|
||||
IMakeTarget makeTarget = target;
|
||||
|
||||
|
@ -142,6 +149,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMakeTarget[] getTargets(IContainer container) throws CoreException {
|
||||
ProjectTargets projectTargets = projectMap.get(container.getProject());
|
||||
if (projectTargets == null) {
|
||||
|
@ -150,6 +158,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
return projectTargets.get(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMakeTarget findTarget(IContainer container, String name) throws CoreException {
|
||||
ProjectTargets projectTargets = projectMap.get(container.getProject());
|
||||
if (projectTargets == null) {
|
||||
|
@ -158,10 +167,12 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
return projectTargets.findTarget(container, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject[] getTargetBuilderProjects() {
|
||||
return fProjects.toArray(new IProject[fProjects.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTargetBuilders(IProject project) {
|
||||
if (fProjects.contains(project) || hasTargetBuilder(project)) {
|
||||
try {
|
||||
|
@ -182,6 +193,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTargetBuilder(IProject project) {
|
||||
try {
|
||||
if (project.isAccessible()) {
|
||||
|
@ -213,6 +225,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
IResourceDelta delta = event.getDelta();
|
||||
if (delta != null) {
|
||||
|
@ -228,6 +241,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
/**
|
||||
* @see IResourceDeltaVisitor#visit(IResourceDelta)
|
||||
*/
|
||||
@Override
|
||||
public boolean visit(IResourceDelta delta) {
|
||||
if (delta == null) {
|
||||
return false;
|
||||
|
@ -330,14 +344,17 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IMakeTargetListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IMakeTargetListener listener) {
|
||||
listeners.remove(listeners);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuilderID(String targetBuilderID) {
|
||||
return builderMap.get(targetBuilderID);
|
||||
}
|
||||
|
|
|
@ -17,16 +17,20 @@ import org.eclipse.core.runtime.CoreException;
|
|||
public class ConfigSupportNature implements IProjectNature {
|
||||
private IProject fProject;
|
||||
|
||||
@Override
|
||||
public void configure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deconfigure() throws CoreException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return fProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
fProject = project;
|
||||
}
|
||||
|
|
|
@ -26,15 +26,15 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule;
|
|||
* statement : rule | macro_definition | comments | empty
|
||||
* rule : inference_rule | target_rule
|
||||
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
[ ( command ) * ]
|
||||
* macro_definition : string '=' (string)*
|
||||
* macro_definition : string '=' (string)*
|
||||
* comments : ('#' (string) <nl>) *
|
||||
* empty : <nl>
|
||||
* command : <tab> prefix_command string <nl>
|
||||
* target : string
|
||||
* prefix_command : '-' | '@' | '+'
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
*/
|
||||
|
||||
public abstract class AbstractMakefile extends Parent implements IMakefile {
|
||||
|
@ -45,8 +45,10 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract IDirective[] getBuiltins();
|
||||
|
||||
@Override
|
||||
public IRule[] getRules() {
|
||||
IDirective[] stmts = getDirectives(true);
|
||||
List<IDirective> array = new ArrayList<IDirective>(stmts.length);
|
||||
|
@ -58,6 +60,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRule[] getRules(String target) {
|
||||
IRule[] rules = getRules();
|
||||
List<IRule> array = new ArrayList<IRule>(rules.length);
|
||||
|
@ -69,6 +72,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInferenceRule[] getInferenceRules() {
|
||||
IRule[] rules = getRules();
|
||||
List<IRule> array = new ArrayList<IRule>(rules.length);
|
||||
|
@ -80,6 +84,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IInferenceRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInferenceRule[] getInferenceRules(String target) {
|
||||
IInferenceRule[] irules = getInferenceRules();
|
||||
List<IInferenceRule> array = new ArrayList<IInferenceRule>(irules.length);
|
||||
|
@ -91,6 +96,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IInferenceRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITargetRule[] getTargetRules() {
|
||||
IRule[] trules = getRules();
|
||||
List<IRule> array = new ArrayList<IRule>(trules.length);
|
||||
|
@ -102,6 +108,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new ITargetRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITargetRule[] getTargetRules(String target) {
|
||||
ITargetRule[] trules = getTargetRules();
|
||||
List<ITargetRule> array = new ArrayList<ITargetRule>(trules.length);
|
||||
|
@ -113,6 +120,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new ITargetRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMacroDefinition[] getMacroDefinitions() {
|
||||
IDirective[] stmts = getDirectives(true);
|
||||
List<IDirective> array = new ArrayList<IDirective>(stmts.length);
|
||||
|
@ -124,6 +132,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IMacroDefinition[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMacroDefinition[] getMacroDefinitions(String name) {
|
||||
IMacroDefinition[] variables = getMacroDefinitions();
|
||||
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(variables.length);
|
||||
|
@ -135,6 +144,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IMacroDefinition[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMacroDefinition[] getBuiltinMacroDefinitions() {
|
||||
IDirective[] stmts = getBuiltins();
|
||||
List<IDirective> array = new ArrayList<IDirective>(stmts.length);
|
||||
|
@ -146,6 +156,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IMacroDefinition[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMacroDefinition[] getBuiltinMacroDefinitions(String name) {
|
||||
IMacroDefinition[] variables = getBuiltinMacroDefinitions();
|
||||
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(variables.length);
|
||||
|
@ -179,10 +190,12 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return array.toArray(new IInferenceRule[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expandString(String line) {
|
||||
return expandString(line, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expandString(String line, boolean recursive) {
|
||||
int len = line.length();
|
||||
boolean foundDollar = false;
|
||||
|
@ -264,14 +277,15 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
|||
return buffer.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URI getFileURI() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
public void setFileURI(URI filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IMakefile getMakefile() {
|
||||
return this;
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.make.core.makefile.ICommand;
|
|||
|
||||
/**
|
||||
* Makefile : ( statement ) *
|
||||
* statement : command | ..
|
||||
* statement : command | ..
|
||||
* command : <tab> prefix_command string <nl>
|
||||
* prefix_command : '-' | '@' | '+'
|
||||
*/
|
||||
|
@ -39,6 +39,7 @@ public class Command extends Directive implements ICommand {
|
|||
* target as a prerequisite or has no prerequisites, any error
|
||||
* found while executing the command will be ignored.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldIgnoreError() {
|
||||
// Check for the prefix hyphen in the command.
|
||||
if (getPrefix() == HYPHEN) {
|
||||
|
@ -54,6 +55,7 @@ public class Command extends Directive implements ICommand {
|
|||
* target as a prerequisite or has no prerequisites, the command
|
||||
* will not be written to standard output before it is executed.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldBeSilent() {
|
||||
// Check for the prefix at sign
|
||||
if (getPrefix() == AT) {
|
||||
|
@ -67,6 +69,7 @@ public class Command extends Directive implements ICommand {
|
|||
* command line that will be executed even if -n, -q or -t is
|
||||
* specified.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldExecute() {
|
||||
// Check for the prefix at sign
|
||||
if (getPrefix() == PLUS) {
|
||||
|
@ -108,6 +111,7 @@ public class Command extends Directive implements ICommand {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.ICommand#execute(java.lang.String[], java.io.File)
|
||||
*/
|
||||
@Override
|
||||
public Process execute(String shell, String[] envp, File dir) throws IOException {
|
||||
String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$
|
||||
return Runtime.getRuntime().exec(cmdArray, envp, dir);
|
||||
|
|
|
@ -33,6 +33,7 @@ public abstract class Directive implements IDirective {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IDirective#getEndLine()
|
||||
*/
|
||||
@Override
|
||||
public int getEndLine() {
|
||||
return endLine;
|
||||
}
|
||||
|
@ -40,6 +41,7 @@ public abstract class Directive implements IDirective {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IDirective#getStartLine()
|
||||
*/
|
||||
@Override
|
||||
public int getStartLine() {
|
||||
return startLine;
|
||||
}
|
||||
|
@ -47,6 +49,7 @@ public abstract class Directive implements IDirective {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IDirective#getParent()
|
||||
*/
|
||||
@Override
|
||||
public IDirective getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
@ -54,6 +57,7 @@ public abstract class Directive implements IDirective {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IDirective#getMakefile()
|
||||
*/
|
||||
@Override
|
||||
public IMakefile getMakefile() {
|
||||
return parent.getMakefile();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
value = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -37,6 +38,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
name = (n == null) ? "" : n.trim() ; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuffer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
@ -78,6 +80,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromCommand()
|
||||
*/
|
||||
@Override
|
||||
public boolean isFromCommand() {
|
||||
return fromCommand;
|
||||
}
|
||||
|
@ -85,6 +88,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromDefault()
|
||||
*/
|
||||
@Override
|
||||
public boolean isFromDefault() {
|
||||
return fromDefault;
|
||||
}
|
||||
|
@ -92,6 +96,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment()
|
||||
*/
|
||||
@Override
|
||||
public boolean isFromEnviroment() {
|
||||
return fromEnvironment;
|
||||
}
|
||||
|
@ -99,6 +104,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment()
|
||||
*/
|
||||
@Override
|
||||
public boolean isFromEnvironmentOverride() {
|
||||
return fromEnvironmentOverride;
|
||||
}
|
||||
|
@ -106,6 +112,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromMakefile()
|
||||
*/
|
||||
@Override
|
||||
public boolean isFromMakefile() {
|
||||
return fromMakefile;
|
||||
}
|
||||
|
|
|
@ -22,15 +22,15 @@ import org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider;
|
|||
* statement : rule | macro_definition | comments | empty
|
||||
* rule : inference_rule | target_rule
|
||||
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
[ ( command ) * ]
|
||||
* macro_definition : string '=' (string)*
|
||||
* macro_definition : string '=' (string)*
|
||||
* comments : ('#' (string) <nl>) *
|
||||
* empty : <nl>
|
||||
* command : <tab> prefix_command string <nl>
|
||||
* target : string
|
||||
* prefix_command : '-' | '@' | '+'
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
*/
|
||||
|
||||
public class NullMakefile extends AbstractMakefile {
|
||||
|
@ -62,12 +62,14 @@ public class NullMakefile extends AbstractMakefile {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.io.Reader)
|
||||
*/
|
||||
@Override
|
||||
public void parse(String name, Reader makefile) throws IOException {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#getMakefileReaderProvider()
|
||||
*/
|
||||
@Override
|
||||
public IMakefileReaderProvider getMakefileReaderProvider() {
|
||||
return null;
|
||||
}
|
||||
|
@ -78,12 +80,14 @@ public class NullMakefile extends AbstractMakefile {
|
|||
public void parse(String name,
|
||||
IMakefileReaderProvider makefileReaderProvider) throws IOException {
|
||||
}
|
||||
@Override
|
||||
public void parse(URI fileURI, Reader makefile) throws IOException {
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider)
|
||||
*/
|
||||
@Override
|
||||
public void parse(URI fileURI,
|
||||
IMakefileReaderProvider makefileReaderProvider) throws IOException {
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.make.internal.core.makefile;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.cdt.make.core.makefile.IParent;
|
||||
import org.eclipse.cdt.make.core.makefile.IDirective;
|
||||
import org.eclipse.cdt.make.core.makefile.IParent;
|
||||
|
||||
/**
|
||||
* IParent
|
||||
|
@ -32,6 +32,7 @@ public abstract class Parent extends Directive implements IParent {
|
|||
return getDirectives();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDirective[] getDirectives() {
|
||||
children.trimToSize();
|
||||
return children.toArray(new IDirective[0]);
|
||||
|
@ -57,7 +58,7 @@ public abstract class Parent extends Directive implements IParent {
|
|||
|
||||
public Directive[] getStatements() {
|
||||
children.trimToSize();
|
||||
return children.toArray(new Directive[0]);
|
||||
return children.toArray(new Directive[0]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.make.internal.core.makefile;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.make.core.makefile.ICommand;
|
||||
import org.eclipse.cdt.make.core.makefile.IRule;
|
||||
import org.eclipse.cdt.make.core.makefile.IDirective;
|
||||
import org.eclipse.cdt.make.core.makefile.IRule;
|
||||
import org.eclipse.cdt.make.core.makefile.ITarget;
|
||||
|
||||
public abstract class Rule extends Parent implements IRule {
|
||||
|
@ -31,6 +31,7 @@ public abstract class Rule extends Parent implements IRule {
|
|||
addDirectives(cmds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICommand[] getCommands() {
|
||||
IDirective[] directives = getDirectives();
|
||||
ArrayList<IDirective> cmds = new ArrayList<IDirective>(directives.length);
|
||||
|
@ -42,6 +43,7 @@ public abstract class Rule extends Parent implements IRule {
|
|||
return cmds.toArray(new ICommand[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITarget getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.core.makefile;
|
||||
|
||||
import org.eclipse.cdt.make.core.makefile.ISpecialRule;
|
||||
import org.eclipse.cdt.make.core.makefile.ICommand;
|
||||
import org.eclipse.cdt.make.core.makefile.ISpecialRule;
|
||||
|
||||
/**
|
||||
* Targets that have special meaning for Make.
|
||||
|
@ -25,6 +25,7 @@ public abstract class SpecialRule extends Rule implements ISpecialRule {
|
|||
prerequisites = reqs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPrerequisites() {
|
||||
return prerequisites;
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule;
|
|||
* statement : rule | macro_definition | comments | empty
|
||||
* rule : inference_rule | target_rule
|
||||
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
[ ( <tab> prefix_command command ) * ]
|
||||
* macro_definition : string '=' (string)*
|
||||
* macro_definition : string '=' (string)*
|
||||
* comments : '#' (string) *
|
||||
* empty : <nl>
|
||||
* command : string <nl>
|
||||
* target : string
|
||||
* prefix_command : '-' | '@' | '+'
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
*/
|
||||
|
||||
public class TargetRule extends Rule implements ITargetRule {
|
||||
|
@ -46,6 +46,7 @@ public class TargetRule extends Rule implements ITargetRule {
|
|||
prerequisites = reqs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPrerequisites() {
|
||||
return prerequisites;
|
||||
}
|
||||
|
|
|
@ -39,34 +39,42 @@ public abstract class Conditional extends Parent implements IConditional {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getConditional() {
|
||||
return cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIfdef() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIfndef() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIfeq() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIfneq() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isElse() {
|
||||
return false;
|
||||
}
|
||||
|
@ -87,12 +95,12 @@ public abstract class Conditional extends Parent implements IConditional {
|
|||
String line = getConditional().trim();
|
||||
|
||||
char terminal = line.charAt(0) == '(' ? ',' : line.charAt(0);
|
||||
|
||||
|
||||
if (line.length() < 5 && terminal != ',' && terminal != '"' && terminal != '\'') {
|
||||
arg1 = arg2 = EMPTY;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Find the end of the first string.
|
||||
int count = 0;
|
||||
// For the (ARG1, ARG2) format.
|
||||
|
@ -121,20 +129,20 @@ public abstract class Conditional extends Parent implements IConditional {
|
|||
|
||||
if (count >= line.length()) {
|
||||
arg1 = arg2 = EMPTY;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
arg1 = line.substring(1, count);
|
||||
|
||||
|
||||
/* Find the start of the second string. */
|
||||
line = line.substring(count + 1).trim();
|
||||
|
||||
|
||||
terminal = terminal == ',' ? ')' : line.charAt(0);
|
||||
if (terminal != ')' && terminal != '"' && terminal != '\'') {
|
||||
arg2 = EMPTY;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
count = 0;
|
||||
/* Find the end of the second string. */
|
||||
if (terminal == ')') {
|
||||
|
|
|
@ -59,15 +59,15 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* statement : rule | macro_definition | comments | empty
|
||||
* rule : inference_rule | target_rule
|
||||
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
* target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
[ ( command ) * ]
|
||||
* macro_definition : string '=' (string)*
|
||||
* macro_definition : string '=' (string)*
|
||||
* comments : ('#' (string) <nl>) *
|
||||
* empty : <nl>
|
||||
* command : <tab> prefix_command string <nl>
|
||||
* target : string
|
||||
* prefix_command : '-' | '@' | '+'
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
*/
|
||||
|
||||
public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
||||
|
@ -82,14 +82,16 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
|||
public GNUMakefile() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#getMakefileReaderProvider()
|
||||
*/
|
||||
@Override
|
||||
public IMakefileReaderProvider getMakefileReaderProvider() {
|
||||
return makefileReaderProvider;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void parse(String filePath, Reader reader) throws IOException {
|
||||
parse(URIUtil.toURI(filePath), new MakefileReader(reader));
|
||||
}
|
||||
|
@ -97,6 +99,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider)
|
||||
*/
|
||||
@Override
|
||||
public void parse(URI fileURI,
|
||||
IMakefileReaderProvider makefileReaderProvider) throws IOException {
|
||||
this.makefileReaderProvider = makefileReaderProvider;
|
||||
|
@ -107,7 +110,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
|||
final IFileInfo info = store.fetchInfo();
|
||||
if (!info.exists() || info.isDirectory())
|
||||
throw new IOException();
|
||||
|
||||
|
||||
reader = new MakefileReader(new InputStreamReader(
|
||||
store.openInputStream(EFS.NONE, null)));
|
||||
} catch (CoreException e) {
|
||||
|
@ -119,12 +122,13 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
|||
}
|
||||
parse(fileURI, reader);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void parse(URI filePath, Reader reader) throws IOException {
|
||||
parse(filePath, new MakefileReader(reader));
|
||||
parse(filePath, new MakefileReader(reader));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected void parse(URI fileURI, MakefileReader reader) throws IOException {
|
||||
String line;
|
||||
Rule[] rules = null;
|
||||
|
@ -306,7 +310,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
|||
vd.setLines(startLine, endLine);
|
||||
addDirective(conditions, vd);
|
||||
if (!vd.isTargetSpecific()) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -814,10 +818,12 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
|
|||
return builtins;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIncludeDirectories(String[] dirs) {
|
||||
includeDirectories = dirs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIncludeDirectories() {
|
||||
return includeDirectories;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class GNUMakefileChecker extends ACBuilder {
|
|||
this.monitor = monitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||
IResource resource = delta.getResource();
|
||||
if (resource != null && resource.getProject() == getProject()) {
|
||||
|
|
|
@ -41,6 +41,7 @@ public class GNUMakefileValidator implements IMakefileValidator {
|
|||
setMarkerGenerator(errorHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerGenerator(IMarkerGenerator errorHandler) {
|
||||
reporter = errorHandler;
|
||||
}
|
||||
|
@ -49,16 +50,18 @@ public class GNUMakefileValidator implements IMakefileValidator {
|
|||
if (reporter == null) {
|
||||
reporter = new IMarkerGenerator() {
|
||||
|
||||
@Override
|
||||
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||
ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar, null);
|
||||
addMarker(problemMarkerInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
|
||||
*/
|
||||
@Override
|
||||
public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
|
||||
String name = "Makefile"; //$NON-NLS-1$
|
||||
if (problemMarkerInfo.file != null) {
|
||||
|
@ -76,8 +79,8 @@ public class GNUMakefileValidator implements IMakefileValidator {
|
|||
sb.append(':').append(problemMarkerInfo.externalPath);
|
||||
}
|
||||
sb.append('\n');
|
||||
System.out.println(sb.toString());
|
||||
|
||||
System.out.println(sb.toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,12 +97,13 @@ public class GNUMakefileValidator implements IMakefileValidator {
|
|||
}
|
||||
return MakefileMessages.getString("MakefileValidator.unknown"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
return reporter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void checkFile(IFile file, IProgressMonitor monitor) {
|
||||
String message = MakefileMessages.getString("MakefileValidator.checkingFile") + file.getFullPath().toString(); //$NON-NLS-1$
|
||||
monitor.subTask(message);
|
||||
|
|
|
@ -44,6 +44,7 @@ public class Include extends Parent implements IInclude {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFilenames() {
|
||||
return filenames;
|
||||
}
|
||||
|
@ -60,8 +61,8 @@ public class Include extends Parent implements IInclude {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IDirective[] getDirectives() {
|
||||
clearDirectives();
|
||||
|
|
|
@ -19,10 +19,12 @@ public abstract class Terminal extends Directive implements ITerminal {
|
|||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEndif() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEndef() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class UnExport extends Directive implements IUnExport {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVariable() {
|
||||
return variable;
|
||||
}
|
||||
|
|
|
@ -36,10 +36,12 @@ public class VPath extends Directive implements IVPath {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDirectories() {
|
||||
return directories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
|
|
@ -84,31 +84,38 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecursivelyExpanded() {
|
||||
return type == TYPE_RECURSIVE_EXPAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSimplyExpanded() {
|
||||
return type == TYPE_SIMPLE_EXPAND;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConditional() {
|
||||
return type == TYPE_CONDITIONAL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAppend() {
|
||||
return type == TYPE_APPEND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetSpecific() {
|
||||
String t = getTarget();
|
||||
return t != null && t.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExport() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiLine() {
|
||||
return false;
|
||||
}
|
||||
|
@ -116,6 +123,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
|
|||
/**
|
||||
* Variable from an `override' directive.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOverride() {
|
||||
return false;
|
||||
}
|
||||
|
@ -123,10 +131,12 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
|
|||
/**
|
||||
* Automatic variable -- cannot be set.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutomatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTarget() {
|
||||
return varTarget;
|
||||
}
|
||||
|
|
|
@ -51,15 +51,15 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* rule : inference_rule | target_rule | special_rule
|
||||
* inference_rule : target ':' [ ';' command ] <nl>
|
||||
[ ( command ) * ]
|
||||
* target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
* target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
|
||||
[ ( command ) * ]
|
||||
* macro_definition : string '=' ( string )*
|
||||
* macro_definition : string '=' ( string )*
|
||||
* comments : ('#' ( string ) <nl>) *
|
||||
* empty : <nl>
|
||||
* command : <tab> prefix_command string <nl>
|
||||
* target : string
|
||||
* prefix_command : '-' | '@' | '+'
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
* internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
|
||||
*/
|
||||
|
||||
public class PosixMakefile extends AbstractMakefile {
|
||||
|
@ -70,14 +70,16 @@ public class PosixMakefile extends AbstractMakefile {
|
|||
public PosixMakefile() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#getMakefileReaderProvider()
|
||||
*/
|
||||
@Override
|
||||
public IMakefileReaderProvider getMakefileReaderProvider() {
|
||||
return makefileReaderProvider;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void parse(String name, Reader reader) throws IOException {
|
||||
parse(URIUtil.toURI(name), new MakefileReader(reader));
|
||||
}
|
||||
|
@ -85,6 +87,7 @@ public class PosixMakefile extends AbstractMakefile {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider)
|
||||
*/
|
||||
@Override
|
||||
public void parse(URI fileURI,
|
||||
IMakefileReaderProvider makefileReaderProvider) throws IOException {
|
||||
this.makefileReaderProvider = makefileReaderProvider;
|
||||
|
@ -102,7 +105,8 @@ public class PosixMakefile extends AbstractMakefile {
|
|||
}
|
||||
parse(fileURI, reader);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void parse(URI fileURI, Reader reader) throws IOException {
|
||||
parse(fileURI, new MakefileReader(reader));
|
||||
}
|
||||
|
|
|
@ -42,23 +42,23 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
|
||||
public class CDataDiscoveredInfoCalculator {
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
|
||||
private static CDataDiscoveredInfoCalculator fInstance;
|
||||
|
||||
|
||||
public static class DiscoveredSettingInfo{
|
||||
private boolean fIsPerFileDiscovery;
|
||||
private IRcSettingInfo[] fInfos;
|
||||
|
||||
|
||||
public DiscoveredSettingInfo(boolean isPerFileDiscovery, IRcSettingInfo[] infos){
|
||||
fIsPerFileDiscovery = isPerFileDiscovery;
|
||||
fInfos = infos;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPerFileDiscovery(){
|
||||
return fIsPerFileDiscovery;
|
||||
}
|
||||
|
||||
|
||||
public IRcSettingInfo[] getRcSettingInfos(){
|
||||
return fInfos;
|
||||
}
|
||||
|
@ -66,16 +66,16 @@ public class CDataDiscoveredInfoCalculator {
|
|||
|
||||
public interface IRcSettingInfo {
|
||||
CResourceData getResourceData();
|
||||
|
||||
|
||||
ILangSettingInfo[] getLangInfos();
|
||||
}
|
||||
|
||||
|
||||
public interface ILangSettingInfo {
|
||||
CLanguageData getLanguageData();
|
||||
|
||||
|
||||
PathInfo getFilePathInfo();
|
||||
}
|
||||
|
||||
|
||||
private static class RcSettingInfo implements IRcSettingInfo{
|
||||
private ArrayList<ILangSettingInfo> fLangInfoList;
|
||||
private CResourceData fRcData;
|
||||
|
@ -84,68 +84,72 @@ public class CDataDiscoveredInfoCalculator {
|
|||
fRcData = rcData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILangSettingInfo[] getLangInfos() {
|
||||
if(fLangInfoList != null && fLangInfoList.size() != 0)
|
||||
return fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]);
|
||||
return new ILangSettingInfo[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public CResourceData getResourceData() {
|
||||
return fRcData;
|
||||
}
|
||||
|
||||
|
||||
void add(ILangSettingInfo info){
|
||||
if(fLangInfoList == null)
|
||||
fLangInfoList = new ArrayList<ILangSettingInfo>();
|
||||
fLangInfoList.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class LangSettingInfo implements ILangSettingInfo {
|
||||
private CLanguageData fLangData;
|
||||
private PathInfo fPathInfo;
|
||||
|
||||
|
||||
LangSettingInfo(CLanguageData langData, PathInfo info){
|
||||
fLangData = langData;
|
||||
fPathInfo = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathInfo getFilePathInfo() {
|
||||
return fPathInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CLanguageData getLanguageData() {
|
||||
return fLangData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static class ListIndexStore {
|
||||
private int fMaxIndex;
|
||||
private List<PathFilePathInfo>[] fStore;
|
||||
|
||||
|
||||
public ListIndexStore(int size){
|
||||
if(size < 0)
|
||||
size = 0;
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<PathFilePathInfo>[] lists = new List[size];
|
||||
fStore = lists;
|
||||
}
|
||||
|
||||
|
||||
public void add(int index, PathFilePathInfo value){
|
||||
List<PathFilePathInfo> list = checkResize(index) ? new ArrayList<PathFilePathInfo>() : fStore[index];
|
||||
if(list == null){
|
||||
list = new ArrayList<PathFilePathInfo>();
|
||||
fStore[index] = list;
|
||||
}
|
||||
|
||||
|
||||
if(fMaxIndex < index)
|
||||
fMaxIndex = index;
|
||||
|
||||
|
||||
list.add(value);
|
||||
}
|
||||
|
||||
|
||||
private boolean checkResize(int index){
|
||||
if(index >= fStore.length){
|
||||
int newSize = ++index;
|
||||
|
@ -159,7 +163,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public List<PathFilePathInfo>[] getLists(){
|
||||
int size = fMaxIndex + 1;
|
||||
List<List<PathFilePathInfo>> list = new ArrayList<List<PathFilePathInfo>>(size);
|
||||
|
@ -169,23 +173,23 @@ public class CDataDiscoveredInfoCalculator {
|
|||
if(l != null)
|
||||
list.add(l);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<PathFilePathInfo>[] lists = list.toArray(new List[list.size()]);
|
||||
return lists;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class PathFilePathInfo {
|
||||
IPath fPath;
|
||||
PathInfo fInfo;
|
||||
|
||||
|
||||
PathFilePathInfo(IPath path, PathInfo info){
|
||||
fPath = path;
|
||||
fInfo = info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ExtsSetSettings {
|
||||
// String[] fExts;
|
||||
// HashSet fExtsSet;
|
||||
|
@ -202,7 +206,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
fBaseLangData = baseLangData;
|
||||
fIsDerived = isDerived;
|
||||
}
|
||||
|
||||
|
||||
void add(ExtsSetSettings setting){
|
||||
if(setting.fPathFilePathInfoMap != null){
|
||||
Collection<List<PathFilePathInfo>> infoLists = setting.fPathFilePathInfoMap.values();
|
||||
|
@ -213,11 +217,11 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void add(PathFilePathInfo pInfo){
|
||||
if(fPathFilePathInfoMap == null)
|
||||
fPathFilePathInfoMap = new HashMap<PathInfo, List<PathFilePathInfo>>(3);
|
||||
|
||||
|
||||
PathInfo fileInfo = pInfo.fInfo;
|
||||
List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList : fPathFilePathInfoMap.get(fileInfo);
|
||||
if(list == null){
|
||||
|
@ -226,13 +230,13 @@ public class CDataDiscoveredInfoCalculator {
|
|||
if(fMaxMatchInfo == null){
|
||||
fMaxMatchInfo = fileInfo;
|
||||
fMaxMatchInfoList = list;
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// fIsMultiple = true;
|
||||
// }
|
||||
} else if(fMaxMatchInfoList != list){
|
||||
// fIsMultiple = true;
|
||||
|
||||
|
||||
if(fMaxMatchInfoList.size() == list.size()){
|
||||
fMaxMatchInfoList = list;
|
||||
fMaxMatchInfo = fileInfo;
|
||||
|
@ -240,32 +244,32 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
list.add(pInfo);
|
||||
}
|
||||
|
||||
|
||||
public boolean isMultiple(){
|
||||
return fPathFilePathInfoMap != null && fPathFilePathInfoMap.size() > 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj == this)
|
||||
return true;
|
||||
|
||||
|
||||
if(isMultiple())
|
||||
return false;
|
||||
|
||||
|
||||
if(!(obj instanceof ExtsSetSettings))
|
||||
return false;
|
||||
|
||||
|
||||
ExtsSetSettings other = (ExtsSetSettings)obj;
|
||||
if(other.isMultiple())
|
||||
return false;
|
||||
|
||||
|
||||
if(!fExtsSet.equals(other.fExtsSet))
|
||||
return false;
|
||||
|
||||
|
||||
if(!CDataUtil.objectsEqual(fMaxMatchInfo, other.fMaxMatchInfo))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -277,18 +281,18 @@ public class CDataDiscoveredInfoCalculator {
|
|||
hash = super.hashCode();
|
||||
else {
|
||||
hash = fExtsSet.hashCode();
|
||||
|
||||
|
||||
if(fMaxMatchInfo != null)
|
||||
hash += fMaxMatchInfo.hashCode();
|
||||
hash += fMaxMatchInfo.hashCode();
|
||||
}
|
||||
|
||||
|
||||
fHash = hash;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class ExtsSet {
|
||||
private String[] fExts;
|
||||
private HashSet<String> fExtsSet;
|
||||
|
@ -297,19 +301,19 @@ public class CDataDiscoveredInfoCalculator {
|
|||
public ExtsSet(String[] exts){
|
||||
fExts = exts == null || exts.length == 0 ? EMPTY_STRING_ARRAY : (String[])exts.clone();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
|
||||
|
||||
if(!(obj instanceof ExtsSet))
|
||||
return false;
|
||||
|
||||
|
||||
ExtsSet other = (ExtsSet)obj;
|
||||
if(fExts.length != other.fExts.length)
|
||||
return false;
|
||||
|
||||
|
||||
if(fExts.length != 0){
|
||||
@SuppressWarnings("unchecked")
|
||||
HashSet<String> set = (HashSet<String>)calcExtsSet().clone();
|
||||
|
@ -319,7 +323,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = fHash;
|
||||
|
@ -332,7 +336,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
private HashSet<String> calcExtsSet(){
|
||||
if(fExtsSet == null)
|
||||
fExtsSet = new HashSet<String>(Arrays.asList(fExts));
|
||||
|
@ -343,9 +347,9 @@ public class CDataDiscoveredInfoCalculator {
|
|||
public String toString() {
|
||||
if(fExts.length == 0)
|
||||
return "<empty>"; //$NON-NLS-1$
|
||||
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
|
||||
for(int i = 0; i < fExts.length; i++){
|
||||
if(i != 0)
|
||||
buf.append(","); //$NON-NLS-1$
|
||||
|
@ -354,7 +358,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class RcSetSettings {
|
||||
private CResourceData fRcData;
|
||||
private HashMap<String, ExtsSetSettings> fExtToExtsSetMap;
|
||||
|
@ -392,13 +396,13 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
void updateRcData(CResourceData data, boolean isDerived){
|
||||
fRcData = data;
|
||||
fIsDerived = data != null ? isDerived : false;
|
||||
updateLangDatas();
|
||||
}
|
||||
|
||||
|
||||
private void updateLangDatas(){
|
||||
if(fRcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
CLanguageData lData = ((CFileData)fRcData).getLanguageData();
|
||||
|
@ -407,9 +411,9 @@ public class CDataDiscoveredInfoCalculator {
|
|||
extSetting.fBaseLangData = lData;
|
||||
extSetting.fIsDerived = lData != null ? fIsDerived : false;
|
||||
}
|
||||
|
||||
if(extSetting != null ?
|
||||
fExtsSetToExtsSetSettingsMap.size() > 1
|
||||
|
||||
if(extSetting != null ?
|
||||
fExtsSetToExtsSetSettingsMap.size() > 1
|
||||
: fExtsSetToExtsSetSettingsMap.size() > 0){
|
||||
for (ExtsSetSettings s : fExtsSetToExtsSetSettingsMap.values()) {
|
||||
if(s != extSetting){
|
||||
|
@ -422,7 +426,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
CLanguageData[] lDatas = ((CFolderData)fRcData).getLanguageDatas();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<ExtsSet, ExtsSetSettings> map = (HashMap<ExtsSet, ExtsSetSettings>)fExtsSetToExtsSetSettingsMap.clone();
|
||||
|
||||
|
||||
CLanguageData lData;
|
||||
for(int i = 0; i < lDatas.length; i++){
|
||||
lData = lDatas[i];
|
||||
|
@ -432,7 +436,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
extSetting.fIsDerived = this.fIsDerived;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(map.size() != 0){
|
||||
Collection<ExtsSetSettings> extSettings = map.values();
|
||||
for (ExtsSetSettings extSetting : extSettings) {
|
||||
|
@ -442,28 +446,28 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IPath getPath(){
|
||||
return fContainer.getPath();
|
||||
}
|
||||
|
||||
|
||||
public RcSetSettings getParent(){
|
||||
PathSettingsContainer cr = fContainer.getParentContainer();
|
||||
if(cr != null)
|
||||
return (RcSetSettings)cr.getValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
void internalSetSettingsMap(HashMap<ExtsSet, ExtsSetSettings> map){
|
||||
fExtsSetToExtsSetSettingsMap = map;
|
||||
fExtToExtsSetMap = calcExtToExtSetSettingsMap(map);
|
||||
}
|
||||
|
||||
|
||||
void internalAdd(ExtsSetSettings setting){
|
||||
if(fExtsSetToExtsSetSettingsMap == null){
|
||||
fExtsSetToExtsSetSettingsMap = new HashMap<ExtsSet, ExtsSetSettings>();
|
||||
}
|
||||
|
||||
|
||||
ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet);
|
||||
if(cur != null){
|
||||
cur.add(setting);
|
||||
|
@ -472,7 +476,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void internalAddSettingsMap(HashMap<ExtsSet, ExtsSetSettings> map){
|
||||
Collection<ExtsSetSettings> settings = map.values();
|
||||
for (ExtsSetSettings setting : settings) {
|
||||
|
@ -488,55 +492,56 @@ public class CDataDiscoveredInfoCalculator {
|
|||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public RcSetSettings[] getChildren(final boolean includeCurrent){
|
||||
final List<Object> list = new ArrayList<Object>();
|
||||
fContainer.accept(new IPathSettingsContainerVisitor(){
|
||||
|
||||
@Override
|
||||
public boolean visit(PathSettingsContainer container) {
|
||||
if(includeCurrent || container != fContainer){
|
||||
list.add(container.getValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
return list.toArray(new RcSetSettings[list.size()]);
|
||||
}
|
||||
|
||||
|
||||
public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated){
|
||||
if(!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size())
|
||||
return false;
|
||||
|
||||
|
||||
Set<Entry<ExtsSet, ExtsSetSettings>> entrySet = other.fExtsSetToExtsSetSettingsMap.entrySet();
|
||||
for (Entry<ExtsSet, ExtsSetSettings> entry : entrySet) {
|
||||
ExtsSetSettings otherSetting = entry.getValue();
|
||||
if(ignoreGenerated && otherSetting.fBaseLangData == null)
|
||||
continue;
|
||||
|
||||
|
||||
ExtsSetSettings thisSetting = fExtsSetToExtsSetSettingsMap.get(entry.getKey());
|
||||
if(thisSetting == null)
|
||||
return false;
|
||||
|
||||
|
||||
if(otherSetting.fMaxMatchInfo != null && !otherSetting.fMaxMatchInfo.equals(thisSetting.fMaxMatchInfo))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void removeChild(RcSetSettings setting){
|
||||
IPath path = setting.fContainer.getPath();
|
||||
IPath thisPath = fContainer.getPath();
|
||||
if(!thisPath.isPrefixOf(path))
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
|
||||
path = path.removeFirstSegments(thisPath.segmentCount());
|
||||
fContainer.removeChildContainer(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static HashMap<String, ExtsSetSettings> calcExtToExtSetSettingsMap(Map<ExtsSet, ExtsSetSettings> extsSetMap){
|
||||
HashMap<String, ExtsSetSettings> result = null;
|
||||
Collection<ExtsSetSettings> settings = extsSetMap.values();
|
||||
|
@ -545,7 +550,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static HashMap<String, ExtsSetSettings> addExtsInfoToMap(ExtsSetSettings setting, HashMap<String, ExtsSetSettings> map){
|
||||
boolean forceAdd = false;
|
||||
String[] exts = setting.fExtsSet.fExts;
|
||||
|
@ -563,7 +568,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
private RcSetSettings createRcSetInfo (CConfigurationData data){
|
||||
CFolderData rootData = data.getRootFolderData();
|
||||
PathSettingsContainer container = PathSettingsContainer.createRootContainer();
|
||||
|
@ -571,22 +576,22 @@ public class CDataDiscoveredInfoCalculator {
|
|||
rcSet.internalSetSettingsMap(createExtsSetSettingsMap(rootData));
|
||||
// rcSet.fExtToExtsSetMap = new HashMap();
|
||||
// rcSet.fExtsSetToExtsSetSettingsMap = new HashMap();
|
||||
|
||||
|
||||
CResourceData[] rcDatas = data.getResourceDatas();
|
||||
CResourceData rcData;
|
||||
RcSetSettings curRcSet;
|
||||
HashMap<ExtsSet, ExtsSetSettings> fileMap;
|
||||
ExtsSetSettings fileSetting;
|
||||
IPath path;
|
||||
|
||||
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
rcData = rcDatas[i];
|
||||
if(rcData == rootData)
|
||||
continue;
|
||||
|
||||
|
||||
if(!includeRcDataInCalculation(data, rcData))
|
||||
continue;
|
||||
|
||||
|
||||
path = rcData.getPath();
|
||||
curRcSet = rcSet.createChild(path, rcData, false);
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
|
@ -598,14 +603,14 @@ public class CDataDiscoveredInfoCalculator {
|
|||
curRcSet.internalSetSettingsMap(createExtsSetSettingsMap((CFolderData)rcData));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return rcSet;
|
||||
}
|
||||
|
||||
|
||||
protected boolean includeRcDataInCalculation(CConfigurationData cfgData, CResourceData rcData){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFileData base) throws CoreException{
|
||||
return cfgData.createFileData(path, base);
|
||||
}
|
||||
|
@ -626,7 +631,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
checkRemoveDups(rcSet);
|
||||
return rcSet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* utility method for creating empty IRcSettingInfo
|
||||
*/
|
||||
|
@ -664,12 +669,12 @@ public class CDataDiscoveredInfoCalculator {
|
|||
} else {
|
||||
list.ensureCapacity(lDatas.length);
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < lDatas.length; i++){
|
||||
list.add(new LangSettingInfo(lDatas[i], info));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, PathFilePathInfo[] pfpis){
|
||||
// IResource rc;
|
||||
PathInfo pInfo;
|
||||
|
@ -682,7 +687,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
CLanguageData lData;
|
||||
ArrayList<ILangSettingInfo> tmpList;
|
||||
PathFilePathInfo pfpi;
|
||||
|
||||
|
||||
for(int i = 0; i < pfpis.length; i++){
|
||||
pfpi = pfpis[i];
|
||||
projRelPath = pfpi.fPath;
|
||||
|
@ -708,19 +713,19 @@ public class CDataDiscoveredInfoCalculator {
|
|||
kinds |= ICLanguageSettingEntry.MACRO_FILE;
|
||||
if(symbolMap.size() != 0)
|
||||
kinds |= ICLanguageSettingEntry.MACRO;
|
||||
|
||||
|
||||
rcInfo = null;
|
||||
for(int k = 0; k < lDatas.length; k++){
|
||||
lData = lDatas[k];
|
||||
if((lData.getSupportedEntryKinds() & kinds) == 0)
|
||||
continue;
|
||||
|
||||
|
||||
if(rcInfo == null){
|
||||
rcInfo = new RcSettingInfo(rootData);
|
||||
tmpList = new ArrayList<ILangSettingInfo>(lDatas.length - k);
|
||||
rcInfo.fLangInfoList = tmpList;
|
||||
}
|
||||
|
||||
|
||||
lInfo = new LangSettingInfo(lData, pInfo);
|
||||
rcInfo.add(lInfo);
|
||||
}
|
||||
|
@ -733,7 +738,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
// switch(rc.getType()){
|
||||
// case IResource.FILE:
|
||||
// projRelPath = rc.getProjectRelativePath();
|
||||
// dataSetting = rcSet.getChild(projRelPath, false);
|
||||
// dataSetting = rcSet.getChild(projRelPath, false);
|
||||
// rcData = dataSetting.fRcData;
|
||||
rcData = rcSet.getChild(projRelPath, false).fRcData;
|
||||
if(!rcData.getPath().equals(projRelPath)){
|
||||
|
@ -752,20 +757,20 @@ public class CDataDiscoveredInfoCalculator {
|
|||
} catch (CoreException e) {
|
||||
rcData = null;
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(rcData != null)
|
||||
// dataSetting = rcSet.createChild(projRelPath, rcData, false);
|
||||
// else
|
||||
// dataSetting = null;
|
||||
}
|
||||
|
||||
|
||||
if(rcData != null){
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
lData = ((CFileData)rcData).getLanguageData();
|
||||
} else {
|
||||
lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData)rcData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(lData != null){
|
||||
|
@ -784,7 +789,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return list.toArray(new RcSettingInfo[list.size()]);
|
||||
}
|
||||
|
||||
|
||||
public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){
|
||||
if(fileDataMode){
|
||||
RcSetSettings rcSettings = createRcSetInfo(data);
|
||||
|
@ -794,7 +799,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
RcSetSettings settings = createRcSetSettings(data, discoveredInfo);
|
||||
return createInfos(data, settings);
|
||||
}
|
||||
|
||||
|
||||
private IRcSettingInfo[] createInfos(CConfigurationData data, RcSetSettings rootSetting){
|
||||
RcSetSettings settings[] = rootSetting.getChildren(true);
|
||||
RcSetSettings setting;
|
||||
|
@ -823,7 +828,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
ExtsSetSettings extSetting = setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath()));
|
||||
if(extSetting != null){
|
||||
|
@ -846,17 +851,17 @@ public class CDataDiscoveredInfoCalculator {
|
|||
for (ExtsSetSettings extSetting : extSettings) {
|
||||
if(extSetting.fMaxMatchInfo == null)
|
||||
continue;
|
||||
|
||||
|
||||
if(extSetting.fBaseLangData == null)
|
||||
continue;
|
||||
|
||||
|
||||
if(extSetting.fIsDerived){
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
rcInfo.add(new LangSettingInfo(extSetting.fBaseLangData, extSetting.fMaxMatchInfo));
|
||||
|
||||
|
||||
if(extSetting.isMultiple()){
|
||||
Set<Entry<PathInfo, List<PathFilePathInfo>>> entries = extSetting.fPathFilePathInfoMap.entrySet();
|
||||
for (Entry<PathInfo, List<PathFilePathInfo>> entry : entries) {
|
||||
|
@ -883,18 +888,18 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
return resultList.toArray(new RcSettingInfo[resultList.size()]);
|
||||
}
|
||||
|
||||
|
||||
private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting) throws CoreException{
|
||||
if(base.getType() == ICSettingBase.SETTING_FOLDER)
|
||||
return createFolderData(cfg, setting.getPath(), (CFolderData)base);
|
||||
|
||||
|
||||
//should not be here
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
private static void checkRemoveDups(RcSetSettings rcSet){
|
||||
RcSetSettings settings[] = rcSet.getChildren(true);
|
||||
RcSetSettings setting, parent;
|
||||
|
@ -902,21 +907,21 @@ public class CDataDiscoveredInfoCalculator {
|
|||
setting = settings[i];
|
||||
if(!setting.fIsDerived)
|
||||
continue;
|
||||
|
||||
|
||||
parent = setting.getParent();
|
||||
if(parent == null)
|
||||
continue;
|
||||
|
||||
|
||||
if(parent.containsEqualMaxMatches(setting, true))
|
||||
removeChildAddingChildSettings(parent, setting);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void removeChildAddingChildSettings(RcSetSettings parent, RcSetSettings child){
|
||||
parent.internalAddSettingsMap(child.fExtsSetToExtsSetSettingsMap);
|
||||
parent.removeChild(child);
|
||||
}
|
||||
|
||||
|
||||
private static void mapDiscoveredInfo(RcSetSettings rcSet, PathFilePathInfo[] pInfos){
|
||||
PathFilePathInfo pInfo;
|
||||
RcSetSettings child, parent;
|
||||
|
@ -938,8 +943,8 @@ public class CDataDiscoveredInfoCalculator {
|
|||
child.internalSetSettingsMap(createEmptyExtSetMapCopy(parent.fExtsSetToExtsSetSettingsMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// isDerived = child.fIsDerived;
|
||||
|
||||
if(pInfo.fPath.segmentCount() == 0){
|
||||
|
@ -956,21 +961,21 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi){
|
||||
Collection<ExtsSetSettings> settings = rcSet.fExtsSetToExtsSetSettingsMap.values();
|
||||
for (ExtsSetSettings setting : settings) {
|
||||
setting.add(pfpi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String getFileExt(IPath path){
|
||||
String ext = path.getFileExtension();
|
||||
if(ext != null)
|
||||
return ext;
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
private static HashMap<ExtsSet, ExtsSetSettings> createEmptyExtSetMapCopy(HashMap<ExtsSet, ExtsSetSettings> base){
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<ExtsSet, ExtsSetSettings> map = (HashMap<ExtsSet, ExtsSetSettings>)base.clone();
|
||||
|
@ -982,7 +987,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
private static ExtsSetSettings createExtsSetSettings(IPath path, CFileData data){
|
||||
CLanguageData lData = data.getLanguageData();
|
||||
if(lData != null){
|
||||
|
@ -991,7 +996,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return new ExtsSetSettings(null, new ExtsSet(EMPTY_STRING_ARRAY), false);
|
||||
}
|
||||
|
||||
|
||||
private static ExtsSetSettings createExtsSetSettings(CLanguageData lData, String exts[]){
|
||||
return new ExtsSetSettings(lData, new ExtsSet(exts), false);
|
||||
}
|
||||
|
@ -1000,7 +1005,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
CLanguageData[] lDatas = data.getLanguageDatas();
|
||||
HashMap<ExtsSet, ExtsSetSettings> map = new HashMap<ExtsSet, ExtsSetSettings>(lDatas.length);
|
||||
ExtsSetSettings settings;
|
||||
|
||||
|
||||
if(lDatas.length != 0) {
|
||||
CLanguageData lData;
|
||||
for( int i = 0; i < lDatas.length; i++){
|
||||
|
@ -1009,7 +1014,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
map.put(settings.fExtsSet, settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1022,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
ListIndexStore store = new ListIndexStore(10);
|
||||
HashMap<PathInfo, PathInfo> infoMap = new HashMap<PathInfo, PathInfo>();
|
||||
// LinkedHashMap result;
|
||||
|
||||
|
||||
Set<Entry<IResource, PathInfo>> entries = map.entrySet();
|
||||
for (Entry<IResource, PathInfo> entry : entries) {
|
||||
IResource rc = entry.getKey();
|
||||
|
@ -1028,17 +1033,17 @@ public class CDataDiscoveredInfoCalculator {
|
|||
|
||||
// path = path.removeFirstSegments(1);
|
||||
// segCount--;
|
||||
|
||||
|
||||
PathInfo info = entry.getValue();
|
||||
PathInfo storedInfo = infoMap.get(info);
|
||||
if(storedInfo == null){
|
||||
storedInfo = info;
|
||||
infoMap.put(storedInfo, storedInfo);
|
||||
}
|
||||
|
||||
|
||||
store.add(segCount, new PathFilePathInfo(path, storedInfo));
|
||||
}
|
||||
|
||||
|
||||
List<PathFilePathInfo> lists[] = store.getLists();
|
||||
// result = new LinkedHashMap(map.size());
|
||||
// List l;
|
||||
|
@ -1059,7 +1064,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
for(int i = 0; i < lists.length; i++){
|
||||
size += lists[i].size();
|
||||
}
|
||||
|
||||
|
||||
infos = new PathFilePathInfo[size];
|
||||
int num = 0;
|
||||
int listSize;
|
||||
|
@ -1071,17 +1076,17 @@ public class CDataDiscoveredInfoCalculator {
|
|||
infos[num++] = list.get(k);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
|
||||
public static CDataDiscoveredInfoCalculator getDefault(){
|
||||
if(fInstance == null)
|
||||
fInstance = new CDataDiscoveredInfoCalculator();
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
public DiscoveredSettingInfo getSettingInfos(IProject project,
|
||||
|
||||
public DiscoveredSettingInfo getSettingInfos(IProject project,
|
||||
CConfigurationData cfgData){
|
||||
InfoContext context = createContext(project, cfgData);
|
||||
try {
|
||||
|
@ -1093,7 +1098,7 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
IPath[] includes = info.getIncludePaths();
|
||||
Map<String, String> symbols = info.getSymbols();
|
||||
|
||||
|
||||
PathInfo pathInfo = new PathInfo(includes, null, symbols, null, null);
|
||||
CFolderData rootData = cfgData.getRootFolderData();
|
||||
IRcSettingInfo rcInfo = createRcSettingInfo(rootData, pathInfo);
|
||||
|
@ -1103,11 +1108,11 @@ public class CDataDiscoveredInfoCalculator {
|
|||
}
|
||||
return new DiscoveredSettingInfo(false, new IRcSettingInfo[0]);
|
||||
}
|
||||
|
||||
|
||||
protected InfoContext createContext(IProject project, CConfigurationData data){
|
||||
return new InfoContext(project, idForData(data));
|
||||
}
|
||||
|
||||
|
||||
protected String idForData(CDataObject data){
|
||||
return data.getId();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class DiscoveredPathContainer implements IPathEntryContainer {
|
|||
fProject = project;
|
||||
fPathEntries = null;
|
||||
}
|
||||
|
||||
|
||||
// public IPathEntry[] getPathEntries() {
|
||||
// IPathEntry[] fPathEntries;
|
||||
// try {
|
||||
|
@ -49,15 +49,18 @@ public class DiscoveredPathContainer implements IPathEntryContainer {
|
|||
// return fPathEntries;
|
||||
// }
|
||||
|
||||
public String getDescription() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return MakeMessages.getString("DiscoveredContainer.description"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public IPath getPath() {
|
||||
@Override
|
||||
public IPath getPath() {
|
||||
return CONTAINER_ID;
|
||||
}
|
||||
|
||||
public IPathEntry[] getPathEntries() {
|
||||
@Override
|
||||
public IPathEntry[] getPathEntries() {
|
||||
if (fPathEntries == null) {
|
||||
try {
|
||||
fPathEntries = computeNewPathEntries();
|
||||
|
|
|
@ -51,10 +51,12 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Map<String, String> getSymbols() {
|
||||
if (activeSymbols == null) {
|
||||
createSymbolsMap();
|
||||
|
@ -63,6 +65,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
return dSymbols;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized IPath[] getIncludePaths() {
|
||||
if ( activePaths == null) {
|
||||
createPathLists();
|
||||
|
@ -70,22 +73,24 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
return activePaths.toArray(new IPath[activePaths.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, Boolean> getIncludeMap() {
|
||||
return new LinkedHashMap<String, Boolean>(discoveredPaths);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setIncludeMap(LinkedHashMap<String, Boolean> paths) {
|
||||
discoveredPaths = SafeStringInterner.safeIntern(new LinkedHashMap<String, Boolean>(paths));
|
||||
activePaths = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populates active and removed include path lists
|
||||
*/
|
||||
private void createPathLists() {
|
||||
List<Path> aPaths = getActivePathList();
|
||||
aPaths.clear();
|
||||
|
||||
|
||||
Set<String> paths = discoveredPaths.keySet();
|
||||
for (String path : paths) {
|
||||
Boolean removed = discoveredPaths.get(path);
|
||||
|
@ -95,22 +100,24 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, SymbolEntry> getSymbolMap() {
|
||||
return new LinkedHashMap<String, SymbolEntry>(discoveredSymbols);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void setSymbolMap(LinkedHashMap<String, SymbolEntry> symbols) {
|
||||
discoveredSymbols = SafeStringInterner.safeIntern(new LinkedHashMap<String, SymbolEntry>(symbols));
|
||||
activeSymbols = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populates active symbols sets
|
||||
*/
|
||||
private void createSymbolsMap() {
|
||||
Map<String, String> aSymbols = getActiveSymbolsMap();
|
||||
aSymbols.clear();
|
||||
|
||||
|
||||
aSymbols.putAll(SafeStringInterner.safeIntern(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols)));
|
||||
}
|
||||
|
||||
|
@ -131,9 +138,10 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
|
||||
*/
|
||||
@Override
|
||||
public void serialize(Element collectorElem) {
|
||||
Document doc = collectorElem.getOwnerDocument();
|
||||
|
||||
Document doc = collectorElem.getOwnerDocument();
|
||||
|
||||
Map<String, Boolean> includes = getIncludeMap();
|
||||
Set<String> includesSet = includes.keySet();
|
||||
for (String include : includesSet) {
|
||||
|
@ -172,6 +180,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
|
||||
*/
|
||||
@Override
|
||||
public void deserialize(Element collectorElem) {
|
||||
LinkedHashMap<String, Boolean> includes = getIncludeMap();
|
||||
LinkedHashMap<String, SymbolEntry> symbols = getSymbolMap();
|
||||
|
@ -190,7 +199,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
|
||||
|
||||
setIncludeMap(includes);
|
||||
setSymbolMap(symbols);
|
||||
}
|
||||
|
@ -198,6 +207,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
|
||||
*/
|
||||
@Override
|
||||
public String getCollectorId() {
|
||||
return PerProjectSICollector.COLLECTOR_ID;
|
||||
}
|
||||
|
@ -205,7 +215,8 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable()
|
||||
*/
|
||||
public IDiscoveredScannerInfoSerializable getSerializable() {
|
||||
@Override
|
||||
public IDiscoveredScannerInfoSerializable getSerializable() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
public IDiscoveredPathInfo getInfo(InfoContext context){
|
||||
return fInfoMap.get(context);
|
||||
}
|
||||
|
||||
|
||||
// private Map getMap(IPath path, boolean create, boolean exactPath){
|
||||
// PathSettingsContainer child = fContainer.getChildContainer(path, create, exactPath);
|
||||
// Map map = null;
|
||||
|
@ -73,10 +73,10 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
// child.setValue(map);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return map;
|
||||
// }
|
||||
|
||||
|
||||
// public IDiscoveredPathInfo getInfo(IFile file, String instanceId){
|
||||
// IPath path = file.getProjectRelativePath();
|
||||
// Map map = getMap(path, false, false);
|
||||
|
@ -98,20 +98,21 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
}
|
||||
|
||||
public DiscoveredPathManager() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void startup() {
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void shutdown() {
|
||||
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
if (event.getSource() instanceof IWorkspace) {
|
||||
IResource resource = event.getResource();
|
||||
|
@ -131,29 +132,32 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IDiscoveredPathInfo getDiscoveredInfo(IProject project) throws CoreException {
|
||||
return getDiscoveredInfo(project, new InfoContext(project));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context) throws CoreException{
|
||||
return getDiscoveredInfo(project, context, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException{
|
||||
DiscoveredInfoHolder holder = getHolder(project, true);
|
||||
IDiscoveredPathInfo info = holder.getInfo(context);
|
||||
|
||||
|
||||
if(info == null){
|
||||
info = loadPathInfo(project, context, defaultToProjectSettings);
|
||||
holder.setInfo(context, info);
|
||||
}
|
||||
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
private DiscoveredInfoHolder getHolder(IProject project, boolean create){
|
||||
DiscoveredInfoHolder holder = fDiscoveredInfoHolderMap.get(project);
|
||||
if(holder == null && create){
|
||||
|
@ -165,7 +169,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
|
||||
private IDiscoveredPathInfo loadPathInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException {
|
||||
IDiscoveredPathInfo pathInfo = null;
|
||||
|
||||
|
||||
IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
|
||||
IScannerConfigBuilderInfo2 buildInfo = container.getInfo(context);
|
||||
if(buildInfo == null && defaultToProjectSettings)
|
||||
|
@ -176,7 +180,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileInstance(project, context, profileId);
|
||||
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||
|
||||
|
||||
if (collector instanceof IScannerInfoCollector2) {
|
||||
IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
|
||||
pathInfo = collector2.createPathInfoObject();
|
||||
|
@ -188,20 +192,20 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
return pathInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// private DiscoveredInfoHolder getHolder
|
||||
|
||||
// private IDiscoveredPathInfo loadPathInfo(IProject project) throws CoreException {
|
||||
// IDiscoveredPathInfo pathInfo = null;
|
||||
//
|
||||
//
|
||||
// IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
|
||||
// String profileId = buildInfo.getSelectedProfileId();
|
||||
// SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||
// getSCProfileInstance(project, profileId);
|
||||
// IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||
//
|
||||
//
|
||||
// if (collector instanceof IScannerInfoCollector2) {
|
||||
// IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
|
||||
// pathInfo = collector2.createPathInfoObject();
|
||||
|
@ -212,10 +216,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
// return pathInfo;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void removeDiscoveredInfo(IProject project) {
|
||||
removeDiscoveredInfo(project, new InfoContext(project));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDiscoveredInfo(IProject project, InfoContext context) {
|
||||
DiscoveredInfoHolder holder = getHolder(project, false);
|
||||
if(holder != null){
|
||||
|
@ -229,16 +235,18 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
|
||||
*/
|
||||
public void updateDiscoveredInfo(IDiscoveredPathInfo info, List<IResource> changedResources) throws CoreException {
|
||||
@Override
|
||||
public void updateDiscoveredInfo(IDiscoveredPathInfo info, List<IResource> changedResources) throws CoreException {
|
||||
updateDiscoveredInfo(new InfoContext(info.getProject()), info, true, changedResources);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
|
||||
*/
|
||||
public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources) throws CoreException {
|
||||
@Override
|
||||
public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources) throws CoreException {
|
||||
DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
|
||||
IDiscoveredPathInfo oldInfo = holder.getInfo(context);
|
||||
IDiscoveredPathInfo oldInfo = holder.getInfo(context);
|
||||
if (oldInfo != null) {
|
||||
IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
|
||||
if (serializable != null) {
|
||||
|
@ -246,7 +254,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
IProject project = info.getProject();
|
||||
DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable);
|
||||
fireUpdate(INFO_CHANGED, info);
|
||||
|
||||
|
||||
if(updateContainer){
|
||||
|
||||
IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
|
||||
|
@ -262,11 +270,11 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allows one to update the discovered information for a particular scanner discovery profile ID.
|
||||
* TODO: This should be made API in IDiscoveredPathManager, or in an interface derived there from.
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
* @param info
|
||||
* @param updateContainer
|
||||
|
@ -276,7 +284,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
*/
|
||||
public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources, String profileId) throws CoreException {
|
||||
DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
|
||||
IDiscoveredPathInfo oldInfo = holder.getInfo(context);
|
||||
IDiscoveredPathInfo oldInfo = holder.getInfo(context);
|
||||
if (oldInfo != null) {
|
||||
IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
|
||||
if (serializable != null) {
|
||||
|
@ -284,11 +292,11 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
IProject project = info.getProject();
|
||||
DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable);
|
||||
fireUpdate(INFO_CHANGED, info);
|
||||
|
||||
|
||||
if(updateContainer){
|
||||
|
||||
IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
|
||||
|
||||
|
||||
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileConfiguration(profileId).getProfileScope();
|
||||
changeDiscoveredContainer(project, profileScope, changedResources);
|
||||
|
@ -304,17 +312,19 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
|
||||
*/
|
||||
public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope, final List<IResource> changedResources) {
|
||||
@Override
|
||||
public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope, final List<IResource> changedResources) {
|
||||
// order here is of essence
|
||||
// 1. clear DiscoveredPathManager's path info cache
|
||||
DiscoveredInfoHolder holder = getHolder(project, false);
|
||||
InfoContext context = new InfoContext(project);
|
||||
IDiscoveredPathInfo oldInfo = holder.getInfo(context);
|
||||
|
||||
|
||||
// 2. switch the containers
|
||||
try {
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
ICProject cProject = CoreModel.getDefault().create(project);
|
||||
if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
|
||||
CoreModel.setPathEntryContainer(new ICProject[]{cProject},
|
||||
|
@ -328,12 +338,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
List<PathEntryContainerChanged> changeDelta = new ArrayList<PathEntryContainerChanged>(changedResources.size());
|
||||
for (IResource resource : changedResources) {
|
||||
IPath path = resource.getFullPath();
|
||||
changeDelta.add(new PathEntryContainerChanged(path,
|
||||
PathEntryContainerChanged.INCLUDE_CHANGED |
|
||||
changeDelta.add(new PathEntryContainerChanged(path,
|
||||
PathEntryContainerChanged.INCLUDE_CHANGED |
|
||||
PathEntryContainerChanged.MACRO_CHANGED)); // both include paths and symbols changed
|
||||
}
|
||||
CoreModel.pathEntryContainerUpdates(container,
|
||||
changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]),
|
||||
CoreModel.pathEntryContainerUpdates(container,
|
||||
changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]),
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +351,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
|
||||
MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
CoreModel.run(runnable, null);
|
||||
|
@ -349,7 +359,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
|
||||
|
||||
// 3. clear the container's path entry cache
|
||||
if (oldInfo != null) {
|
||||
fireUpdate(INFO_REMOVED, oldInfo);
|
||||
|
@ -362,13 +372,15 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
final IDiscoveredInfoListener listener = (IDiscoveredInfoListener)list[i];
|
||||
if (listener != null) {
|
||||
SafeRunner.run(new ISafeRunnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable exception) {
|
||||
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1,
|
||||
CCorePlugin.getResourceString("CDescriptorManager.exception.listenerError"), exception); //$NON-NLS-1$
|
||||
CCorePlugin.log(status);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
switch (type) {
|
||||
case INFO_CHANGED :
|
||||
|
@ -384,10 +396,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDiscoveredInfoListener(IDiscoveredInfoListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDiscoveredInfoListener(IDiscoveredInfoListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ import javax.xml.transform.dom.DOMSource;
|
|||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -54,18 +54,18 @@ import org.xml.sax.SAXException;
|
|||
|
||||
/**
|
||||
* Discovered scanner info persistance store
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public final class DiscoveredScannerInfoStore {
|
||||
private static final QualifiedName dscFileNameProperty = new
|
||||
private static final QualifiedName dscFileNameProperty = new
|
||||
QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "discoveredScannerConfigFileName"); //$NON-NLS-1$
|
||||
private static final String CDESCRIPTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".discoveredScannerInfo"; //$NON-NLS-1$
|
||||
public static final String SCD_STORE_VERSION = "scdStore"; //$NON-NLS-1$
|
||||
public static final String SI_ELEM = "scannerInfo"; //$NON-NLS-1$
|
||||
public static final String COLLECTOR_ELEM = "collector"; //$NON-NLS-1$
|
||||
public static final String ID_ATTR = "id"; //$NON-NLS-1$
|
||||
|
||||
|
||||
private static final String INSTANCE_ELEM = "instance"; //$NON-NLS-1$
|
||||
|
||||
private static DiscoveredScannerInfoStore instance;
|
||||
|
@ -82,7 +82,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
return instance;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private DiscoveredScannerInfoStore() {
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
throws CoreException {
|
||||
// Get the document
|
||||
Element rootElem = getRootElement(project, context, serializable);
|
||||
|
||||
|
||||
if(rootElem != null){
|
||||
// get the collector element
|
||||
NodeList collectorList = rootElem.getElementsByTagName(COLLECTOR_ELEM);
|
||||
|
@ -113,7 +113,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean hasInfo(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable){
|
||||
try {
|
||||
if(getRootElement(project, context, serializable) != null)
|
||||
|
@ -123,7 +123,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private Element getRootElement(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) throws CoreException{
|
||||
if(serializable == null)
|
||||
return null;
|
||||
|
@ -134,17 +134,17 @@ public final class DiscoveredScannerInfoStore {
|
|||
NodeList rootList = document.getElementsByTagName(SI_ELEM);
|
||||
if (rootList.getLength() > 0) {
|
||||
rootElem = (Element) rootList.item(0);
|
||||
|
||||
|
||||
if(!context.isDefaultContext()){
|
||||
String instanceId = context.getInstanceId();
|
||||
|
||||
|
||||
Element instanceElem = findChild(rootElem, INSTANCE_ELEM, ID_ATTR, instanceId);
|
||||
|
||||
|
||||
rootElem = instanceElem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return rootElem;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
Element rootElem = (Element) document.getElementsByTagName(SI_ELEM).item(0);
|
||||
ProcessingInstruction pi = document.createProcessingInstruction(SCD_STORE_VERSION, "version=\"2.0\""); //$NON-NLS-1$
|
||||
document.insertBefore(pi, rootElem);
|
||||
|
||||
|
||||
Element collectorElem = document.createElement(COLLECTOR_ELEM);
|
||||
collectorElem.setAttribute(ID_ATTR, PerProjectSICollector.COLLECTOR_ID);
|
||||
for (Node child = rootElem.getFirstChild(); child != null; child = rootElem.getFirstChild()) {
|
||||
|
@ -223,15 +223,15 @@ public final class DiscoveredScannerInfoStore {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return cfgElem;
|
||||
}
|
||||
|
||||
|
||||
private void saveDiscoveredScannerInfo(InfoContext context, IDiscoveredScannerInfoSerializable serializable, Document doc) {
|
||||
NodeList rootList = doc.getElementsByTagName(SI_ELEM);
|
||||
if (rootList.getLength() > 0) {
|
||||
Element rootElem = (Element) rootList.item(0);
|
||||
|
||||
|
||||
// get the collector element
|
||||
if(!context.isDefaultContext()){
|
||||
String instanceId = context.getInstanceId();
|
||||
|
@ -243,7 +243,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
instanceElem.setAttribute(ID_ATTR, instanceId);
|
||||
rootElem.appendChild(instanceElem);
|
||||
}
|
||||
|
||||
|
||||
rootElem = instanceElem;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
Element cElem = (Element) collectorList.item(i);
|
||||
String collectorId = cElem.getAttribute(ID_ATTR);
|
||||
if (serializable.getCollectorId().equals(collectorId)) {
|
||||
for (Node child = cElem.getFirstChild(); child != null;
|
||||
for (Node child = cElem.getFirstChild(); child != null;
|
||||
child = cElem.getFirstChild()) {
|
||||
cElem.removeChild(child);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
collectorElem.setAttribute(ID_ATTR, serializable.getCollectorId());
|
||||
rootElem.appendChild(collectorElem);
|
||||
}
|
||||
|
||||
|
||||
// Save the discovered scanner info
|
||||
serializable.serialize(collectorElem);
|
||||
}
|
||||
|
@ -279,13 +279,13 @@ public final class DiscoveredScannerInfoStore {
|
|||
public void saveDiscoveredScannerInfoToState(IProject project, IDiscoveredScannerInfoSerializable serializable) throws CoreException {
|
||||
saveDiscoveredScannerInfoToState(project, new InfoContext(project), serializable);
|
||||
}
|
||||
|
||||
|
||||
public void saveDiscoveredScannerInfoToState(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) throws CoreException {
|
||||
Document document = getDocument(project);
|
||||
// Create document
|
||||
try {
|
||||
saveDiscoveredScannerInfo(context, serializable, document);
|
||||
|
||||
|
||||
// Transform the document to something we can save in a file
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
Transformer transformer = TransformerFactory.newInstance().newTransformer();
|
||||
|
@ -295,7 +295,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
DOMSource source = new DOMSource(document);
|
||||
StreamResult result = new StreamResult(stream);
|
||||
transformer.transform(source, result);
|
||||
|
||||
|
||||
// Save the document
|
||||
try {
|
||||
IPath path = getDiscoveredScannerConfigStore(project);
|
||||
|
@ -306,7 +306,7 @@ public final class DiscoveredScannerInfoStore {
|
|||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||
MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
// Close the streams
|
||||
stream.close();
|
||||
} catch (TransformerException e) {
|
||||
|
@ -345,7 +345,8 @@ public final class DiscoveredScannerInfoStore {
|
|||
try {
|
||||
delta.accept(new IResourceDeltaVisitor() {
|
||||
|
||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||
@Override
|
||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||
IResource resource = delta.getResource();
|
||||
if (resource instanceof IProject) {
|
||||
IProject project = (IProject) resource;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
@ -26,7 +26,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
||||
public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
||||
implements IPathEntryContainerExtension {
|
||||
|
||||
public PerFileDiscoveredPathContainer(IProject project) {
|
||||
|
@ -36,13 +36,14 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getPathEntries(org.eclipse.core.runtime.IPath, int)
|
||||
*/
|
||||
public IPathEntry[] getPathEntries(IPath path, int mask) {
|
||||
@Override
|
||||
public IPathEntry[] getPathEntries(IPath path, int mask) {
|
||||
ArrayList<IPathEntry> entries = new ArrayList<IPathEntry>();
|
||||
try {
|
||||
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
|
||||
if (info instanceof IPerFileDiscoveredPathInfo) {
|
||||
IPerFileDiscoveredPathInfo filePathInfo = (IPerFileDiscoveredPathInfo) info;
|
||||
|
||||
|
||||
if ((mask & IPathEntry.CDT_INCLUDE) != 0) {
|
||||
IPath[] includes = filePathInfo.getIncludePaths(path);
|
||||
for (int i = 0; i < includes.length; i++) {
|
||||
|
@ -86,7 +87,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
|||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
//
|
||||
//
|
||||
}
|
||||
return entries.toArray(new IPathEntry[entries.size()]);
|
||||
}
|
||||
|
@ -94,6 +95,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#isEmpty(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty(IPath path) {
|
||||
IDiscoveredPathInfo info;
|
||||
try {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ScannerConfigInfoFactory {
|
|||
* @since 3.0
|
||||
*/
|
||||
static final String SI_PROFILE_ID = PREFIX + ".siProfileId"; //$NON-NLS-1$
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author vhirsl
|
||||
|
@ -60,6 +60,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isAutoDiscoveryEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoDiscoveryEnabled() {
|
||||
return getBoolean(BUILD_SCANNER_CONFIG_ENABLED);
|
||||
}
|
||||
|
@ -67,6 +68,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setAutoDiscoveryEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setAutoDiscoveryEnabled(boolean enabled) throws CoreException {
|
||||
putString(BUILD_SCANNER_CONFIG_ENABLED, Boolean.toString(enabled));
|
||||
}
|
||||
|
@ -74,6 +76,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isMakeBuilderConsoleParserEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isMakeBuilderConsoleParserEnabled() {
|
||||
if (getString(MAKE_BUILDER_PARSER_ENABLED) == null ||
|
||||
getString(MAKE_BUILDER_PARSER_ENABLED).length() == 0) { // if no property then default to true
|
||||
|
@ -81,10 +84,11 @@ public class ScannerConfigInfoFactory {
|
|||
}
|
||||
return getBoolean(MAKE_BUILDER_PARSER_ENABLED);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setMakeBuilderConsoleParserEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setMakeBuilderConsoleParserEnabled(boolean enabled) throws CoreException {
|
||||
putString(MAKE_BUILDER_PARSER_ENABLED, Boolean.toString(enabled));
|
||||
}
|
||||
|
@ -92,19 +96,21 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getMakeBuilderConsoleParserId()
|
||||
*/
|
||||
@Override
|
||||
public String getMakeBuilderConsoleParserId() {
|
||||
String parserId = getString(MAKE_BUILDER_PARSER_ID);
|
||||
if (parserId == null || parserId.length() == 0) {
|
||||
String[] parserIds = MakeCorePlugin.getDefault().
|
||||
getScannerInfoConsoleParserIds("makeBuilder"); //$NON-NLS-1$
|
||||
// the default is the first one in the registry
|
||||
parserId = parserIds[0];
|
||||
parserId = parserIds[0];
|
||||
}
|
||||
return parserId;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setMakeBuilderConsoleParserId(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setMakeBuilderConsoleParserId(String parserId) throws CoreException {
|
||||
putString(MAKE_BUILDER_PARSER_ID, parserId);
|
||||
}
|
||||
|
@ -112,6 +118,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isESIProviderCommandEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isESIProviderCommandEnabled() {
|
||||
if (getString(ESI_PROVIDER_COMMAND_ENABLED) == null ||
|
||||
getString(ESI_PROVIDER_COMMAND_ENABLED).length() == 0) { // if no property then default to true
|
||||
|
@ -123,13 +130,15 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderCommandEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setESIProviderCommandEnabled(boolean enabled) throws CoreException {
|
||||
putString(ESI_PROVIDER_COMMAND_ENABLED, Boolean.toString(enabled));
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isDefaultESIProviderCmd()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDefaultESIProviderCmd() {
|
||||
if (getString(USE_DEFAULT_ESI_PROVIDER_CMD) == null ||
|
||||
getString(USE_DEFAULT_ESI_PROVIDER_CMD).length() == 0) { // if no property then default to true
|
||||
|
@ -141,6 +150,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setUseDefaultESIProviderCmd(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setUseDefaultESIProviderCmd(boolean on) throws CoreException {
|
||||
putString(USE_DEFAULT_ESI_PROVIDER_CMD, Boolean.toString(on));
|
||||
}
|
||||
|
@ -148,6 +158,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getESIProviderCommand()
|
||||
*/
|
||||
@Override
|
||||
public IPath getESIProviderCommand() {
|
||||
if (isDefaultESIProviderCmd()) {
|
||||
String command = getESIProviderParameter("defaultCommand"); //$NON-NLS-1$
|
||||
|
@ -162,13 +173,15 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderCommand(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
@Override
|
||||
public void setESIProviderCommand(IPath command) throws CoreException {
|
||||
putString(ESI_PROVIDER_COMMAND, command.toString());
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getESIProviderArguments()
|
||||
*/
|
||||
@Override
|
||||
public String getESIProviderArguments() {
|
||||
if (isDefaultESIProviderCmd()) {
|
||||
String attributes = getESIProviderParameter("defaultAttributes"); //$NON-NLS-1$
|
||||
|
@ -183,6 +196,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderArguments(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setESIProviderArguments(String args) throws CoreException {
|
||||
putString(ESI_PROVIDER_ARGUMENTS, args);
|
||||
}
|
||||
|
@ -190,20 +204,22 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getESIProviderConsoleParserId()
|
||||
*/
|
||||
@Override
|
||||
public String getESIProviderConsoleParserId() {
|
||||
String parserId = getString(ESI_PROVIDER_PARSER_ID);
|
||||
if (parserId == null || parserId.length() == 0) {
|
||||
String[] parserIds = MakeCorePlugin.getDefault().
|
||||
getScannerInfoConsoleParserIds("externalScannerInfoProvider"); //$NON-NLS-1$
|
||||
// the default is the first one in the registry
|
||||
parserId = parserIds[0];
|
||||
parserId = parserIds[0];
|
||||
}
|
||||
return parserId;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderConsoleParserId(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setESIProviderConsoleParserId(String parserId) throws CoreException {
|
||||
putString(ESI_PROVIDER_PARSER_ID, parserId);
|
||||
}
|
||||
|
@ -211,6 +227,7 @@ public class ScannerConfigInfoFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isSIProblemGenerationEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isSIProblemGenerationEnabled() {
|
||||
if (getString(SI_PROBLEM_GENERATION_ENABLED) == null ||
|
||||
getString(SI_PROBLEM_GENERATION_ENABLED).length() == 0) { // if no property then default to true
|
||||
|
@ -218,10 +235,11 @@ public class ScannerConfigInfoFactory {
|
|||
}
|
||||
return getBoolean(SI_PROBLEM_GENERATION_ENABLED);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setSIProblemGenerationEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setSIProblemGenerationEnabled(boolean enabled) throws CoreException {
|
||||
putString(SI_PROBLEM_GENERATION_ENABLED, Boolean.toString(enabled));
|
||||
}
|
||||
|
@ -256,7 +274,7 @@ public class ScannerConfigInfoFactory {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Preference extends Store {
|
||||
private Preferences prefs;
|
||||
private String builderID;
|
||||
|
@ -290,7 +308,7 @@ public class ScannerConfigInfoFactory {
|
|||
return builderID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class BuildProperty extends Store {
|
||||
private IProject project;
|
||||
private String builderID;
|
||||
|
@ -304,7 +322,7 @@ public class ScannerConfigInfoFactory {
|
|||
throw new CoreException(new Status(IStatus.ERROR,
|
||||
MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||
MakeMessages.getString("ScannerConfigInfoFactory.Missing_Builder")//$NON-NLS-1$
|
||||
+ builderID, null));
|
||||
+ builderID, null));
|
||||
}
|
||||
Map<String,String> bArgs = builder.getArguments();
|
||||
args = bArgs;
|
||||
|
|
|
@ -19,13 +19,13 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
|||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
/**
|
||||
* Common stuff for all GNU build output parsers
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsoleParser {
|
||||
|
@ -35,10 +35,10 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
protected static final String DASHIDASH= "-I-"; //$NON-NLS-1$
|
||||
protected static final String DASHI= "-I"; //$NON-NLS-1$
|
||||
protected static final String DASHD= "-D"; //$NON-NLS-1$
|
||||
|
||||
|
||||
private IProject project;
|
||||
protected IScannerInfoCollector collector;
|
||||
|
||||
|
||||
private boolean bMultiline = false;
|
||||
private String sMultiline = ""; //$NON-NLS-1$
|
||||
|
||||
|
@ -65,7 +65,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
|
||||
/**
|
||||
* Returns array of additional compiler commands to look for
|
||||
*
|
||||
*
|
||||
* @return String[]
|
||||
*/
|
||||
private String[] computeCompilerCommands() {
|
||||
|
@ -86,13 +86,14 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
}
|
||||
}
|
||||
}
|
||||
return COMPILER_INVOCATION;
|
||||
return COMPILER_INVOCATION;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
|
||||
*/
|
||||
public boolean processLine(String line) {
|
||||
@Override
|
||||
public boolean processLine(String line) {
|
||||
boolean rc = false;
|
||||
int lineBreakPos = line.length()-1;
|
||||
char[] lineChars = line.toCharArray();
|
||||
|
@ -123,7 +124,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
String make = line.substring(0, firstColon + 1);
|
||||
if (firstColon != -1 && make.indexOf("make") != -1) { //$NON-NLS-1$
|
||||
boolean enter = false;
|
||||
String msg = line.substring(firstColon + 1).trim();
|
||||
String msg = line.substring(firstColon + 1).trim();
|
||||
if ((enter = msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_EnteringDirectory"))) || //$NON-NLS-1$
|
||||
(msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_LeavingDirectory")))) { //$NON-NLS-1$
|
||||
int s = msg.indexOf('`');
|
||||
|
@ -146,7 +147,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
int num = 0;
|
||||
if (s != -1) {
|
||||
int e = line.indexOf(']');
|
||||
String number = line.substring(s + 1, e).trim();
|
||||
String number = line.substring(s + 1, e).trim();
|
||||
try {
|
||||
num = Integer.parseInt(number);
|
||||
} catch (NumberFormatException exc) {
|
||||
|
@ -156,21 +157,22 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
}
|
||||
|
||||
protected abstract AbstractGCCBOPConsoleParserUtility getUtility();
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
|
||||
*/
|
||||
public void shutdown() {
|
||||
@Override
|
||||
public void shutdown() {
|
||||
if (getUtility() != null) {
|
||||
getUtility().reportProblems();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tokenizes a line into an array of commands. Commands are separated by
|
||||
* Tokenizes a line into an array of commands. Commands are separated by
|
||||
* ';', '&&' or '||'. Tokens are separated by whitespace unless found inside
|
||||
* of quotes, back-quotes, or double quotes.
|
||||
* Outside of single-, double- or back-quotes a backslash escapes white-spaces, all quotes,
|
||||
* Outside of single-, double- or back-quotes a backslash escapes white-spaces, all quotes,
|
||||
* the backslash, '&' and '|'.
|
||||
* A backslash used for escaping is removed.
|
||||
* Quotes other than the back-quote plus '&&', '||', ';' are removed, also.
|
||||
|
@ -182,14 +184,14 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
ArrayList<String[]> commands= new ArrayList<String[]>();
|
||||
ArrayList<String> tokens= new ArrayList<String>();
|
||||
StringBuffer token= new StringBuffer();
|
||||
|
||||
|
||||
final char[] input= line.toCharArray();
|
||||
boolean nextEscaped= false;
|
||||
char currentQuote= 0;
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
final char c = input[i];
|
||||
final boolean escaped= nextEscaped; nextEscaped= false;
|
||||
|
||||
|
||||
if (currentQuote != 0) {
|
||||
if (c == currentQuote) {
|
||||
if (escaped) {
|
||||
|
@ -255,7 +257,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
endCommand(token, tokens, commands);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (Character.isWhitespace(c)) {
|
||||
if (escaped) {
|
||||
|
@ -277,7 +279,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
endCommand(token, tokens, commands);
|
||||
return commands.toArray(new String[commands.size()][]);
|
||||
}
|
||||
|
||||
|
||||
private void endCommand(StringBuffer token, ArrayList<String> tokens, ArrayList<String[]> commands) {
|
||||
endToken(token, tokens);
|
||||
if (!tokens.isEmpty()) {
|
||||
|
@ -291,7 +293,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
token.setLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected boolean processSingleLine(String line) {
|
||||
boolean rc= false;
|
||||
String[][] tokens= tokenize(line, true);
|
||||
|
@ -316,7 +318,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
|
|||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
protected int findCompilerInvocation(String[] tokens) {
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
final String token = tokens[i].toLowerCase();
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||
|
@ -32,7 +33,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
/**
|
||||
* GCC per file build output parser
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||
|
@ -40,13 +41,14 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
|||
".c", ".cc", ".cpp", ".cxx", ".C", ".CC", ".CPP", ".CXX" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
|
||||
};
|
||||
private final static List<String> FILE_EXTENSIONS_LIST = Arrays.asList(FILE_EXTENSIONS);
|
||||
|
||||
|
||||
private GCCPerFileBOPConsoleParserUtility fUtil;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
||||
*/
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
@Override
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
fUtil = (project != null && workingDirectory != null && markerGenerator != null) ?
|
||||
new GCCPerFileBOPConsoleParserUtility(project, workingDirectory, markerGenerator) : null;
|
||||
super.startup(project, collector);
|
||||
|
@ -65,7 +67,7 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
|||
*/
|
||||
@Override
|
||||
protected boolean processCommand(String[] tokens) {
|
||||
// GCC C/C++ compiler invocation
|
||||
// GCC C/C++ compiler invocation
|
||||
int compilerInvocationIndex= findCompilerInvocation(tokens);
|
||||
if (compilerInvocationIndex < 0) {
|
||||
return false;
|
||||
|
@ -117,7 +119,7 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
|||
tokens[i]= "SHORT_NAME" + token.substring(shortFileName.length()); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IFile file= null;
|
||||
IPath baseDirectory= fUtil.getBaseDirectory();
|
||||
if (baseDirectory.isPrefixOf(pFilePath) || baseDirectory.setDevice(null).isPrefixOf(pFilePath)) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
/**
|
||||
* Console parser for generated makefile output
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
||||
|
@ -39,9 +39,9 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
|||
private final static int NO_INCLUDES = 0;
|
||||
private final static int QUOTE_INCLUDES = 1;
|
||||
private final static int INCLUDES = 2;
|
||||
|
||||
|
||||
private IScannerInfoCollector fCollector = null;
|
||||
|
||||
|
||||
private int expectingIncludes = NO_INCLUDES;
|
||||
private List<String> symbols;
|
||||
private List<String> includes;
|
||||
|
@ -51,14 +51,16 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
||||
*/
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
@Override
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
this.fCollector = collector;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
|
||||
*/
|
||||
public boolean processLine(String line) {
|
||||
@Override
|
||||
public boolean processLine(String line) {
|
||||
boolean rc = false;
|
||||
line= line.trim();
|
||||
TraceUtil.outputTrace("GCCPerFileSIPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
|
@ -114,14 +116,15 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
|
|||
if (!includes.contains(line))
|
||||
includes.add(line);
|
||||
}
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
|
||||
*/
|
||||
public void shutdown() {
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Map scannerInfo = new HashMap();
|
||||
// scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
|
||||
// scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
|
||||
|
|
|
@ -30,18 +30,19 @@ import org.eclipse.core.runtime.Path;
|
|||
|
||||
/**
|
||||
* Parses gcc and g++ output for -I and -D parameters.
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||
|
||||
protected ScannerInfoConsoleParserUtility fUtil = null;
|
||||
private String fDefaultMacroDefinitionValue= "1"; //$NON-NLS-1$
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
||||
*/
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
@Override
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
fUtil = (project != null && workingDirectory != null && markerGenerator != null) ?
|
||||
new ScannerInfoConsoleParserUtility(project, workingDirectory, markerGenerator) : null;
|
||||
super.startup(project, collector);
|
||||
|
@ -61,7 +62,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
|
|||
if (compilerInvocationIdx<0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (compilerInvocationIdx+1 >= tokens.length) {
|
||||
return false;
|
||||
}
|
||||
|
@ -164,7 +165,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
|
|||
return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
|
||||
}
|
||||
|
||||
IProject project = getProject();
|
||||
IProject project = getProject();
|
||||
IFile file = null;
|
||||
List<String> translatedIncludes = includes;
|
||||
if (includes.size() > 0) {
|
||||
|
@ -200,7 +201,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void setDefaultMacroDefinitionValue(String val) {
|
||||
if (val != null) {
|
||||
fDefaultMacroDefinitionValue= val;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
|
@ -30,7 +30,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
* Parses output of gcc -c -v specs.c or
|
||||
* g++ -c -v specs.cpp
|
||||
* command
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||
|
@ -39,7 +39,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
|
||||
private IProject fProject = null;
|
||||
protected IScannerInfoCollector fCollector = null;
|
||||
|
||||
|
||||
private boolean expectingIncludes = false;
|
||||
protected List<String> symbols = new ArrayList<String>();
|
||||
protected List<String> includes = new ArrayList<String>();
|
||||
|
@ -47,7 +47,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
||||
*/
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
@Override
|
||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||
this.fProject = project;
|
||||
this.fCollector = collector;
|
||||
}
|
||||
|
@ -55,6 +56,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean processLine(String line) {
|
||||
boolean rc = false;
|
||||
line= line.trim();
|
||||
|
@ -89,7 +91,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
if (defineParts.length > 2) {
|
||||
symbol += defineParts[2];
|
||||
}
|
||||
if (!symbols.contains(symbol)) {
|
||||
if (!symbols.contains(symbol)) {
|
||||
symbols.add(symbol);
|
||||
}
|
||||
}
|
||||
|
@ -106,13 +108,14 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
if (!includes.contains(line))
|
||||
includes.add(line);
|
||||
}
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
|
||||
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.core.runtime.SafeRunner;
|
|||
|
||||
/**
|
||||
* Utility class for build and job related functionality
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class SCJobsUtil {
|
||||
|
@ -54,7 +54,7 @@ public class SCJobsUtil {
|
|||
public void set(boolean rc) {
|
||||
this.rc = rc;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return rc ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -69,7 +69,7 @@ public class SCJobsUtil {
|
|||
final IProgressMonitor monitor) {
|
||||
return getProviderScannerInfo(project, buildInfo.getContext(), buildInfo, monitor);
|
||||
}
|
||||
|
||||
|
||||
public static boolean getProviderScannerInfo(final IProject project,
|
||||
final InfoContext context,
|
||||
final IScannerConfigBuilderInfo2 buildInfo,
|
||||
|
@ -90,7 +90,8 @@ public class SCJobsUtil {
|
|||
if (esiProvider != null) {
|
||||
ISafeRunnable runnable = new ISafeRunnable() {
|
||||
|
||||
public void run() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO we need the environment for the project here...
|
||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
|
||||
ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
|
||||
|
@ -104,12 +105,13 @@ public class SCJobsUtil {
|
|||
esiProvider.invokeProvider(monitor, project, context, providerId, buildInfo, collector, env);
|
||||
rc.set(true);
|
||||
}
|
||||
|
||||
public void handleException(Throwable exception) {
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable exception) {
|
||||
rc.set(false);
|
||||
MakeCorePlugin.log(exception);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
SafeRunner.run(runnable);
|
||||
}
|
||||
|
@ -143,12 +145,14 @@ public class SCJobsUtil {
|
|||
final IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
|
||||
ISafeRunnable runnable = new ISafeRunnable() {
|
||||
|
||||
public void run() throws Exception {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
collector2.updateScannerConfiguration(monitor);
|
||||
rc.set(true);
|
||||
}
|
||||
|
||||
public void handleException(Throwable exception) {
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable exception) {
|
||||
rc.set(false);
|
||||
MakeCorePlugin.log(exception);
|
||||
}
|
||||
|
@ -156,7 +160,7 @@ public class SCJobsUtil {
|
|||
};
|
||||
SafeRunner.run(runnable);
|
||||
}
|
||||
|
||||
|
||||
return rc.get();
|
||||
}
|
||||
|
||||
|
@ -180,21 +184,23 @@ public class SCJobsUtil {
|
|||
|
||||
if (buildInfo.isBuildOutputFileActionEnabled()) {
|
||||
ISafeRunnable runnable = new ISafeRunnable() {
|
||||
|
||||
public void run() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
esiProvider.invokeProvider(monitor, project, context, null, buildInfo, collector, null);
|
||||
rc.set(true);
|
||||
}
|
||||
|
||||
public void handleException(Throwable exception) {
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable exception) {
|
||||
rc.set(false);
|
||||
MakeCorePlugin.log(exception);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
SafeRunner.run(runnable);
|
||||
}
|
||||
|
||||
|
||||
return rc.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
* Tianchao Li (tianchao.li@gmail.com) - arbitrary build directory (bug #136136)
|
||||
|
@ -51,7 +51,7 @@ import org.osgi.service.prefs.BackingStoreException;
|
|||
|
||||
/**
|
||||
* New default external scanner info provider of type 'run'
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
||||
|
@ -70,19 +70,21 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
protected IPath fWorkingDirectory;
|
||||
protected IPath fCompileCommand;
|
||||
protected String[] fCompileArguments;
|
||||
|
||||
|
||||
private SCMarkerGenerator markerGenerator = new SCMarkerGenerator();
|
||||
|
||||
public boolean invokeProvider(IProgressMonitor monitor, IResource resource,
|
||||
@Override
|
||||
public boolean invokeProvider(IProgressMonitor monitor, IResource resource,
|
||||
String providerId, IScannerConfigBuilderInfo2 buildInfo,
|
||||
IScannerInfoCollector collector) {
|
||||
return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo, collector, null);
|
||||
}
|
||||
|
||||
public boolean invokeProvider(IProgressMonitor monitor,
|
||||
IResource resource,
|
||||
|
||||
@Override
|
||||
public boolean invokeProvider(IProgressMonitor monitor,
|
||||
IResource resource,
|
||||
InfoContext context,
|
||||
String providerId,
|
||||
String providerId,
|
||||
IScannerConfigBuilderInfo2 buildInfo,
|
||||
IScannerInfoCollector collector,
|
||||
Properties env) {
|
||||
|
@ -91,7 +93,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
this.providerId = providerId;
|
||||
this.buildInfo = buildInfo;
|
||||
this.collector = collector;
|
||||
|
||||
|
||||
IProject currentProject = resource.getProject();
|
||||
// call a subclass to initialize protected fields
|
||||
if (!initialize()) {
|
||||
|
@ -101,7 +103,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask(MakeMessages.getString("ExternalScannerInfoProvider.Reading_Specs"), 100); //$NON-NLS-1$
|
||||
|
||||
|
||||
try {
|
||||
ILanguage language = context.getLanguage();
|
||||
IConsole console;
|
||||
|
@ -118,7 +120,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
|
||||
// Before launching give visual cues via the monitor
|
||||
monitor.subTask(MakeMessages.getString("ExternalScannerInfoProvider.Reading_Specs")); //$NON-NLS-1$
|
||||
|
||||
|
||||
String errMsg = null;
|
||||
ICommandLauncher launcher = new CommandLauncher();
|
||||
launcher.setProject(currentProject);
|
||||
|
@ -198,29 +200,29 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected IPath getCommandToLaunch() {
|
||||
return fCompileCommand;
|
||||
}
|
||||
|
||||
|
||||
protected String[] getCommandLineOptions() {
|
||||
// add additional arguments
|
||||
// subclass can change default behavior
|
||||
return prepareArguments(
|
||||
return prepareArguments(
|
||||
buildInfo.isUseDefaultProviderCommand(providerId));
|
||||
}
|
||||
|
||||
|
||||
private void printLine(OutputStream stream, String msg) throws IOException {
|
||||
stream.write((msg + NEWLINE).getBytes());
|
||||
stream.flush();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization of protected fields.
|
||||
* Initialization of protected fields.
|
||||
* Subclasses are most likely to override default implementation.
|
||||
*/
|
||||
protected boolean initialize() {
|
||||
|
||||
|
||||
IProject currProject = resource.getProject();
|
||||
//fWorkingDirectory = resource.getProject().getLocation();
|
||||
URI workingDirURI = MakeBuilderUtil.getBuildDirectoryURI(currProject, MakeBuilder.BUILDER_ID);
|
||||
|
@ -228,12 +230,12 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
if(pathString != null) {
|
||||
fWorkingDirectory = new Path(pathString);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
// blow up
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
|
||||
fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$
|
||||
return (fCompileCommand != null);
|
||||
|
@ -261,7 +263,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
private Properties getEnvMap(ICommandLauncher launcher, Properties initialEnv) {
|
||||
// Set the environmennt, some scripts may need the CWD var to be set.
|
||||
Properties props = initialEnv != null ? initialEnv : launcher.getEnvironment();
|
||||
|
||||
|
||||
if (fWorkingDirectory != null) {
|
||||
props.put("CWD", fWorkingDirectory.toOSString()); //$NON-NLS-1$
|
||||
props.put("PWD", fWorkingDirectory.toOSString()); //$NON-NLS-1$
|
||||
|
@ -309,7 +311,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
|
||||
/**
|
||||
* Check preference to stream output of scanner discovery to a console.
|
||||
*
|
||||
*
|
||||
* @return boolean preference value
|
||||
*/
|
||||
public static boolean isConsoleEnabled() {
|
||||
|
@ -317,5 +319,5 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
|
|||
.getBoolean(PREF_CONSOLE_ENABLED, false);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,26 +40,28 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
|
||||
/**
|
||||
* New default external scanner info provider of type 'open'
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class DefaultSIFileReader implements IExternalScannerInfoProvider {
|
||||
private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$
|
||||
|
||||
private long fileSize = 0;
|
||||
|
||||
|
||||
private SCMarkerGenerator markerGenerator = new SCMarkerGenerator();
|
||||
|
||||
public boolean invokeProvider(IProgressMonitor monitor, IResource resource,
|
||||
@Override
|
||||
public boolean invokeProvider(IProgressMonitor monitor, IResource resource,
|
||||
String providerId, IScannerConfigBuilderInfo2 buildInfo,
|
||||
IScannerInfoCollector collector) {
|
||||
return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo, collector, null);
|
||||
}
|
||||
|
||||
public boolean invokeProvider(IProgressMonitor monitor,
|
||||
IResource resource,
|
||||
|
||||
@Override
|
||||
public boolean invokeProvider(IProgressMonitor monitor,
|
||||
IResource resource,
|
||||
InfoContext context,
|
||||
String providerId,
|
||||
String providerId,
|
||||
IScannerConfigBuilderInfo2 buildInfo,
|
||||
IScannerInfoCollector collector,
|
||||
Properties env) {
|
||||
|
@ -69,7 +71,7 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider {
|
|||
BufferedReader reader = getStreamReader(buildInfo.getBuildOutputFilePath());
|
||||
if (reader == null)
|
||||
return rc;
|
||||
|
||||
|
||||
try {
|
||||
// output
|
||||
IConsole console = CCorePlugin.getDefault().getConsole(EXTERNAL_SI_PROVIDER_CONSOLE_ID);
|
||||
|
@ -81,16 +83,16 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider {
|
|||
catch (CoreException e) {
|
||||
ostream = null;
|
||||
}
|
||||
|
||||
|
||||
// get build location
|
||||
IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID);
|
||||
|
||||
|
||||
ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.
|
||||
getMakeBuilderOutputSniffer(ostream, null, project, context, buildDirectory, buildInfo, markerGenerator, collector);
|
||||
if (sniffer != null) {
|
||||
ostream = sniffer.getOutputStream();
|
||||
}
|
||||
|
||||
|
||||
if (ostream != null) {
|
||||
rc = readFileToOutputStream(monitor, reader, ostream);
|
||||
}
|
||||
|
@ -100,7 +102,7 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider {
|
|||
} catch (IOException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
|
@ -20,22 +20,22 @@ import java.util.HashSet;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.cdt.internal.core.SafeStringInterner;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo2;
|
||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||
|
@ -57,7 +57,7 @@ import org.w3c.dom.NodeList;
|
|||
|
||||
/**
|
||||
* Per file scanner info collector
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner {
|
||||
|
@ -65,7 +65,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
protected static final int QUOTE_INCLUDE_PATH = 2;
|
||||
protected static final int INCLUDE_FILE = 3;
|
||||
protected static final int MACROS_FILE = 4;
|
||||
|
||||
|
||||
protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
|
||||
protected final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
|
||||
protected final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
|
||||
|
@ -80,30 +80,31 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
|
||||
*/
|
||||
public void serialize(Element collectorElem) {
|
||||
@Override
|
||||
public void serialize(Element collectorElem) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
Document doc = collectorElem.getOwnerDocument();
|
||||
|
||||
|
||||
List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet());
|
||||
Collections.sort(commandIds);
|
||||
for (Integer commandId : commandIds) {
|
||||
CCommandDSC command = commandIdCommandMap.get(commandId);
|
||||
|
||||
Element cmdElem = doc.createElement(CC_ELEM);
|
||||
|
||||
Element cmdElem = doc.createElement(CC_ELEM);
|
||||
collectorElem.appendChild(cmdElem);
|
||||
cmdElem.setAttribute(ID_ATTR, commandId.toString());
|
||||
cmdElem.setAttribute(ID_ATTR, commandId.toString());
|
||||
cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// write command and scanner info
|
||||
command.serialize(cmdElem);
|
||||
// write files command applies to
|
||||
Element filesElem = doc.createElement(APPLIES_TO_ATTR);
|
||||
Element filesElem = doc.createElement(APPLIES_TO_ATTR);
|
||||
cmdElem.appendChild(filesElem);
|
||||
Set<IFile> files = commandIdToFilesMap.get(commandId);
|
||||
if (files != null) {
|
||||
for (IFile file : files) {
|
||||
Element fileElem = doc.createElement(FILE_ELEM);
|
||||
Element fileElem = doc.createElement(FILE_ELEM);
|
||||
IPath path = file.getProjectRelativePath();
|
||||
fileElem.setAttribute(PATH_ATTR, path.toString());
|
||||
fileElem.setAttribute(PATH_ATTR, path.toString());
|
||||
filesElem.appendChild(fileElem);
|
||||
}
|
||||
}
|
||||
|
@ -114,10 +115,11 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
|
||||
*/
|
||||
public void deserialize(Element collectorElem) {
|
||||
@Override
|
||||
public void deserialize(Element collectorElem) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) {
|
||||
if (child.getNodeName().equals(CC_ELEM)) {
|
||||
if (child.getNodeName().equals(CC_ELEM)) {
|
||||
Element cmdElem = (Element) child;
|
||||
boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
|
||||
CCommandDSC command = new CCommandDSC(cppFileType, project);
|
||||
|
@ -145,12 +147,13 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
|
||||
*/
|
||||
public String getCollectorId() {
|
||||
@Override
|
||||
public String getCollectorId() {
|
||||
return COLLECTOR_ID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected static class ProjectScannerInfo {
|
||||
IPath[] includePaths;
|
||||
IPath[] quoteIncludePaths;
|
||||
|
@ -165,7 +168,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
definedSymbols.size() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$
|
||||
protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
|
||||
protected static final String ID_ATTR = "id"; //$NON-NLS-1$
|
||||
|
@ -173,47 +176,49 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
|
||||
protected static final String FILE_ELEM = "file"; //$NON-NLS-1$
|
||||
protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
|
||||
|
||||
|
||||
protected IProject project;
|
||||
protected InfoContext context;
|
||||
|
||||
|
||||
protected ScannerInfoData sid; // scanner info data
|
||||
protected ProjectScannerInfo psi = null; // sum of all scanner info
|
||||
|
||||
|
||||
// protected List siChangedForFileList; // list of files for which scanner info has changed
|
||||
protected final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
|
||||
protected final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
|
||||
|
||||
|
||||
protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
|
||||
protected int commandIdCounter = 0;
|
||||
|
||||
|
||||
/** monitor for data access */
|
||||
protected final Object fLock = new Object();
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public PerFileSICollector() {
|
||||
sid = new ScannerInfoData();
|
||||
|
||||
|
||||
// siChangedForFileList = new ArrayList();
|
||||
siChangedForFileMap = new HashMap<IFile, Integer>();
|
||||
siChangedForCommandIdList = new ArrayList<Integer>();
|
||||
|
||||
|
||||
freeCommandIdPool = new TreeSet<Integer>();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
||||
*/
|
||||
public void setProject(IProject project) {
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
setInfoContext(new InfoContext(project));
|
||||
}
|
||||
|
||||
public void setInfoContext(InfoContext context) {
|
||||
@Override
|
||||
public void setInfoContext(InfoContext context) {
|
||||
this.project = context.getProject();
|
||||
this.context = context;
|
||||
|
||||
|
||||
try {
|
||||
// deserialize from SI store
|
||||
DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, sid);
|
||||
|
@ -230,7 +235,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) {
|
||||
@Override
|
||||
public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) {
|
||||
// check the resource
|
||||
String errorMessage = null;
|
||||
if (resource == null) {
|
||||
|
@ -257,9 +263,9 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IFile file = (IFile) resource;
|
||||
|
||||
|
||||
synchronized (fLock) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<ScannerInfoTypes, List<CCommandDSC>> scanInfo = scannerInfo;
|
||||
|
@ -292,7 +298,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
siItem = CygpathTranslator.translateIncludePaths(project, siItem);
|
||||
siItem = CCommandDSC.makeRelative(project, siItem);
|
||||
cmd.setQuoteIncludes(siItem);
|
||||
|
||||
|
||||
cmd.setDiscovered(true);
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +323,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
cmd.setCommandId(commandId);
|
||||
sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
|
||||
}
|
||||
|
||||
|
||||
generateFileDelta(file, cmd);
|
||||
}
|
||||
|
||||
|
@ -342,7 +348,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
for (IFile file : resources) {
|
||||
Integer commandId = siChangedForFileMap.get(file);
|
||||
if (commandId != null) {
|
||||
|
||||
|
||||
// update sid.commandIdToFilesMap
|
||||
Set<IFile> fileSet = sid.commandIdToFilesMap.get(commandId);
|
||||
if (fileSet == null) {
|
||||
|
@ -408,8 +414,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
sid.commandIdCommandMap.remove(cmdId);
|
||||
sid.commandIdToFilesMap.remove(cmdId);
|
||||
}
|
||||
while (!freeCommandIdPool.isEmpty()) {
|
||||
Integer last = freeCommandIdPool.last();
|
||||
while (!freeCommandIdPool.isEmpty()) {
|
||||
Integer last = freeCommandIdPool.last();
|
||||
if (last.intValue() == commandIdCounter) {
|
||||
freeCommandIdPool.remove(last);
|
||||
--commandIdCounter;
|
||||
|
@ -417,16 +423,17 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
|
||||
@Override
|
||||
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
|
@ -464,7 +471,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
|
||||
*/
|
||||
public IDiscoveredPathInfo createPathInfoObject() {
|
||||
@Override
|
||||
public IDiscoveredPathInfo createPathInfoObject() {
|
||||
return new PerFileDiscoveredPathInfo();
|
||||
}
|
||||
|
||||
|
@ -477,13 +485,14 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
||||
*/
|
||||
public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
@Override
|
||||
public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
List<CCommandDSC> rv = new ArrayList<CCommandDSC>();
|
||||
// check the resource
|
||||
String errorMessage = null;
|
||||
if (resource == null) {
|
||||
errorMessage = "resource is null";//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else if (!(resource instanceof IResource)) {
|
||||
errorMessage = "resource is not an IResource";//$NON-NLS-1$
|
||||
}
|
||||
|
@ -493,7 +502,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
else if (((IResource) resource).getProject() != project) {
|
||||
errorMessage = "wrong project";//$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
if (errorMessage != null) {
|
||||
TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
|
||||
return rv;
|
||||
|
@ -540,39 +549,44 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAllPaths(IResource resource) {
|
||||
@Override
|
||||
public void deleteAllPaths(IResource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAllSymbols(IResource resource) {
|
||||
@Override
|
||||
public void deleteAllSymbols(IResource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
public void deletePath(IResource resource, String path) {
|
||||
@Override
|
||||
public void deletePath(IResource resource, String path) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
public void deleteSymbol(IResource resource, String symbol) {
|
||||
@Override
|
||||
public void deleteSymbol(IResource resource, String symbol) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAll(IResource resource) {
|
||||
@Override
|
||||
public void deleteAll(IResource resource) {
|
||||
if (resource.equals(project)) {
|
||||
synchronized (fLock) {
|
||||
// siChangedForFileList = new ArrayList();
|
||||
|
@ -583,10 +597,10 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
// siChangedForFileList.add(path);
|
||||
siChangedForFileMap.put(file, null);
|
||||
}
|
||||
|
||||
|
||||
sid = new ScannerInfoData();
|
||||
psi = null;
|
||||
|
||||
|
||||
commandIdCounter = 0;
|
||||
freeCommandIdPool.clear();
|
||||
}
|
||||
|
@ -595,21 +609,23 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
|
||||
/**
|
||||
* Per file DPI object
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
|
||||
*/
|
||||
public IProject getProject() {
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths()
|
||||
*/
|
||||
public IPath[] getIncludePaths() {
|
||||
@Override
|
||||
public IPath[] getIncludePaths() {
|
||||
final IPath[] includepaths;
|
||||
final IPath[] quotepaths;
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
|
@ -632,7 +648,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols()
|
||||
*/
|
||||
public Map<String, String> getSymbols() {
|
||||
@Override
|
||||
public Map<String, String> getSymbols() {
|
||||
// return new HashMap();
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
return getAllSymbols();
|
||||
|
@ -642,7 +659,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IPath[] getIncludePaths(IPath path) {
|
||||
@Override
|
||||
public IPath[] getIncludePaths(IPath path) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
// get the command
|
||||
CCommandDSC cmd = getCommand(path);
|
||||
|
@ -660,7 +678,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IPath[] getQuoteIncludePaths(IPath path) {
|
||||
@Override
|
||||
public IPath[] getQuoteIncludePaths(IPath path) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
// get the command
|
||||
CCommandDSC cmd = getCommand(path);
|
||||
|
@ -678,7 +697,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public Map<String, String> getSymbols(IPath path) {
|
||||
@Override
|
||||
public Map<String, String> getSymbols(IPath path) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
// get the command
|
||||
CCommandDSC cmd = getCommand(path);
|
||||
|
@ -703,7 +723,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IPath[] getIncludeFiles(IPath path) {
|
||||
@Override
|
||||
public IPath[] getIncludeFiles(IPath path) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
// get the command
|
||||
CCommandDSC cmd = getCommand(path);
|
||||
|
@ -721,7 +742,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IPath[] getMacroFiles(IPath path) {
|
||||
@Override
|
||||
public IPath[] getMacroFiles(IPath path) {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
// get the command
|
||||
CCommandDSC cmd = getCommand(path);
|
||||
|
@ -739,7 +761,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
|
||||
*/
|
||||
public IDiscoveredScannerInfoSerializable getSerializable() {
|
||||
@Override
|
||||
public IDiscoveredScannerInfoSerializable getSerializable() {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
return sid;
|
||||
}
|
||||
|
@ -748,6 +771,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty(IPath path) {
|
||||
boolean rc = true;
|
||||
IResource resource = project.getWorkspace().getRoot().findMember(path);
|
||||
|
@ -764,6 +788,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
return rc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<IResource, PathInfo> getPathInfoMap() {
|
||||
synchronized (PerFileSICollector.this.fLock) {
|
||||
//TODO: do we need to cache this?
|
||||
|
@ -772,10 +797,10 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected Map<IResource, PathInfo> calculatePathInfoMap(){
|
||||
assert Thread.holdsLock(fLock);
|
||||
|
||||
|
||||
Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1);
|
||||
Set<Entry<IFile, Integer>> entrySet = sid.fileToCommandIdMap.entrySet();
|
||||
for (Entry<IFile, Integer> entry : entrySet) {
|
||||
|
@ -788,19 +813,19 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(project != null){
|
||||
if(psi == null){
|
||||
generateProjectScannerInfo();
|
||||
}
|
||||
|
||||
|
||||
PathInfo fpi = new PathInfo(psi.includePaths, psi.quoteIncludePaths, psi.definedSymbols, psi.includeFiles, psi.macrosFiles);
|
||||
map.put(project, fpi);
|
||||
}
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
protected static PathInfo createFilePathInfo(CCommandDSC cmd){
|
||||
IPath[] includes = stringListToPathArray(cmd.getIncludes());
|
||||
IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
|
||||
|
@ -813,7 +838,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
String value = ScannerConfigUtil.getSymbolValue(symbol);
|
||||
definedSymbols.put(key, value);
|
||||
}
|
||||
|
||||
|
||||
return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
|
||||
}
|
||||
|
||||
|
@ -845,7 +870,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
* <li><code>QUOTE_INCLUDE_PATH</code>
|
||||
* <li><code>INCLUDE_FILE</code>
|
||||
* <li><code>MACROS_FILE</code>
|
||||
*
|
||||
*
|
||||
* @return list of IPath(s).
|
||||
*/
|
||||
protected IPath[] getAllIncludePaths(int type) {
|
||||
|
@ -859,7 +884,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
case INCLUDE_PATH:
|
||||
discovered = cmd.getIncludes();
|
||||
break;
|
||||
case QUOTE_INCLUDE_PATH:
|
||||
case QUOTE_INCLUDE_PATH:
|
||||
discovered = cmd.getQuoteIncludes();
|
||||
break;
|
||||
case INCLUDE_FILE:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
|
@ -27,6 +27,8 @@ import org.eclipse.cdt.core.model.CoreModel;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||
|
@ -35,8 +37,6 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
|
|||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
|
||||
|
@ -61,7 +61,7 @@ import org.w3c.dom.Element;
|
|||
|
||||
/**
|
||||
* New per project scanner info collector
|
||||
*
|
||||
*
|
||||
* @since 3.0
|
||||
* @author vhirsl
|
||||
*/
|
||||
|
@ -71,22 +71,22 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
protected IProject project;
|
||||
protected InfoContext context;
|
||||
private boolean isBuiltinConfig= false;
|
||||
|
||||
|
||||
protected Map<ScannerInfoTypes, List<String>> discoveredSI;
|
||||
// private List discoveredIncludes;
|
||||
// private List discoveredIncludes;
|
||||
// private List discoveredSymbols;
|
||||
// private List discoveredTSO; // target specific options
|
||||
// cumulative values
|
||||
protected List<String> sumDiscoveredIncludes;
|
||||
protected List<String> sumDiscoveredIncludes;
|
||||
private Map<String, SymbolEntry> sumDiscoveredSymbols;
|
||||
protected boolean scPersisted = false;
|
||||
|
||||
|
||||
public PerProjectSICollector() {
|
||||
discoveredSI = new HashMap<ScannerInfoTypes, List<String>>();
|
||||
// discoveredIncludes = new ArrayList();
|
||||
// discoveredSymbols = new ArrayList();
|
||||
// discoveredTSO = new ArrayList();
|
||||
//
|
||||
//
|
||||
sumDiscoveredIncludes = new ArrayList<String>();
|
||||
sumDiscoveredSymbols = new LinkedHashMap<String, SymbolEntry>();
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
|
||||
*/
|
||||
@Override
|
||||
public void setProject(IProject project) {
|
||||
this.project = project;
|
||||
this.context = new InfoContext(project);
|
||||
|
@ -112,12 +113,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) {
|
||||
// check the resource
|
||||
String errorMessage = null;
|
||||
if (resource == null) {
|
||||
errorMessage = "resource is null";//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else if (!(resource instanceof IResource)) {
|
||||
errorMessage = "resource is not an IResource";//$NON-NLS-1$
|
||||
}
|
||||
|
@ -131,7 +133,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
TraceUtil.outputError("PerProjectSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (scPersisted) {
|
||||
// delete discovered scanner config
|
||||
discoveredSI.clear();
|
||||
|
@ -141,13 +143,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
try {
|
||||
if (/*project.hasNature(MakeProjectNature.NATURE_ID) && */// limits to StandardMake projects
|
||||
(project.hasNature(CProjectNature.C_NATURE_ID) ||
|
||||
project.hasNature(CCProjectNature.CC_NATURE_ID))) {
|
||||
project.hasNature(CCProjectNature.CC_NATURE_ID))) {
|
||||
|
||||
for (Object name : scannerInfo.keySet()) {
|
||||
ScannerInfoTypes siType = (ScannerInfoTypes) name;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> delta = (List<String>) scannerInfo.get(siType);
|
||||
|
||||
|
||||
List<String> discovered = discoveredSI.get(siType);
|
||||
if (discovered == null) {
|
||||
discovered = new ArrayList<String>(delta);
|
||||
|
@ -159,7 +161,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
|
@ -179,18 +181,18 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
|
||||
/**
|
||||
* Adds new items to the already accumulated ones preserving order
|
||||
*
|
||||
*
|
||||
* @param sumIncludes - previously accumulated items
|
||||
* @param includes - items to be added
|
||||
* @param ordered - to preserve order or append at the end
|
||||
* @return boolean - true if added
|
||||
*/
|
||||
protected boolean addItemsWithOrder(List<String> sumIncludes, List<String> includes, boolean ordered) {
|
||||
if (includes.isEmpty())
|
||||
if (includes.isEmpty())
|
||||
return false;
|
||||
|
||||
|
||||
boolean addedIncludes = false;
|
||||
int insertionPoint= ordered ? 0 : sumIncludes.size();
|
||||
int insertionPoint= ordered ? 0 : sumIncludes.size();
|
||||
for (String item : includes) {
|
||||
int pos= sumIncludes.indexOf(item);
|
||||
if (pos >= 0) {
|
||||
|
@ -200,7 +202,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
} else {
|
||||
sumIncludes.add(insertionPoint++, item);
|
||||
addedIncludes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return addedIncludes;
|
||||
}
|
||||
|
@ -208,6 +210,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public synchronized void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
|
@ -215,7 +218,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context);
|
||||
if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
|
||||
IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) pathInfo;
|
||||
|
||||
|
||||
monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
|
||||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
|
||||
if (scannerConfigNeedsUpdate(projectPathInfo)) {
|
||||
|
@ -242,7 +245,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
private boolean scannerConfigNeedsUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
|
||||
boolean addedIncludes = includePathsNeedUpdate(discPathInfo);
|
||||
boolean addedSymbols = definedSymbolsNeedUpdate(discPathInfo);
|
||||
|
||||
|
||||
return (addedIncludes | addedSymbols);
|
||||
}
|
||||
|
||||
|
@ -253,7 +256,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
boolean addedIncludes = false;
|
||||
List<String> discoveredIncludes = discoveredSI.get(ScannerInfoTypes.INCLUDE_PATHS);
|
||||
if (discoveredIncludes != null) {
|
||||
// Step 1. Add discovered scanner config to the existing discovered scanner config
|
||||
// Step 1. Add discovered scanner config to the existing discovered scanner config
|
||||
// add the includes from the latest discovery
|
||||
// if (sumDiscoveredIncludes == null) {
|
||||
// sumDiscoveredIncludes = new ArrayList(discoveredIncludes);
|
||||
|
@ -267,15 +270,15 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
|
||||
// try to translate cygpaths to absolute paths
|
||||
List<String> finalSumIncludes = CygpathTranslator.translateIncludePaths(project, sumDiscoveredIncludes);
|
||||
|
||||
|
||||
// Step 2. Get project's scanner config
|
||||
LinkedHashMap<String, Boolean> persistedIncludes = discPathInfo.getIncludeMap();
|
||||
|
||||
|
||||
// Step 3. Merge scanner config from steps 1 and 2
|
||||
// order is important, use list to preserve it
|
||||
ArrayList<String> persistedKeyList = new ArrayList<String>(persistedIncludes.keySet());
|
||||
addedIncludes = addItemsWithOrder(persistedKeyList, finalSumIncludes, true);
|
||||
|
||||
|
||||
LinkedHashMap<String, Boolean> newPersistedIncludes;
|
||||
if (addedIncludes) {
|
||||
newPersistedIncludes = new LinkedHashMap<String, Boolean>(persistedKeyList.size());
|
||||
|
@ -287,10 +290,10 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
// the paths may be on EFS resources, not local
|
||||
Boolean includePathExists = true;
|
||||
URI projectLocationURI = discPathInfo.getProject().getLocationURI();
|
||||
|
||||
|
||||
// use the project's location... create a URI that uses the same provider but that points to the include path
|
||||
URI includeURI = EFSExtensionManager.getDefault().createNewURIFromPath(projectLocationURI, include);
|
||||
|
||||
|
||||
// ask EFS if the path exists
|
||||
try {
|
||||
IFileStore fileStore = EFS.getStore(includeURI);
|
||||
|
@ -301,7 +304,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
|
||||
|
||||
// if the include path doesn't exist, then we tell the scanner config system that the folder
|
||||
// has been "removed", and thus it won't show up in the UI
|
||||
newPersistedIncludes.put(include, !includePathExists);
|
||||
|
@ -311,13 +314,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
else {
|
||||
newPersistedIncludes = persistedIncludes;
|
||||
}
|
||||
|
||||
|
||||
// Step 4. Set resulting scanner config
|
||||
discPathInfo.setIncludeMap(newPersistedIncludes);
|
||||
}
|
||||
return addedIncludes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare symbol definitions with already discovered.
|
||||
*/
|
||||
|
@ -325,20 +328,20 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
boolean addedSymbols = false;
|
||||
List<String> discoveredSymbols = discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
|
||||
if (discoveredSymbols != null) {
|
||||
// Step 1. Add discovered scanner config to the existing discovered scanner config
|
||||
// Step 1. Add discovered scanner config to the existing discovered scanner config
|
||||
// add the symbols from the latest discovery
|
||||
// if (sumDiscoveredSymbols == null) {
|
||||
// sumDiscoveredSymbols = new LinkedHashMap();
|
||||
// }
|
||||
addedSymbols = ScannerConfigUtil.scAddSymbolsList2SymbolEntryMap(sumDiscoveredSymbols, discoveredSymbols, true);
|
||||
|
||||
|
||||
// Step 2. Get project's scanner config
|
||||
LinkedHashMap<String, SymbolEntry> persistedSymbols = discPathInfo.getSymbolMap();
|
||||
|
||||
|
||||
// Step 3. Merge scanner config from steps 1 and 2
|
||||
LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<String, SymbolEntry>(persistedSymbols);
|
||||
addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols, sumDiscoveredSymbols);
|
||||
|
||||
|
||||
// Step 4. Set resulting scanner config
|
||||
discPathInfo.setSymbolMap(candidateSymbols);
|
||||
}
|
||||
|
@ -348,13 +351,14 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
|
||||
*/
|
||||
public List<String> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
@Override
|
||||
public List<String> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
|
||||
List<String> rv = null;
|
||||
// check the resource
|
||||
String errorMessage = null;
|
||||
if (resource == null) {
|
||||
errorMessage = "resource is null";//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else if (!(resource instanceof IResource)) {
|
||||
errorMessage = "resource is not an IResource";//$NON-NLS-1$
|
||||
}
|
||||
|
@ -364,7 +368,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
else if (((IResource) resource).getProject() != project) {
|
||||
errorMessage = "wrong project";//$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
if (errorMessage != null) {
|
||||
TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -406,7 +410,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAllPaths(IResource resource) {
|
||||
@Override
|
||||
public void deleteAllPaths(IResource resource) {
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.equals(this.project)) {
|
||||
sumDiscoveredIncludes.clear();
|
||||
|
@ -416,7 +421,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAllSymbols(IResource resource) {
|
||||
@Override
|
||||
public void deleteAllSymbols(IResource resource) {
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.equals(this.project)) {
|
||||
sumDiscoveredSymbols.clear();
|
||||
|
@ -426,7 +432,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
public void deletePath(IResource resource, String path) {
|
||||
@Override
|
||||
public void deletePath(IResource resource, String path) {
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.equals(this.project)) {
|
||||
sumDiscoveredIncludes.remove(path);
|
||||
|
@ -436,10 +443,11 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
public void deleteSymbol(IResource resource, String symbol) {
|
||||
@Override
|
||||
public void deleteSymbol(IResource resource, String symbol) {
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.equals(this.project)) {
|
||||
// remove it from the Map of SymbolEntries
|
||||
// remove it from the Map of SymbolEntries
|
||||
ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols);
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +455,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public void deleteAll(IResource resource) {
|
||||
@Override
|
||||
public void deleteAll(IResource resource) {
|
||||
deleteAllPaths(resource);
|
||||
deleteAllSymbols(resource);
|
||||
}
|
||||
|
@ -455,7 +464,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
|
||||
*/
|
||||
public IDiscoveredPathInfo createPathInfoObject() {
|
||||
@Override
|
||||
public IDiscoveredPathInfo createPathInfoObject() {
|
||||
DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project);
|
||||
try {
|
||||
DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, pathInfo);
|
||||
|
@ -463,13 +473,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
return pathInfo;
|
||||
return pathInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static method to return compiler built-in scanner info.
|
||||
* Preconditions: resource has to be contained by a project that has following natures:
|
||||
* C nature, CC nature (for C++ projects), Make nature and ScannerConfig nature
|
||||
* C nature, CC nature (for C++ projects), Make nature and ScannerConfig nature
|
||||
*/
|
||||
public static void calculateCompilerBuiltins(final IProject project) throws CModelException {
|
||||
createDiscoveredPathContainer(project, new NullProgressMonitor());
|
||||
|
@ -484,10 +494,11 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
((IScannerInfoCollectorCleaner) collector).deleteAll(project);
|
||||
}
|
||||
final IExternalScannerInfoProvider esiProvider = profileInstance.createExternalScannerInfoProvider("specsFile");//$NON-NLS-1$
|
||||
|
||||
|
||||
// Set the arguments for the provider
|
||||
|
||||
|
||||
ISafeRunnable runnable = new ISafeRunnable() {
|
||||
@Override
|
||||
public void run() throws CoreException {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
esiProvider.invokeProvider(monitor, project, "specsFile", buildInfo, collector);//$NON-NLS-1$
|
||||
|
@ -496,7 +507,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
collector2.updateScannerConfiguration(monitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleException(Throwable exception) {
|
||||
if (exception instanceof OperationCanceledException) {
|
||||
throw (OperationCanceledException) exception;
|
||||
|
@ -505,7 +517,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
};
|
||||
SafeRunner.run(runnable);
|
||||
}
|
||||
|
||||
|
||||
private static void createDiscoveredPathContainer(IProject project, IProgressMonitor monitor) throws CModelException {
|
||||
IPathEntry container = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
|
||||
ICProject cProject = CoreModel.getDefault().create(project);
|
||||
|
@ -521,13 +533,14 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoContext(InfoContext context) {
|
||||
this.context = context;
|
||||
this.project = context.getProject();
|
||||
}
|
||||
|
||||
|
||||
public InfoContext getContext(){
|
||||
return this.context;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
@ -29,13 +29,13 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
|
||||
/**
|
||||
* Scanner config discovery related marker generator
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class SCMarkerGenerator implements IMarkerGenerator {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public SCMarkerGenerator() {
|
||||
super();
|
||||
|
@ -44,6 +44,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.core.resources.IResource, int, java.lang.String, int, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||
ProblemMarkerInfo info = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar);
|
||||
addMarker(info);
|
||||
|
@ -52,6 +53,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
|
||||
*/
|
||||
@Override
|
||||
public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
|
||||
// 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
|
||||
|
@ -79,7 +81,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
} catch (CoreException e) {
|
||||
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||
|
@ -87,7 +89,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
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);
|
||||
}
|
||||
|
@ -95,7 +97,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
} catch (CoreException e) {
|
||||
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e);
|
||||
}
|
||||
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
|
@ -131,7 +133,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
MakeCorePlugin.log(e.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int mapMarkerSeverity(int severity) {
|
||||
switch (severity) {
|
||||
case SEVERITY_ERROR_BUILD :
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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 - Initial API and implementation
|
||||
* James Blackburn (Broadcom Corp.)
|
||||
|
@ -42,11 +42,11 @@ import org.eclipse.core.runtime.Status;
|
|||
|
||||
/**
|
||||
* New ScannerConfigInfoFactory
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class ScannerConfigInfoFactory2 {
|
||||
// build properties
|
||||
// build properties
|
||||
private static final String SCANNER_CONFIG = "scannerConfiguration"; //$NON-NLS-1$
|
||||
private static final String SC_AUTODISCOVERY = "autodiscovery"; //$NON-NLS-1$
|
||||
private static final String ENABLED = "enabled"; //$NON-NLS-1$
|
||||
|
@ -81,19 +81,19 @@ public class ScannerConfigInfoFactory2 {
|
|||
private static final String SI_PROVIDER_PARSER_ENABLED = ".parser.enabled";//$NON-NLS-1$
|
||||
private static final String INFO_INSTANCE_IDS = SCD + "instanceIds";//$NON-NLS-1$
|
||||
private static final String DELIMITER = ";";//$NON-NLS-1$
|
||||
|
||||
|
||||
|
||||
|
||||
private static final String ELEMENT_CS_INFO = "scannerConfigBuildInfo";//$NON-NLS-1$
|
||||
private static final String ATTRIBUTE_CS_INFO_INSTANCE_ID = "instanceId";//$NON-NLS-1$
|
||||
|
||||
|
||||
private static class ScannerConfigInfoSet extends StoreSet {
|
||||
private IProject fProject;
|
||||
|
||||
|
||||
ScannerConfigInfoSet(IProject project, String profileId){
|
||||
this.fProject = project;
|
||||
load(profileId);
|
||||
}
|
||||
|
||||
|
||||
private void load(String profileId) {
|
||||
ICDescriptor descriptor;
|
||||
try {
|
||||
|
@ -124,6 +124,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() throws CoreException {
|
||||
save(false);
|
||||
}
|
||||
|
@ -132,19 +133,19 @@ public class ScannerConfigInfoFactory2 {
|
|||
if (isDirty()) {
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(fProject, true);
|
||||
ICStorageElement sc = descriptor.getProjectStorageElement(SCANNER_CONFIG);
|
||||
|
||||
|
||||
// Clear all child settings
|
||||
sc.clear();
|
||||
|
||||
|
||||
BuildProperty prop = (BuildProperty)fMap.get(new InfoContext(fProject));
|
||||
prop.store(sc);
|
||||
|
||||
|
||||
for (Entry<InfoContext, IScannerConfigBuilderInfo2> entry : fMap.entrySet()) {
|
||||
|
||||
|
||||
InfoContext context = entry.getKey();
|
||||
if(context.isDefaultContext())
|
||||
continue;
|
||||
|
||||
|
||||
String instanceId = context.getInstanceId();
|
||||
if(instanceId.length() == 0)
|
||||
continue;
|
||||
|
@ -152,19 +153,20 @@ public class ScannerConfigInfoFactory2 {
|
|||
BuildProperty p = (BuildProperty)entry.getValue();
|
||||
if(p == prop)
|
||||
continue;
|
||||
|
||||
|
||||
ICStorageElement el = sc.createChild(ELEMENT_CS_INFO);
|
||||
el.setAttribute(ATTRIBUTE_CS_INFO_INSTANCE_ID, instanceId);
|
||||
p.store(el);
|
||||
}
|
||||
|
||||
|
||||
if(serializeDescriptor)
|
||||
descriptor.saveProjectData();
|
||||
|
||||
|
||||
fIsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return fProject;
|
||||
}
|
||||
|
@ -174,51 +176,52 @@ public class ScannerConfigInfoFactory2 {
|
|||
return new BuildProperty(this, fProject, context, base, profileId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class PreferenceSet extends StoreSet {
|
||||
private Preferences prefs;
|
||||
private Preferences prefs;
|
||||
private boolean useDefaults;
|
||||
PreferenceSet(Preferences prefs, String profileId, boolean loadDefaults){
|
||||
this.prefs = prefs;
|
||||
this.useDefaults = loadDefaults;
|
||||
load(profileId);
|
||||
}
|
||||
|
||||
|
||||
private void load(String profileId) {
|
||||
InfoContext defaultContext = new InfoContext(null);
|
||||
String instancesStr = getString(INFO_INSTANCE_IDS);
|
||||
String[] instanceIds = CDataUtil.stringToArray(instancesStr, DELIMITER);
|
||||
Preference pref = new Preference(this, prefs, defaultContext, profileId, useDefaults);
|
||||
fMap.put(defaultContext, pref);
|
||||
|
||||
|
||||
if(instanceIds != null && instanceIds.length != 0){
|
||||
for(int i = 0; i < instanceIds.length; i++) {
|
||||
String id = instanceIds[i];
|
||||
if(id.length() == 0)
|
||||
continue;
|
||||
|
||||
|
||||
InfoContext c = new InfoContext(null, id);
|
||||
|
||||
|
||||
Preference p = new Preference(this, prefs, c, profileId, useDefaults);
|
||||
fMap.put(c, p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() throws CoreException {
|
||||
if (isDirty()) {
|
||||
|
||||
|
||||
Set<String> idSet = new HashSet<String>(fMap.size() - 1);
|
||||
|
||||
|
||||
Preference pref = (Preference)fMap.get(new InfoContext(null));
|
||||
pref.store();
|
||||
|
||||
|
||||
for (Entry<InfoContext, IScannerConfigBuilderInfo2> entry : fMap.entrySet()) {
|
||||
InfoContext context = entry.getKey();
|
||||
if(context.isDefaultContext())
|
||||
continue;
|
||||
|
||||
|
||||
String instanceId = context.getInstanceId();
|
||||
if(instanceId.length() == 0)
|
||||
continue;
|
||||
|
@ -228,20 +231,21 @@ public class ScannerConfigInfoFactory2 {
|
|||
continue;
|
||||
|
||||
p.store();
|
||||
|
||||
|
||||
idSet.add(instanceId);
|
||||
}
|
||||
|
||||
|
||||
if(idSet.size() != 0){
|
||||
String[] ids = idSet.toArray(new String[idSet.size()]);
|
||||
String idsString = CDataUtil.arrayToString(ids, DELIMITER);
|
||||
set(INFO_INSTANCE_IDS, idsString);
|
||||
}
|
||||
|
||||
|
||||
fIsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return null;
|
||||
}
|
||||
|
@ -250,14 +254,14 @@ public class ScannerConfigInfoFactory2 {
|
|||
protected Store doCreateStore(InfoContext context, Store base, String profileId) {
|
||||
return new Preference(this, prefs, context, base, profileId, useDefaults);
|
||||
}
|
||||
|
||||
|
||||
private String getString(String name) {
|
||||
if (useDefaults) {
|
||||
return prefs.getDefaultString(name);
|
||||
}
|
||||
return prefs.getString(name);
|
||||
}
|
||||
|
||||
|
||||
private void set(String name, String value) {
|
||||
if (useDefaults) {
|
||||
prefs.setDefault(name, value);
|
||||
|
@ -268,14 +272,15 @@ public class ScannerConfigInfoFactory2 {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static abstract class StoreSet implements IScannerConfigBuilderInfo2Set {
|
||||
protected HashMap<InfoContext, IScannerConfigBuilderInfo2> fMap = new HashMap<InfoContext, IScannerConfigBuilderInfo2>();
|
||||
protected boolean fIsDirty;
|
||||
|
||||
|
||||
StoreSet(){
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IScannerConfigBuilderInfo2 createInfo(InfoContext context,
|
||||
IScannerConfigBuilderInfo2 base, String profileId){
|
||||
fIsDirty = true;
|
||||
|
@ -283,38 +288,43 @@ public class ScannerConfigInfoFactory2 {
|
|||
fMap.put(context, store);
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
protected abstract Store doCreateStore(InfoContext context, Store base, String profileId);
|
||||
|
||||
@Override
|
||||
public IScannerConfigBuilderInfo2 createInfo(InfoContext context,
|
||||
IScannerConfigBuilderInfo2 base){
|
||||
fIsDirty = true;
|
||||
return createInfo(context, base, ScannerConfigProfileManager.NULL_PROFILE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoContext[] getContexts() {
|
||||
return fMap.keySet().toArray(new InfoContext[fMap.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScannerConfigBuilderInfo2 getInfo(InfoContext context) {
|
||||
return fMap.get(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<InfoContext, IScannerConfigBuilderInfo2> getInfoMap() {
|
||||
return Collections.unmodifiableMap(fMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScannerConfigBuilderInfo2 removeInfo(InfoContext context) throws CoreException {
|
||||
checkRemoveInfo(context);
|
||||
fIsDirty = true;
|
||||
return fMap.remove(context);
|
||||
}
|
||||
|
||||
|
||||
private void checkRemoveInfo(InfoContext context) throws CoreException{
|
||||
if(context.isDefaultContext())
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, MakeConfigurationDataProviderMessages.getString("ScannerConfigInfoFactory2.0"))); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
public boolean isDirty(){
|
||||
if(fIsDirty)
|
||||
return true;
|
||||
|
@ -322,15 +332,17 @@ public class ScannerConfigInfoFactory2 {
|
|||
if(((Store)prop).isDirty)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScannerConfigBuilderInfo2 createInfo(InfoContext context) {
|
||||
fIsDirty = true;
|
||||
return createInfo(context, ScannerConfigProfileManager.NULL_PROFILE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScannerConfigBuilderInfo2 createInfo(InfoContext context,
|
||||
String profileId) {
|
||||
fIsDirty = true;
|
||||
|
@ -346,17 +358,17 @@ public class ScannerConfigInfoFactory2 {
|
|||
protected boolean autoDiscoveryEnabled;
|
||||
protected boolean problemReportingEnabled;
|
||||
protected String selectedProfile = EMPTY_STRING;
|
||||
/** Map from profile ID -> default ProfileOptions
|
||||
/** Map from profile ID -> default ProfileOptions
|
||||
* allows us to avoid storing options to .cproject when they are default .*/
|
||||
protected static Map<String, ProfileOptions> defaultProfiles = new ConcurrentHashMap<String, ProfileOptions>();
|
||||
protected static Map<String, ProfileOptions> defaultProfiles = new ConcurrentHashMap<String, ProfileOptions>();
|
||||
/** Map from profile ID -> ProfileOptions */
|
||||
protected Map<String, ProfileOptions> profileOptionsMap = new LinkedHashMap<String, ProfileOptions>();
|
||||
protected Map<String, ProfileOptions> profileOptionsMap = new LinkedHashMap<String, ProfileOptions>();
|
||||
static class ProfileOptions implements Cloneable {
|
||||
protected boolean buildOutputFileActionEnabled;
|
||||
protected String buildOutputFilePath = EMPTY_STRING;
|
||||
protected boolean buildOutputParserEnabled;
|
||||
/** Map from provider ID -> providerOptions */
|
||||
protected Map<String, ProviderOptions> providerOptionsMap;
|
||||
protected Map<String, ProviderOptions> providerOptionsMap;
|
||||
static class ProviderOptions implements Cloneable {
|
||||
protected String providerKind; // derived
|
||||
protected boolean providerOutputParserEnabled;
|
||||
|
@ -364,7 +376,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
protected String providerRunCommand = EMPTY_STRING;
|
||||
protected String providerRunArguments = EMPTY_STRING;
|
||||
protected String providerOpenFilePath = EMPTY_STRING;
|
||||
|
||||
|
||||
ProviderOptions(){
|
||||
}
|
||||
|
||||
|
@ -428,7 +440,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ProviderOptions clone() throws CloneNotSupportedException {
|
||||
return (ProviderOptions)super.clone();
|
||||
|
@ -517,13 +529,14 @@ public class ScannerConfigInfoFactory2 {
|
|||
ProfileOptions basePo = entry.getValue();
|
||||
entry.setValue(new ProfileOptions(basePo));
|
||||
}
|
||||
|
||||
|
||||
isDirty = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isAutoDiscoveryEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoDiscoveryEnabled() {
|
||||
return autoDiscoveryEnabled;
|
||||
}
|
||||
|
@ -531,6 +544,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setAutoDiscoveryEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setAutoDiscoveryEnabled(boolean enable) {
|
||||
autoDiscoveryEnabled = setDirty(autoDiscoveryEnabled, enable);
|
||||
}
|
||||
|
@ -538,18 +552,21 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isSIProblemGenerationEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isProblemReportingEnabled() {
|
||||
return problemReportingEnabled;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSIProblemGenerationEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setProblemReportingEnabled(boolean enable) {
|
||||
problemReportingEnabled = setDirty(problemReportingEnabled, enable);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getSelectedProfileId()
|
||||
*/
|
||||
@Override
|
||||
public String getSelectedProfileId() {
|
||||
return selectedProfile;
|
||||
}
|
||||
|
@ -557,6 +574,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSelectedProfileId(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setSelectedProfileId(String profileId) {
|
||||
selectedProfile = SafeStringInterner.safeIntern(setDirty(selectedProfile, profileId));
|
||||
// if (isDirty) {
|
||||
|
@ -573,13 +591,15 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProfileIdList()
|
||||
*/
|
||||
public List<String> getProfileIdList() {
|
||||
@Override
|
||||
public List<String> getProfileIdList() {
|
||||
return new ArrayList<String>(profileOptionsMap.keySet());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isBuildOutputFileActionEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isBuildOutputFileActionEnabled() {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
return (po != null) ? po.buildOutputFileActionEnabled : false;
|
||||
|
@ -588,6 +608,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setBuildOutputFileActionEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setBuildOutputFileActionEnabled(boolean enable) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -598,6 +619,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getBuildOutputFilePath()
|
||||
*/
|
||||
@Override
|
||||
public String getBuildOutputFilePath() {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
return (po != null) ? po.buildOutputFilePath : EMPTY_STRING;
|
||||
|
@ -606,6 +628,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setBuildOutputFilePath(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setBuildOutputFilePath(String path) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -616,6 +639,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isBuildOutputParserEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isBuildOutputParserEnabled() {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
return (po != null) ? po.buildOutputParserEnabled : true;
|
||||
|
@ -624,6 +648,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setBuildOutputParserEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setBuildOutputParserEnabled(boolean enable) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -634,6 +659,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getSIProviderIdList()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getProviderIdList() {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
return (po != null) ? new ArrayList<String>(po.providerOptionsMap.keySet()) : new ArrayList<String>(0);
|
||||
|
@ -656,6 +682,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isSIProviderOutputParserEnabled(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isProviderOutputParserEnabled(String providerId) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -668,6 +695,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSIProviderOutputParserEnabled(java.lang.String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setProviderOutputParserEnabled(String providerId, boolean enable) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -681,6 +709,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isUseDefaultProviderCommand(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseDefaultProviderCommand(String providerId) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -693,6 +722,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setUseDefaultProviderCommand(java.lang.String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setUseDefaultProviderCommand(String providerId, boolean enable) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -706,6 +736,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProviderRunCommand(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getProviderRunCommand(String providerId) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -718,6 +749,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setProviderRunCommand(java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setProviderRunCommand(String providerId, String command) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -731,6 +763,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProviderRunArguments(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getProviderRunArguments(String providerId) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -743,6 +776,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setProviderRunArguments(java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setProviderRunArguments(String providerId, String arguments) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -756,6 +790,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProviderOpenFilePath(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getProviderOpenFilePath(String providerId) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -768,6 +803,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setProviderOpenFilePath(java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setProviderOpenFilePath(String providerId, String filePath) {
|
||||
ProfileOptions po = profileOptionsMap.get(selectedProfile);
|
||||
if (po != null) {
|
||||
|
@ -777,7 +813,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean setDirty(boolean l, boolean r) {
|
||||
isDirty = isDirty || (l != r);
|
||||
return r;
|
||||
|
@ -786,13 +822,13 @@ public class ScannerConfigInfoFactory2 {
|
|||
isDirty = isDirty || !l.equals(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
// protected abstract void load();
|
||||
// public abstract void store();
|
||||
|
||||
/**
|
||||
* Load defaults for the specified profileId.
|
||||
* Returns a clone() of the default profile matching the passed in profileId
|
||||
* Returns a clone() of the default profile matching the passed in profileId
|
||||
*/
|
||||
protected static ProfileOptions getDefaultProfile(String profileId) {
|
||||
if (defaultProfiles.containsKey(profileId))
|
||||
|
@ -811,7 +847,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
po.buildOutputFileActionEnabled = true;
|
||||
String buildOutputFilePath = configuredProfile.getBuildOutputProviderElement().
|
||||
getAction().getAttribute("file");//$NON-NLS-1$
|
||||
po.buildOutputFilePath = (buildOutputFilePath != null) ? buildOutputFilePath : EMPTY_STRING;
|
||||
po.buildOutputFilePath = (buildOutputFilePath != null) ? buildOutputFilePath : EMPTY_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -826,7 +862,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
|
||||
ppo.providerRunUseDefault = true;
|
||||
attrValue = configuredProvider.getAction().getAttribute(COMMAND);
|
||||
ppo.providerRunCommand = (attrValue != null) ? attrValue : EMPTY_STRING;
|
||||
ppo.providerRunCommand = (attrValue != null) ? attrValue : EMPTY_STRING;
|
||||
attrValue = configuredProvider.getAction().getAttribute(ARGUMENTS);
|
||||
ppo.providerRunArguments = (attrValue != null) ? attrValue : EMPTY_STRING;
|
||||
} else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
|
||||
|
@ -845,7 +881,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
|
||||
/**
|
||||
* Build properties stored in .cproject file
|
||||
*
|
||||
*
|
||||
* Responsible for both load and store. Doesn't store profile settings if they're identical to the default.
|
||||
*/
|
||||
private static class BuildProperty extends Store {
|
||||
|
@ -862,7 +898,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
this.container = container;
|
||||
load(element);
|
||||
}
|
||||
|
||||
|
||||
BuildProperty(ScannerConfigInfoSet container, IProject project, InfoContext context, Store base, String profileId) {
|
||||
super(base, profileId);
|
||||
this.project = project;
|
||||
|
@ -896,7 +932,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
if (sc.getName().equals(SC_AUTODISCOVERY)) {
|
||||
autoDiscoveryEnabled = Boolean.valueOf(
|
||||
sc.getAttribute(ENABLED)).booleanValue();
|
||||
selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID)
|
||||
selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID)
|
||||
? sc.getAttribute(SELECTED_PROFILE_ID)
|
||||
: profileId;
|
||||
selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
|
||||
|
@ -929,11 +965,11 @@ public class ScannerConfigInfoFactory2 {
|
|||
problemReportingEnabled = oldInfo.isSIProblemGenerationEnabled();
|
||||
// effectively a PerProject profile
|
||||
selectedProfile = SafeStringInterner.safeIntern(profileId);
|
||||
|
||||
|
||||
ProfileOptions po = new ProfileOptions();
|
||||
po.buildOutputFileActionEnabled = false;
|
||||
po.buildOutputParserEnabled = oldInfo.isMakeBuilderConsoleParserEnabled();
|
||||
|
||||
|
||||
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
|
||||
ppo.providerKind = ScannerConfigProfile.ScannerInfoProvider.RUN;
|
||||
ppo.providerOutputParserEnabled = oldInfo.isESIProviderCommandEnabled();
|
||||
|
@ -947,14 +983,14 @@ public class ScannerConfigInfoFactory2 {
|
|||
String providerId = configuredProfile.getSIProviderIds().get(0);
|
||||
po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(1);
|
||||
po.providerOptionsMap.put(providerId, ppo);
|
||||
|
||||
|
||||
profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(1);
|
||||
profileOptionsMap.put(profileId, po);
|
||||
|
||||
|
||||
// store migrated data
|
||||
isDirty = true;
|
||||
save();
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
rc = false;
|
||||
|
@ -996,12 +1032,12 @@ public class ScannerConfigInfoFactory2 {
|
|||
po.providerOptionsMap.put(providerId, ppo);
|
||||
ppo.providerKind = configuredProfile.getScannerInfoProviderElement(
|
||||
providerId).getProviderKind();
|
||||
|
||||
|
||||
for (ICStorageElement grandchild : child.getChildren()) {
|
||||
// action
|
||||
if (RUN_ACTION.equals(grandchild.getName())) {
|
||||
ppo.providerRunUseDefault = Boolean.valueOf(
|
||||
grandchild.getAttribute(USE_DEFAULT)).booleanValue();
|
||||
grandchild.getAttribute(USE_DEFAULT)).booleanValue();
|
||||
ppo.providerRunCommand = grandchild.getAttribute(COMMAND);
|
||||
ppo.providerRunArguments = grandchild.getAttribute(ARGUMENTS);
|
||||
}
|
||||
|
@ -1052,7 +1088,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
|
||||
/**
|
||||
* @param profile element
|
||||
* @param po options
|
||||
* @param po options
|
||||
*/
|
||||
private void store(ICStorageElement profile, ProfileOptions po) {
|
||||
ICStorageElement child, grandchild;
|
||||
|
@ -1073,19 +1109,19 @@ public class ScannerConfigInfoFactory2 {
|
|||
for (int i = 0; i < providerIds.size(); ++i) {
|
||||
String providerId = providerIds.get(i);
|
||||
ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
|
||||
|
||||
|
||||
if (ppo != null) {
|
||||
child = profile.createChild(SCANNER_INFO_PROVIDER);
|
||||
child.setAttribute(ID, providerId);
|
||||
|
||||
|
||||
// action
|
||||
// String providerKind = configuredProfile.getScannerInfoProviderElement(
|
||||
// providerId).getProviderKind();
|
||||
String providerKind = ppo.providerKind;
|
||||
|
||||
|
||||
if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
|
||||
grandchild = child.createChild(RUN_ACTION);
|
||||
grandchild.setAttribute(USE_DEFAULT, Boolean.toString(ppo.providerRunUseDefault));
|
||||
grandchild.setAttribute(USE_DEFAULT, Boolean.toString(ppo.providerRunUseDefault));
|
||||
if(ppo.providerRunCommand != null)
|
||||
grandchild.setAttribute(COMMAND, ppo.providerRunCommand);
|
||||
if(ppo.providerRunArguments != null)
|
||||
|
@ -1110,14 +1146,16 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
||||
*/
|
||||
public synchronized void save() throws CoreException {
|
||||
@Override
|
||||
public synchronized void save() throws CoreException {
|
||||
if(isDirty){
|
||||
container.save(true);
|
||||
isDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
public InfoContext getContext(){
|
||||
|
||||
@Override
|
||||
public InfoContext getContext(){
|
||||
return context;
|
||||
}
|
||||
|
||||
|
@ -1125,7 +1163,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
|
||||
/**
|
||||
* Preferences
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
private static class Preference extends Store {
|
||||
|
@ -1144,7 +1182,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
this.context = context;
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
Preference(PreferenceSet container, Preferences prefs, InfoContext context, Store base, String profileId, boolean useDefaults) {
|
||||
super(base, profileId);
|
||||
this.prefs = prefs;
|
||||
|
@ -1169,12 +1207,12 @@ public class ScannerConfigInfoFactory2 {
|
|||
protected void load() {
|
||||
String instanceId = context.getInstanceId();
|
||||
String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$
|
||||
|
||||
|
||||
autoDiscoveryEnabled = getBoolean(prefix + SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX);
|
||||
selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ?
|
||||
getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) :
|
||||
selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ?
|
||||
getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) :
|
||||
profileId;
|
||||
selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
|
||||
selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
|
||||
problemReportingEnabled = getBoolean(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX);
|
||||
if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfile) && !useDefaults) {
|
||||
// get the default value
|
||||
|
@ -1195,7 +1233,7 @@ public class ScannerConfigInfoFactory2 {
|
|||
po.buildOutputFileActionEnabled = getBoolean(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED);
|
||||
po.buildOutputFilePath = getString(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_FILE_PATH);
|
||||
po.buildOutputParserEnabled = getBoolean(SCD + prefix + profileId + BUILD_OUTPUT_PARSER_ENABLED);
|
||||
|
||||
|
||||
ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileConfiguration(profileId);
|
||||
List<String> providerIds = configuredProfile.getSIProviderIds();
|
||||
|
@ -1205,25 +1243,25 @@ public class ScannerConfigInfoFactory2 {
|
|||
po.providerOptionsMap.put(providerId, ppo);
|
||||
ppo.providerKind = configuredProfile.getScannerInfoProviderElement(
|
||||
providerId).getProviderKind();
|
||||
|
||||
ppo.providerOutputParserEnabled = getBoolean(SCD + prefix + profileId + DOT +
|
||||
|
||||
ppo.providerOutputParserEnabled = getBoolean(SCD + prefix + profileId + DOT +
|
||||
providerId + SI_PROVIDER_PARSER_ENABLED);
|
||||
if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
|
||||
ppo.providerRunUseDefault = getBoolean(SCD + prefix + profileId + DOT + providerId +
|
||||
SI_PROVIDER_RUN_ACTION_USE_DEFAULT);
|
||||
ppo.providerRunCommand = getString(SCD + prefix + profileId + DOT + providerId +
|
||||
ppo.providerRunUseDefault = getBoolean(SCD + prefix + profileId + DOT + providerId +
|
||||
SI_PROVIDER_RUN_ACTION_USE_DEFAULT);
|
||||
ppo.providerRunCommand = getString(SCD + prefix + profileId + DOT + providerId +
|
||||
SI_PROVIDER_RUN_ACTION_COMMAND);
|
||||
ppo.providerRunArguments = getString(SCD + prefix + profileId + DOT + providerId +
|
||||
ppo.providerRunArguments = getString(SCD + prefix + profileId + DOT + providerId +
|
||||
SI_PROVIDER_RUN_ACTION_ARGUMENTS);
|
||||
}
|
||||
else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
|
||||
ppo.providerOpenFilePath = getString(SCD + prefix + profileId + DOT + providerId +
|
||||
ppo.providerOpenFilePath = getString(SCD + prefix + profileId + DOT + providerId +
|
||||
SI_PROVIDER_OPEN_ACTION_FILE_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void store() {
|
||||
String instanceId = context.getInstanceId();
|
||||
String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$
|
||||
|
@ -1231,31 +1269,31 @@ public class ScannerConfigInfoFactory2 {
|
|||
set(prefix + SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX, autoDiscoveryEnabled);
|
||||
set(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX, selectedProfile);
|
||||
set(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX, problemReportingEnabled);
|
||||
|
||||
|
||||
for (String profileId : profileOptionsMap.keySet()) {
|
||||
ProfileOptions po = profileOptionsMap.get(profileId);
|
||||
|
||||
|
||||
set(SCD + prefix + profileId + DOT + ENABLED, !useDefaults);
|
||||
set(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED, po.buildOutputFileActionEnabled);
|
||||
set(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_FILE_PATH, po.buildOutputFilePath);
|
||||
set(SCD + prefix + profileId + BUILD_OUTPUT_PARSER_ENABLED, po.buildOutputParserEnabled);
|
||||
|
||||
|
||||
ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileConfiguration(profileId);
|
||||
List<String> providerIds = configuredProfile.getSIProviderIds();
|
||||
for (String providerId : providerIds) {
|
||||
ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
|
||||
|
||||
|
||||
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_PARSER_ENABLED,
|
||||
ppo.providerOutputParserEnabled);
|
||||
// String providerKind = configuredProfile.getScannerInfoProviderElement(
|
||||
// providerId).getProviderKind();
|
||||
String providerKind = ppo.providerKind;
|
||||
|
||||
|
||||
if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
|
||||
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_USE_DEFAULT,
|
||||
ppo.providerRunUseDefault);
|
||||
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_COMMAND,
|
||||
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_COMMAND,
|
||||
ppo.providerRunCommand);
|
||||
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_ARGUMENTS,
|
||||
ppo.providerRunArguments);
|
||||
|
@ -1266,11 +1304,11 @@ public class ScannerConfigInfoFactory2 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
isDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean getBoolean(String name) {
|
||||
if (useDefaults) {
|
||||
return prefs.getDefaultBoolean(name);
|
||||
|
@ -1304,12 +1342,14 @@ public class ScannerConfigInfoFactory2 {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
|
||||
*/
|
||||
public void save() throws CoreException {
|
||||
@Override
|
||||
public void save() throws CoreException {
|
||||
if(isDirty)
|
||||
prefsContainer.save();
|
||||
}
|
||||
|
||||
public InfoContext getContext(){
|
||||
@Override
|
||||
public InfoContext getContext(){
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.ui;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
|
@ -66,10 +65,12 @@ import org.eclipse.swt.widgets.TableColumn;
|
|||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.eclipse.ui.dialogs.ListSelectionDialog;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* @deprecated as of CDT 4.0. This tab was used to set preferences/properties
|
||||
* for 3.X style projects.
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
|
@ -112,7 +113,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
/**
|
||||
* Returns this variable's name, which serves as the key in the
|
||||
* key/value pair this variable represents
|
||||
*
|
||||
*
|
||||
* @return this variable's name
|
||||
*/
|
||||
public String getName() {
|
||||
|
@ -121,7 +122,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/**
|
||||
* Returns this variables value.
|
||||
*
|
||||
*
|
||||
* @return this variable's value
|
||||
*/
|
||||
public String getValue() {
|
||||
|
@ -137,7 +138,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
|
@ -147,7 +148,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
|
@ -161,7 +162,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
|
@ -175,6 +176,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
*/
|
||||
protected class EnvironmentVariableContentProvider implements IStructuredContentProvider {
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
EnvironmentVariable[] elements = new EnvironmentVariable[0];
|
||||
IMakeCommonBuildInfo info = (IMakeCommonBuildInfo)inputElement;
|
||||
|
@ -189,8 +191,10 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
}
|
||||
return elements;
|
||||
}
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
if (newInput == null) {
|
||||
return;
|
||||
|
@ -222,6 +226,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
*/
|
||||
public class EnvironmentVariableLabelProvider extends LabelProvider implements ITableLabelProvider {
|
||||
|
||||
@Override
|
||||
public String getColumnText(Object element, int columnIndex) {
|
||||
String result = null;
|
||||
if (element != null) {
|
||||
|
@ -237,6 +242,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
if (columnIndex == 0) {
|
||||
return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_ENV_VAR);
|
||||
|
@ -278,6 +284,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
// To avoid multi-build
|
||||
IWorkspaceRunnable operation = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask(MakeUIPlugin.getResourceString("SettingsBlock.monitor.applyingSettings"), 1); //$NON-NLS-1$
|
||||
IMakeCommonBuildInfo info = null;
|
||||
|
@ -300,7 +307,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
{
|
||||
EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
|
||||
map.put(var.getName(), var.getValue());
|
||||
}
|
||||
}
|
||||
info.setEnvironment(map);
|
||||
info.setAppendEnvironment(appendEnvironment.getSelection());
|
||||
}
|
||||
|
@ -367,7 +374,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
createBuildEnvironmentControls(composite);
|
||||
createTableButtons(composite);
|
||||
createAppendReplace(composite);
|
||||
|
||||
|
||||
boolean append = fBuildInfo.appendEnvironment();
|
||||
if (append) {
|
||||
appendEnvironment.setSelection(true);
|
||||
|
@ -413,12 +420,14 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
environmentTable.setColumnProperties(envTableColumnProperties);
|
||||
environmentTable.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
handleTableSelectionChanged(event);
|
||||
}
|
||||
});
|
||||
environmentTable.addDoubleClickListener(new IDoubleClickListener() {
|
||||
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
if (!environmentTable.getSelection().isEmpty()) {
|
||||
handleEnvEditButtonSelected();
|
||||
|
@ -436,7 +445,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/**
|
||||
* Responds to a selection changed event in the environment table
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* the selection change event
|
||||
*/
|
||||
|
@ -459,7 +468,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/**
|
||||
* Creates the add/edit/remove buttons for the environment table
|
||||
*
|
||||
*
|
||||
* @param parent
|
||||
* the composite in which the buttons should be created
|
||||
*/
|
||||
|
@ -548,7 +557,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
* Attempts to add the given variable. Returns whether the variable was
|
||||
* added or not (as when the user answers not to overwrite an existing
|
||||
* variable).
|
||||
*
|
||||
*
|
||||
* @param variable
|
||||
* the variable to add
|
||||
* @return whether the variable was added
|
||||
|
@ -575,7 +584,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/**
|
||||
* Gets native environment variable. Creates EnvironmentVariable objects.
|
||||
*
|
||||
*
|
||||
* @return Map of name - EnvironmentVariable pairs based on native
|
||||
* environment.
|
||||
*/
|
||||
|
@ -625,27 +634,33 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
/**
|
||||
* Creates a label provider for the native native environment variable
|
||||
* selection dialog.
|
||||
*
|
||||
*
|
||||
* @return A label provider for the native native environment variable
|
||||
* selection dialog.
|
||||
*/
|
||||
private ILabelProvider createSelectionDialogLabelProvider() {
|
||||
return new ILabelProvider() {
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_ENVIRONMNET);
|
||||
}
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
EnvironmentVariable var = (EnvironmentVariable)element;
|
||||
return var.getName() + " [" + var.getValue() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
}
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void removeListener(ILabelProviderListener listener) {
|
||||
}
|
||||
};
|
||||
|
@ -654,19 +669,21 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
/**
|
||||
* Creates a content provider for the native native environment variable
|
||||
* selection dialog.
|
||||
*
|
||||
*
|
||||
* @return A content provider for the native native environment variable
|
||||
* selection dialog.
|
||||
*/
|
||||
private IStructuredContentProvider createSelectionDialogContentProvider() {
|
||||
return new IStructuredContentProvider() {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Object[] getElements(Object inputElement) {
|
||||
EnvironmentVariable[] elements = null;
|
||||
if (inputElement instanceof Map<?, ?>) {
|
||||
Comparator<String> comparator = new Comparator() {
|
||||
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
String s1 = (String)o1;
|
||||
String s2 = (String)o2;
|
||||
|
@ -685,8 +702,10 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
}
|
||||
return elements;
|
||||
}
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
};
|
||||
|
@ -749,7 +768,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
/**
|
||||
* Returns the name of the section that this dialog stores its settings
|
||||
* in
|
||||
*
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
protected String getDialogSettingsSectionName() {
|
||||
|
@ -758,7 +777,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
|
||||
*/
|
||||
@Override
|
||||
|
@ -772,7 +791,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#getInitialSize()
|
||||
*/
|
||||
@Override
|
||||
|
@ -783,7 +802,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#close()
|
||||
*/
|
||||
@Override
|
||||
|
@ -797,7 +816,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
|
|||
* Creates and configures the widgets which allow the user to choose whether
|
||||
* the specified environment should be appended to the native environment or
|
||||
* if it should completely replace it.
|
||||
*
|
||||
*
|
||||
* @param parent
|
||||
* the composite in which the widgets should be created
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,8 @@ public class MakeStartup extends Job {
|
|||
final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects();
|
||||
if (oldProject.length > 0) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = MakeUIPlugin.getDefault().getShell();
|
||||
boolean shouldUpdate = MessageDialog.openQuestion(shell,
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
|
||||
|
|
|
@ -76,7 +76,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
public static String getPluginId() {
|
||||
return getDefault().getBundle().getSymbolicName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the workspace instance.
|
||||
*/
|
||||
|
@ -109,7 +109,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the string from the plugin's resource bundle,
|
||||
* or 'key' if not found.
|
||||
|
@ -179,6 +179,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
display = Display.getDefault();
|
||||
final IStatus fstatus = status;
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ErrorDialog.openError(null, title, null, fstatus);
|
||||
}
|
||||
|
@ -227,7 +228,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
message = null;
|
||||
}
|
||||
} else {
|
||||
status = new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
|
||||
status = new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
|
||||
}
|
||||
ErrorDialog.openError(shell, title, message, status);
|
||||
}
|
||||
|
@ -257,7 +258,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
|
||||
/**
|
||||
* Returns a combined preference store, this store is read-only.
|
||||
*
|
||||
*
|
||||
* @return the combined preference store
|
||||
*/
|
||||
public IPreferenceStore getCombinedPreferenceStore() {
|
||||
|
@ -268,7 +269,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
return chainedStore;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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
|
||||
*******************************************************************************/
|
||||
|
@ -45,24 +45,24 @@ public class MultipleInputDialog extends Dialog {
|
|||
protected static final int TEXT = 100;
|
||||
protected static final int BROWSE = 101;
|
||||
protected static final int VARIABLE = 102;
|
||||
|
||||
|
||||
protected Composite panel;
|
||||
|
||||
|
||||
protected List<FieldSummary> fieldList = new ArrayList<FieldSummary>();
|
||||
protected List<Text> controlList = new ArrayList<Text>();
|
||||
protected List<Validator> validators = new ArrayList<Validator>();
|
||||
protected Map<Object, String> valueMap = new HashMap<Object, String>();
|
||||
|
||||
private String title;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public MultipleInputDialog(Shell shell, String title) {
|
||||
super(shell);
|
||||
this.title = title;
|
||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
|
@ -72,9 +72,9 @@ public class MultipleInputDialog extends Dialog {
|
|||
if (title != null) {
|
||||
shell.setText(title);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ public class MultipleInputDialog extends Dialog {
|
|||
validateFields();
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
|
@ -93,12 +93,12 @@ public class MultipleInputDialog extends Dialog {
|
|||
Composite container = (Composite)super.createDialogArea(parent);
|
||||
container.setLayout(new GridLayout(2, false));
|
||||
container.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
|
||||
panel = new Composite(container, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(2, false);
|
||||
panel.setLayout(layout);
|
||||
panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
|
||||
for (FieldSummary field : fieldList) {
|
||||
switch(field.type) {
|
||||
case TEXT:
|
||||
|
@ -112,12 +112,12 @@ public class MultipleInputDialog extends Dialog {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fieldList = null; // allow it to be gc'd
|
||||
Dialog.applyDialogFont(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
public void addBrowseField(String labelText, String initialValue, boolean allowsEmpty) {
|
||||
fieldList.add(new FieldSummary(BROWSE, labelText, initialValue, allowsEmpty));
|
||||
}
|
||||
|
@ -128,22 +128,22 @@ public class MultipleInputDialog extends Dialog {
|
|||
fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue, allowsEmpty));
|
||||
}
|
||||
|
||||
protected void createTextField(String labelText, String initialValue, boolean allowEmpty) {
|
||||
protected void createTextField(String labelText, String initialValue, boolean allowEmpty) {
|
||||
Label label = new Label(panel, SWT.NONE);
|
||||
label.setText(labelText);
|
||||
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
|
||||
|
||||
|
||||
final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER);
|
||||
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
text.setData(FIELD_NAME, labelText);
|
||||
|
||||
|
||||
// make sure rows are the same height on both panels.
|
||||
label.setSize(label.getSize().x, text.getSize().y);
|
||||
|
||||
label.setSize(label.getSize().x, text.getSize().y);
|
||||
|
||||
if (initialValue != null) {
|
||||
text.setText(initialValue);
|
||||
}
|
||||
|
||||
|
||||
if (!allowEmpty) {
|
||||
validators.add(new Validator() {
|
||||
@Override
|
||||
|
@ -152,27 +152,28 @@ public class MultipleInputDialog extends Dialog {
|
|||
}
|
||||
});
|
||||
text.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
validateFields();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
controlList.add(text);
|
||||
}
|
||||
|
||||
|
||||
protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) {
|
||||
Label label = new Label(panel, SWT.NONE);
|
||||
label.setText(labelText);
|
||||
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
|
||||
|
||||
|
||||
Composite comp = new Composite(panel, SWT.NONE);
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight=0;
|
||||
layout.marginWidth=0;
|
||||
comp.setLayout(layout);
|
||||
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
|
||||
final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
|
||||
GridData data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
data.widthHint = 200;
|
||||
|
@ -180,8 +181,8 @@ public class MultipleInputDialog extends Dialog {
|
|||
text.setData(FIELD_NAME, labelText);
|
||||
|
||||
// make sure rows are the same height on both panels.
|
||||
label.setSize(label.getSize().x, text.getSize().y);
|
||||
|
||||
label.setSize(label.getSize().x, text.getSize().y);
|
||||
|
||||
if (initialValue != null) {
|
||||
text.setText(initialValue);
|
||||
}
|
||||
|
@ -195,12 +196,13 @@ public class MultipleInputDialog extends Dialog {
|
|||
});
|
||||
|
||||
text.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
validateFields();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Button button = createButton(comp, IDialogConstants.IGNORE_ID, MakeUIPlugin.getResourceString("MultipleInputDialog.0"), false); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -212,33 +214,33 @@ public class MultipleInputDialog extends Dialog {
|
|||
File path = new File(currentWorkingDir);
|
||||
if (path.exists()) {
|
||||
dialog.setFilterPath(currentWorkingDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String selectedDirectory = dialog.open();
|
||||
if (selectedDirectory != null) {
|
||||
text.setText(selectedDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
controlList.add(text);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void createVariablesField(String labelText, String initialValue, boolean allowEmpty) {
|
||||
Label label = new Label(panel, SWT.NONE);
|
||||
label.setText(labelText);
|
||||
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
|
||||
|
||||
|
||||
Composite comp = new Composite(panel, SWT.NONE);
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight=0;
|
||||
layout.marginWidth=0;
|
||||
comp.setLayout(layout);
|
||||
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
|
||||
final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
|
||||
GridData data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
data.widthHint = 200;
|
||||
|
@ -246,8 +248,8 @@ public class MultipleInputDialog extends Dialog {
|
|||
text.setData(FIELD_NAME, labelText);
|
||||
|
||||
// make sure rows are the same height on both panels.
|
||||
label.setSize(label.getSize().x, text.getSize().y);
|
||||
|
||||
label.setSize(label.getSize().x, text.getSize().y);
|
||||
|
||||
if (initialValue != null) {
|
||||
text.setText(initialValue);
|
||||
}
|
||||
|
@ -261,12 +263,13 @@ public class MultipleInputDialog extends Dialog {
|
|||
});
|
||||
|
||||
text.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
validateFields();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Button button = createButton(comp, IDialogConstants.IGNORE_ID, MakeUIPlugin.getResourceString("MultipleInputDialog.2"), false); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -283,9 +286,9 @@ public class MultipleInputDialog extends Dialog {
|
|||
});
|
||||
|
||||
controlList.add(text);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
||||
*/
|
||||
|
@ -298,7 +301,7 @@ public class MultipleInputDialog extends Dialog {
|
|||
super.okPressed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.window.Window#open()
|
||||
*/
|
||||
|
@ -307,15 +310,15 @@ public class MultipleInputDialog extends Dialog {
|
|||
applyDialogFont(panel);
|
||||
return super.open();
|
||||
}
|
||||
|
||||
|
||||
public Object getValue(String key) {
|
||||
return valueMap.get(key);
|
||||
}
|
||||
|
||||
|
||||
public String getStringValue(String key) {
|
||||
return (String) getValue(key);
|
||||
}
|
||||
|
||||
|
||||
public void validateFields() {
|
||||
for (Validator validator : validators) {
|
||||
if (!validator.validate()) {
|
||||
|
@ -338,11 +341,11 @@ public class MultipleInputDialog extends Dialog {
|
|||
return super.getInitialLocation(initialSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected String getDialogSettingsSectionName() {
|
||||
return MakeUIPlugin.getPluginId() + ".MULTIPLE_INPUT_DIALOG_2"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.window.Window#getInitialSize()
|
||||
*/
|
||||
|
@ -351,7 +354,7 @@ public class MultipleInputDialog extends Dialog {
|
|||
Point size = super.getInitialSize();
|
||||
return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.window.Window#close()
|
||||
*/
|
||||
|
@ -366,7 +369,7 @@ public class MultipleInputDialog extends Dialog {
|
|||
String name;
|
||||
String initialValue;
|
||||
boolean allowsEmpty;
|
||||
|
||||
|
||||
public FieldSummary(int type, String name, String initialValue, boolean allowsEmpty) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
|
@ -374,7 +377,7 @@ public class MultipleInputDialog extends Dialog {
|
|||
this.allowsEmpty = allowsEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected class Validator {
|
||||
boolean validate() {
|
||||
return true;
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.eclipse.cdt.make.internal.ui.actions;
|
|||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.cdt.make.internal.ui.editor.MakefileEditor;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.text.ITextViewer;
|
||||
|
@ -29,8 +30,6 @@ import org.eclipse.ui.texteditor.IUpdate;
|
|||
import org.eclipse.ui.texteditor.ResourceAction;
|
||||
import org.eclipse.ui.texteditor.TextOperationAction;
|
||||
|
||||
import org.eclipse.cdt.make.internal.ui.editor.MakefileEditor;
|
||||
|
||||
/**
|
||||
* Groups the CDT folding actions.
|
||||
*/
|
||||
|
@ -42,37 +41,38 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class FoldingAction extends PreferenceAction {
|
||||
|
||||
FoldingAction(ResourceBundle bundle, String prefix) {
|
||||
super(bundle, prefix, IAction.AS_PUSH_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
setEnabled(FoldingActionGroup.this.isEnabled() && fViewer.isProjectionMode());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private ProjectionViewer fViewer;
|
||||
private IProjectionListener fProjectionListener;
|
||||
|
||||
|
||||
private TextOperationAction fToggle;
|
||||
private TextOperationAction fExpand;
|
||||
private TextOperationAction fCollapse;
|
||||
private TextOperationAction fExpandAll;
|
||||
|
||||
|
||||
private TextOperationAction fCollapseAll;
|
||||
private PreferenceAction fRestoreDefaults;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new projection action group for <code>editor</code>. If the
|
||||
* supplied viewer is not an instance of <code>ProjectionViewer</code>, the
|
||||
* action group is disabled.
|
||||
*
|
||||
*
|
||||
* @param editor the text editor to operate on
|
||||
* @param viewer the viewer of the editor
|
||||
*/
|
||||
|
@ -87,28 +87,30 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
fProjectionListener= null;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fViewer= (ProjectionViewer) viewer;
|
||||
|
||||
|
||||
fProjectionListener= new IProjectionListener() {
|
||||
@Override
|
||||
public void projectionEnabled() {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void projectionDisabled() {
|
||||
update();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
fViewer.addProjectionListener(fProjectionListener);
|
||||
|
||||
|
||||
fToggle= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Toggle.", editor, ProjectionViewer.TOGGLE, true); //$NON-NLS-1$
|
||||
fToggle.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE);
|
||||
editor.setAction("FoldingToggle", fToggle); //$NON-NLS-1$
|
||||
|
||||
|
||||
fExpandAll= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.ExpandAll.", editor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$
|
||||
fExpandAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
|
||||
editor.setAction("FoldingExpandAll", fExpandAll); //$NON-NLS-1$
|
||||
|
||||
|
||||
fCollapseAll= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.CollapseAll.", editor, ProjectionViewer.COLLAPSE_ALL, true); //$NON-NLS-1$
|
||||
fCollapseAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
|
||||
editor.setAction("FoldingCollapseAll", fCollapseAll); //$NON-NLS-1$
|
||||
|
@ -116,7 +118,7 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
fExpand= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Expand.", editor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$
|
||||
fExpand.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND);
|
||||
editor.setAction("FoldingExpand", fExpand); //$NON-NLS-1$
|
||||
|
||||
|
||||
fCollapse= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Collapse.", editor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$
|
||||
fCollapse.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE);
|
||||
editor.setAction("FoldingCollapse", fCollapse); //$NON-NLS-1$
|
||||
|
@ -133,19 +135,19 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
fRestoreDefaults.setActionDefinitionId(IFoldingCommandIds.FOLDING_RESTORE);
|
||||
editor.setAction("FoldingRestore", fRestoreDefaults); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the group is enabled.
|
||||
* Returns <code>true</code> if the group is enabled.
|
||||
* <pre>
|
||||
* Invariant: isEnabled() <=> fViewer and all actions are != null.
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if the group is enabled
|
||||
*/
|
||||
protected boolean isEnabled() {
|
||||
return fViewer != null;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.actions.ActionGroup#dispose()
|
||||
*/
|
||||
|
@ -157,7 +159,7 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the actions.
|
||||
*/
|
||||
|
@ -172,10 +174,10 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
fRestoreDefaults.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fills the menu with all folding actions.
|
||||
*
|
||||
*
|
||||
* @param manager the menu manager for the folding submenu
|
||||
*/
|
||||
public void fillMenu(IMenuManager manager) {
|
||||
|
@ -189,7 +191,7 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
manager.add(fRestoreDefaults);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
|
||||
*/
|
||||
|
|
|
@ -11,22 +11,19 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.internal.ui.compare;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
|
||||
import org.eclipse.compare.CompareConfiguration;
|
||||
import org.eclipse.compare.IViewerCreator;
|
||||
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
|
||||
/**
|
||||
* Required when creating a MakefileMergeViewer from the plugin.xml file.
|
||||
*/
|
||||
public class MakefileContentViewerCreator implements IViewerCreator {
|
||||
|
||||
|
||||
@Override
|
||||
public Viewer createViewer(Composite parent, CompareConfiguration mp) {
|
||||
return new MakefileMergeViewer(parent, SWT.NULL, mp);
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ public class MakefileMergeViewer extends TextMergeViewer {
|
|||
if (fPreferenceStore == null) {
|
||||
fPreferenceStore= MakeUIPlugin.getDefault().getCombinedPreferenceStore();
|
||||
fPreferenceChangeListener= new IPropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
handlePropertyChange(event);
|
||||
}
|
||||
|
@ -96,15 +97,15 @@ public class MakefileMergeViewer extends TextMergeViewer {
|
|||
}
|
||||
|
||||
protected void handlePropertyChange(PropertyChangeEvent event) {
|
||||
|
||||
|
||||
String key= event.getProperty();
|
||||
|
||||
|
||||
if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) {
|
||||
if (!fUseSystemColors) {
|
||||
RGB bg= createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
|
||||
setBackgroundColor(bg);
|
||||
}
|
||||
|
||||
|
||||
} else if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
|
||||
fUseSystemColors= fPreferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
|
||||
if (fUseSystemColors) {
|
||||
|
|
|
@ -109,6 +109,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public boolean isEnabled(DropTargetEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
@ -121,6 +122,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public void dragEnter(DropTargetEvent event) {
|
||||
lastDragOverTarget = null;
|
||||
lastDragOverOperation = DND.DROP_NONE;
|
||||
|
@ -142,6 +144,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public void dragOperationChanged(DropTargetEvent event) {
|
||||
originallyRequestedOperation = event.detail;
|
||||
event.detail = dragOverOperationCached(originallyRequestedOperation,
|
||||
|
@ -156,6 +159,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public void dragOver(DropTargetEvent event) {
|
||||
event.detail = dragOverOperationCached(originallyRequestedOperation,
|
||||
determineDropContainer(event), determineDropTarget(event));
|
||||
|
@ -180,6 +184,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public void dragLeave(DropTargetEvent event) {
|
||||
// no action
|
||||
}
|
||||
|
@ -192,6 +197,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public void dropAccept(DropTargetEvent event) {
|
||||
// no action
|
||||
}
|
||||
|
@ -204,6 +210,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa
|
|||
*
|
||||
* @see DropTargetEvent
|
||||
*/
|
||||
@Override
|
||||
public void drop(DropTargetEvent event) {
|
||||
IContainer dropContainer = determineDropContainer(event);
|
||||
if (dropContainer != null) {
|
||||
|
|
|
@ -88,6 +88,7 @@ public abstract class AbstractSelectionDragAdapter implements TransferDragSource
|
|||
*
|
||||
* @param event the information associated with the drag event
|
||||
*/
|
||||
@Override
|
||||
public void dragStart(DragSourceEvent event) {
|
||||
ISelection selection= fProvider.getSelection();
|
||||
if (isDragable(selection)) {
|
||||
|
@ -107,6 +108,7 @@ public abstract class AbstractSelectionDragAdapter implements TransferDragSource
|
|||
*
|
||||
* @param event the information associated with the drag event
|
||||
*/
|
||||
@Override
|
||||
public void dragSetData(DragSourceEvent event) {
|
||||
// Define data type so a listener could examine it with isSupportedType().
|
||||
// The selection is not passed using event by the LocalSelectionTransfer internally.
|
||||
|
@ -122,6 +124,7 @@ public abstract class AbstractSelectionDragAdapter implements TransferDragSource
|
|||
*
|
||||
* @param event the information associated with the drag event
|
||||
*/
|
||||
@Override
|
||||
public void dragFinished(DragSourceEvent event) {
|
||||
dragDone();
|
||||
event.doit = false;
|
||||
|
|
|
@ -52,6 +52,7 @@ public class FileTransferDropTargetListener extends AbstractContainerAreaDropAda
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return FileTransfer.getInstance();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class LocalTransferDragSourceListener extends AbstractSelectionDragAdapte
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return LocalSelectionTransfer.getTransfer();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ public class LocalTransferDropTargetListener extends AbstractContainerAreaDropAd
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return LocalSelectionTransfer.getTransfer();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.make.internal.ui.dnd;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -41,6 +40,8 @@ import org.eclipse.swt.SWTException;
|
|||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* A collection of various functions for Make Target View drag and drop support.
|
||||
*/
|
||||
|
@ -267,6 +268,7 @@ public class MakeTargetDndUtil {
|
|||
private static void copyTargetsWithProgressIndicator(final IMakeTarget[] makeTargets,
|
||||
final IContainer container, final int operation, final Shell shell) {
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException,
|
||||
InterruptedException {
|
||||
boolean isMove = operation == DND.DROP_MOVE;
|
||||
|
|
|
@ -41,6 +41,7 @@ public class MakeTargetTransferDragSourceListener extends AbstractSelectionDragA
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return MakeTargetTransfer.getInstance();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class MakeTargetTransferDropTargetListener extends AbstractContainerAreaD
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return MakeTargetTransfer.getInstance();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class TextTransferDragSourceListener extends AbstractSelectionDragAdapter
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return TextTransfer.getInstance();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
package org.eclipse.cdt.make.internal.ui.dnd;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -26,6 +25,8 @@ import org.eclipse.swt.dnd.TextTransfer;
|
|||
import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* {@code TextTransferDropTargetListener} handles dropping of selected text to
|
||||
* Make Target View. Each line of miltiline text passed is treated as separate
|
||||
|
@ -50,6 +51,7 @@ public class TextTransferDropTargetListener extends AbstractContainerAreaDropAda
|
|||
* @return the {@link Transfer} type that this listener can accept a
|
||||
* drop operation for.
|
||||
*/
|
||||
@Override
|
||||
public Transfer getTransfer() {
|
||||
return TextTransfer.getInstance();
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object element) {
|
||||
if (element == fInput) {
|
||||
return getElements(makefile);
|
||||
|
@ -81,6 +82,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
if (element instanceof IMakefile) {
|
||||
return fInput;
|
||||
|
@ -93,6 +95,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
if (element == fInput) {
|
||||
return true;
|
||||
|
@ -109,6 +112,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
IDirective[] directives;
|
||||
if (inputElement == fInput) {
|
||||
|
@ -135,7 +139,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
} else {
|
||||
boolean irrelevant = (directives[i] instanceof IComment ||
|
||||
directives[i] instanceof IEmptyLine ||
|
||||
directives[i] instanceof ITerminal);
|
||||
directives[i] instanceof ITerminal);
|
||||
if (!irrelevant) {
|
||||
list.add(directives[i]);
|
||||
}
|
||||
|
@ -147,12 +151,14 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
if (oldInput != null) {
|
||||
makefile = nullMakefile;
|
||||
|
@ -246,6 +252,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
MenuManager manager= new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$
|
||||
manager.setRemoveAllWhenShown(true);
|
||||
manager.addMenuListener(new IMenuListener() {
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager m) {
|
||||
contextMenuAboutToShow(m);
|
||||
}
|
||||
|
@ -258,6 +265,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
|
||||
*/
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
if (fOpenIncludeAction != null) {
|
||||
fOpenIncludeAction.run();
|
||||
|
@ -307,6 +315,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
final Control control = viewer.getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
control.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!control.isDisposed()) {
|
||||
control.setRedraw(false);
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
|
|||
import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
|
||||
|
||||
public class MakefileDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider {
|
||||
|
||||
|
||||
IMakefile fMakefile;
|
||||
|
||||
protected class MakefileAnnotationModel extends ResourceMarkerAnnotationModel /*implements IProblemRequestor */{
|
||||
|
@ -43,7 +43,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
/**
|
||||
* Remembers a IMakefile for each element.
|
||||
*/
|
||||
protected class MakefileFileInfo extends FileInfo {
|
||||
protected class MakefileFileInfo extends FileInfo {
|
||||
public IMakefile fCopy;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
protected FileInfo createFileInfo(Object element) throws CoreException {
|
||||
if (!(element instanceof IFileEditorInput))
|
||||
return null;
|
||||
|
||||
|
||||
IFileEditorInput input= (IFileEditorInput) element;
|
||||
IMakefile original= createMakefile(input.getFile());
|
||||
if (original == null)
|
||||
|
@ -87,7 +87,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
if (!(info instanceof MakefileFileInfo)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
MakefileFileInfo makefileInfo= (MakefileFileInfo) info;
|
||||
setUpSynchronization(makefileInfo);
|
||||
|
||||
|
@ -96,10 +96,10 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
if (makefileInfo.fModel instanceof MakefileAnnotationModel) {
|
||||
MakefileAnnotationModel model= (MakefileAnnotationModel) makefileInfo.fModel;
|
||||
model.setMakefile(makefileInfo.fCopy);
|
||||
}
|
||||
}
|
||||
return makefileInfo;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object, org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo)
|
||||
*/
|
||||
|
@ -111,9 +111,9 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
makefileInfo.fCopy = null;
|
||||
}
|
||||
}
|
||||
super.disposeFileInfo(element, info);
|
||||
super.disposeFileInfo(element, info);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo()
|
||||
*/
|
||||
|
@ -121,12 +121,13 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
protected FileInfo createEmptyFileInfo() {
|
||||
return new MakefileFileInfo();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public IMakefile getWorkingCopy(Object element) {
|
||||
FileInfo fileInfo= getFileInfo(element);
|
||||
FileInfo fileInfo= getFileInfo(element);
|
||||
if (fileInfo instanceof MakefileFileInfo) {
|
||||
MakefileFileInfo info= (MakefileFileInfo) fileInfo;
|
||||
return info.fCopy;
|
||||
|
@ -137,12 +138,13 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
/*
|
||||
* @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
Iterator<?> e= getConnectedElementsIterator();
|
||||
while (e.hasNext())
|
||||
disconnect(e.next());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createSaveOperation(java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
|
||||
*/
|
||||
|
|
|
@ -23,27 +23,28 @@ import org.eclipse.jface.text.rules.FastPartitioner;
|
|||
* The document setup participant for Makefile.
|
||||
*/
|
||||
public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant {
|
||||
|
||||
|
||||
/**
|
||||
* The name of the Makefiile partitioning.
|
||||
*/
|
||||
public final static String MAKEFILE_PARTITIONING= "___makefile_partitioning"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public MakefileDocumentSetupParticipant() {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
|
||||
*/
|
||||
@Override
|
||||
public void setup(IDocument document) {
|
||||
if (document instanceof IDocumentExtension3) {
|
||||
IDocumentExtension3 extension3= (IDocumentExtension3) document;
|
||||
IDocumentPartitioner partitioner = createDocumentPartitioner();
|
||||
extension3.setDocumentPartitioner(MAKEFILE_PARTITIONING, partitioner);
|
||||
partitioner.connect(document);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IDocumentPartitioner createDocumentPartitioner() {
|
||||
return new FastPartitioner(
|
||||
new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);
|
||||
|
|
|
@ -17,9 +17,9 @@ import java.util.ResourceBundle;
|
|||
|
||||
import org.eclipse.cdt.make.core.makefile.IDirective;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.cdt.make.internal.ui.actions.FoldingActionGroup;
|
||||
import org.eclipse.cdt.make.internal.ui.preferences.MakefileEditorPreferenceConstants;
|
||||
import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileWordDetector;
|
||||
import org.eclipse.cdt.make.internal.ui.actions.FoldingActionGroup;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
@ -128,7 +128,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
boolean isFoldingEnabled() {
|
||||
return MakeUIPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
|
||||
*/
|
||||
|
@ -180,7 +180,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
|
||||
// ensure decoration support has been created and configured.
|
||||
getSourceViewerDecorationSupport(viewer);
|
||||
|
||||
|
||||
return viewer;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
a.setActionDefinitionId(IMakefileEditorActionDefinitionIds.COMMENT);
|
||||
setAction("Comment", a); //$NON-NLS-1$
|
||||
markAsStateDependentAction("Comment", true); //$NON-NLS-1$
|
||||
|
||||
|
||||
a = new TextOperationAction(bundle, "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
|
||||
a.setActionDefinitionId(IMakefileEditorActionDefinitionIds.UNCOMMENT);
|
||||
setAction("Uncomment", a); //$NON-NLS-1$
|
||||
|
@ -252,14 +252,15 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
ISelection selection = event.getSelection();
|
||||
if (selection.isEmpty()) {
|
||||
resetHighlightRange();
|
||||
} else if (selection instanceof IStructuredSelection){
|
||||
} else if (selection instanceof IStructuredSelection){
|
||||
if (!isActivePart() && MakeUIPlugin.getActivePage() != null) {
|
||||
MakeUIPlugin.getActivePage().bringToTop(this);
|
||||
}
|
||||
}
|
||||
Object element = ((IStructuredSelection) selection).getFirstElement();
|
||||
if (element instanceof IDirective) {
|
||||
IDirective statement = (IDirective)element;
|
||||
|
@ -280,7 +281,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
|
||||
/**
|
||||
* Returns the find/replace document adapter.
|
||||
*
|
||||
*
|
||||
* @return the find/replace document adapter.
|
||||
*/
|
||||
private FindReplaceDocumentAdapter getFindReplaceDocumentAdapter() {
|
||||
|
@ -347,7 +348,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
/**
|
||||
* Adds the given listener.
|
||||
* Has no effect if an identical listener was not already registered.
|
||||
*
|
||||
*
|
||||
* @param listener The reconcile listener to be added
|
||||
* @since 3.0
|
||||
*/
|
||||
|
@ -356,11 +357,11 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
fReconcilingListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the given listener.
|
||||
* Has no effect if an identical listener was not already registered.
|
||||
*
|
||||
*
|
||||
* @param listener the reconcile listener to be removed
|
||||
* @since 3.0
|
||||
*/
|
||||
|
@ -369,17 +370,18 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
fReconcilingListeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
public void reconciled() {
|
||||
@Override
|
||||
public void reconciled() {
|
||||
// Notify listeners
|
||||
Object[] listeners = fReconcilingListeners.getListeners();
|
||||
for (int i = 0, length= listeners.length; i < length; ++i) {
|
||||
((IReconcilingParticipant)listeners[i]).reconciled();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the folding action group, or <code>null</code> if there is none.
|
||||
*
|
||||
|
@ -397,22 +399,22 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
|
||||
projectionViewer.setRedraw(false);
|
||||
try {
|
||||
|
||||
|
||||
boolean projectionMode= projectionViewer.isProjectionMode();
|
||||
if (projectionMode) {
|
||||
projectionViewer.disableProjection();
|
||||
projectionViewer.disableProjection();
|
||||
if (fProjectionMakefileUpdater != null)
|
||||
fProjectionMakefileUpdater.uninstall();
|
||||
}
|
||||
|
||||
|
||||
super.performRevert();
|
||||
|
||||
|
||||
if (projectionMode) {
|
||||
if (fProjectionMakefileUpdater != null)
|
||||
fProjectionMakefileUpdater.install(this, projectionViewer);
|
||||
fProjectionMakefileUpdater.install(this, projectionViewer);
|
||||
projectionViewer.enableProjection();
|
||||
}
|
||||
|
||||
|
||||
} finally {
|
||||
projectionViewer.setRedraw(true);
|
||||
}
|
||||
|
@ -480,7 +482,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
System.arraycopy(parentPrefPageIds, 0, prefPageIds, nIds, parentPrefPageIds.length);
|
||||
return prefPageIds;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isTabsToSpacesConversionEnabled()
|
||||
*/
|
||||
|
@ -490,7 +492,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
// see http://bugs.eclipse.org/186106
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
|
||||
* @see http://bugs.eclipse.org/172331
|
||||
|
|
|
@ -44,40 +44,40 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
|
|||
public class ProjectionMakefileUpdater implements IProjectionListener {
|
||||
|
||||
private static class MakefileProjectionAnnotation extends ProjectionAnnotation {
|
||||
|
||||
|
||||
private IDirective fDirective;
|
||||
private boolean fIsComment;
|
||||
|
||||
|
||||
public MakefileProjectionAnnotation(IDirective element, boolean isCollapsed, boolean isComment) {
|
||||
super(isCollapsed);
|
||||
fDirective = element;
|
||||
fIsComment = isComment;
|
||||
}
|
||||
|
||||
|
||||
public IDirective getElement() {
|
||||
return fDirective;
|
||||
}
|
||||
|
||||
|
||||
public void setElement(IDirective element) {
|
||||
fDirective = element;
|
||||
}
|
||||
|
||||
|
||||
public boolean isComment() {
|
||||
return fIsComment;
|
||||
}
|
||||
|
||||
|
||||
// public void setIsComment(boolean isComment) {
|
||||
// fIsComment= isComment;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void install(MakefileEditor editor, ProjectionViewer viewer) {
|
||||
fEditor= editor;
|
||||
fViewer= viewer;
|
||||
fViewer.addProjectionListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void uninstall() {
|
||||
if (isInstalled()) {
|
||||
projectionDisabled();
|
||||
|
@ -86,7 +86,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
fEditor= null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected boolean isInstalled() {
|
||||
return fEditor != null;
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.ui.editor.IReconcilingParticipant#reconciled()
|
||||
*/
|
||||
@Override
|
||||
public void reconciled() {
|
||||
processReconcile();
|
||||
}
|
||||
|
@ -115,6 +116,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
/*
|
||||
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled()
|
||||
*/
|
||||
@Override
|
||||
public void projectionEnabled() {
|
||||
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
|
||||
// projectionEnabled messages are not always paired with projectionDisabled
|
||||
|
@ -122,15 +124,16 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
// we have to make sure that we disable first when getting an enable
|
||||
// message.
|
||||
projectionDisabled();
|
||||
|
||||
initialize();
|
||||
|
||||
initialize();
|
||||
fParticipant= new ReconcilerParticipant();
|
||||
fEditor.addReconcilingParticipant(fParticipant);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled()
|
||||
*/
|
||||
@Override
|
||||
public void projectionDisabled() {
|
||||
fCachedDocument= null;
|
||||
if (fParticipant != null) {
|
||||
|
@ -138,23 +141,23 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
fParticipant= null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void initialize() {
|
||||
|
||||
|
||||
if (!isInstalled())
|
||||
return;
|
||||
|
||||
|
||||
initializePreferences();
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
IDocumentProvider provider= fEditor.getDocumentProvider();
|
||||
fCachedDocument= provider.getDocument(fEditor.getEditorInput());
|
||||
fAllowCollapsing= true;
|
||||
|
||||
|
||||
IWorkingCopyManager manager= MakeUIPlugin.getDefault().getWorkingCopyManager();
|
||||
fInput= manager.getWorkingCopy(fEditor.getEditorInput());
|
||||
|
||||
|
||||
if (fInput != null) {
|
||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
if (model != null) {
|
||||
|
@ -163,7 +166,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
model.replaceAnnotations(null, additions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} finally {
|
||||
fCachedDocument= null;
|
||||
fAllowCollapsing= false;
|
||||
|
@ -186,9 +189,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
private void computeAdditions(IDirective[] elements, Map<MakefileProjectionAnnotation, Position> map) {
|
||||
for (int i= 0; i < elements.length; i++) {
|
||||
IDirective element= elements[i];
|
||||
|
||||
|
||||
computeAdditions(element, map);
|
||||
|
||||
|
||||
if (element instanceof IParent) {
|
||||
IParent parent= (IParent) element;
|
||||
computeAdditions(parent.getDirectives(), map);
|
||||
|
@ -197,11 +200,11 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
}
|
||||
|
||||
private void computeAdditions(IDirective element, Map<MakefileProjectionAnnotation, Position> map) {
|
||||
|
||||
|
||||
boolean createProjection= false;
|
||||
|
||||
|
||||
boolean collapse= false;
|
||||
|
||||
|
||||
if (element instanceof IConditional) {
|
||||
collapse= fAllowCollapsing && fCollapseConditional;
|
||||
createProjection= true;
|
||||
|
@ -212,7 +215,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
collapse= fAllowCollapsing && fCollapseRule;
|
||||
createProjection= true;
|
||||
}
|
||||
|
||||
|
||||
if (createProjection) {
|
||||
Position position= createProjectionPosition(element);
|
||||
if (position != null) {
|
||||
|
@ -222,11 +225,11 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
}
|
||||
|
||||
private Position createProjectionPosition(IDirective element) {
|
||||
|
||||
|
||||
if (fCachedDocument == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
|
||||
try {
|
||||
int startLine= element.getStartLine() - 1;
|
||||
int endLine= element.getEndLine() - 1;
|
||||
if (startLine != endLine) {
|
||||
|
@ -234,38 +237,38 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
int endOffset= fCachedDocument.getLineOffset(endLine + 1);
|
||||
return new Position(offset, endOffset - offset);
|
||||
}
|
||||
|
||||
|
||||
} catch (BadLocationException x) {
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void processReconcile() {
|
||||
if (!isInstalled())
|
||||
return;
|
||||
|
||||
|
||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
if (model == null)
|
||||
return;
|
||||
|
||||
|
||||
try {
|
||||
IDocumentProvider provider= fEditor.getDocumentProvider();
|
||||
fCachedDocument= provider.getDocument(fEditor.getEditorInput());
|
||||
fAllowCollapsing= false;
|
||||
|
||||
|
||||
Map<MakefileProjectionAnnotation, Position> additions= new HashMap<MakefileProjectionAnnotation, Position>();
|
||||
List<MakefileProjectionAnnotation> deletions= new ArrayList<MakefileProjectionAnnotation>();
|
||||
List<MakefileProjectionAnnotation> updates= new ArrayList<MakefileProjectionAnnotation>();
|
||||
|
||||
|
||||
Map<MakefileProjectionAnnotation, Position> updated= computeAdditions((IParent) fInput);
|
||||
Map<IDirective, List<MakefileProjectionAnnotation>> previous= createAnnotationMap(model);
|
||||
|
||||
|
||||
|
||||
|
||||
for (MakefileProjectionAnnotation annotation : updated.keySet()) {
|
||||
IDirective element= annotation.getElement();
|
||||
Position position= updated.get(annotation);
|
||||
|
||||
|
||||
List<MakefileProjectionAnnotation> annotations= previous.get(element);
|
||||
if (annotations == null) {
|
||||
additions.put(annotation, position);
|
||||
|
@ -284,12 +287,12 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (annotations.isEmpty())
|
||||
previous.remove(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (List<MakefileProjectionAnnotation> list : previous.values()) {
|
||||
int size= list.size();
|
||||
for (int i= 0; i < size; i++)
|
||||
|
@ -303,7 +306,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
Annotation[] changes= new Annotation[updates.size()];
|
||||
updates.toArray(changes);
|
||||
model.modifyAnnotations(removals, additions, changes);
|
||||
|
||||
|
||||
} finally {
|
||||
fCachedDocument= null;
|
||||
fAllowCollapsing= true;
|
||||
|
@ -312,20 +315,20 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
|
||||
private void match(ProjectionAnnotationModel model, List<MakefileProjectionAnnotation> deletions,
|
||||
Map<MakefileProjectionAnnotation, Position> additions, List<MakefileProjectionAnnotation> changes) {
|
||||
|
||||
|
||||
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
|
||||
return;
|
||||
|
||||
|
||||
List<MakefileProjectionAnnotation> newDeletions= new ArrayList<MakefileProjectionAnnotation>();
|
||||
List<MakefileProjectionAnnotation> newChanges= new ArrayList<MakefileProjectionAnnotation>();
|
||||
|
||||
|
||||
Iterator<MakefileProjectionAnnotation> deletionIterator= deletions.iterator();
|
||||
outer: while (deletionIterator.hasNext()) {
|
||||
MakefileProjectionAnnotation deleted= deletionIterator.next();
|
||||
Position deletedPosition= model.getPosition(deleted);
|
||||
if (deletedPosition == null)
|
||||
continue;
|
||||
|
||||
|
||||
Iterator<MakefileProjectionAnnotation> changesIterator= changes.iterator();
|
||||
while (changesIterator.hasNext()) {
|
||||
MakefileProjectionAnnotation changed= changesIterator.next();
|
||||
|
@ -333,45 +336,45 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
Position changedPosition= model.getPosition(changed);
|
||||
if (changedPosition == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (deletedPosition.getOffset() == changedPosition.getOffset()) {
|
||||
|
||||
|
||||
deletedPosition.setLength(changedPosition.getLength());
|
||||
deleted.setElement(changed.getElement());
|
||||
|
||||
|
||||
deletionIterator.remove();
|
||||
newChanges.add(deleted);
|
||||
|
||||
|
||||
changesIterator.remove();
|
||||
newDeletions.add(changed);
|
||||
|
||||
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Iterator<MakefileProjectionAnnotation> additionsIterator= additions.keySet().iterator();
|
||||
while (additionsIterator.hasNext()) {
|
||||
MakefileProjectionAnnotation added= additionsIterator.next();
|
||||
if (deleted.isComment() == added.isComment()) {
|
||||
Position addedPosition= additions.get(added);
|
||||
|
||||
|
||||
if (deletedPosition.getOffset() == addedPosition.getOffset()) {
|
||||
|
||||
|
||||
deletedPosition.setLength(addedPosition.getLength());
|
||||
deleted.setElement(added.getElement());
|
||||
|
||||
|
||||
deletionIterator.remove();
|
||||
newChanges.add(deleted);
|
||||
|
||||
|
||||
additionsIterator.remove();
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
deletions.addAll(newDeletions);
|
||||
changes.addAll(newChanges);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.eclipse.ui.IEditorInput;
|
|||
* additionally offers to "overwrite" the working copy provided by this document provider.
|
||||
*/
|
||||
public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
|
||||
|
||||
|
||||
private IMakefileDocumentProvider fDocumentProvider;
|
||||
private Map<IEditorInput, IMakefile> fMap;
|
||||
private boolean fIsShuttingDown;
|
||||
|
@ -36,7 +36,7 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
|||
/**
|
||||
* Creates a new working copy manager that co-operates with the given
|
||||
* compilation unit document provider.
|
||||
*
|
||||
*
|
||||
* @param provider the provider
|
||||
*/
|
||||
public WorkingCopyManager(IMakefileDocumentProvider provider) {
|
||||
|
@ -47,20 +47,23 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
|||
/*
|
||||
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public void connect(IEditorInput input) throws CoreException {
|
||||
fDocumentProvider.connect(input);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public void disconnect(IEditorInput input) {
|
||||
fDocumentProvider.disconnect(input);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
if (!fIsShuttingDown) {
|
||||
fIsShuttingDown= true;
|
||||
|
@ -79,14 +82,16 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
|||
/*
|
||||
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public IMakefile getWorkingCopy(IEditorInput input) {
|
||||
IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input);
|
||||
return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.make.core.makefile.IMakefile)
|
||||
*/
|
||||
@Override
|
||||
public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) {
|
||||
if (fDocumentProvider.getDocument(input) != null) {
|
||||
if (fMap == null)
|
||||
|
@ -94,10 +99,11 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
|||
fMap.put(input, workingCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.make.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
|
||||
*/
|
||||
@Override
|
||||
public void removeWorkingCopy(IEditorInput input) {
|
||||
fMap.remove(input);
|
||||
if (fMap.isEmpty())
|
||||
|
|
|
@ -37,11 +37,13 @@ public class CheckboxTablePart extends StructuredViewerPart {
|
|||
style |= SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
|
||||
CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, style);
|
||||
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent e) {
|
||||
CheckboxTablePart.this.selectionChanged((IStructuredSelection) e.getSelection());
|
||||
}
|
||||
});
|
||||
tableViewer.addCheckStateListener(new ICheckStateListener() {
|
||||
@Override
|
||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||
elementChecked(event.getElement(), event.getChecked());
|
||||
}
|
||||
|
|
|
@ -29,9 +29,11 @@ public abstract class SharedPartWithButtons extends SharedPart {
|
|||
private Composite buttonContainer;
|
||||
|
||||
private class SelectionHandler implements SelectionListener {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
buttonSelected(e);
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
buttonSelected(e);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.make.internal.ui.preferences;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -40,24 +39,29 @@ import org.eclipse.swt.widgets.Text;
|
|||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* AbstraceMakeEditorPreferencePage
|
||||
*/
|
||||
public abstract class AbstractMakefileEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
|
||||
OverlayPreferenceStore fOverlayStore;
|
||||
|
||||
|
||||
Map<Control, String> fCheckBoxes= new HashMap<Control, String>();
|
||||
private SelectionListener fCheckBoxListener= new SelectionListener() {
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Button button= (Button) e.widget;
|
||||
fOverlayStore.setValue(fCheckBoxes.get(button), button.getSelection());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Map<Control, String> fTextFields= new HashMap<Control, String>();
|
||||
private ModifyListener fTextFieldListener= new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
Text text= (Text) e.widget;
|
||||
fOverlayStore.setValue(fTextFields.get(text), text.getText());
|
||||
|
@ -66,25 +70,27 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
|
||||
private Map<Text, String[]> fNumberFields= new HashMap<Text, String[]>();
|
||||
private ModifyListener fNumberFieldListener= new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
numberFieldChanged((Text) e.widget);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public AbstractMakefileEditorPreferencePage() {
|
||||
super();
|
||||
setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore());
|
||||
fOverlayStore= createOverlayStore();
|
||||
}
|
||||
|
||||
|
||||
protected abstract OverlayPreferenceStore createOverlayStore();
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||
*/
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
}
|
||||
|
||||
|
||||
protected void initializeFields() {
|
||||
Map<Control, String> checkBoxes= getCheckBoxes();
|
||||
Map<Control, String> textFields= getTextFields();
|
||||
|
@ -94,15 +100,15 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
String key= checkBoxes.get(b);
|
||||
b.setSelection(getOverlayStore().getBoolean(key));
|
||||
}
|
||||
|
||||
|
||||
e= textFields.keySet().iterator();
|
||||
while (e.hasNext()) {
|
||||
Text t= (Text) e.next();
|
||||
String key= textFields.get(t);
|
||||
t.setText(getOverlayStore().getString(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
|
||||
*/
|
||||
|
@ -112,27 +118,27 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
MakeUIPlugin.getDefault().savePluginPreferences();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected OverlayPreferenceStore getOverlayStore() {
|
||||
return fOverlayStore;
|
||||
}
|
||||
|
||||
|
||||
protected OverlayPreferenceStore setOverlayStore() {
|
||||
return fOverlayStore;
|
||||
}
|
||||
|
||||
|
||||
protected Map<Control, String> getCheckBoxes() {
|
||||
return fCheckBoxes;
|
||||
}
|
||||
|
||||
|
||||
protected Map<Control, String> getTextFields() {
|
||||
return fTextFields;
|
||||
}
|
||||
|
||||
|
||||
protected Map<Text, String[]> getNumberFields() {
|
||||
return fNumberFields;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
|
||||
*/
|
||||
|
@ -143,9 +149,9 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
handleDefaults();
|
||||
super.performDefaults();
|
||||
}
|
||||
|
||||
|
||||
protected abstract void handleDefaults();
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
||||
*/
|
||||
|
@ -157,35 +163,35 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected Button addCheckBox(Composite parent, String labelText, String key, int indentation) {
|
||||
|
||||
protected Button addCheckBox(Composite parent, String labelText, String key, int indentation) {
|
||||
Button checkBox= new Button(parent, SWT.CHECK);
|
||||
checkBox.setText(labelText);
|
||||
checkBox.setFont(parent.getFont());
|
||||
|
||||
|
||||
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||
gd.horizontalIndent= indentation;
|
||||
gd.horizontalSpan= 2;
|
||||
checkBox.setLayoutData(gd);
|
||||
checkBox.addSelectionListener(fCheckBoxListener);
|
||||
|
||||
|
||||
getCheckBoxes().put(checkBox, key);
|
||||
|
||||
|
||||
return checkBox;
|
||||
}
|
||||
|
||||
|
||||
protected Control addTextField(Composite composite, String labelText, String key, int textLimit, int indentation, String[] errorMessages) {
|
||||
Font font= composite.getFont();
|
||||
|
||||
|
||||
Label label= new Label(composite, SWT.NONE);
|
||||
label.setText(labelText);
|
||||
label.setFont(font);
|
||||
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||
gd.horizontalIndent= indentation;
|
||||
label.setLayoutData(gd);
|
||||
|
||||
|
||||
Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
|
||||
textControl.setFont(font);
|
||||
textControl.setFont(font);
|
||||
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||
gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
|
||||
textControl.setLayoutData(gd);
|
||||
|
@ -197,10 +203,10 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
} else {
|
||||
textControl.addModifyListener(fTextFieldListener);
|
||||
}
|
||||
|
||||
|
||||
return textControl;
|
||||
}
|
||||
|
||||
|
||||
void numberFieldChanged(Text textControl) {
|
||||
String number= textControl.getText();
|
||||
IStatus status= validatePositiveNumber(number, getNumberFields().get(textControl));
|
||||
|
@ -209,7 +215,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
}
|
||||
updateStatus(status);
|
||||
}
|
||||
|
||||
|
||||
private IStatus validatePositiveNumber(String number, String[] errorMessages) {
|
||||
StatusInfo status= new StatusInfo();
|
||||
if (number.length() == 0) {
|
||||
|
@ -225,7 +231,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
private void updateStatus(IStatus status) {
|
||||
if (!status.matches(IStatus.ERROR)) {
|
||||
Set<Text> keys= getNumberFields().keySet();
|
||||
|
@ -234,7 +240,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
IStatus s= validatePositiveNumber(text.getText(), getNumberFields().get(text));
|
||||
status= s.getSeverity() > status.getSeverity() ? s : status;
|
||||
}
|
||||
}
|
||||
}
|
||||
setValid(!status.matches(IStatus.ERROR));
|
||||
applyToStatusLine(this, status);
|
||||
}
|
||||
|
@ -252,21 +258,21 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
case IStatus.WARNING:
|
||||
page.setMessage(message, IMessageProvider.WARNING);
|
||||
page.setErrorMessage(null);
|
||||
break;
|
||||
break;
|
||||
case IStatus.INFO:
|
||||
page.setMessage(message, IMessageProvider.INFORMATION);
|
||||
page.setErrorMessage(null);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
if (message.length() == 0) {
|
||||
message= null;
|
||||
}
|
||||
page.setMessage(null);
|
||||
page.setErrorMessage(message);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of size 2:
|
||||
* - first element is of type <code>Label</code>
|
||||
|
@ -280,8 +286,8 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||
gd.horizontalIndent= indentation;
|
||||
labelControl.setLayoutData(gd);
|
||||
|
||||
Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
|
||||
|
||||
Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
|
||||
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||
gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
|
||||
textControl.setLayoutData(gd);
|
||||
|
@ -294,10 +300,10 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
|
|||
} else {
|
||||
textControl.addModifyListener(fTextFieldListener);
|
||||
}
|
||||
|
||||
|
||||
return new Control[]{labelControl, textControl};
|
||||
}
|
||||
|
||||
|
||||
protected String loadPreviewContentFromFile(String filename) {
|
||||
String line;
|
||||
String separator= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
|
|
@ -33,24 +33,24 @@ import org.eclipse.swt.widgets.Display;
|
|||
* A "button" of a certain color determined by the color picker
|
||||
*/
|
||||
public class ColorEditor {
|
||||
|
||||
|
||||
private Point fExtent;
|
||||
Image fImage;
|
||||
RGB fColorValue;
|
||||
Color fColor;
|
||||
Button fButton;
|
||||
|
||||
|
||||
public ColorEditor(Composite parent) {
|
||||
|
||||
|
||||
fButton= new Button(parent, SWT.PUSH);
|
||||
fExtent= computeImageSize(parent);
|
||||
fImage= new Image(parent.getDisplay(), fExtent.x, fExtent.y);
|
||||
|
||||
|
||||
GC gc= new GC(fImage);
|
||||
gc.setBackground(fButton.getBackground());
|
||||
gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
|
||||
gc.dispose();
|
||||
|
||||
|
||||
fButton.setImage(fImage);
|
||||
fButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
|
@ -64,8 +64,9 @@ public class ColorEditor {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fButton.addDisposeListener(new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent event) {
|
||||
if (fImage != null) {
|
||||
fImage.dispose();
|
||||
|
@ -78,39 +79,39 @@ public class ColorEditor {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public RGB getColorValue() {
|
||||
return fColorValue;
|
||||
}
|
||||
|
||||
|
||||
public void setColorValue(RGB rgb) {
|
||||
fColorValue= rgb;
|
||||
updateColorImage();
|
||||
}
|
||||
|
||||
|
||||
public Button getButton() {
|
||||
return fButton;
|
||||
}
|
||||
|
||||
|
||||
protected void updateColorImage() {
|
||||
|
||||
|
||||
Display display= fButton.getDisplay();
|
||||
|
||||
|
||||
GC gc= new GC(fImage);
|
||||
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||
gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
|
||||
|
||||
|
||||
if (fColor != null)
|
||||
fColor.dispose();
|
||||
|
||||
|
||||
fColor= new Color(display, fColorValue);
|
||||
gc.setBackground(fColor);
|
||||
gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
|
||||
gc.dispose();
|
||||
|
||||
|
||||
fButton.setImage(fImage);
|
||||
}
|
||||
|
||||
|
||||
protected Point computeImageSize(Control window) {
|
||||
GC gc= new GC(window);
|
||||
Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo
|
|||
|
||||
private static final String PREF_BUILD_TARGET_IN_BACKGROUND = "MakeTargetPrefs.buildTargetInBackground"; //$NON-NLS-1$
|
||||
private static final String TARGET_BUILDS_IN_BACKGROUND = "MakeTargetPreferencePage.buildTargetInBackground.label"; //$NON-NLS-1$
|
||||
|
||||
|
||||
private static final String PREF_BUILD_LAST_TARGET = "MakeTargetPrefs.buildLastTarget"; //$NON-NLS-1$
|
||||
private static final String BUILD_LAST_TARGET = "MakeTargetPreferencePage.buildLastTarget.title"; //$NON-NLS-1$
|
||||
private static final String PREF_BUILD_LAST_PROJECT = "MakeTargetPrefs.buildLastTarget.project"; //$NON-NLS-1$
|
||||
|
@ -57,15 +57,15 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo
|
|||
BooleanFieldEditor tagetBackgroundEditor = new BooleanFieldEditor(PREF_BUILD_TARGET_IN_BACKGROUND,
|
||||
MakeUIPlugin.getResourceString(TARGET_BUILDS_IN_BACKGROUND), parent);
|
||||
addField(tagetBackgroundEditor);
|
||||
|
||||
|
||||
// make last target for selected resource or project
|
||||
RadioGroupFieldEditor edit = new RadioGroupFieldEditor(
|
||||
PREF_BUILD_LAST_TARGET,
|
||||
MakeUIPlugin.getResourceString(BUILD_LAST_TARGET), 1,
|
||||
MakeUIPlugin.getResourceString(BUILD_LAST_TARGET), 1,
|
||||
new String[][] {
|
||||
{MakeUIPlugin.getResourceString(BUILD_LAST_PROJECT), PREF_BUILD_LAST_PROJECT},
|
||||
{MakeUIPlugin.getResourceString(BUILD_LAST_RESOURCE), PREF_BUILD_LAST_RESOURCE},
|
||||
{MakeUIPlugin.getResourceString(BUILD_LAST_PROJECTROOT), PREF_BUILD_LAST_PROJECTROOT} },
|
||||
{MakeUIPlugin.getResourceString(BUILD_LAST_RESOURCE), PREF_BUILD_LAST_RESOURCE},
|
||||
{MakeUIPlugin.getResourceString(BUILD_LAST_PROJECTROOT), PREF_BUILD_LAST_PROJECTROOT} },
|
||||
parent,
|
||||
true);
|
||||
addField(edit);
|
||||
|
@ -81,17 +81,17 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo
|
|||
|
||||
/**
|
||||
* preference to rebuild last target
|
||||
*
|
||||
* @return {@code true} if from root folder of selected project
|
||||
*
|
||||
* @return {@code true} if from root folder of selected project
|
||||
*/
|
||||
public static boolean useProjectRootForLastMakeTarget() {
|
||||
return MakeUIPlugin.getDefault().getPreferenceStore().getString(PREF_BUILD_LAST_TARGET).equals(PREF_BUILD_LAST_PROJECTROOT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* preference to rebuild last target
|
||||
*
|
||||
* @return {@code true} if from selected project irrespective in which container
|
||||
*
|
||||
* @return {@code true} if from selected project irrespective in which container
|
||||
*/
|
||||
public static boolean useProjectLastMakeTarget() {
|
||||
return MakeUIPlugin.getDefault().getPreferenceStore().getString(PREF_BUILD_LAST_TARGET).equals(PREF_BUILD_LAST_PROJECT);
|
||||
|
@ -104,6 +104,7 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo
|
|||
prefs.setDefault(PREF_BUILD_LAST_TARGET, PREF_BUILD_LAST_PROJECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,13 +65,13 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
ColorSelector fSyntaxForegroundColorEditor;
|
||||
Button fBoldCheckBox;
|
||||
Button fItalicCheckBox;
|
||||
|
||||
|
||||
// folding
|
||||
protected Button fFoldingCheckbox;
|
||||
|
||||
/**
|
||||
* Item in the highlighting color list.
|
||||
*
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private class HighlightingColorListItem {
|
||||
|
@ -85,10 +85,10 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
private String fItalicKey;
|
||||
/** Item color */
|
||||
private Color fItemColor;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the item with the given values.
|
||||
*
|
||||
*
|
||||
* @param displayName the display name
|
||||
* @param colorKey the color preference key
|
||||
* @param boldKey the bold preference key
|
||||
|
@ -102,35 +102,35 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
fItalicKey= italicKey;
|
||||
fItemColor= itemColor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the bold preference key
|
||||
*/
|
||||
public String getBoldKey() {
|
||||
return fBoldKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the bold preference key
|
||||
*/
|
||||
public String getItalicKey() {
|
||||
return fItalicKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the color preference key
|
||||
*/
|
||||
public String getColorKey() {
|
||||
return fColorKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the display name
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return fDisplayName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the item color
|
||||
*/
|
||||
|
@ -141,7 +141,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
|
||||
/**
|
||||
* Color list label provider.
|
||||
*
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private class ColorListLabelProvider extends LabelProvider implements IColorProvider {
|
||||
|
@ -153,10 +153,11 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
public String getText(Object element) {
|
||||
return ((HighlightingColorListItem)element).getDisplayName();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
return ((HighlightingColorListItem)element).getItemColor();
|
||||
}
|
||||
|
@ -164,14 +165,15 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
/*
|
||||
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Color getBackground(Object element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Color list content provider.
|
||||
*
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private class ColorListContentProvider implements IStructuredContentProvider {
|
||||
|
@ -179,6 +181,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
/*
|
||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
return ((List<?>)inputElement).toArray();
|
||||
}
|
||||
|
@ -186,20 +189,22 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
/*
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public MakefileEditorPreferencePage() {
|
||||
super();
|
||||
|
@ -221,12 +226,12 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL));
|
||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF));
|
||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_RULE));
|
||||
|
||||
|
||||
for (int i= 0; i < fSyntaxColorListModel.length; i++) {
|
||||
String colorKey= fSyntaxColorListModel[i][1];
|
||||
addTextKeyToCover(overlayKeys, colorKey);
|
||||
}
|
||||
|
||||
|
||||
OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
|
||||
overlayKeys.toArray(keys);
|
||||
return new OverlayPreferenceStore(getPreferenceStore(), keys);
|
||||
|
@ -246,33 +251,33 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
MakeUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), IMakeHelpContextIds.MAKE_EDITOR_PREFERENCE_PAGE);
|
||||
getOverlayStore().load();
|
||||
getOverlayStore().start();
|
||||
|
||||
|
||||
TabFolder folder= new TabFolder(parent, SWT.NONE);
|
||||
folder.setLayout(new TabFolderLayout());
|
||||
folder.setLayout(new TabFolderLayout());
|
||||
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
|
||||
TabItem item= new TabItem(folder, SWT.NONE);
|
||||
item.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.syntax")); //$NON-NLS-1$
|
||||
item.setControl(createSyntaxPage(folder));
|
||||
|
||||
|
||||
item= new TabItem(folder, SWT.NONE);
|
||||
item.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.folding")); //$NON-NLS-1$
|
||||
item.setControl(createFoldingTabContent(folder));
|
||||
|
||||
|
||||
initialize();
|
||||
|
||||
|
||||
applyDialogFont(folder);
|
||||
return folder;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
||||
|
||||
initializeFields();
|
||||
|
||||
|
||||
for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) {
|
||||
fHighlightingColorList.add(
|
||||
new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1],
|
||||
fSyntaxColorListModel[i][1] + MakefileEditorPreferenceConstants.EDITOR_BOLD_SUFFIX,
|
||||
fSyntaxColorListModel[i][1] + MakefileEditorPreferenceConstants.EDITOR_BOLD_SUFFIX,
|
||||
fSyntaxColorListModel[i][1] + MakefileEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null));
|
||||
}
|
||||
fHighlightingColorListViewer.setInput(fHighlightingColorList);
|
||||
|
@ -283,12 +288,12 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
|
||||
void initializeFolding() {
|
||||
boolean enabled= getOverlayStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
|
||||
fFoldingCheckbox.setSelection(enabled);
|
||||
fFoldingCheckbox.setSelection(enabled);
|
||||
}
|
||||
|
||||
void initializeDefaultFolding() {
|
||||
boolean enabled= getOverlayStore().getDefaultBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
|
||||
fFoldingCheckbox.setSelection(enabled);
|
||||
fFoldingCheckbox.setSelection(enabled);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -299,9 +304,9 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
handleSyntaxColorListSelection();
|
||||
initializeDefaultFolding();
|
||||
}
|
||||
|
||||
|
||||
private Control createSyntaxPage(Composite parent) {
|
||||
|
||||
|
||||
Composite colorComposite= new Composite(parent, SWT.NONE);
|
||||
colorComposite.setLayout(new GridLayout());
|
||||
|
||||
|
@ -316,7 +321,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
layout.marginWidth= 0;
|
||||
editorComposite.setLayout(layout);
|
||||
GridData gd= new GridData(GridData.FILL_BOTH);
|
||||
editorComposite.setLayoutData(gd);
|
||||
editorComposite.setLayoutData(gd);
|
||||
|
||||
fHighlightingColorListViewer= new TableViewer(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
|
||||
fHighlightingColorListViewer.setLabelProvider(new ColorListLabelProvider());
|
||||
|
@ -325,7 +330,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
gd= new GridData(GridData.FILL_BOTH);
|
||||
gd.heightHint= convertHeightInCharsToPixels(5);
|
||||
fHighlightingColorListViewer.getControl().setLayoutData(gd);
|
||||
|
||||
|
||||
Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
|
||||
layout= new GridLayout();
|
||||
layout.marginHeight= 0;
|
||||
|
@ -333,7 +338,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
layout.numColumns= 2;
|
||||
stylesComposite.setLayout(layout);
|
||||
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
|
||||
label= new Label(stylesComposite, SWT.LEFT);
|
||||
label.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.color")); //$NON-NLS-1$
|
||||
gd= new GridData();
|
||||
|
@ -345,14 +350,14 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
gd= new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalAlignment= GridData.BEGINNING;
|
||||
foregroundColorButton.setLayoutData(gd);
|
||||
|
||||
|
||||
fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);
|
||||
fBoldCheckBox.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.bold")); //$NON-NLS-1$
|
||||
gd= new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalAlignment= GridData.BEGINNING;
|
||||
gd.horizontalSpan= 2;
|
||||
fBoldCheckBox.setLayoutData(gd);
|
||||
|
||||
|
||||
fItalicCheckBox= new Button(stylesComposite, SWT.CHECK);
|
||||
fItalicCheckBox.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.italic")); //$NON-NLS-1$
|
||||
gd= new GridData(GridData.FILL_HORIZONTAL);
|
||||
|
@ -361,15 +366,18 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
fItalicCheckBox.setLayoutData(gd);
|
||||
|
||||
fHighlightingColorListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
handleSyntaxColorListSelection();
|
||||
}
|
||||
});
|
||||
|
||||
foregroundColorButton.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// do nothing
|
||||
}
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
HighlightingColorListItem item= getHighlightingColorListItem();
|
||||
PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue());
|
||||
|
@ -377,28 +385,32 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
});
|
||||
|
||||
fBoldCheckBox.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// do nothing
|
||||
}
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
HighlightingColorListItem item= getHighlightingColorListItem();
|
||||
getOverlayStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fItalicCheckBox.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// do nothing
|
||||
}
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
HighlightingColorListItem item= getHighlightingColorListItem();
|
||||
getOverlayStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return colorComposite;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Composite createFoldingTabContent(TabFolder folder) {
|
||||
Composite composite= new Composite(folder, SWT.NULL);
|
||||
|
@ -410,37 +422,39 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
//PixelConverter pc= new PixelConverter(composite);
|
||||
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
|
||||
composite.setLayout(layout);
|
||||
|
||||
|
||||
|
||||
|
||||
/* check box for new editors */
|
||||
fFoldingCheckbox= new Button(composite, SWT.CHECK);
|
||||
fFoldingCheckbox.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.foldingenable")); //$NON-NLS-1$
|
||||
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
|
||||
fFoldingCheckbox.setLayoutData(gd);
|
||||
fFoldingCheckbox.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
boolean enabled= fFoldingCheckbox.getSelection();
|
||||
boolean enabled= fFoldingCheckbox.getSelection();
|
||||
getOverlayStore().setValue(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
void handleSyntaxColorListSelection() {
|
||||
HighlightingColorListItem item= getHighlightingColorListItem();
|
||||
RGB rgb= PreferenceConverter.getColor(getOverlayStore(), item.getColorKey());
|
||||
fSyntaxForegroundColorEditor.setColorValue(rgb);
|
||||
fSyntaxForegroundColorEditor.setColorValue(rgb);
|
||||
fBoldCheckBox.setSelection(getOverlayStore().getBoolean(item.getBoldKey()));
|
||||
fItalicCheckBox.setSelection(getOverlayStore().getBoolean(item.getItalicKey()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current highlighting color list item.
|
||||
*
|
||||
*
|
||||
* @return the current highlighting color list item
|
||||
* @since 3.0
|
||||
*/
|
||||
|
@ -457,14 +471,14 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
return super.performOk();
|
||||
}
|
||||
|
||||
public static void initDefaults(IPreferenceStore prefs) {
|
||||
public static void initDefaults(IPreferenceStore prefs) {
|
||||
// Makefile Editor color preferences
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_COMMENT_COLOR, ColorManager.MAKE_COMMENT_RGB);
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_DEFAULT_COLOR, ColorManager.MAKE_DEFAULT_RGB);
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_FUNCTION_COLOR, ColorManager.MAKE_FUNCTION_RGB);
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_KEYWORD_COLOR, ColorManager.MAKE_KEYWORD_RGB);
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_MACRO_DEF_COLOR, ColorManager.MAKE_MACRO_DEF_RGB);
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_MACRO_REF_COLOR, ColorManager.MAKE_MACRO_REF_RGB);
|
||||
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_MACRO_REF_COLOR, ColorManager.MAKE_MACRO_REF_RGB);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ public class MakefileSettingsPreferencePage extends FieldEditorPreferencePage im
|
|||
public static void initDefaults(IPreferenceStore prefs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
|
|||
* It is left here for compatibility reasons only.
|
||||
* The page is superseded by "New CDT Project Wizard/Makefile Project" page,
|
||||
* class {@code org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject}.
|
||||
*
|
||||
*
|
||||
* @deprecated as of CDT 4.0.
|
||||
*/
|
||||
@Deprecated
|
||||
public class NewMakeProjectPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, ICOptionContainer {
|
||||
|
||||
|
||||
private MakeProjectOptionBlock fOptionBlock;
|
||||
|
||||
public NewMakeProjectPreferencePage() {
|
||||
|
@ -43,7 +43,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor
|
|||
fOptionBlock = new MakeProjectOptionBlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setContainer(IPreferencePageContainer preferencePageContainer) {
|
||||
super.setContainer(preferencePageContainer);
|
||||
|
@ -63,7 +63,8 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor
|
|||
return fOptionBlock.createContents(parent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
}
|
||||
|
||||
|
@ -83,6 +84,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor
|
|||
fOptionBlock.setVisible(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateContainer() {
|
||||
fOptionBlock.update();
|
||||
boolean ok = fOptionBlock.isValid();
|
||||
|
@ -95,6 +97,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor
|
|||
setValid(ok);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
return null;
|
||||
}
|
||||
|
@ -114,6 +117,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferences()
|
||||
*/
|
||||
@Override
|
||||
public Preferences getPreferences() {
|
||||
return MakeCorePlugin.getDefault().getPluginPreferences();
|
||||
}
|
||||
|
|
|
@ -23,57 +23,58 @@ import org.eclipse.jface.util.PropertyChangeEvent;
|
|||
* An overlaying preference store.
|
||||
*/
|
||||
class OverlayPreferenceStore implements IPreferenceStore {
|
||||
|
||||
|
||||
|
||||
|
||||
public static final class TypeDescriptor {
|
||||
TypeDescriptor() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final TypeDescriptor BOOLEAN= new TypeDescriptor();
|
||||
public static final TypeDescriptor DOUBLE= new TypeDescriptor();
|
||||
public static final TypeDescriptor FLOAT= new TypeDescriptor();
|
||||
public static final TypeDescriptor INT= new TypeDescriptor();
|
||||
public static final TypeDescriptor LONG= new TypeDescriptor();
|
||||
public static final TypeDescriptor STRING= new TypeDescriptor();
|
||||
|
||||
|
||||
public static class OverlayKey {
|
||||
|
||||
|
||||
TypeDescriptor fDescriptor;
|
||||
String fKey;
|
||||
|
||||
|
||||
public OverlayKey(TypeDescriptor descriptor, String key) {
|
||||
fDescriptor= descriptor;
|
||||
fKey= key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class PropertyListener implements IPropertyChangeListener {
|
||||
|
||||
|
||||
/*
|
||||
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
OverlayKey key= findOverlayKey(event.getProperty());
|
||||
if (key != null)
|
||||
propagateProperty(fParent, key, fStore);
|
||||
propagateProperty(fParent, key, fStore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
IPreferenceStore fParent;
|
||||
IPreferenceStore fStore;
|
||||
private OverlayKey[] fOverlayKeys;
|
||||
|
||||
|
||||
private PropertyListener fPropertyListener;
|
||||
|
||||
|
||||
|
||||
|
||||
public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
|
||||
fParent= parent;
|
||||
fOverlayKeys= overlayKeys;
|
||||
fStore= new PreferenceStore();
|
||||
}
|
||||
|
||||
|
||||
OverlayKey findOverlayKey(String key) {
|
||||
for (int i= 0; i < fOverlayKeys.length; i++) {
|
||||
if (fOverlayKeys[i].fKey.equals(key))
|
||||
|
@ -81,41 +82,41 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private boolean covers(String key) {
|
||||
return (findOverlayKey(key) != null);
|
||||
}
|
||||
|
||||
|
||||
void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
|
||||
|
||||
|
||||
if (orgin.isDefault(key.fKey)) {
|
||||
if (!target.isDefault(key.fKey))
|
||||
target.setToDefault(key.fKey);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TypeDescriptor d= key.fDescriptor;
|
||||
if (BOOLEAN == d) {
|
||||
|
||||
|
||||
boolean originValue= orgin.getBoolean(key.fKey);
|
||||
boolean targetValue= target.getBoolean(key.fKey);
|
||||
if (targetValue != originValue)
|
||||
target.setValue(key.fKey, originValue);
|
||||
|
||||
|
||||
} else if (DOUBLE == d) {
|
||||
|
||||
|
||||
double originValue= orgin.getDouble(key.fKey);
|
||||
double targetValue= target.getDouble(key.fKey);
|
||||
if (targetValue != originValue)
|
||||
target.setValue(key.fKey, originValue);
|
||||
|
||||
|
||||
} else if (FLOAT == d) {
|
||||
|
||||
|
||||
float originValue= orgin.getFloat(key.fKey);
|
||||
float targetValue= target.getFloat(key.fKey);
|
||||
if (targetValue != originValue)
|
||||
target.setValue(key.fKey, originValue);
|
||||
|
||||
|
||||
} else if (INT == d) {
|
||||
|
||||
int originValue= orgin.getInt(key.fKey);
|
||||
|
@ -139,100 +140,103 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void propagate() {
|
||||
for (int i= 0; i < fOverlayKeys.length; i++)
|
||||
propagateProperty(fStore, fOverlayKeys[i], fParent);
|
||||
}
|
||||
|
||||
|
||||
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
|
||||
TypeDescriptor d= key.fDescriptor;
|
||||
if (BOOLEAN == d) {
|
||||
|
||||
|
||||
if (forceInitialization)
|
||||
target.setValue(key.fKey, true);
|
||||
target.setValue(key.fKey, orgin.getBoolean(key.fKey));
|
||||
target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
|
||||
|
||||
|
||||
} else if (DOUBLE == d) {
|
||||
|
||||
|
||||
if (forceInitialization)
|
||||
target.setValue(key.fKey, 1.0D);
|
||||
target.setValue(key.fKey, orgin.getDouble(key.fKey));
|
||||
target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
|
||||
|
||||
|
||||
} else if (FLOAT == d) {
|
||||
|
||||
|
||||
if (forceInitialization)
|
||||
target.setValue(key.fKey, 1.0F);
|
||||
target.setValue(key.fKey, orgin.getFloat(key.fKey));
|
||||
target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
|
||||
|
||||
|
||||
} else if (INT == d) {
|
||||
|
||||
|
||||
if (forceInitialization)
|
||||
target.setValue(key.fKey, 1);
|
||||
target.setValue(key.fKey, orgin.getInt(key.fKey));
|
||||
target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
|
||||
|
||||
|
||||
} else if (LONG == d) {
|
||||
|
||||
|
||||
if (forceInitialization)
|
||||
target.setValue(key.fKey, 1L);
|
||||
target.setValue(key.fKey, orgin.getLong(key.fKey));
|
||||
target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
|
||||
|
||||
|
||||
} else if (STRING == d) {
|
||||
|
||||
|
||||
if (forceInitialization)
|
||||
target.setValue(key.fKey, "1"); //$NON-NLS-1$
|
||||
target.setValue(key.fKey, orgin.getString(key.fKey));
|
||||
target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void load() {
|
||||
for (int i= 0; i < fOverlayKeys.length; i++)
|
||||
loadProperty(fParent, fOverlayKeys[i], fStore, true);
|
||||
}
|
||||
|
||||
|
||||
public void loadDefaults() {
|
||||
for (int i= 0; i < fOverlayKeys.length; i++)
|
||||
setToDefault(fOverlayKeys[i].fKey);
|
||||
}
|
||||
|
||||
|
||||
public void start() {
|
||||
if (fPropertyListener == null) {
|
||||
fPropertyListener= new PropertyListener();
|
||||
fParent.addPropertyChangeListener(fPropertyListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stop() {
|
||||
if (fPropertyListener != null) {
|
||||
fParent.removePropertyChangeListener(fPropertyListener);
|
||||
fPropertyListener= null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener)
|
||||
*/
|
||||
@Override
|
||||
public void addPropertyChangeListener(IPropertyChangeListener listener) {
|
||||
fStore.addPropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener)
|
||||
*/
|
||||
@Override
|
||||
public void removePropertyChangeListener(IPropertyChangeListener listener) {
|
||||
fStore.removePropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object)
|
||||
*/
|
||||
@Override
|
||||
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
|
||||
fStore.firePropertyChangeEvent(name, oldValue, newValue);
|
||||
}
|
||||
|
@ -240,13 +244,15 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#contains(String)
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(String name) {
|
||||
return fStore.contains(name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see IPreferenceStore#getBoolean(String)
|
||||
*/
|
||||
@Override
|
||||
public boolean getBoolean(String name) {
|
||||
return fStore.getBoolean(name);
|
||||
}
|
||||
|
@ -254,6 +260,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDefaultBoolean(String)
|
||||
*/
|
||||
@Override
|
||||
public boolean getDefaultBoolean(String name) {
|
||||
return fStore.getDefaultBoolean(name);
|
||||
}
|
||||
|
@ -261,6 +268,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDefaultDouble(String)
|
||||
*/
|
||||
@Override
|
||||
public double getDefaultDouble(String name) {
|
||||
return fStore.getDefaultDouble(name);
|
||||
}
|
||||
|
@ -268,6 +276,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDefaultFloat(String)
|
||||
*/
|
||||
@Override
|
||||
public float getDefaultFloat(String name) {
|
||||
return fStore.getDefaultFloat(name);
|
||||
}
|
||||
|
@ -275,6 +284,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDefaultInt(String)
|
||||
*/
|
||||
@Override
|
||||
public int getDefaultInt(String name) {
|
||||
return fStore.getDefaultInt(name);
|
||||
}
|
||||
|
@ -282,6 +292,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDefaultLong(String)
|
||||
*/
|
||||
@Override
|
||||
public long getDefaultLong(String name) {
|
||||
return fStore.getDefaultLong(name);
|
||||
}
|
||||
|
@ -289,6 +300,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDefaultString(String)
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultString(String name) {
|
||||
return fStore.getDefaultString(name);
|
||||
}
|
||||
|
@ -296,6 +308,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getDouble(String)
|
||||
*/
|
||||
@Override
|
||||
public double getDouble(String name) {
|
||||
return fStore.getDouble(name);
|
||||
}
|
||||
|
@ -303,6 +316,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getFloat(String)
|
||||
*/
|
||||
@Override
|
||||
public float getFloat(String name) {
|
||||
return fStore.getFloat(name);
|
||||
}
|
||||
|
@ -310,6 +324,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getInt(String)
|
||||
*/
|
||||
@Override
|
||||
public int getInt(String name) {
|
||||
return fStore.getInt(name);
|
||||
}
|
||||
|
@ -317,6 +332,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getLong(String)
|
||||
*/
|
||||
@Override
|
||||
public long getLong(String name) {
|
||||
return fStore.getLong(name);
|
||||
}
|
||||
|
@ -324,6 +340,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#getString(String)
|
||||
*/
|
||||
@Override
|
||||
public String getString(String name) {
|
||||
return fStore.getString(name);
|
||||
}
|
||||
|
@ -331,6 +348,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#isDefault(String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isDefault(String name) {
|
||||
return fStore.isDefault(name);
|
||||
}
|
||||
|
@ -338,6 +356,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#needsSaving()
|
||||
*/
|
||||
@Override
|
||||
public boolean needsSaving() {
|
||||
return fStore.needsSaving();
|
||||
}
|
||||
|
@ -345,6 +364,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#putValue(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void putValue(String name, String value) {
|
||||
if (covers(name))
|
||||
fStore.putValue(name, value);
|
||||
|
@ -353,6 +373,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setDefault(String, double)
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(String name, double value) {
|
||||
if (covers(name))
|
||||
fStore.setDefault(name, value);
|
||||
|
@ -361,6 +382,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setDefault(String, float)
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(String name, float value) {
|
||||
if (covers(name))
|
||||
fStore.setDefault(name, value);
|
||||
|
@ -369,6 +391,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setDefault(String, int)
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(String name, int value) {
|
||||
if (covers(name))
|
||||
fStore.setDefault(name, value);
|
||||
|
@ -377,6 +400,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setDefault(String, long)
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(String name, long value) {
|
||||
if (covers(name))
|
||||
fStore.setDefault(name, value);
|
||||
|
@ -385,6 +409,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setDefault(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(String name, String value) {
|
||||
if (covers(name))
|
||||
fStore.setDefault(name, value);
|
||||
|
@ -393,6 +418,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setDefault(String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setDefault(String name, boolean value) {
|
||||
if (covers(name))
|
||||
fStore.setDefault(name, value);
|
||||
|
@ -401,6 +427,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setToDefault(String)
|
||||
*/
|
||||
@Override
|
||||
public void setToDefault(String name) {
|
||||
fStore.setToDefault(name);
|
||||
}
|
||||
|
@ -408,6 +435,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setValue(String, double)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(String name, double value) {
|
||||
if (covers(name))
|
||||
fStore.setValue(name, value);
|
||||
|
@ -416,6 +444,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setValue(String, float)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(String name, float value) {
|
||||
if (covers(name))
|
||||
fStore.setValue(name, value);
|
||||
|
@ -424,6 +453,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setValue(String, int)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(String name, int value) {
|
||||
if (covers(name))
|
||||
fStore.setValue(name, value);
|
||||
|
@ -432,6 +462,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setValue(String, long)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(String name, long value) {
|
||||
if (covers(name))
|
||||
fStore.setValue(name, value);
|
||||
|
@ -440,6 +471,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setValue(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(String name, String value) {
|
||||
if (covers(name))
|
||||
fStore.setValue(name, value);
|
||||
|
@ -448,6 +480,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
|
|||
/*
|
||||
* @see IPreferenceStore#setValue(String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(String name, boolean value) {
|
||||
if (covers(name))
|
||||
fStore.setValue(name, value);
|
||||
|
|
|
@ -47,6 +47,7 @@ public class StatusInfo implements IStatus {
|
|||
/**
|
||||
* Returns if the status' severity is OK.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOK() {
|
||||
return fSeverity == IStatus.OK;
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ public class StatusInfo implements IStatus {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IStatus#getMessage()
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return fStatusMessage;
|
||||
}
|
||||
|
@ -120,6 +122,7 @@ public class StatusInfo implements IStatus {
|
|||
/*
|
||||
* @see IStatus#matches(int)
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(int severityMask) {
|
||||
return (fSeverity & severityMask) != 0;
|
||||
}
|
||||
|
@ -128,6 +131,7 @@ public class StatusInfo implements IStatus {
|
|||
* Returns always <code>false</code>.
|
||||
* @see IStatus#isMultiStatus()
|
||||
*/
|
||||
@Override
|
||||
public boolean isMultiStatus() {
|
||||
return false;
|
||||
}
|
||||
|
@ -135,6 +139,7 @@ public class StatusInfo implements IStatus {
|
|||
/*
|
||||
* @see IStatus#getSeverity()
|
||||
*/
|
||||
@Override
|
||||
public int getSeverity() {
|
||||
return fSeverity;
|
||||
}
|
||||
|
@ -142,6 +147,7 @@ public class StatusInfo implements IStatus {
|
|||
/*
|
||||
* @see IStatus#getPlugin()
|
||||
*/
|
||||
@Override
|
||||
public String getPlugin() {
|
||||
return MakeUIPlugin.getPluginId();
|
||||
}
|
||||
|
@ -150,6 +156,7 @@ public class StatusInfo implements IStatus {
|
|||
* Returns always <code>null</code>.
|
||||
* @see IStatus#getException()
|
||||
*/
|
||||
@Override
|
||||
public Throwable getException() {
|
||||
return null;
|
||||
}
|
||||
|
@ -158,6 +165,7 @@ public class StatusInfo implements IStatus {
|
|||
* Returns always the error severity.
|
||||
* @see IStatus#getCode()
|
||||
*/
|
||||
@Override
|
||||
public int getCode() {
|
||||
return fSeverity;
|
||||
}
|
||||
|
@ -166,6 +174,7 @@ public class StatusInfo implements IStatus {
|
|||
* Returns always <code>null</code>.
|
||||
* @see IStatus#getChildren()
|
||||
*/
|
||||
@Override
|
||||
public IStatus[] getChildren() {
|
||||
return new IStatus[0];
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
|||
public void setContainer(IPreferencePageContainer preferencePageContainer) {
|
||||
super.setContainer(preferencePageContainer);
|
||||
fOptionBlock.setOptionContainer(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createContents(Composite parent) {
|
||||
Composite composite = new Composite(parent, SWT.NONE);
|
||||
|
@ -70,7 +70,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
|||
|
||||
private void contentForCProject(Composite parent) {
|
||||
fOptionBlock.createContents(parent);
|
||||
// WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
|
||||
// WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
|
||||
}
|
||||
|
||||
private void contentForClosedProject(Composite parent) {
|
||||
|
@ -84,6 +84,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
|||
@Override
|
||||
public boolean performOk() {
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) {
|
||||
fOptionBlock.performApply(monitor);
|
||||
}
|
||||
|
@ -101,6 +102,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject getProject() {
|
||||
Object element = getElement();
|
||||
if (element instanceof IProject) {
|
||||
|
@ -115,6 +117,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
|||
fOptionBlock.setVisible(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateContainer() {
|
||||
fOptionBlock.update();
|
||||
setValid(fOptionBlock.isValid());
|
||||
|
@ -133,6 +136,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
|||
return super.isValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Preferences getPreferences() {
|
||||
return MakeCorePlugin.getDefault().getPluginPreferences();
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.eclipse.swt.widgets.Display;
|
|||
|
||||
/**
|
||||
* Label provider for DiscoveredElement-s. DiscoveredElement can be active or removed.
|
||||
*
|
||||
*
|
||||
* @deprecated as of CDT 4.0. This class was used to set preferences/properties
|
||||
* for 3.X style projects.
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -45,7 +45,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
private ImageDescriptorRegistry fRegistry;
|
||||
|
||||
private final String DISABLED_LABEL = MakeUIPlugin.
|
||||
getResourceString("ManageScannerConfigDialogCommon.discoveredGroup.annotation.disabled");//$NON-NLS-1$
|
||||
getResourceString("ManageScannerConfigDialogCommon.discoveredGroup.annotation.disabled");//$NON-NLS-1$
|
||||
|
||||
public DiscoveredElementLabelProvider() {
|
||||
fRegistry = CUIPlugin.getImageDescriptorRegistry();
|
||||
|
@ -58,7 +58,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
fIncludeAndMacrosFileIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT_HEADER);
|
||||
fMacroIcon = fMacroGroupIcon;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
|
||||
*/
|
||||
|
@ -138,6 +138,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
if (element instanceof DiscoveredElement) {
|
||||
DiscoveredElement elem = (DiscoveredElement) element;
|
||||
|
@ -157,13 +158,14 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Color getBackground(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* ComositeImageDescriptor adds 'removed' image overlay to the DiscoveredElement
|
||||
*
|
||||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
private class DiscoveredElementImageDescriptor extends CompositeImageDescriptor {
|
||||
|
@ -199,7 +201,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
drawImage(data, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize()
|
||||
*/
|
||||
|
|
|
@ -36,10 +36,10 @@ public class ColorManager implements ISharedTextColors {
|
|||
public static final RGB MAKE_DEFAULT_RGB = new RGB(0, 0, 0);
|
||||
|
||||
private static ColorManager fgColorManager;
|
||||
|
||||
|
||||
private ColorManager() {
|
||||
}
|
||||
|
||||
|
||||
public static ColorManager getDefault() {
|
||||
if (fgColorManager == null) {
|
||||
fgColorManager= new ColorManager();
|
||||
|
@ -52,6 +52,7 @@ public class ColorManager implements ISharedTextColors {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.source.ISharedTextColors#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
Iterator<Color> e = fColorTable.values().iterator();
|
||||
while (e.hasNext())
|
||||
|
@ -61,6 +62,7 @@ public class ColorManager implements ISharedTextColors {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.source.ISharedTextColors#getColor(org.eclipse.swt.graphics.RGB)
|
||||
*/
|
||||
@Override
|
||||
public Color getColor(RGB rgb) {
|
||||
Color color = fColorTable.get(rgb);
|
||||
if (color == null) {
|
||||
|
|
|
@ -22,12 +22,13 @@ public class CompletionProposalComparator implements Comparator<ICompletionPropo
|
|||
*/
|
||||
public CompletionProposalComparator() {
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Comparator#compare(Object, Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(ICompletionProposal c1, ICompletionProposal c2) {
|
||||
return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,16 +26,18 @@ class MacroDefinitionRule implements IPredicateRule {
|
|||
private IToken token;
|
||||
private StringBuffer buffer = new StringBuffer();
|
||||
protected IToken defaultToken;
|
||||
|
||||
|
||||
public MacroDefinitionRule(IToken token, IToken defaultToken) {
|
||||
this.token = token;
|
||||
this.defaultToken = defaultToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getSuccessToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||
buffer.setLength(0);
|
||||
int state = INIT_STATE;
|
||||
|
@ -103,6 +105,7 @@ class MacroDefinitionRule implements IPredicateRule {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken evaluate(ICharacterScanner scanner) {
|
||||
return evaluate(scanner, false);
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@ import org.eclipse.ui.IEditorPart;
|
|||
|
||||
/**
|
||||
* MakefileAnnotationHover
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MakefileAnnotationHover implements IAnnotationHover {
|
||||
|
||||
private IEditorPart fEditor;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public MakefileAnnotationHover(IEditorPart editor) {
|
||||
fEditor = editor;
|
||||
|
@ -38,10 +38,11 @@ public class MakefileAnnotationHover implements IAnnotationHover {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
|
||||
IDocument document = sourceViewer.getDocument();
|
||||
try {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
|
|||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected List<IRule> createRules() {
|
||||
IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR);
|
||||
|
@ -67,6 +67,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
|
|||
|
||||
// Add generic whitespace rule.
|
||||
rules.add(new WhitespaceRule(new IWhitespaceDetector() {
|
||||
@Override
|
||||
public boolean isWhitespace(char character) {
|
||||
return Character.isWhitespace(character);
|
||||
}
|
||||
|
@ -82,9 +83,11 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
|
|||
// Add word rule for keywords, types, and constants.
|
||||
// We restrict the detection of the keywords to be the first column to be valid.
|
||||
WordRule keyWordRule = new WordRule(new IWordDetector() {
|
||||
@Override
|
||||
public boolean isWordPart(char c) {
|
||||
return Character.isLetterOrDigit(c) || c == '_';
|
||||
}
|
||||
@Override
|
||||
public boolean isWordStart(char c) {
|
||||
return Character.isLetterOrDigit(c) || c == '_' || c == '-';
|
||||
}}, other);
|
||||
|
@ -95,9 +98,11 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
|
|||
rules.add(keyWordRule);
|
||||
|
||||
WordRule functionRule = new WordRule(new IWordDetector() {
|
||||
@Override
|
||||
public boolean isWordPart(char c) {
|
||||
return Character.isLetterOrDigit(c) || c == '_';
|
||||
}
|
||||
@Override
|
||||
public boolean isWordStart(char c) {
|
||||
return Character.isLetterOrDigit(c) || c == '_';
|
||||
}}, other);
|
||||
|
|
|
@ -51,6 +51,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/*
|
||||
* @see IContextInformationValidator#isContextInformationValid(int)
|
||||
*/
|
||||
@Override
|
||||
public boolean isContextInformationValid(int offset) {
|
||||
return Math.abs(fInstallOffset - offset) < 5;
|
||||
}
|
||||
|
@ -58,6 +59,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/*
|
||||
* @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
|
||||
*/
|
||||
@Override
|
||||
public void install(IContextInformation info, ITextViewer viewer, int offset) {
|
||||
fInstallOffset = offset;
|
||||
}
|
||||
|
@ -65,6 +67,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/*
|
||||
* @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
|
||||
*/
|
||||
@Override
|
||||
public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
|
||||
return false;
|
||||
}
|
||||
|
@ -75,6 +78,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
String name1;
|
||||
String name2;
|
||||
|
@ -98,7 +102,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
//return String.CASE_INSENSITIVE_ORDER.compare(name1, name2);
|
||||
return name1.compareToIgnoreCase(name2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
protected IContextInformationValidator fValidator = new Validator();
|
||||
protected Image imageMacro = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO);
|
||||
|
@ -116,6 +120,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
|
||||
*/
|
||||
@Override
|
||||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
|
||||
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
|
||||
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
|
||||
|
@ -171,6 +176,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
|
||||
*/
|
||||
@Override
|
||||
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
|
||||
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
|
||||
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
|
||||
|
@ -215,6 +221,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
|
||||
*/
|
||||
@Override
|
||||
public char[] getCompletionProposalAutoActivationCharacters() {
|
||||
return null;
|
||||
}
|
||||
|
@ -222,6 +229,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
|
||||
*/
|
||||
@Override
|
||||
public char[] getContextInformationAutoActivationCharacters() {
|
||||
return null;
|
||||
}
|
||||
|
@ -229,6 +237,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
|
||||
*/
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
@ -236,6 +245,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
|
||||
*/
|
||||
@Override
|
||||
public IContextInformationValidator getContextInformationValidator() {
|
||||
return fValidator;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
|
|||
public class MakefileReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension {
|
||||
|
||||
|
||||
private ITextEditor fEditor;
|
||||
private ITextEditor fEditor;
|
||||
private IWorkingCopyManager fManager;
|
||||
private IDocumentProvider fDocumentProvider;
|
||||
private MakefileContentOutlinePage fOutliner;
|
||||
|
@ -50,17 +50,19 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see IReconcilingStrategy#setDocument(IDocument)
|
||||
*/
|
||||
@Override
|
||||
public void setDocument(IDocument document) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see IReconcilingStrategy#reconcile(IRegion)
|
||||
*/
|
||||
@Override
|
||||
public void reconcile(IRegion region) {
|
||||
reconcile();
|
||||
}
|
||||
|
@ -68,10 +70,11 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon
|
|||
/**
|
||||
* @see IReconcilingStrategy#reconcile(DirtyRegion, IRegion)
|
||||
*/
|
||||
@Override
|
||||
public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
|
||||
assert false : "This is a non-incremental reconciler"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
private void reconcile() {
|
||||
try {
|
||||
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
|
||||
|
@ -82,7 +85,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon
|
|||
makefile.parse(makefile.getFileURI(), reader);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
|
||||
fOutliner.update();
|
||||
}
|
||||
} finally {
|
||||
|
@ -99,6 +102,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon
|
|||
/*
|
||||
* @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public void setProgressMonitor(IProgressMonitor monitor) {
|
||||
// no use for a progress monitor at the moment
|
||||
}
|
||||
|
@ -106,8 +110,9 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon
|
|||
/*
|
||||
* @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile()
|
||||
*/
|
||||
@Override
|
||||
public void initialReconcile() {
|
||||
// no need to reconcile initially
|
||||
// reconcile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue