mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
This commit is contained in:
parent
35996a5c5c
commit
170e654b47
7984 changed files with 448190 additions and 465755 deletions
|
@ -39,7 +39,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
public class AutotoolsNewProjectNature implements IProjectNature {
|
public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
|
|
||||||
public static final String AUTOTOOLS_NATURE_ID = "org.eclipse.cdt.autotools.core.autotoolsNatureV2"; //$NON-NLS-1$
|
public static final String AUTOTOOLS_NATURE_ID = "org.eclipse.cdt.autotools.core.autotoolsNatureV2"; //$NON-NLS-1$
|
||||||
public static final String OLD_AUTOTOOLS_NATURE_ID = "org.eclipse.linuxtools.cdt.autotools.core.autotoolsNatureV2"; //$NON-NLS-1$
|
public static final String OLD_AUTOTOOLS_NATURE_ID = "org.eclipse.linuxtools.cdt.autotools.core.autotoolsNatureV2"; //$NON-NLS-1$
|
||||||
public static final String BUILDER_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".genmakebuilder"; //$NON-NLS-1$
|
public static final String BUILDER_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".genmakebuilder"; //$NON-NLS-1$
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +49,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
public static final String OLD_AUTOTOOLS_BUILDER_ID = "org.eclipse.linuxtools.cdt.autotools.genmakebuilder"; //$NON-NLS-1$
|
public static final String OLD_AUTOTOOLS_BUILDER_ID = "org.eclipse.linuxtools.cdt.autotools.genmakebuilder"; //$NON-NLS-1$
|
||||||
|
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure() throws CoreException {
|
public void configure() throws CoreException {
|
||||||
addAutotoolsBuilder(project, new NullProgressMonitor());
|
addAutotoolsBuilder(project, new NullProgressMonitor());
|
||||||
|
@ -59,17 +59,17 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
public void deconfigure() throws CoreException {
|
public void deconfigure() throws CoreException {
|
||||||
// TODO remove builder from here
|
// TODO remove builder from here
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProject(IProject project) {
|
public void setProject(IProject project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the Autotools builder to the project
|
* Add the Autotools builder to the project
|
||||||
* @param project
|
* @param project
|
||||||
|
@ -80,7 +80,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
// Add the builder to the project
|
// Add the builder to the project
|
||||||
IProjectDescription description = project.getDescription();
|
IProjectDescription description = project.getDescription();
|
||||||
ICommand[] commands = description.getBuildSpec();
|
ICommand[] commands = description.getBuildSpec();
|
||||||
if(checkEquals(commands,getBuildCommandsList(description, commands))){
|
if (checkEquals(commands, getBuildCommandsList(description, commands))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
@ -101,21 +101,21 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
//Other pieces of wizard might have contributed new builder commands;
|
//Other pieces of wizard might have contributed new builder commands;
|
||||||
//need to make sure we are using the most recent ones
|
//need to make sure we are using the most recent ones
|
||||||
ICommand[] currentCommands = prDescription.getBuildSpec();
|
ICommand[] currentCommands = prDescription.getBuildSpec();
|
||||||
ICommand[] newCommands = getBuildCommandsList(prDescription, currentCommands);
|
ICommand[] newCommands = getBuildCommandsList(prDescription, currentCommands);
|
||||||
if(!checkEquals(currentCommands,newCommands)){
|
if (!checkEquals(currentCommands, newCommands)) {
|
||||||
prDescription.setBuildSpec(newCommands);
|
prDescription.setBuildSpec(newCommands);
|
||||||
proj.setDescription(prDescription, new NullProgressMonitor());
|
proj.setDescription(prDescription, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
restoreAutoBuild(workspace);
|
restoreAutoBuild(workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
|
protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
|
||||||
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
||||||
savedAutoBuildingValue = workspaceDesc.isAutoBuilding();
|
savedAutoBuildingValue = workspaceDesc.isAutoBuilding();
|
||||||
workspaceDesc.setAutoBuilding(false);
|
workspaceDesc.setAutoBuilding(false);
|
||||||
workspace.setDescription(workspaceDesc);
|
workspace.setDescription(workspaceDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException {
|
protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException {
|
||||||
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
||||||
workspaceDesc.setAutoBuilding(savedAutoBuildingValue);
|
workspaceDesc.setAutoBuilding(savedAutoBuildingValue);
|
||||||
|
@ -134,21 +134,19 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
backgroundJob.schedule();
|
backgroundJob.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean checkEquals(ICommand[] commands,
|
static boolean checkEquals(ICommand[] commands, ICommand[] newCommands) {
|
||||||
ICommand[] newCommands) {
|
if (newCommands.length != commands.length) {
|
||||||
if (newCommands.length != commands.length){
|
return false;
|
||||||
|
}
|
||||||
|
for (int j = 0; j < commands.length; ++j) {
|
||||||
|
if (!commands[j].getBuilderName().equals(newCommands[j].getBuilderName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < commands.length; ++j) {
|
}
|
||||||
if (!commands[j].getBuilderName().equals(newCommands[j].getBuilderName())) {
|
return true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ICommand[] getBuildCommandsList(IProjectDescription description,
|
static ICommand[] getBuildCommandsList(IProjectDescription description, ICommand[] commands) {
|
||||||
ICommand[] commands) {
|
|
||||||
ArrayList<ICommand> commandList = new ArrayList<>();
|
ArrayList<ICommand> commandList = new ArrayList<>();
|
||||||
|
|
||||||
// Make sure the Autotools Configuration builder just precedes the Common Builder
|
// Make sure the Autotools Configuration builder just precedes the Common Builder
|
||||||
|
@ -164,8 +162,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
}
|
}
|
||||||
// Make sure that the Autotools builder precedes the Managed builder
|
// Make sure that the Autotools builder precedes the Managed builder
|
||||||
// or the Remote Synchronized builder.
|
// or the Remote Synchronized builder.
|
||||||
if (command.getBuilderName().equals(BUILDER_ID) ||
|
if (command.getBuilderName().equals(BUILDER_ID) || command.getBuilderName().equals(REMOTE_BUILDER_ID)) {
|
||||||
command.getBuilderName().equals(REMOTE_BUILDER_ID)) {
|
|
||||||
// add Autotools Configuration builder just before builder
|
// add Autotools Configuration builder just before builder
|
||||||
ICommand newCommand = description.newCommand();
|
ICommand newCommand = description.newCommand();
|
||||||
newCommand.setBuilderName(AutotoolsConfigurationBuilder.BUILDER_ID);
|
newCommand.setBuilderName(AutotoolsConfigurationBuilder.BUILDER_ID);
|
||||||
|
@ -179,7 +176,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for adding an autotools nature to a project.
|
* Utility method for adding an autotools nature to a project.
|
||||||
*
|
*
|
||||||
* @param proj the project to add the autotools nature to.
|
* @param proj the project to add the autotools nature to.
|
||||||
* @param monitor a progress monitor to indicate the duration of the operation, or
|
* @param monitor a progress monitor to indicate the duration of the operation, or
|
||||||
* <code>null</code> if progress reporting is not required.
|
* <code>null</code> if progress reporting is not required.
|
||||||
|
@ -190,7 +187,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for adding a nature to a project.
|
* Utility method for adding a nature to a project.
|
||||||
*
|
*
|
||||||
* @param proj the project to add the nature to.
|
* @param proj the project to add the nature to.
|
||||||
* @param natureId the id of the nature to assign to the project
|
* @param natureId the id of the nature to assign to the project
|
||||||
* @param monitor a progress monitor to indicate the duration of the operation, or
|
* @param monitor a progress monitor to indicate the duration of the operation, or
|
||||||
|
@ -209,13 +206,13 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
description.setNatureIds(newNatures);
|
description.setNatureIds(newNatures);
|
||||||
project.setDescription(description, monitor);
|
project.setDescription(description, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to remove the autotools nature from a project.
|
* Utility method to remove the autotools nature from a project.
|
||||||
*
|
*
|
||||||
* @param project to remove the autotools nature from
|
* @param project to remove the autotools nature from
|
||||||
* @param mon progress monitor to indicate the duration of the operation, or
|
* @param mon progress monitor to indicate the duration of the operation, or
|
||||||
* <code>null</code> if progress reporting is not required.
|
* <code>null</code> if progress reporting is not required.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static void removeAutotoolsNature(IProject project, IProgressMonitor mon) throws CoreException {
|
public static void removeAutotoolsNature(IProject project, IProgressMonitor mon) throws CoreException {
|
||||||
|
@ -224,10 +221,10 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to remove the old autotools nature from a project.
|
* Utility method to remove the old autotools nature from a project.
|
||||||
*
|
*
|
||||||
* @param project to remove the old autotools nature from
|
* @param project to remove the old autotools nature from
|
||||||
* @param mon progress monitor to indicate the duration of the operation, or
|
* @param mon progress monitor to indicate the duration of the operation, or
|
||||||
* <code>null</code> if progress reporting is not required.
|
* <code>null</code> if progress reporting is not required.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static void removeOldAutotoolsNature(IProject project, IProgressMonitor mon) throws CoreException {
|
public static void removeOldAutotoolsNature(IProject project, IProgressMonitor mon) throws CoreException {
|
||||||
|
@ -236,7 +233,7 @@ public class AutotoolsNewProjectNature implements IProjectNature {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for removing a project nature from a project.
|
* Utility method for removing a project nature from a project.
|
||||||
*
|
*
|
||||||
* @param proj the project to remove the nature from
|
* @param proj the project to remove the nature from
|
||||||
* @param natureId the nature id to remove
|
* @param natureId the nature id to remove
|
||||||
* @param monitor a progress monitor to indicate the duration of the operation, or
|
* @param monitor a progress monitor to indicate the duration of the operation, or
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
//The shared instance.
|
//The shared instance.
|
||||||
private static AutotoolsPlugin plugin;
|
private static AutotoolsPlugin plugin;
|
||||||
private ResourceBundle resourceBundle;
|
private ResourceBundle resourceBundle;
|
||||||
|
|
||||||
public static final String PLUGIN_ID = "org.eclipse.cdt.autotools.core"; //$NON-NLS-1$
|
public static final String PLUGIN_ID = "org.eclipse.cdt.autotools.core"; //$NON-NLS-1$
|
||||||
public static final String AUTOTOOLS_PROJECT_TYPE_ID = "org.eclipse.linuxtools.cdt.autotools.core.projectType"; //$NON-NLS-1$
|
public static final String AUTOTOOLS_PROJECT_TYPE_ID = "org.eclipse.linuxtools.cdt.autotools.core.projectType"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
public static String getPluginId() {
|
public static String getPluginId() {
|
||||||
return PLUGIN_ID;
|
return PLUGIN_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUniqueIdentifier() {
|
public static String getUniqueIdentifier() {
|
||||||
if (getDefault() == null) {
|
if (getDefault() == null) {
|
||||||
// If the default instance is not yet initialized,
|
// If the default instance is not yet initialized,
|
||||||
|
@ -94,7 +94,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OSGi service with the given service interface.
|
* Return the OSGi service with the given service interface.
|
||||||
*
|
*
|
||||||
* @param service service interface
|
* @param service service interface
|
||||||
* @return the specified service or null if it's not registered
|
* @return the specified service or null if it's not registered
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
|
@ -108,7 +108,7 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* Returns the string from the plugin's resource bundle,
|
* Returns the string from the plugin's resource bundle,
|
||||||
* or 'key' if not found.
|
* or 'key' if not found.
|
||||||
*
|
*
|
||||||
* @param key the message key
|
* @param key the message key
|
||||||
* @return the resource bundle message
|
* @return the resource bundle message
|
||||||
*/
|
*/
|
||||||
|
@ -124,13 +124,13 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* Returns the string from the plugin's resource bundle,
|
* Returns the string from the plugin's resource bundle,
|
||||||
* or 'key' if not found.
|
* or 'key' if not found.
|
||||||
*
|
*
|
||||||
* @param key the message key
|
* @param key the message key
|
||||||
* @param args an array of substituition strings
|
* @param args an array of substituition strings
|
||||||
* @return the resource bundle message
|
* @return the resource bundle message
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
return MessageFormat.format(getResourceString(key), (Object[])args);
|
return MessageFormat.format(getResourceString(key), (Object[]) args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,15 +187,14 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return set of Autotool configuration options for a given build configuration id.
|
* Return set of Autotool configuration options for a given build configuration id.
|
||||||
*
|
*
|
||||||
* @param project existing autotools project
|
* @param project existing autotools project
|
||||||
* @param cfgId configuration id
|
* @param cfgId configuration id
|
||||||
* @return a copy of Autotools configurations for the given configuration id
|
* @return a copy of Autotools configurations for the given configuration id
|
||||||
* @throws CoreException if project is not valid Autotools project or cfgId does not exist
|
* @throws CoreException if project is not valid Autotools project or cfgId does not exist
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public Map<String, IAutotoolsOption> getAutotoolCfgOptions(IProject project,
|
public Map<String, IAutotoolsOption> getAutotoolCfgOptions(IProject project, String cfgId) throws CoreException {
|
||||||
String cfgId) throws CoreException {
|
|
||||||
return AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(project, cfgId);
|
return AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(project, cfgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,11 +205,11 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
||||||
* @param cfgId configuation id
|
* @param cfgId configuation id
|
||||||
* @param options set of updated Autotool configuration options
|
* @param options set of updated Autotool configuration options
|
||||||
* @throws CoreException if project is not valid Autotools project or cfgId does not exist
|
* @throws CoreException if project is not valid Autotools project or cfgId does not exist
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public void updateAutotoolCfgOptions(IProject project, String cfgId,
|
public void updateAutotoolCfgOptions(IProject project, String cfgId, Map<String, IAutotoolsOption> options)
|
||||||
Map<String,IAutotoolsOption> options) throws CoreException {
|
throws CoreException {
|
||||||
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(project, cfgId, options);
|
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(project, cfgId, options);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.autotools.core;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -43,24 +43,23 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
|
||||||
public static final String BUILDER_ID = AutotoolsPlugin.getPluginId() + "." + BUILDER_NAME; //$NON-NLS-1$
|
public static final String BUILDER_ID = AutotoolsPlugin.getPluginId() + "." + BUILDER_NAME; //$NON-NLS-1$
|
||||||
public static final String OLD_BUILDER_ID = "org.eclipse.linuxtools.cdt.autotools.core.genmakebuilderV2"; //$NON-NLS-1$
|
public static final String OLD_BUILDER_ID = "org.eclipse.linuxtools.cdt.autotools.core.genmakebuilderV2"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String BUILD_STOPPED="AutotoolsMakefileBuilder.message.stopped"; //$NON-NLS-1$
|
private static final String BUILD_STOPPED = "AutotoolsMakefileBuilder.message.stopped"; //$NON-NLS-1$
|
||||||
private AutotoolsNewMakeGenerator generator;
|
private AutotoolsNewMakeGenerator generator;
|
||||||
|
|
||||||
public AutotoolsConfigurationBuilder() {
|
public AutotoolsConfigurationBuilder() {
|
||||||
super();
|
super();
|
||||||
generator = new AutotoolsNewMakeGenerator();
|
generator = new AutotoolsNewMakeGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isCdtProjectCreated(IProject project){
|
protected boolean isCdtProjectCreated(IProject project) {
|
||||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false);
|
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
return des != null && !des.isCdtProjectCreating();
|
return des != null && !des.isCdtProjectCreating();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor)
|
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
if(!isCdtProjectCreated(project))
|
if (!isCdtProjectCreated(project))
|
||||||
return project.getReferencedProjects();
|
return project.getReferencedProjects();
|
||||||
|
|
||||||
boolean bPerformBuild = true;
|
boolean bPerformBuild = true;
|
||||||
|
@ -110,7 +109,7 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
|
||||||
checkCancel(monitor);
|
checkCancel(monitor);
|
||||||
return getProject().getReferencedProjects();
|
return getProject().getReferencedProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void clean(IProgressMonitor monitor) {
|
protected void clean(IProgressMonitor monitor) {
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
|
@ -118,15 +117,17 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
|
||||||
if (shouldBuild(CLEAN_BUILD, info)) {
|
if (shouldBuild(CLEAN_BUILD, info)) {
|
||||||
IConfiguration icfg = info.getDefaultConfiguration();
|
IConfiguration icfg = info.getDefaultConfiguration();
|
||||||
if (icfg instanceof IMultiConfiguration) {
|
if (icfg instanceof IMultiConfiguration) {
|
||||||
IMultiConfiguration mcfg = (IMultiConfiguration)icfg;
|
IMultiConfiguration mcfg = (IMultiConfiguration) icfg;
|
||||||
IConfiguration[] cfgs = (IConfiguration[])mcfg.getItems();
|
IConfiguration[] cfgs = (IConfiguration[]) mcfg.getItems();
|
||||||
for (int i = 0; i < cfgs.length; ++i) {
|
for (int i = 0; i < cfgs.length; ++i) {
|
||||||
IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, icfg.getName());
|
IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project,
|
||||||
|
icfg.getName());
|
||||||
cfg.setDirty(true);
|
cfg.setDirty(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, icfg.getName());
|
IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project,
|
||||||
cfg.setDirty(true); // Mark Configuration dirty so next build will do full reconfigure
|
icfg.getName());
|
||||||
|
cfg.setDirty(true); // Mark Configuration dirty so next build will do full reconfigure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,16 +135,15 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
|
||||||
protected MultiStatus performMakefileGeneration(IProject project, IManagedBuildInfo info,
|
protected MultiStatus performMakefileGeneration(IProject project, IManagedBuildInfo info,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
MultiStatus result;
|
MultiStatus result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
generator.initialize(project, info, monitor);
|
generator.initialize(project, info, monitor);
|
||||||
result = generator.regenerateMakefiles(false);
|
result = generator.regenerateMakefiles(false);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
String errMsg = AutotoolsPlugin.getResourceString("MakeGenerator.didnt.generate"); //$NON-NLS-1$
|
String errMsg = AutotoolsPlugin.getResourceString("MakeGenerator.didnt.generate"); //$NON-NLS-1$
|
||||||
result = new MultiStatus(AutotoolsPlugin.getUniqueIdentifier(), IStatus.ERROR,
|
result = new MultiStatus(AutotoolsPlugin.getUniqueIdentifier(), IStatus.ERROR, errMsg, e);
|
||||||
errMsg, e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,18 +160,17 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
|
||||||
IBuilder builder = null;
|
IBuilder builder = null;
|
||||||
if (cfg != null) {
|
if (cfg != null) {
|
||||||
builder = cfg.getEditableBuilder();
|
builder = cfg.getEditableBuilder();
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case IncrementalProjectBuilder.AUTO_BUILD :
|
case IncrementalProjectBuilder.AUTO_BUILD:
|
||||||
return builder.isAutoBuildEnable();
|
return builder.isAutoBuildEnable();
|
||||||
case IncrementalProjectBuilder.INCREMENTAL_BUILD : // now treated as the same!
|
case IncrementalProjectBuilder.INCREMENTAL_BUILD: // now treated as the same!
|
||||||
case IncrementalProjectBuilder.FULL_BUILD :
|
case IncrementalProjectBuilder.FULL_BUILD:
|
||||||
return builder.isFullBuildEnabled() | builder.isIncrementalBuildEnabled() ;
|
return builder.isFullBuildEnabled() | builder.isIncrementalBuildEnabled();
|
||||||
case IncrementalProjectBuilder.CLEAN_BUILD :
|
case IncrementalProjectBuilder.CLEAN_BUILD:
|
||||||
return builder.isCleanBuildEnabled();
|
return builder.isCleanBuildEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,14 @@ public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvir
|
||||||
|
|
||||||
private static boolean isVar(String name) {
|
private static boolean isVar(String name) {
|
||||||
// Windows has case insensitive env var names
|
// Windows has case insensitive env var names
|
||||||
return Platform.getOS().equals(Platform.OS_WIN32) ? name.equalsIgnoreCase(VerboseEnvironmentVariable.VERBOSE_VAR_NAME)
|
return Platform.getOS().equals(Platform.OS_WIN32)
|
||||||
|
? name.equalsIgnoreCase(VerboseEnvironmentVariable.VERBOSE_VAR_NAME)
|
||||||
: name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME);
|
: name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBuildEnvironmentVariable create() {
|
private static IBuildEnvironmentVariable create() {
|
||||||
return new VerboseEnvironmentVariable(VERBOSE_VAR_NAME, VERBOSE_VAR_VALUE, IEnvironmentVariable.ENVVAR_PREPEND, null);
|
return new VerboseEnvironmentVariable(VERBOSE_VAR_NAME, VERBOSE_VAR_VALUE,
|
||||||
|
IEnvironmentVariable.ENVVAR_PREPEND, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,16 +24,12 @@ import org.eclipse.core.runtime.IPath;
|
||||||
*/
|
*/
|
||||||
public class AutotoolsProblemMarkerInfo {
|
public class AutotoolsProblemMarkerInfo {
|
||||||
|
|
||||||
public static enum Type{
|
public static enum Type {
|
||||||
PACKAGE,
|
PACKAGE, HEADER, PROG,
|
||||||
HEADER,
|
|
||||||
PROG,
|
|
||||||
/**
|
/**
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
LIB,
|
LIB, FILE, GENERIC
|
||||||
FILE,
|
|
||||||
GENERIC
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProblemMarkerInfo marker;
|
private ProblemMarkerInfo marker;
|
||||||
|
@ -42,18 +38,19 @@ public class AutotoolsProblemMarkerInfo {
|
||||||
this(file, -1, description, severity, null, null, name, type);
|
this(file, -1, description, severity, null, null, name, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutotoolsProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName, Type type) {
|
public AutotoolsProblemMarkerInfo(IResource file, int lineNumber, String description, int severity,
|
||||||
|
String variableName, Type type) {
|
||||||
this(file, lineNumber, description, severity, variableName, null, null, type);
|
this(file, lineNumber, description, severity, variableName, null, null, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutotoolsProblemMarkerInfo(IResource file, int lineNumber, String description, int severity, String variableName,
|
public AutotoolsProblemMarkerInfo(IResource file, int lineNumber, String description, int severity,
|
||||||
IPath externalPath, String libraryInfo, Type type) {
|
String variableName, IPath externalPath, String libraryInfo, Type type) {
|
||||||
this.marker = new ProblemMarkerInfo(file, lineNumber, description, severity, variableName, externalPath);
|
this.marker = new ProblemMarkerInfo(file, lineNumber, description, severity, variableName, externalPath);
|
||||||
|
|
||||||
marker.setAttribute(IAutotoolsMarker.MARKER_PROBLEM_TYPE, type.name());
|
marker.setAttribute(IAutotoolsMarker.MARKER_PROBLEM_TYPE, type.name());
|
||||||
marker.setAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, libraryInfo);
|
marker.setAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, libraryInfo);
|
||||||
|
|
||||||
marker.setType (IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER);
|
marker.setType(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProblemMarkerInfo getMarker() {
|
public ProblemMarkerInfo getMarker() {
|
||||||
|
@ -64,7 +61,7 @@ public class AutotoolsProblemMarkerInfo {
|
||||||
return marker.getAttribute(IAutotoolsMarker.MARKER_PROBLEM_TYPE);
|
return marker.getAttribute(IAutotoolsMarker.MARKER_PROBLEM_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLibraryInfo(){
|
public String getLibraryInfo() {
|
||||||
return marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO);
|
return marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,24 +16,25 @@ package org.eclipse.cdt.internal.autotools.core;
|
||||||
import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
|
import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
|
||||||
|
|
||||||
public class AutotoolsPropertyConstants {
|
public class AutotoolsPropertyConstants {
|
||||||
|
|
||||||
static final String PREFIX = AutotoolsPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
|
static final String PREFIX = AutotoolsPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
|
||||||
static final String PREFIX_COMPAT = "org.eclipse.linuxtools.cdt.autotools."; //$NON-NLS-1$
|
static final String PREFIX_COMPAT = "org.eclipse.linuxtools.cdt.autotools."; //$NON-NLS-1$
|
||||||
public static final String AUTOMAKE_VERSION_STRING = "AutoconfEditorAutomakeVersion"; //$NON-NLS-1$
|
public static final String AUTOMAKE_VERSION_STRING = "AutoconfEditorAutomakeVersion"; //$NON-NLS-1$
|
||||||
public static final QualifiedName AUTOMAKE_VERSION = new QualifiedName(PREFIX, AUTOMAKE_VERSION_STRING);
|
public static final QualifiedName AUTOMAKE_VERSION = new QualifiedName(PREFIX, AUTOMAKE_VERSION_STRING);
|
||||||
public static final QualifiedName AUTOMAKE_VERSION_COMPAT = new QualifiedName(PREFIX_COMPAT, AUTOMAKE_VERSION_STRING);
|
public static final QualifiedName AUTOMAKE_VERSION_COMPAT = new QualifiedName(PREFIX_COMPAT,
|
||||||
|
AUTOMAKE_VERSION_STRING);
|
||||||
public static final String AUTOCONF_VERSION_STRING = "AutoconfEditorAutoconfVersion"; //$NON-NLS-1$
|
public static final String AUTOCONF_VERSION_STRING = "AutoconfEditorAutoconfVersion"; //$NON-NLS-1$
|
||||||
public static final QualifiedName AUTOCONF_VERSION = new QualifiedName(PREFIX, AUTOCONF_VERSION_STRING);
|
public static final QualifiedName AUTOCONF_VERSION = new QualifiedName(PREFIX, AUTOCONF_VERSION_STRING);
|
||||||
public static final QualifiedName AUTOCONF_VERSION_COMPAT = new QualifiedName(PREFIX_COMPAT, AUTOCONF_VERSION_STRING);
|
public static final QualifiedName AUTOCONF_VERSION_COMPAT = new QualifiedName(PREFIX_COMPAT,
|
||||||
|
AUTOCONF_VERSION_STRING);
|
||||||
public static final String AUTOCONF_MACRO_VERSIONING = "AutoconfEditorMacroVersioning"; //$NON-NLS-1$
|
public static final String AUTOCONF_MACRO_VERSIONING = "AutoconfEditorMacroVersioning"; //$NON-NLS-1$
|
||||||
public static final QualifiedName AUTOCONF_TOOL = new QualifiedName(PREFIX, "AutoconfToolPath"); //$NON-NLS-1$
|
public static final QualifiedName AUTOCONF_TOOL = new QualifiedName(PREFIX, "AutoconfToolPath"); //$NON-NLS-1$
|
||||||
public static final QualifiedName AUTOMAKE_TOOL = new QualifiedName(PREFIX, "AutomakeToolPath"); //$NON-NLS-1$
|
public static final QualifiedName AUTOMAKE_TOOL = new QualifiedName(PREFIX, "AutomakeToolPath"); //$NON-NLS-1$
|
||||||
public static final QualifiedName ACLOCAL_TOOL = new QualifiedName(PREFIX, "AclocalToolPath"); //$NON-NLS-1$
|
public static final QualifiedName ACLOCAL_TOOL = new QualifiedName(PREFIX, "AclocalToolPath"); //$NON-NLS-1$
|
||||||
public static final QualifiedName AUTOHEADER_TOOL = new QualifiedName(PREFIX, "AutoheaderToolPath"); //$NON-NLS-1$
|
public static final QualifiedName AUTOHEADER_TOOL = new QualifiedName(PREFIX, "AutoheaderToolPath"); //$NON-NLS-1$
|
||||||
public static final QualifiedName AUTORECONF_TOOL = new QualifiedName(PREFIX, "AutoreconfToolPath"); //$NON-NLS-1$
|
public static final QualifiedName AUTORECONF_TOOL = new QualifiedName(PREFIX, "AutoreconfToolPath"); //$NON-NLS-1$
|
||||||
public static final QualifiedName LIBTOOLIZE_TOOL = new QualifiedName(PREFIX, "LibtoolizePath"); //$NON-NLS-1$
|
public static final QualifiedName LIBTOOLIZE_TOOL = new QualifiedName(PREFIX, "LibtoolizePath"); //$NON-NLS-1$
|
||||||
public static final QualifiedName CLEAN_DELETE = new QualifiedName(PREFIX, "CleanDelete"); //$NON-NLS-1$
|
public static final QualifiedName CLEAN_DELETE = new QualifiedName(PREFIX, "CleanDelete"); //$NON-NLS-1$
|
||||||
public static final QualifiedName CLEAN_MAKE_TARGET = new QualifiedName(PREFIX, "CleanMakeTarget"); //$NON-NLS-1$
|
public static final QualifiedName CLEAN_MAKE_TARGET = new QualifiedName(PREFIX, "CleanMakeTarget"); //$NON-NLS-1$
|
||||||
public static final QualifiedName SCANNER_USE_MAKE_W = new QualifiedName(PREFIX, "ScannerUseMakeW");
|
public static final QualifiedName SCANNER_USE_MAKE_W = new QualifiedName(PREFIX, "ScannerUseMakeW");
|
||||||
|
@ -41,7 +42,7 @@ public class AutotoolsPropertyConstants {
|
||||||
public static final QualifiedName OPEN_INCLUDE = new QualifiedName(PREFIX, "IncludeResourceMapping"); //$NON-NLS-1$
|
public static final QualifiedName OPEN_INCLUDE = new QualifiedName(PREFIX, "IncludeResourceMapping"); //$NON-NLS-1$
|
||||||
public static final QualifiedName OPEN_INCLUDE_P = new QualifiedName(PREFIX, "PersistentIncludeResourceMapping"); //$NON-NLS-1$
|
public static final QualifiedName OPEN_INCLUDE_P = new QualifiedName(PREFIX, "PersistentIncludeResourceMapping"); //$NON-NLS-1$
|
||||||
public static final QualifiedName SCANNER_INFO_DIRTY = new QualifiedName(PREFIX, "ScannerInfoDirty"); // $NON-NLSp-1$
|
public static final QualifiedName SCANNER_INFO_DIRTY = new QualifiedName(PREFIX, "ScannerInfoDirty"); // $NON-NLSp-1$
|
||||||
|
|
||||||
public static final String[] fACVersions = { "2.13", "2.59", "2.61", "2.67", "2.68" }; //$NON-NLS-1$
|
public static final String[] fACVersions = { "2.13", "2.59", "2.61", "2.67", "2.68" }; //$NON-NLS-1$
|
||||||
public static final String AC_VERSION_2_13 = fACVersions[0];
|
public static final String AC_VERSION_2_13 = fACVersions[0];
|
||||||
public static final String AC_VERSION_2_59 = fACVersions[1];
|
public static final String AC_VERSION_2_59 = fACVersions[1];
|
||||||
|
@ -49,12 +50,12 @@ public class AutotoolsPropertyConstants {
|
||||||
public static final String AC_VERSION_2_67 = fACVersions[3];
|
public static final String AC_VERSION_2_67 = fACVersions[3];
|
||||||
public static final String AC_VERSION_2_68 = fACVersions[4];
|
public static final String AC_VERSION_2_68 = fACVersions[4];
|
||||||
public static final String LATEST_AC_VERSION = fACVersions[fACVersions.length - 1];
|
public static final String LATEST_AC_VERSION = fACVersions[fACVersions.length - 1];
|
||||||
|
|
||||||
public static final String[] fAMVersions = {"1.4-p6", "1.9.5", "1.9.6", "1.11.1"}; //$NON-NLS-1$
|
public static final String[] fAMVersions = { "1.4-p6", "1.9.5", "1.9.6", "1.11.1" }; //$NON-NLS-1$
|
||||||
public static final String LATEST_AM_VERSION = fAMVersions[fAMVersions.length - 1];
|
public static final String LATEST_AM_VERSION = fAMVersions[fAMVersions.length - 1];
|
||||||
|
|
||||||
public static final String CLEAN_MAKE_TARGET_DEFAULT = "distclean"; //$NON-NLS-1$
|
public static final String CLEAN_MAKE_TARGET_DEFAULT = "distclean"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String TRUE = "true"; //$NON-NLS-1$
|
public static final String TRUE = "true"; //$NON-NLS-1$
|
||||||
public static final String FALSE = "false"; //$NON-NLS-1$
|
public static final String FALSE = "false"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,43 +36,39 @@ import org.eclipse.core.runtime.Path;
|
||||||
// which is similar to the CDT one.
|
// which is similar to the CDT one.
|
||||||
public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
public static final String ID = AutotoolsPlugin.PLUGIN_ID + ".errorParser"; //$NON-NLS-1$
|
public static final String ID = AutotoolsPlugin.PLUGIN_ID + ".errorParser"; //$NON-NLS-1$
|
||||||
private Pattern pkgconfigError =
|
private Pattern pkgconfigError = Pattern
|
||||||
Pattern.compile(".*?(configure:\\s+error:\\s+Package requirements\\s+\\((.*?)\\)\\s+were not met).*"); //$NON-NLS-1$
|
.compile(".*?(configure:\\s+error:\\s+Package requirements\\s+\\((.*?)\\)\\s+were not met).*"); //$NON-NLS-1$
|
||||||
private Pattern genconfigError =
|
private Pattern genconfigError = Pattern.compile(".*?configure:\\s+error:\\s+(.*)"); //$NON-NLS-1$
|
||||||
Pattern.compile(".*?configure:\\s+error:\\s+(.*)"); //$NON-NLS-1$
|
private Pattern checkingFail = Pattern.compile("checking for (.*)\\.\\.\\. no"); //$NON-NLS-1$
|
||||||
private Pattern checkingFail =
|
|
||||||
Pattern.compile("checking for (.*)\\.\\.\\. no"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
private Pattern changingConfigDirectory =
|
private Pattern changingConfigDirectory = Pattern.compile("Configuring in (.*)"); //$NON-NLS-1$
|
||||||
Pattern.compile("Configuring in (.*)"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
private IPath buildDir;
|
private IPath buildDir;
|
||||||
private IPath sourcePath;
|
private IPath sourcePath;
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
public ErrorParser(){
|
public ErrorParser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ErrorParser(IPath sourcePath, IPath buildPath) {
|
public ErrorParser(IPath sourcePath, IPath buildPath) {
|
||||||
this.buildDir = buildPath;
|
this.buildDir = buildPath;
|
||||||
this.sourcePath = sourcePath;
|
this.sourcePath = sourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processLine(String line,
|
public boolean processLine(String line, org.eclipse.cdt.core.ErrorParserManager eoParser) {
|
||||||
org.eclipse.cdt.core.ErrorParserManager eoParser) {
|
|
||||||
|
|
||||||
if (this.project == null)
|
if (this.project == null)
|
||||||
this.project = eoParser.getProject();
|
this.project = eoParser.getProject();
|
||||||
|
|
||||||
if (this.buildDir == null)
|
if (this.buildDir == null)
|
||||||
this.buildDir = new Path(eoParser.getWorkingDirectoryURI().getPath());
|
this.buildDir = new Path(eoParser.getWorkingDirectoryURI().getPath());
|
||||||
|
|
||||||
if (this.sourcePath == null)
|
if (this.sourcePath == null)
|
||||||
this.sourcePath = eoParser.getProject().getLocation();
|
this.sourcePath = eoParser.getProject().getLocation();
|
||||||
|
|
||||||
AutotoolsProblemMarkerInfo marker = processLine(line);
|
AutotoolsProblemMarkerInfo marker = processLine(line);
|
||||||
if ( marker != null){
|
if (marker != null) {
|
||||||
// Check to see if addProblemMarker exists.
|
// Check to see if addProblemMarker exists.
|
||||||
try {
|
try {
|
||||||
Method method = eoParser.getClass().getMethod("addProblemMarker", ProblemMarkerInfo.class);
|
Method method = eoParser.getClass().getMethod("addProblemMarker", ProblemMarkerInfo.class);
|
||||||
|
@ -92,9 +88,9 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
public boolean processLine(String line, ErrorParserManager eoParser) {
|
public boolean processLine(String line, ErrorParserManager eoParser) {
|
||||||
if (this.project == null)
|
if (this.project == null)
|
||||||
this.project = eoParser.getProject();
|
this.project = eoParser.getProject();
|
||||||
|
|
||||||
AutotoolsProblemMarkerInfo marker = processLine(line);
|
AutotoolsProblemMarkerInfo marker = processLine(line);
|
||||||
if ( marker != null){
|
if (marker != null) {
|
||||||
eoParser.addProblemMarker(marker);
|
eoParser.addProblemMarker(marker);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -103,9 +99,9 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
|
|
||||||
public AutotoolsProblemMarkerInfo processLine(String line) {
|
public AutotoolsProblemMarkerInfo processLine(String line) {
|
||||||
Matcher m;
|
Matcher m;
|
||||||
|
|
||||||
m = changingConfigDirectory.matcher(line);
|
m = changingConfigDirectory.matcher(line);
|
||||||
if(m.matches()){
|
if (m.matches()) {
|
||||||
// set configuration directory.
|
// set configuration directory.
|
||||||
this.buildDir = this.buildDir.append(m.group(1));
|
this.buildDir = this.buildDir.append(m.group(1));
|
||||||
this.sourcePath = this.sourcePath.append(m.group(1));
|
this.sourcePath = this.sourcePath.append(m.group(1));
|
||||||
|
@ -114,22 +110,24 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
|
|
||||||
m = pkgconfigError.matcher(line);
|
m = pkgconfigError.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return new AutotoolsProblemMarkerInfo(getProject(), -1, m.group(1), SEVERITY_ERROR_BUILD, null, null, m.group(2), AutotoolsProblemMarkerInfo.Type.PACKAGE);
|
return new AutotoolsProblemMarkerInfo(getProject(), -1, m.group(1), SEVERITY_ERROR_BUILD, null, null,
|
||||||
|
m.group(2), AutotoolsProblemMarkerInfo.Type.PACKAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m = genconfigError.matcher(line);
|
m = genconfigError.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return new AutotoolsProblemMarkerInfo(getProject(), -1, m.group(1), SEVERITY_ERROR_BUILD, null,
|
return new AutotoolsProblemMarkerInfo(getProject(), -1, m.group(1), SEVERITY_ERROR_BUILD, null,
|
||||||
AutotoolsProblemMarkerInfo.Type.GENERIC);
|
AutotoolsProblemMarkerInfo.Type.GENERIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
m = checkingFail.matcher(line);
|
m = checkingFail.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
// We know that there is a 'checking for ...' fail.
|
// We know that there is a 'checking for ...' fail.
|
||||||
// Find the log file containing this check
|
// Find the log file containing this check
|
||||||
AutotoolsProblemMarkerInfo.Type type = getCheckType(m.group(1));
|
AutotoolsProblemMarkerInfo.Type type = getCheckType(m.group(1));
|
||||||
if (type != null)
|
if (type != null)
|
||||||
return new AutotoolsProblemMarkerInfo(getProject(), "Missing " + type + " " + m.group(1), SEVERITY_INFO, m.group(1), type);
|
return new AutotoolsProblemMarkerInfo(getProject(), "Missing " + type + " " + m.group(1), SEVERITY_INFO,
|
||||||
|
m.group(1), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -139,7 +137,7 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
* Given the name of the filed check object, look for it in the log file
|
* Given the name of the filed check object, look for it in the log file
|
||||||
* file and then examine the configure script to figure out what the type of
|
* file and then examine the configure script to figure out what the type of
|
||||||
* the check was.
|
* the check was.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -191,7 +189,7 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
/**
|
/**
|
||||||
* Check the log file for the check for the given name and return the line
|
* Check the log file for the check for the given name and return the line
|
||||||
* number in configure where the check occurs.
|
* number in configure where the check occurs.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -201,8 +199,7 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return -1;
|
return -1;
|
||||||
try (LineNumberReader reader = new LineNumberReader(new FileReader(file))) {
|
try (LineNumberReader reader = new LineNumberReader(new FileReader(file))) {
|
||||||
Pattern errorPattern =
|
Pattern errorPattern = Pattern.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$
|
||||||
Pattern.compile("configure:(\\d+): checking for " + name); //$NON-NLS-1$
|
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
Matcher m = errorPattern.matcher(line);
|
Matcher m = errorPattern.matcher(line);
|
||||||
|
@ -215,7 +212,7 @@ public class ErrorParser extends MarkerGenerator implements IErrorParser {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return this.project;
|
return this.project;
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
* https://www.eclipse.org/legal/epl-2.0/
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* James Blackburn (Broadcom) - Bug 247838
|
* James Blackburn (Broadcom) - Bug 247838
|
||||||
* Andrew Gvozdev (Quoin Inc)
|
* Andrew Gvozdev (Quoin Inc)
|
||||||
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
|
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.autotools.core;
|
package org.eclipse.cdt.internal.autotools.core;
|
||||||
|
|
||||||
|
@ -37,11 +37,11 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.URIUtil;
|
import org.eclipse.core.runtime.URIUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The purpose of ErrorParserManager is to delegate the work of error parsing
|
* The purpose of ErrorParserManager is to delegate the work of error parsing
|
||||||
* build output to {@link IErrorParser}s, assist in finding {@link IResource}s, and
|
* build output to {@link IErrorParser}s, assist in finding {@link IResource}s, and
|
||||||
* help create appropriate error/warning/info markers to be displayed
|
* help create appropriate error/warning/info markers to be displayed
|
||||||
* by the Problems view.
|
* by the Problems view.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
|
@ -51,7 +51,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
* as key/value pair with key="org.eclipse.cdt.core.errorOutputParser"
|
* as key/value pair with key="org.eclipse.cdt.core.errorOutputParser"
|
||||||
* @deprecated since CDT 4.0.
|
* @deprecated since CDT 4.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delimiter for error parsers presented in one string.
|
* Delimiter for error parsers presented in one string.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
@ -59,7 +59,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
public static final char ERROR_PARSER_DELIMITER = ';';
|
public static final char ERROR_PARSER_DELIMITER = ';';
|
||||||
|
|
||||||
private int nOpens;
|
private int nOpens;
|
||||||
private int lineCounter=0;
|
private int lineCounter = 0;
|
||||||
|
|
||||||
private final IProject fProject;
|
private final IProject fProject;
|
||||||
private final MarkerGenerator fMarkerGenerator;
|
private final MarkerGenerator fMarkerGenerator;
|
||||||
|
@ -74,10 +74,9 @@ public class ErrorParserManager extends OutputStream {
|
||||||
private OutputStream outputStream;
|
private OutputStream outputStream;
|
||||||
private final StringBuilder currentLine = new StringBuilder();
|
private final StringBuilder currentLine = new StringBuilder();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param project - project being built.
|
* @param project - project being built.
|
||||||
* @param markerGenerator - marker generator able to create markers.
|
* @param markerGenerator - marker generator able to create markers.
|
||||||
*/
|
*/
|
||||||
|
@ -85,12 +84,11 @@ public class ErrorParserManager extends OutputStream {
|
||||||
this(project, project.getLocationURI(), markerGenerator);
|
this(project, project.getLocationURI(), markerGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URI based constructor.
|
* URI based constructor.
|
||||||
*
|
*
|
||||||
* @param project - project being built.
|
* @param project - project being built.
|
||||||
* @param baseDirectoryURI - absolute location URI of working directory of where the build is performed.
|
* @param baseDirectoryURI - absolute location URI of working directory of where the build is performed.
|
||||||
* @param markerGenerator - marker generator able to create markers.
|
* @param markerGenerator - marker generator able to create markers.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@ -134,7 +132,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
* {@link #pushDirectory} and {@link #popDirectory} are used to change working directory
|
* {@link #pushDirectory} and {@link #popDirectory} are used to change working directory
|
||||||
* from where file name is searched (see {@link #findFileInWorkspace}).
|
* from where file name is searched (see {@link #findFileInWorkspace}).
|
||||||
* The intention is to handle make output of commands "pushd dir" and "popd".
|
* The intention is to handle make output of commands "pushd dir" and "popd".
|
||||||
*
|
*
|
||||||
* @param dir - another directory level to keep in stack -- corresponding to 'pushd'.
|
* @param dir - another directory level to keep in stack -- corresponding to 'pushd'.
|
||||||
*/
|
*/
|
||||||
public void pushDirectory(IPath dir) {
|
public void pushDirectory(IPath dir) {
|
||||||
|
@ -156,7 +154,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
* {@link #pushDirectoryURI} and {@link #popDirectoryURI} are used to change working directory
|
* {@link #pushDirectoryURI} and {@link #popDirectoryURI} are used to change working directory
|
||||||
* from where file name is searched (see {@link #findFileInWorkspace}).
|
* from where file name is searched (see {@link #findFileInWorkspace}).
|
||||||
* The intention is to handle make output of commands "pushd dir" and "popd".
|
* The intention is to handle make output of commands "pushd dir" and "popd".
|
||||||
*
|
*
|
||||||
* @param dir - another directory level to keep in stack -- corresponding to 'pushd'.
|
* @param dir - another directory level to keep in stack -- corresponding to 'pushd'.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@ -173,7 +171,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
* {@link #pushDirectoryURI(URI)} and {@link #popDirectoryURI()} are used to change working directory
|
* {@link #pushDirectoryURI(URI)} and {@link #popDirectoryURI()} are used to change working directory
|
||||||
* from where file name is searched (see {@link #findFileInWorkspace(IPath)}).
|
* from where file name is searched (see {@link #findFileInWorkspace(IPath)}).
|
||||||
* The intention is to handle make output of commands "pushd" and "popd".
|
* The intention is to handle make output of commands "pushd" and "popd".
|
||||||
*
|
*
|
||||||
* @return previous build directory location corresponding 'popd' command.
|
* @return previous build directory location corresponding 'popd' command.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@ -194,7 +192,6 @@ public class ErrorParserManager extends OutputStream {
|
||||||
return fDirectoryStack.size();
|
return fDirectoryStack.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the input and tries to generate error or warning markers
|
* Parses the input and tries to generate error or warning markers
|
||||||
*/
|
*/
|
||||||
|
@ -202,7 +199,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
String lineTrimmed = line.trim();
|
String lineTrimmed = line.trim();
|
||||||
lineCounter++;
|
lineCounter++;
|
||||||
|
|
||||||
ProblemMarkerInfo marker=null;
|
ProblemMarkerInfo marker = null;
|
||||||
|
|
||||||
for (ErrorParser parser : fErrorParsers.values()) {
|
for (ErrorParser parser : fErrorParsers.values()) {
|
||||||
ErrorParser curr = parser;
|
ErrorParser curr = parser;
|
||||||
|
@ -217,7 +214,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
}
|
}
|
||||||
// standard behavior (pre 5.1) is to trim the line
|
// standard behavior (pre 5.1) is to trim the line
|
||||||
String lineToParse = lineTrimmed;
|
String lineToParse = lineTrimmed;
|
||||||
if ((types & IErrorParser2.KEEP_UNTRIMMED) !=0 ) {
|
if ((types & IErrorParser2.KEEP_UNTRIMMED) != 0) {
|
||||||
// untrimmed lines
|
// untrimmed lines
|
||||||
lineToParse = line;
|
lineToParse = line;
|
||||||
}
|
}
|
||||||
|
@ -228,11 +225,11 @@ public class ErrorParserManager extends OutputStream {
|
||||||
// It should not stop parsing of the rest of output.
|
// It should not stop parsing of the rest of output.
|
||||||
try {
|
try {
|
||||||
consume = curr.processLine(lineToParse, this);
|
consume = curr.processLine(lineToParse, this);
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
AutotoolsPlugin.log(e);
|
AutotoolsPlugin.log(e);
|
||||||
} finally {
|
} finally {
|
||||||
if (fErrors.size() > 0) {
|
if (fErrors.size() > 0) {
|
||||||
if (marker==null)
|
if (marker == null)
|
||||||
marker = fErrors.get(0);
|
marker = fErrors.get(0);
|
||||||
fErrors.clear();
|
fErrors.clear();
|
||||||
}
|
}
|
||||||
|
@ -240,12 +237,12 @@ public class ErrorParserManager extends OutputStream {
|
||||||
|
|
||||||
if (consume)
|
if (consume)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
outputLine(line, marker);
|
outputLine(line, marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conditionally output line to outputStream. If stream
|
* Conditionally output line to outputStream. If stream
|
||||||
* supports error markers, use it, otherwise use conventional stream
|
* supports error markers, use it, otherwise use conventional stream
|
||||||
*/
|
*/
|
||||||
private void outputLine(String line, ProblemMarkerInfo marker) {
|
private void outputLine(String line, ProblemMarkerInfo marker) {
|
||||||
|
@ -256,12 +253,12 @@ public class ErrorParserManager extends OutputStream {
|
||||||
try {
|
try {
|
||||||
if (marker != null) {
|
if (marker != null) {
|
||||||
if (outputStream instanceof IErrorMarkeredOutputStream) {
|
if (outputStream instanceof IErrorMarkeredOutputStream) {
|
||||||
IErrorMarkeredOutputStream mos = (IErrorMarkeredOutputStream)outputStream;
|
IErrorMarkeredOutputStream mos = (IErrorMarkeredOutputStream) outputStream;
|
||||||
mos.write(l, marker);
|
mos.write(l, marker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
byte[] b = l.getBytes();
|
byte[] b = l.getBytes();
|
||||||
outputStream.write(b, 0, b.length);
|
outputStream.write(b, 0, b.length);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
AutotoolsPlugin.log(e);
|
AutotoolsPlugin.log(e);
|
||||||
}
|
}
|
||||||
|
@ -275,10 +272,9 @@ public class ErrorParserManager extends OutputStream {
|
||||||
return lineCounter;
|
return lineCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add marker to the list of error markers.
|
* Add marker to the list of error markers.
|
||||||
*
|
*
|
||||||
* @param file - resource to add the new marker.
|
* @param file - resource to add the new marker.
|
||||||
* @param lineNumber - line number of the error.
|
* @param lineNumber - line number of the error.
|
||||||
* @param desc - description of the error.
|
* @param desc - description of the error.
|
||||||
|
@ -292,7 +288,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add marker to the list of error markers.
|
* Add marker to the list of error markers.
|
||||||
*
|
*
|
||||||
* @param file - resource to add the new marker.
|
* @param file - resource to add the new marker.
|
||||||
* @param lineNumber - line number of the error.
|
* @param lineNumber - line number of the error.
|
||||||
* @param desc - description of the error.
|
* @param desc - description of the error.
|
||||||
|
@ -304,19 +300,19 @@ public class ErrorParserManager extends OutputStream {
|
||||||
* @param varName - variable name.
|
* @param varName - variable name.
|
||||||
* @param externalPath - external path pointing to a file outside the workspace.
|
* @param externalPath - external path pointing to a file outside the workspace.
|
||||||
*/
|
*/
|
||||||
public void generateExternalMarker(IResource file, int lineNumber, String desc, int severity,
|
public void generateExternalMarker(IResource file, int lineNumber, String desc, int severity, String varName,
|
||||||
String varName, IPath externalPath, String libraryInfo, AutotoolsProblemMarkerInfo.Type type) {
|
IPath externalPath, String libraryInfo, AutotoolsProblemMarkerInfo.Type type) {
|
||||||
AutotoolsProblemMarkerInfo problemMarkerInfo =
|
AutotoolsProblemMarkerInfo problemMarkerInfo = new AutotoolsProblemMarkerInfo(file, lineNumber, desc, severity,
|
||||||
new AutotoolsProblemMarkerInfo(file, lineNumber, desc, severity, varName, externalPath, libraryInfo, type);
|
varName, externalPath, libraryInfo, type);
|
||||||
addProblemMarker(problemMarkerInfo);
|
addProblemMarker(problemMarkerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given marker to the list of error markers.
|
* Add the given marker to the list of error markers.
|
||||||
*
|
*
|
||||||
* @param problemMarkerInfo - The marker to be added
|
* @param problemMarkerInfo - The marker to be added
|
||||||
*/
|
*/
|
||||||
public void addProblemMarker(AutotoolsProblemMarkerInfo problemMarkerInfo){
|
public void addProblemMarker(AutotoolsProblemMarkerInfo problemMarkerInfo) {
|
||||||
fErrors.add(problemMarkerInfo.getMarker());
|
fErrors.add(problemMarkerInfo.getMarker());
|
||||||
fMarkerGenerator.addMarker(problemMarkerInfo);
|
fMarkerGenerator.addMarker(problemMarkerInfo);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +328,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
/**
|
/**
|
||||||
* Method setOutputStream.
|
* Method setOutputStream.
|
||||||
* Note: you have to close this stream explicitly
|
* Note: you have to close this stream explicitly
|
||||||
* don't rely on ErrorParserManager.close().
|
* don't rely on ErrorParserManager.close().
|
||||||
* @param os - output stream
|
* @param os - output stream
|
||||||
*/
|
*/
|
||||||
public void setOutputStream(OutputStream os) {
|
public void setOutputStream(OutputStream os) {
|
||||||
|
@ -340,9 +336,9 @@ public class ErrorParserManager extends OutputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getOutputStream.
|
* Method getOutputStream.
|
||||||
* Note: you have to close this stream explicitly
|
* Note: you have to close this stream explicitly
|
||||||
* don't rely on ErrorParserManager.close().
|
* don't rely on ErrorParserManager.close().
|
||||||
* @return OutputStream
|
* @return OutputStream
|
||||||
*/
|
*/
|
||||||
public OutputStream getOutputStream() {
|
public OutputStream getOutputStream() {
|
||||||
|
@ -352,8 +348,8 @@ public class ErrorParserManager extends OutputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see java.io.OutputStream#close()
|
* @see java.io.OutputStream#close()
|
||||||
* Note: don't rely on this method to close underlying OutputStream,
|
* Note: don't rely on this method to close underlying OutputStream,
|
||||||
* close it explicitly
|
* close it explicitly
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() {
|
public synchronized void close() {
|
||||||
|
@ -393,7 +389,7 @@ public class ErrorParserManager extends OutputStream {
|
||||||
|
|
||||||
// This method examines contents of currentLine buffer
|
// This method examines contents of currentLine buffer
|
||||||
// if it contains whole line this line is checked by error
|
// if it contains whole line this line is checked by error
|
||||||
// parsers (processLine method).
|
// parsers (processLine method).
|
||||||
// If flush is true rest of line is checked by error parsers.
|
// If flush is true rest of line is checked by error parsers.
|
||||||
private void checkLine(boolean flush) {
|
private void checkLine(boolean flush) {
|
||||||
String buffer = currentLine.toString();
|
String buffer = currentLine.toString();
|
||||||
|
@ -401,8 +397,8 @@ public class ErrorParserManager extends OutputStream {
|
||||||
while ((i = buffer.indexOf('\n')) != -1) {
|
while ((i = buffer.indexOf('\n')) != -1) {
|
||||||
String line = buffer.substring(0, i);
|
String line = buffer.substring(0, i);
|
||||||
// get rid of any trailing '\r'
|
// get rid of any trailing '\r'
|
||||||
if (line.endsWith("\r")) //$NON-NLS-1$
|
if (line.endsWith("\r")) //$NON-NLS-1$
|
||||||
line=line.substring(0,line.length()-1);
|
line = line.substring(0, line.length() - 1);
|
||||||
processLine(line);
|
processLine(line);
|
||||||
previousLine = line;
|
previousLine = line;
|
||||||
buffer = buffer.substring(i + 1); // skip the \n and advance
|
buffer = buffer.substring(i + 1); // skip the \n and advance
|
||||||
|
@ -418,42 +414,39 @@ public class ErrorParserManager extends OutputStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a location {@link IPath} to an {@link URI}. Contrary to
|
* Converts a location {@link IPath} to an {@link URI}. Contrary to
|
||||||
* {@link URIUtil#toURI(IPath)} this method does not assume that the path belongs
|
* {@link URIUtil#toURI(IPath)} this method does not assume that the path belongs
|
||||||
* to local file system.
|
* to local file system.
|
||||||
*
|
*
|
||||||
* The returned URI uses the scheme and authority of the current working directory
|
* The returned URI uses the scheme and authority of the current working directory
|
||||||
* as returned by {@link #getWorkingDirectoryURI()}
|
* as returned by {@link #getWorkingDirectoryURI()}
|
||||||
*
|
*
|
||||||
* @param path - the path to convert to URI.
|
* @param path - the path to convert to URI.
|
||||||
* @return URI
|
* @return URI
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
private URI toURI(IPath path) {
|
private URI toURI(IPath path) {
|
||||||
// try {
|
// try {
|
||||||
URI baseURI = getWorkingDirectoryURI();
|
URI baseURI = getWorkingDirectoryURI();
|
||||||
String uriString = path.toString();
|
String uriString = path.toString();
|
||||||
|
|
||||||
// On Windows "C:/folder/" -> "/C:/folder/"
|
// On Windows "C:/folder/" -> "/C:/folder/"
|
||||||
if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR)
|
if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR)
|
||||||
uriString = IPath.SEPARATOR + uriString;
|
uriString = IPath.SEPARATOR + uriString;
|
||||||
|
|
||||||
return EFSExtensionManager.getDefault().createNewURIFromPath(baseURI, uriString);
|
return EFSExtensionManager.getDefault().createNewURIFromPath(baseURI, uriString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ids - array of error parser IDs
|
* @param ids - array of error parser IDs
|
||||||
* @return error parser IDs delimited with error parser delimiter ";"
|
* @return error parser IDs delimited with error parser delimiter ";"
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public static String toDelimitedString(String[] ids) {
|
public static String toDelimitedString(String[] ids) {
|
||||||
String result=""; //$NON-NLS-1$
|
String result = ""; //$NON-NLS-1$
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
if (result.length()==0) {
|
if (result.length() == 0) {
|
||||||
result = id;
|
result = id;
|
||||||
} else {
|
} else {
|
||||||
result += ERROR_PARSER_DELIMITER + id;
|
result += ERROR_PARSER_DELIMITER + id;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class MakeMessages {
|
public class MakeMessages {
|
||||||
|
|
||||||
private static final String RESOURCE_BUNDLE= MakeMessages.class.getName();
|
private static final String RESOURCE_BUNDLE = MakeMessages.class.getName();
|
||||||
private static ResourceBundle fgResourceBundle;
|
private static ResourceBundle fgResourceBundle;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -28,10 +28,10 @@ public class MakeMessages {
|
||||||
fgResourceBundle = null;
|
fgResourceBundle = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MakeMessages() {
|
private MakeMessages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
try {
|
try {
|
||||||
return fgResourceBundle.getString(key);
|
return fgResourceBundle.getString(key);
|
||||||
|
@ -41,10 +41,10 @@ public class MakeMessages {
|
||||||
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
|
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string from the resource bundle and formats it with the argument
|
* Gets a string from the resource bundle and formats it with the argument
|
||||||
*
|
*
|
||||||
* @param key the string used to get the bundle value, must not be null
|
* @param key the string used to get the bundle value, must not be null
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, Object arg) {
|
public static String getFormattedString(String key, Object arg) {
|
||||||
|
@ -53,7 +53,7 @@ public class MakeMessages {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string from the resource bundle and formats it with arguments
|
* Gets a string from the resource bundle and formats it with arguments
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, Object[] args) {
|
public static String getFormattedString(String key, Object[] args) {
|
||||||
return MessageFormat.format(getString(key), args);
|
return MessageFormat.format(getString(key), args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,15 +69,14 @@ public abstract class MarkerGenerator {
|
||||||
if (errorVar != null) {
|
if (errorVar != null) {
|
||||||
marker.setAttribute(IAutotoolsMarker.MARKER_VARIABLE, errorVar);
|
marker.setAttribute(IAutotoolsMarker.MARKER_VARIABLE, errorVar);
|
||||||
}
|
}
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch (CoreException e) {
|
|
||||||
AutotoolsPlugin.log(e.getStatus());
|
AutotoolsPlugin.log(e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract IProject getProject();
|
public abstract IProject getProject();
|
||||||
|
|
||||||
public boolean hasMarkers(IResource file) {
|
public boolean hasMarkers(IResource file) {
|
||||||
IMarker[] markers;
|
IMarker[] markers;
|
||||||
try {
|
try {
|
||||||
|
@ -94,14 +93,15 @@ public abstract class MarkerGenerator {
|
||||||
public void addMarker(AutotoolsProblemMarkerInfo autotoolsMarker) {
|
public void addMarker(AutotoolsProblemMarkerInfo autotoolsMarker) {
|
||||||
|
|
||||||
ProblemMarkerInfo info = autotoolsMarker.getMarker();
|
ProblemMarkerInfo info = autotoolsMarker.getMarker();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IResource markerResource = info.file ;
|
IResource markerResource = info.file;
|
||||||
if (markerResource==null) {
|
if (markerResource == null) {
|
||||||
markerResource = getProject();
|
markerResource = getProject();
|
||||||
}
|
}
|
||||||
IMarker[] cur = markerResource.findMarkers(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER, true, IResource.DEPTH_ONE);
|
IMarker[] cur = markerResource.findMarkers(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER, true,
|
||||||
// IMarker[] cur = markerResource.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_ONE);
|
IResource.DEPTH_ONE);
|
||||||
|
// IMarker[] cur = markerResource.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_ONE);
|
||||||
/*
|
/*
|
||||||
* Try to find matching markers and don't put in duplicates
|
* Try to find matching markers and don't put in duplicates
|
||||||
*/
|
*/
|
||||||
|
@ -110,14 +110,15 @@ public abstract class MarkerGenerator {
|
||||||
int line = ((Integer) cur[i].getAttribute(IMarker.LOCATION)).intValue();
|
int line = ((Integer) cur[i].getAttribute(IMarker.LOCATION)).intValue();
|
||||||
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
|
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
|
||||||
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
||||||
if (line == info.lineNumber && sev == mapMarkerSeverity(info.severity) && mesg.equals(info.description)) {
|
if (line == info.lineNumber && sev == mapMarkerSeverity(info.severity)
|
||||||
|
&& mesg.equals(info.description)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMarker marker = markerResource.createMarker(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER);
|
IMarker marker = markerResource.createMarker(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER);
|
||||||
// IMarker marker = markerResource.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
// IMarker marker = markerResource.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||||
marker.setAttribute(IMarker.LOCATION, info.lineNumber);
|
marker.setAttribute(IMarker.LOCATION, info.lineNumber);
|
||||||
marker.setAttribute(IMarker.MESSAGE, info.description);
|
marker.setAttribute(IMarker.MESSAGE, info.description);
|
||||||
marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(info.severity));
|
marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(info.severity));
|
||||||
|
@ -133,36 +134,34 @@ public abstract class MarkerGenerator {
|
||||||
|
|
||||||
// Add all other client defined attributes.
|
// Add all other client defined attributes.
|
||||||
Map<String, String> attributes = info.getAttributes();
|
Map<String, String> attributes = info.getAttributes();
|
||||||
if (attributes != null){
|
if (attributes != null) {
|
||||||
for (Entry<String, String> entry : attributes.entrySet()) {
|
for (Entry<String, String> entry : attributes.entrySet()) {
|
||||||
marker.setAttribute(entry.getKey(), entry.getValue());
|
marker.setAttribute(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (CoreException e) {
|
||||||
}
|
|
||||||
catch (CoreException e) {
|
|
||||||
AutotoolsPlugin.log(e.getStatus());
|
AutotoolsPlugin.log(e.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int mapMarkerSeverity(int severity) {
|
private int mapMarkerSeverity(int severity) {
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case SEVERITY_ERROR_BUILD :
|
case SEVERITY_ERROR_BUILD:
|
||||||
case SEVERITY_ERROR_RESOURCE :
|
case SEVERITY_ERROR_RESOURCE:
|
||||||
return IMarker.SEVERITY_ERROR;
|
return IMarker.SEVERITY_ERROR;
|
||||||
case SEVERITY_INFO :
|
case SEVERITY_INFO:
|
||||||
return IMarker.SEVERITY_INFO;
|
return IMarker.SEVERITY_INFO;
|
||||||
case SEVERITY_WARNING :
|
case SEVERITY_WARNING:
|
||||||
return IMarker.SEVERITY_WARNING;
|
return IMarker.SEVERITY_WARNING;
|
||||||
}
|
}
|
||||||
return IMarker.SEVERITY_ERROR;
|
return IMarker.SEVERITY_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the IMarkers for the project specified in the argument if the
|
* Removes the IMarkers for the project specified in the argument if the
|
||||||
* project exists, and is open.
|
* project exists, and is open.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
public void removeAllMarkers(IProject project) {
|
public void removeAllMarkers(IProject project) {
|
||||||
|
@ -175,7 +174,7 @@ public abstract class MarkerGenerator {
|
||||||
IMarker[] markers;
|
IMarker[] markers;
|
||||||
try {
|
try {
|
||||||
markers = project.findMarkers(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
markers = project.findMarkers(IAutotoolsMarker.AUTOTOOLS_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
||||||
// markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
// markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// Handled just about every case in the sanity check
|
// Handled just about every case in the sanity check
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,11 +21,11 @@ public class MarkerResolutionGenerator implements IMarkerResolutionGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMarkerResolution[] getResolutions(IMarker marker) {
|
public IMarkerResolution[] getResolutions(IMarker marker) {
|
||||||
// System.out.println("in marker resolution, library info is " + marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, ""));
|
// System.out.println("in marker resolution, library info is " + marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, ""));
|
||||||
// String libraryInfo = marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, null);
|
// String libraryInfo = marker.getAttribute(IAutotoolsMarker.MARKER_LIBRARY_INFO, null);
|
||||||
// if (libraryInfo != null) {
|
// if (libraryInfo != null) {
|
||||||
// return new IMarkerResolution[] {new PkgconfigErrorResolution(libraryInfo)};
|
// return new IMarkerResolution[] {new PkgconfigErrorResolution(libraryInfo)};
|
||||||
// };
|
// };
|
||||||
return new IMarkerResolution[0];
|
return new IMarkerResolution[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ import org.eclipse.ui.IMarkerResolution;
|
||||||
public class PkgconfigErrorResolution implements IMarkerResolution {
|
public class PkgconfigErrorResolution implements IMarkerResolution {
|
||||||
|
|
||||||
private static class ConsoleOutputStream extends OutputStream {
|
private static class ConsoleOutputStream extends OutputStream {
|
||||||
|
|
||||||
protected StringBuffer fBuffer;
|
protected StringBuffer fBuffer;
|
||||||
|
|
||||||
public ConsoleOutputStream() {
|
public ConsoleOutputStream() {
|
||||||
fBuffer= new StringBuffer();
|
fBuffer = new StringBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized String readBuffer() {
|
public synchronized String readBuffer() {
|
||||||
|
@ -50,16 +50,16 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
|
||||||
ascii[0] = (byte) c;
|
ascii[0] = (byte) c;
|
||||||
fBuffer.append(new String(ascii));
|
fBuffer.append(new String(ascii));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void write(byte[] b, int off, int len) {
|
public synchronized void write(byte[] b, int off, int len) {
|
||||||
fBuffer.append(new String(b, off, len));
|
fBuffer.append(new String(b, off, len));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String PKG_UPDATE_MSG = "UpdatePackage.msg"; //$NON-NLS-1$
|
private static final String PKG_UPDATE_MSG = "UpdatePackage.msg"; //$NON-NLS-1$
|
||||||
private String pkgName;
|
private String pkgName;
|
||||||
|
|
||||||
public PkgconfigErrorResolution(String pkgconfigRequirement) {
|
public PkgconfigErrorResolution(String pkgconfigRequirement) {
|
||||||
// Get the pkgconfig package name from the requirement message.
|
// Get the pkgconfig package name from the requirement message.
|
||||||
Pattern p = Pattern.compile("(.*?)[\\s,>,<,=].*");
|
Pattern p = Pattern.compile("(.*?)[\\s,>,<,=].*");
|
||||||
|
@ -68,10 +68,10 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
|
||||||
pkgName = m.group(1);
|
pkgName = m.group(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return AutotoolsPlugin.getFormattedString(PKG_UPDATE_MSG, new String[] {pkgName});
|
return AutotoolsPlugin.getFormattedString(PKG_UPDATE_MSG, new String[] { pkgName });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,23 +85,20 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
|
||||||
// Note, that we won't have any pkgconfig path settings from the configure call
|
// Note, that we won't have any pkgconfig path settings from the configure call
|
||||||
// so we can't handle the situation where the user doesn't have pkgconfig files
|
// so we can't handle the situation where the user doesn't have pkgconfig files
|
||||||
// stored in the usual place.
|
// stored in the usual place.
|
||||||
IPath pkgconfigPath =
|
IPath pkgconfigPath = new Path("/usr/lib/pkgconfig").append(pkgName + ".pc"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Path("/usr/lib/pkgconfig").append(pkgName+".pc"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
// Get a launcher for the config command
|
// Get a launcher for the config command
|
||||||
RemoteCommandLauncher launcher = new RemoteCommandLauncher();
|
RemoteCommandLauncher launcher = new RemoteCommandLauncher();
|
||||||
IPath commandPath = new Path("rpm"); //$NON-NLS-1$
|
IPath commandPath = new Path("rpm"); //$NON-NLS-1$
|
||||||
String[] commandArgs =
|
String[] commandArgs = new String[] { "-q", //$NON-NLS-1$
|
||||||
new String[] {"-q", //$NON-NLS-1$
|
|
||||||
"--queryformat", //$NON-NLS-1$
|
"--queryformat", //$NON-NLS-1$
|
||||||
"%{NAME}", //$NON-NLS-1$
|
"%{NAME}", //$NON-NLS-1$
|
||||||
"--whatprovides", //$NON-NLS-1$
|
"--whatprovides", //$NON-NLS-1$
|
||||||
pkgconfigPath.toOSString()};
|
pkgconfigPath.toOSString() };
|
||||||
try {
|
try {
|
||||||
// Use CDT launcher to run rpm to query the package that provides
|
// Use CDT launcher to run rpm to query the package that provides
|
||||||
// the pkgconfig .pc file for the package in question.
|
// the pkgconfig .pc file for the package in question.
|
||||||
ConsoleOutputStream output = new ConsoleOutputStream();
|
ConsoleOutputStream output = new ConsoleOutputStream();
|
||||||
Process proc = launcher.execute(commandPath, commandArgs, null,
|
Process proc = launcher.execute(commandPath, commandArgs, null, new Path("."), new NullProgressMonitor());
|
||||||
new Path("."), new NullProgressMonitor());
|
|
||||||
if (proc != null) {
|
if (proc != null) {
|
||||||
try {
|
try {
|
||||||
// Close the input of the process since we will never write to
|
// Close the input of the process since we will never write to
|
||||||
|
@ -109,8 +106,7 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
|
||||||
proc.getOutputStream().close();
|
proc.getOutputStream().close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
if (launcher.waitAndRead(output, output, new NullProgressMonitor())
|
if (launcher.waitAndRead(output, output, new NullProgressMonitor()) != ICommandLauncher.OK) {
|
||||||
!= ICommandLauncher.OK) {
|
|
||||||
AutotoolsPlugin.logErrorMessage(launcher.getErrorMessage());
|
AutotoolsPlugin.logErrorMessage(launcher.getErrorMessage());
|
||||||
} else {
|
} else {
|
||||||
String result = output.readBuffer();
|
String result = output.readBuffer();
|
||||||
|
@ -118,7 +114,7 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
|
||||||
System.out.println("need to execute update of " + result);
|
System.out.println("need to execute update of " + result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ public class VersionComparator {
|
||||||
* Compare two version numbers if
|
* Compare two version numbers if
|
||||||
* return -1 if v1 is older than v2 0 if they are the same and +1
|
* return -1 if v1 is older than v2 0 if they are the same and +1
|
||||||
* if v1 is newer than v2
|
* if v1 is newer than v2
|
||||||
*
|
*
|
||||||
* Version numbers are expected to be in the format x.y.z...
|
* Version numbers are expected to be in the format x.y.z...
|
||||||
*
|
*
|
||||||
* So:
|
* So:
|
||||||
* VersionComparator.compare("1.0", "1.2") return -1
|
* VersionComparator.compare("1.0", "1.2") return -1
|
||||||
* VersionComparator.compare("1.5", "1.2") returns 1
|
* VersionComparator.compare("1.5", "1.2") returns 1
|
||||||
|
@ -33,28 +33,28 @@ public class VersionComparator {
|
||||||
public static int compare(String v1, String v2) {
|
public static int compare(String v1, String v2) {
|
||||||
String[] v1digits = v1.split("\\.");
|
String[] v1digits = v1.split("\\.");
|
||||||
String[] v2digits = v2.split("\\.");
|
String[] v2digits = v2.split("\\.");
|
||||||
|
|
||||||
for (int i = 0; i < v1digits.length && i < v2digits.length; i++) {
|
for (int i = 0; i < v1digits.length && i < v2digits.length; i++) {
|
||||||
int d1 = Integer.valueOf(v1digits[i]);
|
int d1 = Integer.valueOf(v1digits[i]);
|
||||||
int d2 = Integer.valueOf(v2digits[i]);
|
int d2 = Integer.valueOf(v2digits[i]);
|
||||||
|
|
||||||
if (d1 < d2)
|
if (d1 < d2)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (d1 > d2)
|
if (d1 > d2)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point all digits have the same value
|
// At this point all digits have the same value
|
||||||
// so the version with the longer string wins
|
// so the version with the longer string wins
|
||||||
|
|
||||||
if (v1digits.length < v2digits.length)
|
if (v1digits.length < v2digits.length)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (v1digits.length > v2digits.length)
|
if (v1digits.length > v2digits.length)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,13 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
|
||||||
public AbstractConfigurationOption(String name, AutotoolsConfiguration cfg) {
|
public AbstractConfigurationOption(String name, AutotoolsConfiguration cfg) {
|
||||||
this(name, name, cfg);
|
this(name, name, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractConfigurationOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
public AbstractConfigurationOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.msgName = msgName;
|
this.msgName = msgName;
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return ConfigureMessages.getConfigureDescription(msgName);
|
return ConfigureMessages.getConfigureDescription(msgName);
|
||||||
|
@ -45,7 +45,7 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
|
||||||
public String getMsgName() {
|
public String getMsgName() {
|
||||||
return msgName;
|
return msgName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@ -54,7 +54,7 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
|
||||||
public AutotoolsConfiguration getCfg() {
|
public AutotoolsConfiguration getCfg() {
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getParameters() {
|
public List<String> getParameters() {
|
||||||
List<String> parameters = new ArrayList<>();
|
List<String> parameters = new ArrayList<>();
|
||||||
|
@ -62,7 +62,7 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
|
||||||
parameters.add(getParameter());
|
parameters.add(getParameter());
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParameterName() {
|
public String getParameterName() {
|
||||||
return "--" + getName();
|
return "--" + getName();
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,12 @@ public abstract class AbstractConfigurationOption implements IConfigureOption {
|
||||||
public boolean isCategory() {
|
public boolean isCategory() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlag() {
|
public boolean isFlag() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlagValue() {
|
public boolean isFlagValue() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
|
||||||
public class AutotoolsConfiguration implements IAConfiguration {
|
public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
|
|
||||||
public static class Option {
|
public static class Option {
|
||||||
|
@ -39,24 +38,24 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
private String superClassId;
|
private String superClassId;
|
||||||
private int type;
|
private int type;
|
||||||
private String defaultValue;
|
private String defaultValue;
|
||||||
|
|
||||||
public Option(String name, int type) {
|
public Option(String name, int type) {
|
||||||
this(name, name, type);
|
this(name, name, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Option(String name, String transformedName, int type) {
|
public Option(String name, String transformedName, int type) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.transformedName = transformedName;
|
this.transformedName = transformedName;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Option(String name, String transformedName, String defaultValue, int type) {
|
public Option(String name, String transformedName, String defaultValue, int type) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.transformedName = transformedName;
|
this.transformedName = transformedName;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Option(String name, String transformedName, String defaultValue, String superClassId, int type) {
|
public Option(String name, String transformedName, String defaultValue, String superClassId, int type) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.transformedName = transformedName;
|
this.transformedName = transformedName;
|
||||||
|
@ -68,15 +67,15 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultValue() {
|
public String getDefaultValue() {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSuperClassId() {
|
public String getSuperClassId() {
|
||||||
return superClassId;
|
return superClassId;
|
||||||
}
|
}
|
||||||
|
@ -84,64 +83,66 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return ConfigureMessages.getConfigureDescription(transformedName);
|
return ConfigureMessages.getConfigureDescription(transformedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToolTip() {
|
public String getToolTip() {
|
||||||
return ConfigureMessages.getConfigureTip(transformedName);
|
return ConfigureMessages.getConfigureTip(transformedName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure options and categories. List below is ordered.
|
// Configure options and categories. List below is ordered.
|
||||||
// All options following a category are children of that category
|
// All options following a category are children of that category
|
||||||
// in a tree view, up to the next category.
|
// in a tree view, up to the next category.
|
||||||
private static Option[] configOpts = new Option[] {
|
private static Option[] configOpts = new Option[] {
|
||||||
new Option(AutotoolsOptionConstants.TOOL_CONFIGURE, IConfigureOption.TOOL),
|
new Option(AutotoolsOptionConstants.TOOL_CONFIGURE, IConfigureOption.TOOL),
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_GENERAL, IConfigureOption.CATEGORY),
|
new Option(AutotoolsOptionConstants.CATEGORY_GENERAL, IConfigureOption.CATEGORY),
|
||||||
new Option(AutotoolsOptionConstants.OPT_CONFIGDIR, IConfigureOption.INTERNAL),
|
new Option(AutotoolsOptionConstants.OPT_CONFIGDIR, IConfigureOption.INTERNAL),
|
||||||
new Option(AutotoolsOptionConstants.OPT_CACHE_FILE, "cache_file", IConfigureOption.STRING), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_CACHE_FILE, "cache_file", IConfigureOption.STRING), //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_HELP, IConfigureOption.BIN),
|
new Option(AutotoolsOptionConstants.OPT_HELP, IConfigureOption.BIN),
|
||||||
new Option(AutotoolsOptionConstants.OPT_NO_CREATE, "no_create", IConfigureOption.BIN), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_NO_CREATE, "no_create", IConfigureOption.BIN), //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_QUIET, IConfigureOption.BIN),
|
new Option(AutotoolsOptionConstants.OPT_QUIET, IConfigureOption.BIN),
|
||||||
new Option(AutotoolsOptionConstants.OPT_VERSION, IConfigureOption.BIN),
|
new Option(AutotoolsOptionConstants.OPT_VERSION, IConfigureOption.BIN),
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_PLATFORM, IConfigureOption.CATEGORY),
|
new Option(AutotoolsOptionConstants.CATEGORY_PLATFORM, IConfigureOption.CATEGORY),
|
||||||
new Option(AutotoolsOptionConstants.OPT_HOST, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_HOST, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_BUILD, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_BUILD, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_TARGET, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_TARGET, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_DIRECTORIES, IConfigureOption.CATEGORY),
|
new Option(AutotoolsOptionConstants.CATEGORY_DIRECTORIES, IConfigureOption.CATEGORY),
|
||||||
new Option(AutotoolsOptionConstants.OPT_PREFIX, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_PREFIX, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_EXEC_PREFIX, "exec_prefix", IConfigureOption.STRING), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_EXEC_PREFIX, "exec_prefix", IConfigureOption.STRING), //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_LIBDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_LIBDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_BINDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_BINDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_SBINDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_SBINDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_INCLUDEDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_INCLUDEDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_DATADIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_DATADIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_SYSCONFDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_SYSCONFDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_INFODIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_INFODIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_MANDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_MANDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_SRCDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_SRCDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_LOCALSTATEDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_LOCALSTATEDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_LIBEXECDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_LIBEXECDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR, IConfigureOption.STRING),
|
new Option(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR, IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_FILENAMES, IConfigureOption.CATEGORY),
|
new Option(AutotoolsOptionConstants.CATEGORY_FILENAMES, IConfigureOption.CATEGORY),
|
||||||
new Option(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX, "program_prefix", IConfigureOption.STRING), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX, "program_prefix", IConfigureOption.STRING), //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX, "program_suffix", IConfigureOption.STRING), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX, "program_suffix", IConfigureOption.STRING), //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME, "program_transform_name", IConfigureOption.STRING), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME, "program_transform_name", //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_ENVVAR, IConfigureOption.CATEGORY),
|
IConfigureOption.STRING),
|
||||||
new Option(AutotoolsOptionConstants.OPT_ENVVAR, IConfigureOption.ENVVAR),
|
new Option(AutotoolsOptionConstants.CATEGORY_ENVVAR, IConfigureOption.CATEGORY),
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_FEATURES, IConfigureOption.CATEGORY),
|
new Option(AutotoolsOptionConstants.OPT_ENVVAR, IConfigureOption.ENVVAR),
|
||||||
new Option(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE, "enable_maintainer_mode", IConfigureOption.BIN), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.CATEGORY_FEATURES, IConfigureOption.CATEGORY),
|
||||||
new Option(AutotoolsOptionConstants.FLAG_CFLAGS, "cflags", AutotoolsOptionConstants.FLAG_CFLAGS_FLAGS, IConfigureOption.FLAG), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE, "enable_maintainer_mode", //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG, "cflags_debug", IConfigureOption.FLAGVALUE), //$NON-NLS-1$ //$NON-NLS-2$
|
IConfigureOption.BIN),
|
||||||
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GPROF, "cflags_gprof", IConfigureOption.FLAGVALUE), //$NON-NLS-1$ //$NON-NLS-2$
|
new Option(AutotoolsOptionConstants.FLAG_CFLAGS, "cflags", AutotoolsOptionConstants.FLAG_CFLAGS_FLAGS, //$NON-NLS-1$
|
||||||
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GCOV, "cflags_gcov", IConfigureOption.FLAGVALUE), //$NON-NLS-1$ //$NON-NLS-2$
|
IConfigureOption.FLAG),
|
||||||
new Option(AutotoolsOptionConstants.OPT_USER, IConfigureOption.MULTIARG),
|
new Option(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG, "cflags_debug", IConfigureOption.FLAGVALUE), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Option(AutotoolsOptionConstants.TOOL_AUTOGEN, "autogen", "autogen.sh", IConfigureOption.TOOL), //$NON-NLS-1$
|
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GPROF, "cflags_gprof", IConfigureOption.FLAGVALUE), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Option(AutotoolsOptionConstants.CATEGORY_OPTIONS, IConfigureOption.CATEGORY),
|
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GCOV, "cflags_gcov", IConfigureOption.FLAGVALUE), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Option(AutotoolsOptionConstants.OPT_AUTOGENOPTS, IConfigureOption.MULTIARG),
|
new Option(AutotoolsOptionConstants.OPT_USER, IConfigureOption.MULTIARG),
|
||||||
};
|
new Option(AutotoolsOptionConstants.TOOL_AUTOGEN, "autogen", "autogen.sh", IConfigureOption.TOOL), //$NON-NLS-1$
|
||||||
|
new Option(AutotoolsOptionConstants.CATEGORY_OPTIONS, IConfigureOption.CATEGORY),
|
||||||
|
new Option(AutotoolsOptionConstants.OPT_AUTOGENOPTS, IConfigureOption.MULTIARG), };
|
||||||
|
|
||||||
private static Option[] toolList;
|
private static Option[] toolList;
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private boolean isDirty;
|
private boolean isDirty;
|
||||||
private boolean isParmsDirty;
|
private boolean isParmsDirty;
|
||||||
|
@ -156,7 +157,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
public AutotoolsConfiguration(IProject project, String name) {
|
public AutotoolsConfiguration(IProject project, String name) {
|
||||||
this(project, name, true);
|
this(project, name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutotoolsConfiguration(IProject project, String name, boolean initialize) {
|
private AutotoolsConfiguration(IProject project, String name, boolean initialize) {
|
||||||
this.id = name;
|
this.id = name;
|
||||||
this.project = project;
|
this.project = project;
|
||||||
|
@ -165,7 +166,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
initConfigOptions();
|
initConfigOptions();
|
||||||
isParmsDirty = true;
|
isParmsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initConfigOptions() {
|
private void initConfigOptions() {
|
||||||
// Put configure options in hash map. Ignore categories.
|
// Put configure options in hash map. Ignore categories.
|
||||||
ArrayList<Option> tools = new ArrayList<>();
|
ArrayList<Option> tools = new ArrayList<>();
|
||||||
|
@ -214,8 +215,8 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
"org.eclipse.linuxtools.cdt.autotools.core.buildType.debug")) { //$NON-NLS-1$
|
"org.eclipse.linuxtools.cdt.autotools.core.buildType.debug")) { //$NON-NLS-1$
|
||||||
defaultValue = "CFLAGS='-g -O0'"; //$NON-NLS-1$
|
defaultValue = "CFLAGS='-g -O0'"; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
if (project.hasNature(CCProjectNature.CC_NATURE_ID))
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID))
|
||||||
defaultValue += " CXXFLAGS='-g -O0'"; //$NON-NLS-1$
|
defaultValue += " CXXFLAGS='-g -O0'"; //$NON-NLS-1$
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -244,9 +245,8 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
configOptions.put(opt.name, f);
|
configOptions.put(opt.name, f);
|
||||||
break;
|
break;
|
||||||
case IConfigureOption.FLAGVALUE:
|
case IConfigureOption.FLAGVALUE:
|
||||||
FlagValueConfigureOption fv
|
FlagValueConfigureOption fv = new FlagValueConfigureOption(opt.name, opt.transformedName, this,
|
||||||
= new FlagValueConfigureOption(opt.name, opt.transformedName,
|
ConfigureMessages.getParameter(opt.transformedName));
|
||||||
this, ConfigureMessages.getParameter(opt.transformedName));
|
|
||||||
if (defaultValue != null)
|
if (defaultValue != null)
|
||||||
fv.setValue(defaultValue);
|
fv.setValue(defaultValue);
|
||||||
lastFlag.addChild(opt.name);
|
lastFlag.addChild(opt.name);
|
||||||
|
@ -262,7 +262,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
}
|
}
|
||||||
toolList = tools.toArray(new Option[tools.size()]);
|
toolList = tools.toArray(new Option[tools.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Option[] getOptionList() {
|
public static Option[] getOptionList() {
|
||||||
return configOpts.clone();
|
return configOpts.clone();
|
||||||
}
|
}
|
||||||
|
@ -276,8 +276,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
for (int j = i + 1; j < configOpts.length; ++j) {
|
for (int j = i + 1; j < configOpts.length; ++j) {
|
||||||
Option o = configOpts[j];
|
Option o = configOpts[j];
|
||||||
int type = o.getType();
|
int type = o.getType();
|
||||||
if (type != IConfigureOption.CATEGORY &&
|
if (type != IConfigureOption.CATEGORY && type != IConfigureOption.TOOL)
|
||||||
type != IConfigureOption.TOOL)
|
|
||||||
options.add(o);
|
options.add(o);
|
||||||
else
|
else
|
||||||
return options.toArray(new Option[options.size()]);
|
return options.toArray(new Option[options.size()]);
|
||||||
|
@ -290,17 +289,17 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
options.add(o);
|
options.add(o);
|
||||||
else if (type == IConfigureOption.TOOL)
|
else if (type == IConfigureOption.TOOL)
|
||||||
return options.toArray(new Option[options.size()]);
|
return options.toArray(new Option[options.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return options.toArray(new Option[options.size()]);
|
return options.toArray(new Option[options.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Option[] getTools() {
|
public static Option[] getTools() {
|
||||||
return toolList.clone();
|
return toolList.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigureOption getOption(String name) {
|
public IConfigureOption getOption(String name) {
|
||||||
return configOptions.get(name);
|
return configOptions.get(name);
|
||||||
|
@ -310,7 +309,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
public IAConfiguration copy() {
|
public IAConfiguration copy() {
|
||||||
return copy(this.id);
|
return copy(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAConfiguration copy(String newId) {
|
public IAConfiguration copy(String newId) {
|
||||||
AutotoolsConfiguration cfg = new AutotoolsConfiguration(project, newId, false);
|
AutotoolsConfiguration cfg = new AutotoolsConfiguration(project, newId, false);
|
||||||
|
@ -325,29 +324,29 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
cfg.setDirty(true); // we are cloning with a new id, treat it as never built/dirty
|
cfg.setDirty(true); // we are cloning with a new id, treat it as never built/dirty
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return isDirty;
|
return isDirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDirty(boolean value) {
|
public void setDirty(boolean value) {
|
||||||
isDirty = value;
|
isDirty = value;
|
||||||
if (isDirty)
|
if (isDirty)
|
||||||
isParmsDirty = true;
|
isParmsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, IConfigureOption> getOptions() {
|
public Map<String, IConfigureOption> getOptions() {
|
||||||
return configOptions;
|
return configOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToolParameters(String name) {
|
public String getToolParameters(String name) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
@ -404,7 +403,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setConfigToolDirectory(String configToolDirectory) {
|
public void setConfigToolDirectory(String configToolDirectory) {
|
||||||
setOption("configdir", configToolDirectory);
|
setOption("configdir", configToolDirectory);
|
||||||
|
|
|
@ -64,10 +64,10 @@ import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
|
|
||||||
public static final String CFG_FILE_NAME = ".autotools"; //$NON-NLS-1$
|
public static final String CFG_FILE_NAME = ".autotools"; //$NON-NLS-1$
|
||||||
private static final String CFG_CANT_SAVE = "Configure.Error.NoProjectToSave"; //$NON-NLS-1$
|
private static final String CFG_CANT_SAVE = "Configure.Error.NoProjectToSave"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
@ -80,18 +80,18 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
|
|
||||||
private static AutotoolsConfigurationManager instance;
|
private static AutotoolsConfigurationManager instance;
|
||||||
private static Random rand = new Random();
|
private static Random rand = new Random();
|
||||||
|
|
||||||
private boolean isSyncing;
|
private boolean isSyncing;
|
||||||
|
|
||||||
private static Map<String, Map<String, IAConfiguration>> configs;
|
private static Map<String, Map<String, IAConfiguration>> configs;
|
||||||
private static Map<String, Map<String, IAConfiguration>> tmpConfigs;
|
private static Map<String, Map<String, IAConfiguration>> tmpConfigs;
|
||||||
|
|
||||||
private AutotoolsConfigurationManager() {
|
private AutotoolsConfigurationManager() {
|
||||||
configs = new HashMap<>();
|
configs = new HashMap<>();
|
||||||
tmpConfigs = new HashMap<>();
|
tmpConfigs = new HashMap<>();
|
||||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AutotoolsConfigurationManager getInstance() {
|
public static AutotoolsConfigurationManager getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new AutotoolsConfigurationManager();
|
instance = new AutotoolsConfigurationManager();
|
||||||
|
@ -102,7 +102,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
public synchronized IAConfiguration createDefaultConfiguration(String id) {
|
public synchronized IAConfiguration createDefaultConfiguration(String id) {
|
||||||
return new AutotoolsConfiguration(id);
|
return new AutotoolsConfiguration(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) {
|
public synchronized IAConfiguration createDefaultConfiguration(IProject project, String id) {
|
||||||
return new AutotoolsConfiguration(project, id);
|
return new AutotoolsConfiguration(project, id);
|
||||||
}
|
}
|
||||||
|
@ -130,15 +130,14 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public synchronized boolean isConfigurationAlreadySaved(IProject project, ICConfigurationDescription cfgd) {
|
public synchronized boolean isConfigurationAlreadySaved(IProject project, ICConfigurationDescription cfgd) {
|
||||||
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
|
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
|
||||||
if (cfgs != null)
|
if (cfgs != null)
|
||||||
return cfgs.get(cfgd.getId()) != null;
|
return cfgs.get(cfgd.getId()) != null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addConfiguration(IProject project, IAConfiguration cfg) {
|
public synchronized void addConfiguration(IProject project, IAConfiguration cfg) {
|
||||||
String projectName = project.getName();
|
String projectName = project.getName();
|
||||||
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
|
Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
|
||||||
|
@ -149,7 +148,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
cfgs.put(cfg.getId(), cfg);
|
cfgs.put(cfg.getId(), cfg);
|
||||||
saveConfigs(project);
|
saveConfigs(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean isSyncing() {
|
public synchronized boolean isSyncing() {
|
||||||
return isSyncing;
|
return isSyncing;
|
||||||
}
|
}
|
||||||
|
@ -157,15 +156,15 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
private synchronized void setSyncing(boolean value) {
|
private synchronized void setSyncing(boolean value) {
|
||||||
isSyncing = value;
|
isSyncing = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronize the current set of configurations for the project with the
|
* Synchronize the current set of configurations for the project with the
|
||||||
* Autotools saved configuration data. This is required when configuration
|
* Autotools saved configuration data. This is required when configuration
|
||||||
* management occurs outside of the Autotools Configure Settings page in the
|
* management occurs outside of the Autotools Configure Settings page in the
|
||||||
* Property menu.
|
* Property menu.
|
||||||
*
|
*
|
||||||
* @param project to synchronize configurations for
|
* @param project to synchronize configurations for
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public synchronized void syncConfigurations(IProject project) {
|
public synchronized void syncConfigurations(IProject project) {
|
||||||
setSyncing(true);
|
setSyncing(true);
|
||||||
|
@ -182,14 +181,15 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
clearTmpConfigurations(project);
|
clearTmpConfigurations(project);
|
||||||
replaceProjectConfigurations(project, newCfgList);
|
replaceProjectConfigurations(project, newCfgList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs) {
|
public synchronized void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs) {
|
||||||
String projectName = project.getName();
|
String projectName = project.getName();
|
||||||
configs.put(projectName, cfgs);
|
configs.put(projectName, cfgs);
|
||||||
saveConfigs(project);
|
saveConfigs(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs, ICConfigurationDescription[] cfgds) {
|
public synchronized void replaceProjectConfigurations(IProject project, Map<String, IAConfiguration> cfgs,
|
||||||
|
ICConfigurationDescription[] cfgds) {
|
||||||
String projectName = project.getName();
|
String projectName = project.getName();
|
||||||
configs.put(projectName, cfgs);
|
configs.put(projectName, cfgs);
|
||||||
saveConfigs(project, cfgds);
|
saveConfigs(project, cfgds);
|
||||||
|
@ -223,8 +223,8 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
cfgId = cfgIdNode.getNodeValue();
|
cfgId = cfgIdNode.getNodeValue();
|
||||||
else if (nameNode != null) {
|
else if (nameNode != null) {
|
||||||
String cfgName = nameNode.getNodeValue();
|
String cfgName = nameNode.getNodeValue();
|
||||||
ICConfigurationDescription cfgd =
|
ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
|
||||||
CoreModel.getDefault().getProjectDescription(project).getConfigurationByName(cfgName);
|
.getConfigurationByName(cfgName);
|
||||||
if (cfgd != null)
|
if (cfgd != null)
|
||||||
cfgId = cfgd.getId();
|
cfgId = cfgd.getId();
|
||||||
else
|
else
|
||||||
|
@ -254,7 +254,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
NamedNodeMap optionAttrs2 = flagChild.getAttributes();
|
NamedNodeMap optionAttrs2 = flagChild.getAttributes();
|
||||||
Node id2 = optionAttrs2.getNamedItem("id"); //$NON-NLS-1$
|
Node id2 = optionAttrs2.getNamedItem("id"); //$NON-NLS-1$
|
||||||
Node value = optionAttrs2.getNamedItem("value"); //$NON-NLS-1$
|
Node value = optionAttrs2.getNamedItem("value"); //$NON-NLS-1$
|
||||||
cfg.setOption(id2.getNodeValue(), value.getNodeValue());
|
cfg.setOption(id2.getNodeValue(), value.getNodeValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized IAConfiguration getTmpConfiguration(IProject p, ICConfigurationDescription cfgd) {
|
public synchronized IAConfiguration getTmpConfiguration(IProject p, ICConfigurationDescription cfgd) {
|
||||||
Map <String, IAConfiguration> list = getTmpConfigs(p);
|
Map<String, IAConfiguration> list = getTmpConfigs(p);
|
||||||
IAConfiguration acfg = list.get(cfgd.getId());
|
IAConfiguration acfg = list.get(cfgd.getId());
|
||||||
if (acfg != null) {
|
if (acfg != null) {
|
||||||
return acfg;
|
return acfg;
|
||||||
|
@ -289,7 +289,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
/**
|
/**
|
||||||
* Clone a configuration and put it on the tmp list if it is not already a saved configuration
|
* Clone a configuration and put it on the tmp list if it is not already a saved configuration
|
||||||
* and not already on the tmp list.
|
* and not already on the tmp list.
|
||||||
*
|
*
|
||||||
* @param p project
|
* @param p project
|
||||||
* @param oldId the id of the old configuration to clone
|
* @param oldId the id of the old configuration to clone
|
||||||
* @param cfgd the configuration descriptor for the clone
|
* @param cfgd the configuration descriptor for the clone
|
||||||
|
@ -298,7 +298,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
public synchronized boolean cloneCfg(IProject p, String oldId, ICConfigurationDescription cfgd) {
|
public synchronized boolean cloneCfg(IProject p, String oldId, ICConfigurationDescription cfgd) {
|
||||||
if (isConfigurationAlreadySaved(p, cfgd))
|
if (isConfigurationAlreadySaved(p, cfgd))
|
||||||
return true;
|
return true;
|
||||||
Map <String, IAConfiguration> tmpList = getTmpConfigs(p);
|
Map<String, IAConfiguration> tmpList = getTmpConfigs(p);
|
||||||
String newId = cfgd.getId();
|
String newId = cfgd.getId();
|
||||||
// Don't bother if the new configuration is already on the tmp list
|
// Don't bother if the new configuration is already on the tmp list
|
||||||
IAConfiguration cfg = tmpList.get(newId);
|
IAConfiguration cfg = tmpList.get(newId);
|
||||||
|
@ -307,7 +307,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
// Otherwise, try and find the old id to copy the configuration from
|
// Otherwise, try and find the old id to copy the configuration from
|
||||||
// or punt if not found
|
// or punt if not found
|
||||||
IAConfiguration oldCfg = null;
|
IAConfiguration oldCfg = null;
|
||||||
Map <String, IAConfiguration> savedList = getSavedConfigs(p);
|
Map<String, IAConfiguration> savedList = getSavedConfigs(p);
|
||||||
if (savedList != null)
|
if (savedList != null)
|
||||||
oldCfg = savedList.get(oldId);
|
oldCfg = savedList.get(oldId);
|
||||||
if (oldCfg != null) {
|
if (oldCfg != null) {
|
||||||
|
@ -325,25 +325,26 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, IAConfiguration> getTmpConfigs(IProject p) {
|
private Map<String, IAConfiguration> getTmpConfigs(IProject p) {
|
||||||
Map <String, IAConfiguration> tmpList = tmpConfigs.get(p.getName());
|
Map<String, IAConfiguration> tmpList = tmpConfigs.get(p.getName());
|
||||||
if (tmpList == null) {
|
if (tmpList == null) {
|
||||||
tmpList = new HashMap<>();
|
tmpList = new HashMap<>();
|
||||||
tmpConfigs.put(p.getName(), tmpList);
|
tmpConfigs.put(p.getName(), tmpList);
|
||||||
}
|
}
|
||||||
return tmpList;
|
return tmpList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clearTmpConfigurations(IProject p) {
|
public synchronized void clearTmpConfigurations(IProject p) {
|
||||||
tmpConfigs.remove(p.getName());
|
tmpConfigs.remove(p.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void saveConfigs(IProject project) {
|
public synchronized void saveConfigs(IProject project) {
|
||||||
synchronized (project) {
|
synchronized (project) {
|
||||||
ICConfigurationDescription[] cfgds = CoreModel.getDefault().getProjectDescription(project).getConfigurations();
|
ICConfigurationDescription[] cfgds = CoreModel.getDefault().getProjectDescription(project)
|
||||||
|
.getConfigurations();
|
||||||
saveConfigs(project, cfgds);
|
saveConfigs(project, cfgds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncNameField(ICConfigurationDescription cfgd) {
|
private void syncNameField(ICConfigurationDescription cfgd) {
|
||||||
IConfiguration icfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
|
IConfiguration icfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
|
||||||
String id = cfgd.getId();
|
String id = cfgd.getId();
|
||||||
|
@ -353,8 +354,8 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
for (int j = 0; j < tools.length; ++j) {
|
for (int j = 0; j < tools.length; ++j) {
|
||||||
ITool tool = tools[j];
|
ITool tool = tools[j];
|
||||||
if (tool.getName().equals("configure")) { //$NON-NLS-1$
|
if (tool.getName().equals("configure")) { //$NON-NLS-1$
|
||||||
IOption option =
|
IOption option = tool
|
||||||
tool.getOptionBySuperClassId("org.eclipse.linuxtools.cdt.autotools.core.option.configure.name"); //$NON-NLS-1$
|
.getOptionBySuperClassId("org.eclipse.linuxtools.cdt.autotools.core.option.configure.name"); //$NON-NLS-1$
|
||||||
IHoldsOptions h = tool;
|
IHoldsOptions h = tool;
|
||||||
try {
|
try {
|
||||||
IOption optionToSet = h.getOptionToSet(option, false);
|
IOption optionToSet = h.getOptionToSet(option, false);
|
||||||
|
@ -365,16 +366,16 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String xmlEscape(String value) {
|
private String xmlEscape(String value) {
|
||||||
value = value.replaceAll("\\&", "&"); //$NON-NLS-1$ //$NON-NLS-2$
|
value = value.replaceAll("\\&", "&"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
value = value.replaceAll("\\\"", """); //$NON-NLS-1$ //$NON-NLS-2$
|
value = value.replaceAll("\\\"", """); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
value = value.replaceAll("\\\'", "'"); //$NON-NLS-1$ //$NON-NLS-2$
|
value = value.replaceAll("\\\'", "'"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
value = value.replaceAll("\\<", "<"); //$NON-NLS-1$ //$NON-NLS-2$
|
value = value.replaceAll("\\<", "<"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
value = value.replaceAll("\\>", ">"); //$NON-NLS-1$ //$NON-NLS-2$
|
value = value.replaceAll("\\>", ">"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveConfigs(IProject project, ICConfigurationDescription[] cfgds) {
|
private void saveConfigs(IProject project, ICConfigurationDescription[] cfgds) {
|
||||||
try {
|
try {
|
||||||
String projectName = project.getName();
|
String projectName = project.getName();
|
||||||
|
@ -435,7 +436,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
AutotoolsPlugin.log(e);
|
AutotoolsPlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform apply of configuration changes. This rewrites out the current known list of configurations
|
// Perform apply of configuration changes. This rewrites out the current known list of configurations
|
||||||
// with any changes currently that have been made to them. If a configuration has been renamed, but this
|
// with any changes currently that have been made to them. If a configuration has been renamed, but this
|
||||||
// has not yet been confirmed by the end-user, then only the changes to the configuration are made. The
|
// has not yet been confirmed by the end-user, then only the changes to the configuration are made. The
|
||||||
|
@ -445,11 +446,11 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IResource res = root.findMember(projectName, false);
|
IResource res = root.findMember(projectName, false);
|
||||||
if (res == null || res.getType() != IResource.PROJECT) {
|
if (res == null || res.getType() != IResource.PROJECT) {
|
||||||
AutotoolsPlugin.logErrorMessage(ConfigureMessages.getFormattedString(CFG_CANT_SAVE,
|
AutotoolsPlugin.logErrorMessage(
|
||||||
new String[]{projectName}));
|
ConfigureMessages.getFormattedString(CFG_CANT_SAVE, new String[] { projectName }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IProject project = (IProject)res;
|
IProject project = (IProject) res;
|
||||||
IPath output = project.getLocation().append(CFG_FILE_NAME);
|
IPath output = project.getLocation().append(CFG_FILE_NAME);
|
||||||
File f = output.toFile();
|
File f = output.toFile();
|
||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
|
@ -472,7 +473,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
savedIds.add(id);
|
savedIds.add(id);
|
||||||
IAConfiguration cfg = getTmpConfiguration(project, cfgd);
|
IAConfiguration cfg = getTmpConfiguration(project, cfgd);
|
||||||
cfgs.put(id, cfg); // add to list in case we have a new configuration not yet added to Project Description
|
cfgs.put(id, cfg); // add to list in case we have a new configuration not yet added to Project Description
|
||||||
p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
|
p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
for (int j = 0; j < optionList.length; ++j) {
|
for (int j = 0; j < optionList.length; ++j) {
|
||||||
Option option = optionList[j];
|
Option option = optionList[j];
|
||||||
IConfigureOption opt = cfg.getOption(option.getName());
|
IConfigureOption opt = cfg.getOption(option.getName());
|
||||||
|
@ -491,12 +492,13 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
// A remaining id won't appear in our savedIds list.
|
// A remaining id won't appear in our savedIds list.
|
||||||
if (!savedIds.contains(id)) {
|
if (!savedIds.contains(id)) {
|
||||||
IAConfiguration cfg = i.getValue();
|
IAConfiguration cfg = i.getValue();
|
||||||
p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
|
p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
for (int j = 0; j < optionList.length; ++j) {
|
for (int j = 0; j < optionList.length; ++j) {
|
||||||
Option option = optionList[j];
|
Option option = optionList[j];
|
||||||
IConfigureOption opt = cfg.getOption(option.getName());
|
IConfigureOption opt = cfg.getOption(option.getName());
|
||||||
if (!opt.isCategory())
|
if (!opt.isCategory())
|
||||||
p.println("<option id=\"" + option.getName() + "\" value=\"" + opt.getValue() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
p.println("<option id=\"" + option.getName() + "\" value=\"" + opt.getValue() //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
+ "\"/>"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
p.println("</configuration>"); //$NON-NLS-1$
|
p.println("</configuration>"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -508,7 +510,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
AutotoolsPlugin.log(e);
|
AutotoolsPlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Map<String, IAConfiguration> getConfigurations(IProject project) {
|
public synchronized Map<String, IAConfiguration> getConfigurations(IProject project) {
|
||||||
Map<String, IAConfiguration> list = getSavedConfigs(project);
|
Map<String, IAConfiguration> list = getSavedConfigs(project);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
@ -517,7 +519,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void resourceChanged(IResourceChangeEvent event) {
|
public synchronized void resourceChanged(IResourceChangeEvent event) {
|
||||||
IResource res = event.getResource();
|
IResource res = event.getResource();
|
||||||
|
@ -547,17 +549,16 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AutotoolsOption implements IAutotoolsOption {
|
private static class AutotoolsOption implements IAutotoolsOption {
|
||||||
|
|
||||||
private IConfigureOption option;
|
private IConfigureOption option;
|
||||||
private final static String UNMODIFIABLE_CONFIG_OPTION = "CfgOptions.Unmodifiable.Option"; //$NON-NLS-1$
|
private final static String UNMODIFIABLE_CONFIG_OPTION = "CfgOptions.Unmodifiable.Option"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
public AutotoolsOption(IConfigureOption option) {
|
public AutotoolsOption(IConfigureOption option) {
|
||||||
this.option = option;
|
this.option = option;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return option.getType();
|
return option.getType();
|
||||||
|
@ -582,7 +583,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String value) throws CoreException {
|
public void setValue(String value) throws CoreException {
|
||||||
if (!canUpdate()) {
|
if (!canUpdate()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||||
ConfigureMessages.getString(UNMODIFIABLE_CONFIG_OPTION)));
|
ConfigureMessages.getString(UNMODIFIABLE_CONFIG_OPTION)));
|
||||||
}
|
}
|
||||||
synchronized (option) {
|
synchronized (option) {
|
||||||
|
@ -596,9 +597,9 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
return option.getValue();
|
return option.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createDummyId() {
|
private String createDummyId() {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
String id = "TEMP_" + rand.nextInt();
|
String id = "TEMP_" + rand.nextInt();
|
||||||
|
@ -606,25 +607,25 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public synchronized Map<String, IAutotoolsOption> getAutotoolsCfgOptions(IProject project,
|
public synchronized Map<String, IAutotoolsOption> getAutotoolsCfgOptions(IProject project, String cfgId)
|
||||||
String cfgId) throws CoreException {
|
throws CoreException {
|
||||||
|
|
||||||
// Verify project is valid Autotools project
|
// Verify project is valid Autotools project
|
||||||
if (project == null || !project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
if (project == null || !project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_PROJECT)));
|
ConfigureMessages.getString(INVALID_AUTOTOOLS_PROJECT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify configuration id is valid
|
// Verify configuration id is valid
|
||||||
ICConfigurationDescription cfgd =
|
ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
|
||||||
CoreModel.getDefault().getProjectDescription(project).getConfigurationById(cfgId);
|
.getConfigurationById(cfgId);
|
||||||
IConfiguration icfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
|
IConfiguration icfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
|
||||||
if (icfg == null) {
|
if (icfg == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_CONFIG_ID)));
|
ConfigureMessages.getString(INVALID_AUTOTOOLS_CONFIG_ID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,30 +638,30 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
for (Iterator<Entry<String, IConfigureOption>> i = cfgOptions.entrySet().iterator(); i.hasNext();) {
|
for (Iterator<Entry<String, IConfigureOption>> i = cfgOptions.entrySet().iterator(); i.hasNext();) {
|
||||||
Map.Entry<String, IConfigureOption> entry = i.next();
|
Map.Entry<String, IConfigureOption> entry = i.next();
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
IAutotoolsOption configOption =
|
IAutotoolsOption configOption = new AutotoolsOption(
|
||||||
new AutotoolsOption(entry.getValue().copy((AutotoolsConfiguration)dummyCfg));
|
entry.getValue().copy((AutotoolsConfiguration) dummyCfg));
|
||||||
options.put(name, configOption);
|
options.put(name, configOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public synchronized void updateAutotoolCfgOptions(IProject project, String cfgId,
|
public synchronized void updateAutotoolCfgOptions(IProject project, String cfgId,
|
||||||
Map<String,IAutotoolsOption> options) throws CoreException {
|
Map<String, IAutotoolsOption> options) throws CoreException {
|
||||||
|
|
||||||
// Verify project is valid Autotools project
|
// Verify project is valid Autotools project
|
||||||
if (project == null || !project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
if (project == null || !project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_PROJECT)));
|
ConfigureMessages.getString(INVALID_AUTOTOOLS_PROJECT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify configuration id is valid
|
// Verify configuration id is valid
|
||||||
IAConfiguration cfg = findCfg(project, cfgId);
|
IAConfiguration cfg = findCfg(project, cfgId);
|
||||||
if (cfg == null) {
|
if (cfg == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
throw new CoreException(new Status(IStatus.ERROR, AutotoolsPlugin.PLUGIN_ID,
|
||||||
ConfigureMessages.getString(INVALID_AUTOTOOLS_CONFIG_ID)));
|
ConfigureMessages.getString(INVALID_AUTOTOOLS_CONFIG_ID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +675,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
|
||||||
cfgOption.setValue(option.getValue());
|
cfgOption.setValue(option.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save changes
|
// Save changes
|
||||||
saveConfigs(project);
|
saveConfigs(project);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,8 @@ import org.eclipse.cdt.managedbuilder.core.ManagedOptionValueHandler;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
|
public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler implements IOptionApplicability {
|
||||||
implements IOptionApplicability {
|
|
||||||
|
|
||||||
public static final String DEFAULT_BUILD_DIR = "build"; //$NON-NLS-1$
|
public static final String DEFAULT_BUILD_DIR = "build"; //$NON-NLS-1$
|
||||||
public static final String CONFIGURE_TOOL_ID = "org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure"; //$NON-NLS-1$
|
public static final String CONFIGURE_TOOL_ID = "org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure"; //$NON-NLS-1$
|
||||||
public static final String BUILD_DIR_OPTION_ID = "org.eclipse.linuxtools.cdt.autotools.core.option.configure.builddir"; //$NON-NLS-1$
|
public static final String BUILD_DIR_OPTION_ID = "org.eclipse.linuxtools.cdt.autotools.core.option.configure.builddir"; //$NON-NLS-1$
|
||||||
|
@ -41,25 +40,21 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
|
||||||
|
|
||||||
//FIXME: Use holder to set option value, not the "option" parameter
|
//FIXME: Use holder to set option value, not the "option" parameter
|
||||||
@Override
|
@Override
|
||||||
public boolean handleValue(IBuildObject buildObject,
|
public boolean handleValue(IBuildObject buildObject, IHoldsOptions holder, IOption option, String extraArgument,
|
||||||
IHoldsOptions holder,
|
int event) {
|
||||||
IOption option,
|
|
||||||
String extraArgument, int event)
|
|
||||||
{
|
|
||||||
// Get the current value of the build dir option.
|
// Get the current value of the build dir option.
|
||||||
String value = (String)option.getValue();
|
String value = (String) option.getValue();
|
||||||
|
|
||||||
if (buildObject instanceof IConfiguration &&
|
if (buildObject instanceof IConfiguration && (event == IManagedOptionValueHandler.EVENT_OPEN)) {
|
||||||
(event == IManagedOptionValueHandler.EVENT_OPEN)) {
|
// SortedSet<Integer> nums = new TreeSet<Integer>();
|
||||||
// SortedSet<Integer> nums = new TreeSet<Integer>();
|
IConfiguration configuration = (IConfiguration) buildObject;
|
||||||
IConfiguration configuration = (IConfiguration)buildObject;
|
|
||||||
ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(configuration);
|
ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(configuration);
|
||||||
if (option.getName().equals("Name") && cfgd != null) {
|
if (option.getName().equals("Name") && cfgd != null) {
|
||||||
String cfgId = cfgd.getId();
|
String cfgId = cfgd.getId();
|
||||||
if (!value.isEmpty() && !value.equals(cfgId)) {
|
if (!value.isEmpty() && !value.equals(cfgId)) {
|
||||||
// we have a cloned configuration and we know that the
|
// we have a cloned configuration and we know that the
|
||||||
// clonee's name is the value of the option
|
// clonee's name is the value of the option
|
||||||
IProject project = (IProject)configuration.getManagedProject().getOwner();
|
IProject project = (IProject) configuration.getManagedProject().getOwner();
|
||||||
String autoName = null;
|
String autoName = null;
|
||||||
String autoNameTemplate = null;
|
String autoNameTemplate = null;
|
||||||
// Check if we are supposed to automatically name the build directory for any
|
// Check if we are supposed to automatically name the build directory for any
|
||||||
|
@ -71,8 +66,8 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
if (autoName == null || autoName.equals(AutotoolsPropertyConstants.TRUE)) {
|
if (autoName == null || autoName.equals(AutotoolsPropertyConstants.TRUE)) {
|
||||||
autoNameTemplate = "${workspace_loc:/" + project.getName() + //$NON-NLS-1$
|
autoNameTemplate = "${workspace_loc:/" + project.getName() + //$NON-NLS-1$
|
||||||
"}/build-" + fixName(configuration.getName()); //$NON-NLS-1$
|
"}/build-" + fixName(configuration.getName()); //$NON-NLS-1$
|
||||||
IBuilder cfgBuilder = configuration.getEditableBuilder();
|
IBuilder cfgBuilder = configuration.getEditableBuilder();
|
||||||
cfgBuilder.setBuildPath(autoNameTemplate);
|
cfgBuilder.setBuildPath(autoNameTemplate);
|
||||||
}
|
}
|
||||||
|
@ -93,35 +88,31 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The event was not handled, thus return false
|
// The event was not handled, thus return false
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fixName(String cfgName) {
|
private String fixName(String cfgName) {
|
||||||
// Replace whitespace with underscores.
|
// Replace whitespace with underscores.
|
||||||
return cfgName.replaceAll("\\s", "_");
|
return cfgName.replaceAll("\\s", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
// IOptionApplicability methods
|
// IOptionApplicability methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptionEnabled(IBuildObject configuration,
|
public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) {
|
||||||
IHoldsOptions holder, IOption option) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptionUsedInCommandLine(IBuildObject configuration,
|
public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) {
|
||||||
IHoldsOptions holder, IOption option) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptionVisible(IBuildObject configuration,
|
public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) {
|
||||||
IHoldsOptions holder, IOption option) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.internal.autotools.core.configure;
|
||||||
public class BinConfigureOption extends AbstractConfigurationOption {
|
public class BinConfigureOption extends AbstractConfigurationOption {
|
||||||
|
|
||||||
private boolean value;
|
private boolean value;
|
||||||
|
|
||||||
public BinConfigureOption(String name, AutotoolsConfiguration cfg) {
|
public BinConfigureOption(String name, AutotoolsConfiguration cfg) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
}
|
}
|
||||||
|
@ -29,25 +29,25 @@ public class BinConfigureOption extends AbstractConfigurationOption {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isParmSet() {
|
public boolean isParmSet() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
if (isParmSet())
|
if (isParmSet())
|
||||||
return getParameterName();
|
return getParameterName();
|
||||||
else
|
else
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return Boolean.toString(value);
|
return Boolean.toString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
boolean oldValue = this.value;
|
boolean oldValue = this.value;
|
||||||
|
@ -58,7 +58,7 @@ public class BinConfigureOption extends AbstractConfigurationOption {
|
||||||
if (this.value != oldValue)
|
if (this.value != oldValue)
|
||||||
cfg.setDirty(true);
|
cfg.setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigureOption copy(AutotoolsConfiguration config) {
|
public IConfigureOption copy(AutotoolsConfiguration config) {
|
||||||
return new BinConfigureOption(name, config, value);
|
return new BinConfigureOption(name, config, value);
|
||||||
|
|
|
@ -20,8 +20,7 @@ import java.util.ResourceBundle;
|
||||||
public class ConfigureMessages {
|
public class ConfigureMessages {
|
||||||
private static final String BUNDLE_NAME = ConfigureMessages.class.getName();
|
private static final String BUNDLE_NAME = ConfigureMessages.class.getName();
|
||||||
|
|
||||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||||
.getBundle(BUNDLE_NAME);
|
|
||||||
|
|
||||||
private ConfigureMessages() {
|
private ConfigureMessages() {
|
||||||
}
|
}
|
||||||
|
@ -29,7 +28,7 @@ public class ConfigureMessages {
|
||||||
public static String getConfigureDescription(String name) {
|
public static String getConfigureDescription(String name) {
|
||||||
return getString("Option.configure." + name); //$NON-NLS-11$
|
return getString("Option.configure." + name); //$NON-NLS-11$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getConfigureTip(String name) {
|
public static String getConfigureTip(String name) {
|
||||||
return getString("Option.configure." + name + ".tip"); //$NON-NLS-1$ //$NON-NLS-2$
|
return getString("Option.configure." + name + ".tip"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
@ -37,10 +36,11 @@ public class ConfigureMessages {
|
||||||
public static String getParameter(String name) {
|
public static String getParameter(String name) {
|
||||||
return getString("Option.configure." + name + ".parm"); //$NON-NLS-1$ //$NON-NLS-2$
|
return getString("Option.configure." + name + ".parm"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the string from the resource bundle,
|
* Returns the string from the resource bundle,
|
||||||
* or 'key' if not found.
|
* or 'key' if not found.
|
||||||
*
|
*
|
||||||
* @param key the message key
|
* @param key the message key
|
||||||
* @return the resource bundle message
|
* @return the resource bundle message
|
||||||
*/
|
*/
|
||||||
|
@ -51,17 +51,17 @@ public class ConfigureMessages {
|
||||||
return '!' + key + '!';
|
return '!' + key + '!';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the formatted string from the resource bundle,
|
* Returns the formatted string from the resource bundle,
|
||||||
* or 'key' if not found.
|
* or 'key' if not found.
|
||||||
*
|
*
|
||||||
* @param key the message key
|
* @param key the message key
|
||||||
* @param args an array of substituition strings
|
* @param args an array of substituition strings
|
||||||
* @return the resource bundle message
|
* @return the resource bundle message
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
return MessageFormat.format(getString(key), (Object[])args);
|
return MessageFormat.format(getString(key), (Object[]) args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@ import java.util.ArrayList;
|
||||||
public class ConfigureOptionCategory implements IConfigureOption {
|
public class ConfigureOptionCategory implements IConfigureOption {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ConfigureOptionCategory(String name) {
|
public ConfigureOptionCategory(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigureOption copy(AutotoolsConfiguration config) {
|
public IConfigureOption copy(AutotoolsConfiguration config) {
|
||||||
return new ConfigureOptionCategory(name);
|
return new ConfigureOptionCategory(name);
|
||||||
|
@ -47,7 +47,7 @@ public class ConfigureOptionCategory implements IConfigureOption {
|
||||||
public ArrayList<String> getParameters() {
|
public ArrayList<String> getParameters() {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToolTip() {
|
public String getToolTip() {
|
||||||
return "";
|
return "";
|
||||||
|
@ -77,12 +77,12 @@ public class ConfigureOptionCategory implements IConfigureOption {
|
||||||
public boolean isMultiArg() {
|
public boolean isMultiArg() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlag() {
|
public boolean isFlag() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlagValue() {
|
public boolean isFlagValue() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.ArrayList;
|
||||||
public class ConfigureTool extends AbstractConfigurationOption {
|
public class ConfigureTool extends AbstractConfigurationOption {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public ConfigureTool(String name, AutotoolsConfiguration cfg) {
|
public ConfigureTool(String name, AutotoolsConfiguration cfg) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = name;
|
this.value = name;
|
||||||
|
@ -33,12 +33,12 @@ public class ConfigureTool extends AbstractConfigurationOption {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String newValue) {
|
public void setValue(String newValue) {
|
||||||
if (!newValue.equals(value)) {
|
if (!newValue.equals(value)) {
|
||||||
|
@ -51,17 +51,17 @@ public class ConfigureTool extends AbstractConfigurationOption {
|
||||||
public boolean isParmSet() {
|
public boolean isParmSet() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> getParameters() {
|
public ArrayList<String> getParameters() {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigureOption copy(AutotoolsConfiguration config) {
|
public IConfigureOption copy(AutotoolsConfiguration config) {
|
||||||
return new ConfigureTool(name, config, value);
|
return new ConfigureTool(name, config, value);
|
||||||
|
|
|
@ -21,23 +21,23 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
private ArrayList<String> children = new ArrayList<>();
|
private ArrayList<String> children = new ArrayList<>();
|
||||||
|
|
||||||
public FlagConfigureOption(String name, AutotoolsConfiguration cfg) {
|
public FlagConfigureOption(String name, AutotoolsConfiguration cfg) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = name;
|
this.value = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlagConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
public FlagConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
||||||
super(name, msgName, cfg);
|
super(name, msgName, cfg);
|
||||||
this.value = name;
|
this.value = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FlagConfigureOption(String name, AutotoolsConfiguration cfg, String value, ArrayList<String> children) {
|
private FlagConfigureOption(String name, AutotoolsConfiguration cfg, String value, ArrayList<String> children) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.children = new ArrayList<>(children);
|
this.children = new ArrayList<>(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
StringBuilder parms = new StringBuilder();
|
StringBuilder parms = new StringBuilder();
|
||||||
|
@ -56,7 +56,7 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
|
||||||
IConfigureOption o = cfg.getOption(fvname);
|
IConfigureOption o = cfg.getOption(fvname);
|
||||||
if (o.isParmSet()) {
|
if (o.isParmSet()) {
|
||||||
if (o instanceof IFlagConfigureValueOption) {
|
if (o instanceof IFlagConfigureValueOption) {
|
||||||
parm.append(separator).append(((IFlagConfigureValueOption)o).getFlags());
|
parm.append(separator).append(((IFlagConfigureValueOption) o).getFlags());
|
||||||
separator = " "; //$NON-NLS-1$
|
separator = " "; //$NON-NLS-1$
|
||||||
haveParm = true;
|
haveParm = true;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
|
||||||
public String getParameterName() {
|
public String getParameterName() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isParmSet() {
|
public boolean isParmSet() {
|
||||||
for (int i = 0; i < children.size(); ++i) {
|
for (int i = 0; i < children.size(); ++i) {
|
||||||
|
@ -106,18 +106,18 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return FLAG;
|
return FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlag() {
|
public boolean isFlag() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addChild(String name) {
|
public void addChild(String name) {
|
||||||
children.add(name);
|
children.add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getChildren() {
|
public List<String> getChildren() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,13 @@ import java.util.ArrayList;
|
||||||
public class FlagValueConfigureOption extends BinConfigureOption implements IFlagConfigureValueOption {
|
public class FlagValueConfigureOption extends BinConfigureOption implements IFlagConfigureValueOption {
|
||||||
|
|
||||||
private String flags;
|
private String flags;
|
||||||
|
|
||||||
public FlagValueConfigureOption(String name, String msgName, AutotoolsConfiguration cfg,
|
public FlagValueConfigureOption(String name, String msgName, AutotoolsConfiguration cfg, String flags) {
|
||||||
String flags) {
|
|
||||||
super(name, msgName, cfg);
|
super(name, msgName, cfg);
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FlagValueConfigureOption(String name, AutotoolsConfiguration cfg, String value,
|
private FlagValueConfigureOption(String name, AutotoolsConfiguration cfg, String value, String flags) {
|
||||||
String flags) {
|
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.setValue(value);
|
this.setValue(value);
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
|
@ -36,7 +34,7 @@ public class FlagValueConfigureOption extends BinConfigureOption implements IFla
|
||||||
public ArrayList<String> getParameters() {
|
public ArrayList<String> getParameters() {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
return "";
|
return "";
|
||||||
|
@ -61,5 +59,5 @@ public class FlagValueConfigureOption extends BinConfigureOption implements IFla
|
||||||
public boolean isFlagValue() {
|
public boolean isFlagValue() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.autotools.core.IAutotoolsOption;
|
import org.eclipse.cdt.autotools.core.IAutotoolsOption;
|
||||||
|
|
||||||
public interface IConfigureOption {
|
public interface IConfigureOption {
|
||||||
|
|
||||||
int CATEGORY = IAutotoolsOption.CATEGORY;
|
int CATEGORY = IAutotoolsOption.CATEGORY;
|
||||||
int BIN = IAutotoolsOption.BIN;
|
int BIN = IAutotoolsOption.BIN;
|
||||||
int STRING = IAutotoolsOption.STRING;
|
int STRING = IAutotoolsOption.STRING;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.internal.autotools.core.configure;
|
package org.eclipse.cdt.internal.autotools.core.configure;
|
||||||
|
|
||||||
public interface IFlagConfigureValueOption {
|
public interface IFlagConfigureValueOption {
|
||||||
|
|
||||||
String getFlags();
|
String getFlags();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,28 +16,27 @@ package org.eclipse.cdt.internal.autotools.core.configure;
|
||||||
public class InternalConfigureOption extends AbstractConfigurationOption {
|
public class InternalConfigureOption extends AbstractConfigurationOption {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public InternalConfigureOption(String name, AutotoolsConfiguration cfg) {
|
public InternalConfigureOption(String name, AutotoolsConfiguration cfg) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = ""; //$NON-NLS-1$
|
this.value = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public InternalConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
public InternalConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
||||||
super(name, msgName, cfg);
|
super(name, msgName, cfg);
|
||||||
this.value = ""; //$NON-NLS-1$
|
this.value = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private InternalConfigureOption(String name, AutotoolsConfiguration cfg,
|
private InternalConfigureOption(String name, AutotoolsConfiguration cfg, String value) {
|
||||||
String value) {
|
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String newValue) {
|
public void setValue(String newValue) {
|
||||||
if (!newValue.equals(value)) {
|
if (!newValue.equals(value)) {
|
||||||
|
@ -50,12 +49,12 @@ public class InternalConfigureOption extends AbstractConfigurationOption {
|
||||||
public boolean isParmSet() {
|
public boolean isParmSet() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigureOption copy(AutotoolsConfiguration config) {
|
public IConfigureOption copy(AutotoolsConfiguration config) {
|
||||||
return new InternalConfigureOption(name, config, value);
|
return new InternalConfigureOption(name, config, value);
|
||||||
|
|
|
@ -16,34 +16,32 @@ package org.eclipse.cdt.internal.autotools.core.configure;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class MultiArgConfigureOption extends AbstractConfigurationOption {
|
public class MultiArgConfigureOption extends AbstractConfigurationOption {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
private List<String> userArgs;
|
private List<String> userArgs;
|
||||||
private boolean isDirty;
|
private boolean isDirty;
|
||||||
|
|
||||||
public MultiArgConfigureOption(String name, AutotoolsConfiguration cfg) {
|
public MultiArgConfigureOption(String name, AutotoolsConfiguration cfg) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = ""; //$NON-NLS-1$
|
this.value = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiArgConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
public MultiArgConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
||||||
super(name, msgName, cfg);
|
super(name, msgName, cfg);
|
||||||
this.value = ""; //$NON-NLS-1$
|
this.value = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private MultiArgConfigureOption(String name, AutotoolsConfiguration cfg,
|
private MultiArgConfigureOption(String name, AutotoolsConfiguration cfg, String value) {
|
||||||
String value) {
|
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String newValue) {
|
public void setValue(String newValue) {
|
||||||
if (!newValue.equals(value)) {
|
if (!newValue.equals(value)) {
|
||||||
|
@ -57,17 +55,17 @@ public class MultiArgConfigureOption extends AbstractConfigurationOption {
|
||||||
public boolean isParmSet() {
|
public boolean isParmSet() {
|
||||||
return value.length() > 0;
|
return value.length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMultiArg() {
|
public boolean isMultiArg() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getParameters() {
|
public List<String> getParameters() {
|
||||||
// May be multiple user-specified options in which case we
|
// May be multiple user-specified options in which case we
|
||||||
|
|
|
@ -13,32 +13,30 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.autotools.core.configure;
|
package org.eclipse.cdt.internal.autotools.core.configure;
|
||||||
|
|
||||||
|
|
||||||
public class StringConfigureOption extends AbstractConfigurationOption {
|
public class StringConfigureOption extends AbstractConfigurationOption {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public StringConfigureOption(String name, AutotoolsConfiguration cfg) {
|
public StringConfigureOption(String name, AutotoolsConfiguration cfg) {
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = ""; //$NON-NLS-1$
|
this.value = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
public StringConfigureOption(String name, String msgName, AutotoolsConfiguration cfg) {
|
||||||
super(name, msgName, cfg);
|
super(name, msgName, cfg);
|
||||||
this.value = ""; //$NON-NLS-1$
|
this.value = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringConfigureOption(String name, AutotoolsConfiguration cfg,
|
private StringConfigureOption(String name, AutotoolsConfiguration cfg, String value) {
|
||||||
String value) {
|
|
||||||
super(name, cfg);
|
super(name, cfg);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String newValue) {
|
public void setValue(String newValue) {
|
||||||
if (!newValue.equals(value)) {
|
if (!newValue.equals(value)) {
|
||||||
|
@ -51,14 +49,14 @@ public class StringConfigureOption extends AbstractConfigurationOption {
|
||||||
public boolean isParmSet() {
|
public boolean isParmSet() {
|
||||||
return value.length() > 0;
|
return value.length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParameter() {
|
public String getParameter() {
|
||||||
if (isParmSet())
|
if (isParmSet())
|
||||||
return getParameterName() + "=" + getValue(); //$NON-NLS-1$
|
return getParameterName() + "=" + getValue(); //$NON-NLS-1$
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigureOption copy(AutotoolsConfiguration config) {
|
public IConfigureOption copy(AutotoolsConfiguration config) {
|
||||||
return new StringConfigureOption(name, config, value);
|
return new StringConfigureOption(name, config, value);
|
||||||
|
|
|
@ -40,7 +40,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Project in the workspace.
|
* Creates a new Project in the workspace.
|
||||||
*/
|
*/
|
||||||
|
@ -48,19 +47,20 @@ public class NewAutotoolsProject extends ProcessRunner {
|
||||||
protected boolean savedAutoBuildingValue;
|
protected boolean savedAutoBuildingValue;
|
||||||
protected ProjectCreatedActions pca;
|
protected ProjectCreatedActions pca;
|
||||||
protected IManagedBuildInfo info;
|
protected IManagedBuildInfo info;
|
||||||
|
|
||||||
public NewAutotoolsProject() {
|
public NewAutotoolsProject() {
|
||||||
pca = new ProjectCreatedActions();
|
pca = new ProjectCreatedActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
|
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
|
||||||
|
throws ProcessFailureException {
|
||||||
String projectName = args[0].getSimpleValue();
|
String projectName = args[0].getSimpleValue();
|
||||||
String location = args[1].getSimpleValue();
|
String location = args[1].getSimpleValue();
|
||||||
String artifactExtension = args[2].getSimpleValue();
|
String artifactExtension = args[2].getSimpleValue();
|
||||||
String isCProjectValue = args[3].getSimpleValue();
|
String isCProjectValue = args[3].getSimpleValue();
|
||||||
boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
|
boolean isCProject = Boolean.valueOf(isCProjectValue).booleanValue();
|
||||||
|
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -85,7 +85,7 @@ public class NewAutotoolsProject extends ProcessRunner {
|
||||||
info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);
|
info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject);
|
||||||
|
|
||||||
AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
|
AutotoolsNewProjectNature.addAutotoolsNature(project, monitor);
|
||||||
|
|
||||||
// For each IConfiguration, create a corresponding Autotools Configuration
|
// For each IConfiguration, create a corresponding Autotools Configuration
|
||||||
IConfiguration[] cfgs = pca.getConfigs();
|
IConfiguration[] cfgs = pca.getConfigs();
|
||||||
for (int i = 0; i < cfgs.length; ++i) {
|
for (int i = 0; i < cfgs.length; ++i) {
|
||||||
|
@ -115,13 +115,13 @@ public class NewAutotoolsProject extends ProcessRunner {
|
||||||
workspaceDesc.setAutoBuilding(false);
|
workspaceDesc.setAutoBuilding(false);
|
||||||
workspace.setDescription(workspaceDesc);
|
workspace.setDescription(workspaceDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException {
|
protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException {
|
||||||
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
||||||
workspaceDesc.setAutoBuilding(savedAutoBuildingValue);
|
workspaceDesc.setAutoBuilding(savedAutoBuildingValue);
|
||||||
workspace.setDescription(workspaceDesc);
|
workspace.setDescription(workspaceDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setOptionValue
|
* setOptionValue
|
||||||
* @param config
|
* @param config
|
||||||
|
@ -134,7 +134,8 @@ public class NewAutotoolsProject extends ProcessRunner {
|
||||||
if (!option.isExtensionElement()) {
|
if (!option.isExtensionElement()) {
|
||||||
option.setValue(val);
|
option.setValue(val);
|
||||||
} else {
|
} else {
|
||||||
IOption newOption = config.getToolChain().createOption(option, option.getId() + "." + ManagedBuildManager.getRandomNumber(), option.getName(), false); //$NON-NLS-1$
|
IOption newOption = config.getToolChain().createOption(option,
|
||||||
|
option.getId() + "." + ManagedBuildManager.getRandomNumber(), option.getName(), false); //$NON-NLS-1$
|
||||||
newOption.setValue(val);
|
newOption.setValue(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,13 +43,13 @@ public class SetAutotoolsStringOptionValue extends ProcessRunner {
|
||||||
workspace.setDescription(workspaceDesc);
|
workspace.setDescription(workspaceDesc);
|
||||||
} catch (CoreException e) {//ignore
|
} catch (CoreException e) {//ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessArgument[][] resourcePathObjects = args[1].getComplexArrayValue();
|
ProcessArgument[][] resourcePathObjects = args[1].getComplexArrayValue();
|
||||||
for(int i=0; i<resourcePathObjects.length; i++) {
|
for (int i = 0; i < resourcePathObjects.length; i++) {
|
||||||
ProcessArgument[] resourcePathObject = resourcePathObjects[i];
|
ProcessArgument[] resourcePathObject = resourcePathObjects[i];
|
||||||
String id = resourcePathObject[0].getSimpleValue();
|
String id = resourcePathObject[0].getSimpleValue();
|
||||||
String value = resourcePathObject[1].getSimpleValue();
|
String value = resourcePathObject[1].getSimpleValue();
|
||||||
setOptionValue(projectHandle, id, value);
|
setOptionValue(projectHandle, id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
workspaceDesc.setAutoBuilding(autoBuilding);
|
workspaceDesc.setAutoBuilding(autoBuilding);
|
||||||
|
@ -58,16 +58,15 @@ public class SetAutotoolsStringOptionValue extends ProcessRunner {
|
||||||
} catch (CoreException e) {//ignore
|
} catch (CoreException e) {//ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOptionValue(IProject projectHandle, String id, String value) {
|
private void setOptionValue(IProject projectHandle, String id, String value) {
|
||||||
|
|
||||||
AutotoolsConfigurationManager.getInstance().syncConfigurations(projectHandle);
|
AutotoolsConfigurationManager.getInstance().syncConfigurations(projectHandle);
|
||||||
ICConfigurationDescription[] cfgds =
|
ICConfigurationDescription[] cfgds = CoreModel.getDefault().getProjectDescription(projectHandle)
|
||||||
CoreModel.getDefault().getProjectDescription(projectHandle).getConfigurations();
|
.getConfigurations();
|
||||||
if (cfgds != null && cfgds.length >= 1) {
|
if (cfgds != null && cfgds.length >= 1) {
|
||||||
IAConfiguration iaConfig =
|
IAConfiguration iaConfig = AutotoolsConfigurationManager.getInstance().getConfiguration(projectHandle,
|
||||||
AutotoolsConfigurationManager.getInstance().getConfiguration(projectHandle,
|
cfgds[0].getId());
|
||||||
cfgds[0].getId());
|
|
||||||
iaConfig.setOption(id, value);
|
iaConfig.setOption(id, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,8 @@ import org.junit.runners.Suite;
|
||||||
|
|
||||||
/** On Windows requires either Cygwin or MinGW to be in PATH */
|
/** On Windows requires either Cygwin or MinGW to be in PATH */
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({ AutotoolsProjectTest0.class, AutotoolsProjectNatureTest.class, AutotoolsProjectTest1.class,
|
||||||
AutotoolsProjectTest0.class,
|
AutotoolsProjectTest2.class, AutotoolsVirtualFolderTest.class, AutotoolsEnvironmentVarTest.class,
|
||||||
AutotoolsProjectNatureTest.class,
|
LibtoolGCCBuildCommandParserTest.class, UpdateConfigureTest.class, EditorTests.class })
|
||||||
AutotoolsProjectTest1.class,
|
|
||||||
AutotoolsProjectTest2.class,
|
|
||||||
AutotoolsVirtualFolderTest.class,
|
|
||||||
AutotoolsEnvironmentVarTest.class,
|
|
||||||
LibtoolGCCBuildCommandParserTest.class,
|
|
||||||
UpdateConfigureTest.class,
|
|
||||||
EditorTests.class
|
|
||||||
})
|
|
||||||
public class AutomatedIntegrationSuite {
|
public class AutomatedIntegrationSuite {
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,4 +88,3 @@ public class AutotoolsEnvironmentVarTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,18 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class AutotoolsProjectNatureTest {
|
public class AutotoolsProjectNatureTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws CoreException {
|
public void setUp() throws CoreException {
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAutotoolsProjectNature() throws Exception {
|
public void testAutotoolsProjectNature() throws Exception {
|
||||||
IProject testProject = ProjectTools.createProject("testProject");
|
IProject testProject = ProjectTools.createProject("testProject");
|
||||||
if(testProject == null) {
|
if (testProject == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
assertTrue(testProject.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID));
|
assertTrue(testProject.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID));
|
||||||
testProject.delete(true, false, ProjectTools.getMonitor());
|
testProject.delete(true, false, ProjectTools.getMonitor());
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,25 +28,26 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class AutotoolsProjectTest0 {
|
public class AutotoolsProjectTest0 {
|
||||||
|
|
||||||
private IProject testProject;
|
private IProject testProject;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
testProject = ProjectTools.createProject("testProject0");
|
testProject = ProjectTools.createProject("testProject0");
|
||||||
if (testProject == null) {
|
if (testProject == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
testProject.open(new NullProgressMonitor());
|
testProject.open(new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test sample project which has a hello world program. The top-level
|
* Test sample project which has a hello world program. The top-level
|
||||||
* configure is found in the top-level directory. The hello world source
|
* configure is found in the top-level directory. The hello world source
|
||||||
* is found in sample/hello.c.
|
* is found in sample/hello.c.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAutotoolsProject0() throws Exception {
|
public void testAutotoolsProject0() throws Exception {
|
||||||
Path p = new Path("zip/project1.zip");
|
Path p = new Path("zip/project1.zip");
|
||||||
|
@ -72,6 +73,7 @@ public class AutotoolsProjectTest0 {
|
||||||
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
||||||
assertTrue(testProject.exists(x));
|
assertTrue(testProject.exists(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
|
@ -28,27 +28,28 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class AutotoolsProjectTest1 {
|
public class AutotoolsProjectTest1 {
|
||||||
|
|
||||||
private IProject testProject;
|
private IProject testProject;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
testProject = ProjectTools.createProject("testProject1");
|
testProject = ProjectTools.createProject("testProject1");
|
||||||
if (testProject == null) {
|
if (testProject == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
testProject.open(new NullProgressMonitor());
|
testProject.open(new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test sample project which has a hello world program. The top-level
|
* Test sample project which has a hello world program. The top-level
|
||||||
* configure is found in the subdirectory src which also contains the
|
* configure is found in the subdirectory src which also contains the
|
||||||
* subdirectory sample. The hello world source is found in
|
* subdirectory sample. The hello world source is found in
|
||||||
* src/sample/hello.c so configuration must create multiple
|
* src/sample/hello.c so configuration must create multiple
|
||||||
* Makefiles.
|
* Makefiles.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAutotoolsProject1() throws Exception {
|
public void testAutotoolsProject1() throws Exception {
|
||||||
Path p = new Path("zip/project1.zip");
|
Path p = new Path("zip/project1.zip");
|
||||||
|
@ -75,6 +76,7 @@ public class AutotoolsProjectTest1 {
|
||||||
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
||||||
assertTrue(testProject.exists(x));
|
assertTrue(testProject.exists(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
|
@ -31,27 +31,28 @@ import org.junit.Test;
|
||||||
// This test verifies an autogen.sh project that builds configure, but
|
// This test verifies an autogen.sh project that builds configure, but
|
||||||
// does not run it.
|
// does not run it.
|
||||||
public class AutotoolsProjectTest2 {
|
public class AutotoolsProjectTest2 {
|
||||||
|
|
||||||
private IProject testProject;
|
private IProject testProject;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
testProject = ProjectTools.createProject("testProject2");
|
testProject = ProjectTools.createProject("testProject2");
|
||||||
if (testProject == null) {
|
if (testProject == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
testProject.open(new NullProgressMonitor());
|
testProject.open(new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test sample project which has a hello world program. The top-level
|
* Test sample project which has a hello world program. The top-level
|
||||||
* contains autogen.sh which will build configure, but not run it.
|
* contains autogen.sh which will build configure, but not run it.
|
||||||
* The hello world source is found in
|
* The hello world source is found in
|
||||||
* src/sample/hello.c so configuration must create multiple
|
* src/sample/hello.c so configuration must create multiple
|
||||||
* Makefiles.
|
* Makefiles.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAutotoolsProject2() throws Exception {
|
public void testAutotoolsProject2() throws Exception {
|
||||||
Path p = new Path("zip/project2.zip");
|
Path p = new Path("zip/project2.zip");
|
||||||
|
@ -89,6 +90,7 @@ public class AutotoolsProjectTest2 {
|
||||||
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
||||||
assertTrue(testProject.exists(x));
|
assertTrue(testProject.exists(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class AutotoolsVirtualFolderTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test sample project with a virtual folder that points to configure scripts.
|
* Test sample project with a virtual folder that points to configure scripts.
|
||||||
* Tests Bug 434275 - Autotools configuration in subfolder not found
|
* Tests Bug 434275 - Autotools configuration in subfolder not found
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -60,23 +60,22 @@ import org.eclipse.ui.wizards.datatransfer.ImportOperation;
|
||||||
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
|
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
|
||||||
import org.osgi.framework.FrameworkUtil;
|
import org.osgi.framework.FrameworkUtil;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class ProjectTools {
|
public class ProjectTools {
|
||||||
|
|
||||||
static IWorkspace workspace;
|
static IWorkspace workspace;
|
||||||
static IWorkspaceRoot root;
|
static IWorkspaceRoot root;
|
||||||
static NullProgressMonitor monitor;
|
static NullProgressMonitor monitor;
|
||||||
static String pluginRoot;
|
static String pluginRoot;
|
||||||
static ConvertProjectWizardPage page;
|
static ConvertProjectWizardPage page;
|
||||||
static boolean setupComplete;
|
static boolean setupComplete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup routine for tests.
|
* Setup routine for tests.
|
||||||
* @return true if setup successful, false otherwise
|
* @return true if setup successful, false otherwise
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static boolean setup() throws CoreException {
|
public static boolean setup() throws CoreException {
|
||||||
if (!setupComplete) {
|
if (!setupComplete) {
|
||||||
IWorkspaceDescription desc;
|
IWorkspaceDescription desc;
|
||||||
workspace = ResourcesPlugin.getWorkspace();
|
workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
@ -95,7 +94,7 @@ public class ProjectTools {
|
||||||
setupComplete = true;
|
setupComplete = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the project.
|
* Build the project.
|
||||||
* @return true if build started successfully or false otherwise
|
* @return true if build started successfully or false otherwise
|
||||||
|
@ -105,11 +104,11 @@ public class ProjectTools {
|
||||||
workspace.build(IncrementalProjectBuilder.FULL_BUILD, getMonitor());
|
workspace.build(IncrementalProjectBuilder.FULL_BUILD, getMonitor());
|
||||||
workspace.getRoot().refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
|
workspace.getRoot().refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default monitor.
|
* Get the default monitor.
|
||||||
* @return The current monitor
|
* @return The current monitor
|
||||||
|
@ -145,7 +144,7 @@ public class ProjectTools {
|
||||||
// if the path points to an actual object, use its resource to get its run path location
|
// if the path points to an actual object, use its resource to get its run path location
|
||||||
// which will handle any linked directories
|
// which will handle any linked directories
|
||||||
if (project.findMember(filePath) != null)
|
if (project.findMember(filePath) != null)
|
||||||
runPath = project.findMember(filePath).getLocation().removeLastSegments(1);
|
runPath = project.findMember(filePath).getLocation().removeLastSegments(1);
|
||||||
String[] args = new String[2];
|
String[] args = new String[2];
|
||||||
args[0] = "+x";
|
args[0] = "+x";
|
||||||
// if the path points to an actual object, use its resource to get its location
|
// if the path points to an actual object, use its resource to get its location
|
||||||
|
@ -155,8 +154,7 @@ public class ProjectTools {
|
||||||
else // otherwise, just append to project location
|
else // otherwise, just append to project location
|
||||||
args[1] = project.getLocation().append(filePath).toOSString();
|
args[1] = project.getLocation().append(filePath).toOSString();
|
||||||
try {
|
try {
|
||||||
Process proc = launcher.execute(commandPath, args, new String[0],
|
Process proc = launcher.execute(commandPath, args, new String[0], runPath, new NullProgressMonitor());
|
||||||
runPath, new NullProgressMonitor());
|
|
||||||
if (proc != null) {
|
if (proc != null) {
|
||||||
try {
|
try {
|
||||||
// Close the input of the process since we will never write to
|
// Close the input of the process since we will never write to
|
||||||
|
@ -176,7 +174,7 @@ public class ProjectTools {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inner class to allow us to fake a project wizard without starting up
|
// Inner class to allow us to fake a project wizard without starting up
|
||||||
// the UI for it.
|
// the UI for it.
|
||||||
protected static class ConvertToAutotoolsProjectWizardTest extends ConvertToAutotoolsProjectWizard {
|
protected static class ConvertToAutotoolsProjectWizardTest extends ConvertToAutotoolsProjectWizard {
|
||||||
|
@ -194,30 +192,32 @@ public class ProjectTools {
|
||||||
@Override
|
@Override
|
||||||
public void applyOptions(IProject project, IProgressMonitor monitor) {
|
public void applyOptions(IProject project, IProgressMonitor monitor) {
|
||||||
setCurrentProject(project);
|
setCurrentProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfiguration[] getSelectedConfigurations() {
|
public IConfiguration[] getSelectedConfigurations() {
|
||||||
IProjectType projectType = ManagedBuildManager.getExtensionProjectType("org.eclipse.linuxtools.cdt.autotools.core.projectType"); //$NON-NLS-1$
|
IProjectType projectType = ManagedBuildManager
|
||||||
|
.getExtensionProjectType("org.eclipse.linuxtools.cdt.autotools.core.projectType"); //$NON-NLS-1$
|
||||||
return projectType.getConfigurations();
|
return projectType.getConfigurations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty Autotools project.
|
* Creates an empty Autotools project.
|
||||||
* @param name The name of the new project
|
* @param name The name of the new project
|
||||||
* @return The newly created project or null
|
* @return The newly created project or null
|
||||||
*/
|
*/
|
||||||
public static IProject createProject(String name) {
|
public static IProject createProject(String name) {
|
||||||
IProject testProject = root.getProject(name);
|
IProject testProject = root.getProject(name);
|
||||||
if (testProject == null) {
|
if (testProject == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IProjectDescription description = workspace.newProjectDescription(name);
|
IProjectDescription description = workspace.newProjectDescription(name);
|
||||||
try {
|
try {
|
||||||
testProject.create(monitor);
|
testProject.create(monitor);
|
||||||
testProject.open(monitor);
|
testProject.open(monitor);
|
||||||
IProject newProject = CCorePlugin.getDefault().createCDTProject(description, testProject, SubMonitor.convert(monitor,25));
|
IProject newProject = CCorePlugin.getDefault().createCDTProject(description, testProject,
|
||||||
|
SubMonitor.convert(monitor, 25));
|
||||||
ConvertToAutotoolsProjectWizardTest wizard = new ConvertToAutotoolsProjectWizardTest();
|
ConvertToAutotoolsProjectWizardTest wizard = new ConvertToAutotoolsProjectWizardTest();
|
||||||
wizard.addPages();
|
wizard.addPages();
|
||||||
ConvertToAutotoolsProjectWizardPage page = new ConvertToAutotoolsProjectWizardPage("test", wizard);
|
ConvertToAutotoolsProjectWizardPage page = new ConvertToAutotoolsProjectWizardPage("test", wizard);
|
||||||
|
@ -227,7 +227,7 @@ public class ProjectTools {
|
||||||
}
|
}
|
||||||
return testProject;
|
return testProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the configuration source directory for an Autotools project.
|
* Set the configuration source directory for an Autotools project.
|
||||||
* @param project The Autotools project to modify
|
* @param project The Autotools project to modify
|
||||||
|
@ -241,11 +241,13 @@ public class ProjectTools {
|
||||||
IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id, true);
|
IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id, true);
|
||||||
cfg.setConfigToolDirectory(dir);
|
cfg.setConfigToolDirectory(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException {
|
private static void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor)
|
||||||
ZipFileStructureProvider structureProvider= new ZipFileStructureProvider(srcZipFile);
|
throws InvocationTargetException {
|
||||||
|
ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(srcZipFile);
|
||||||
try {
|
try {
|
||||||
ImportOperation op= new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, new ImportOverwriteQuery());
|
ImportOperation op = new ImportOperation(destPath, structureProvider.getRoot(), structureProvider,
|
||||||
|
new ImportOverwriteQuery());
|
||||||
op.run(monitor);
|
op.run(monitor);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// should not happen
|
// should not happen
|
||||||
|
@ -257,17 +259,16 @@ public class ProjectTools {
|
||||||
CommandLauncher launcher = new CommandLauncher();
|
CommandLauncher launcher = new CommandLauncher();
|
||||||
OutputStream stdout = new ByteArrayOutputStream();
|
OutputStream stdout = new ByteArrayOutputStream();
|
||||||
OutputStream stderr = new ByteArrayOutputStream();
|
OutputStream stderr = new ByteArrayOutputStream();
|
||||||
|
|
||||||
IPath runPath = root.getLocation().append(destPath);
|
IPath runPath = root.getLocation().append(destPath);
|
||||||
|
|
||||||
// Run the genfiles.sh shell script which will simulate
|
// Run the genfiles.sh shell script which will simulate
|
||||||
// running aclocal, autoconf, and automake
|
// running aclocal, autoconf, and automake
|
||||||
launcher.showCommand(true);
|
launcher.showCommand(true);
|
||||||
IPath commandPath = new Path("sh");
|
IPath commandPath = new Path("sh");
|
||||||
String[] cmdargs = new String[]{"genfiles.sh"};
|
String[] cmdargs = new String[] { "genfiles.sh" };
|
||||||
try {
|
try {
|
||||||
Process proc = launcher.execute(commandPath, cmdargs, new String[0],
|
Process proc = launcher.execute(commandPath, cmdargs, new String[0], runPath, new NullProgressMonitor());
|
||||||
runPath, new NullProgressMonitor());
|
|
||||||
if (proc != null) {
|
if (proc != null) {
|
||||||
try {
|
try {
|
||||||
// Close the input of the process since we will never write to
|
// Close the input of the process since we will never write to
|
||||||
|
@ -276,8 +277,8 @@ public class ProjectTools {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (launcher.waitAndRead(stdout, stderr, SubMonitor.convert(
|
if (launcher.waitAndRead(stdout, stderr,
|
||||||
monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
|
SubMonitor.convert(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -289,42 +290,43 @@ public class ProjectTools {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void importFilesFromZipAndGenerate(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException {
|
private static void importFilesFromZipAndGenerate(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor)
|
||||||
|
throws InvocationTargetException {
|
||||||
importFilesFromZip(srcZipFile, destPath, monitor);
|
importFilesFromZip(srcZipFile, destPath, monitor);
|
||||||
if (!generateFiles(destPath))
|
if (!generateFiles(destPath))
|
||||||
throw new InvocationTargetException(new Exception("Unsuccessful test file generation"));
|
throw new InvocationTargetException(new Exception("Unsuccessful test file generation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ImportOverwriteQuery implements IOverwriteQuery {
|
private static class ImportOverwriteQuery implements IOverwriteQuery {
|
||||||
@Override
|
@Override
|
||||||
public String queryOverwrite(String file) {
|
public String queryOverwrite(String file) {
|
||||||
return ALL;
|
return ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a source container to a IProject.
|
* Adds a source container to a IProject.
|
||||||
* @param jproject The parent project
|
* @param jproject The parent project
|
||||||
* @param containerName The name of the new source container
|
* @param containerName The name of the new source container
|
||||||
* @return The handle to the new source container
|
* @return The handle to the new source container
|
||||||
* @throws CoreException Creation failed
|
* @throws CoreException Creation failed
|
||||||
*/
|
*/
|
||||||
public static IContainer addSourceContainer(IProject jproject, String containerName) throws CoreException {
|
public static IContainer addSourceContainer(IProject jproject, String containerName) throws CoreException {
|
||||||
IProject project= jproject.getProject();
|
IProject project = jproject.getProject();
|
||||||
IContainer container= null;
|
IContainer container = null;
|
||||||
if (containerName == null || containerName.length() == 0) {
|
if (containerName == null || containerName.length() == 0) {
|
||||||
container= project;
|
container = project;
|
||||||
} else {
|
} else {
|
||||||
IFolder folder= project.getFolder(containerName);
|
IFolder folder = project.getFolder(containerName);
|
||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
createFolder(folder, false, true, null);
|
createFolder(folder, false, true, null);
|
||||||
}
|
}
|
||||||
container= folder;
|
container = folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a source container to a IProject and imports all files contained
|
* Adds a source container to a IProject and imports all files contained
|
||||||
* in the given ZIP file.
|
* in the given ZIP file.
|
||||||
|
@ -337,10 +339,11 @@ public class ProjectTools {
|
||||||
* @throws InvocationTargetException Creation failed
|
* @throws InvocationTargetException Creation failed
|
||||||
* @throws CoreException Creation failed
|
* @throws CoreException Creation failed
|
||||||
* @throws IOException Creation failed
|
* @throws IOException Creation failed
|
||||||
*/
|
*/
|
||||||
public static IContainer addSourceContainerWithImport(IProject project, String containerName, File zipFile, boolean generate) throws InvocationTargetException, CoreException, IOException {
|
public static IContainer addSourceContainerWithImport(IProject project, String containerName, File zipFile,
|
||||||
try (ZipFile file= new ZipFile(zipFile)){
|
boolean generate) throws InvocationTargetException, CoreException, IOException {
|
||||||
IContainer root= addSourceContainer(project, containerName);
|
try (ZipFile file = new ZipFile(zipFile)) {
|
||||||
|
IContainer root = addSourceContainer(project, containerName);
|
||||||
if (generate)
|
if (generate)
|
||||||
importFilesFromZipAndGenerate(file, root.getFullPath(), null);
|
importFilesFromZipAndGenerate(file, root.getFullPath(), null);
|
||||||
else
|
else
|
||||||
|
@ -360,12 +363,14 @@ public class ProjectTools {
|
||||||
* @throws InvocationTargetException Creation failed
|
* @throws InvocationTargetException Creation failed
|
||||||
* @throws CoreException Creation failed
|
* @throws CoreException Creation failed
|
||||||
* @throws IOException Creation failed
|
* @throws IOException Creation failed
|
||||||
*/
|
*/
|
||||||
public static IContainer addSourceContainerWithImport(IProject project, String containerName, Path zipFilePath, boolean generate) throws InvocationTargetException, CoreException, IOException {
|
public static IContainer addSourceContainerWithImport(IProject project, String containerName, Path zipFilePath,
|
||||||
File zipFile = new File(FileLocator.toFileURL(FileLocator.find(FrameworkUtil.getBundle(ProjectTools.class), zipFilePath, null)).getFile());
|
boolean generate) throws InvocationTargetException, CoreException, IOException {
|
||||||
|
File zipFile = new File(FileLocator
|
||||||
|
.toFileURL(FileLocator.find(FrameworkUtil.getBundle(ProjectTools.class), zipFilePath, null)).getFile());
|
||||||
return addSourceContainerWithImport(project, containerName, zipFile, generate);
|
return addSourceContainerWithImport(project, containerName, zipFile, generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a source container to a IProject and imports all files contained
|
* Adds a source container to a IProject and imports all files contained
|
||||||
* in the given ZIP file.
|
* in the given ZIP file.
|
||||||
|
@ -376,8 +381,9 @@ public class ProjectTools {
|
||||||
* @throws InvocationTargetException Creation failed
|
* @throws InvocationTargetException Creation failed
|
||||||
* @throws CoreException Creation failed
|
* @throws CoreException Creation failed
|
||||||
* @throws IOException Creation failed
|
* @throws IOException Creation failed
|
||||||
*/
|
*/
|
||||||
public static IContainer addSourceContainerWithImport(IProject project, String containerName, Path zipFilePath) throws InvocationTargetException, CoreException, IOException {
|
public static IContainer addSourceContainerWithImport(IProject project, String containerName, Path zipFilePath)
|
||||||
|
throws InvocationTargetException, CoreException, IOException {
|
||||||
return addSourceContainerWithImport(project, containerName, zipFilePath, false);
|
return addSourceContainerWithImport(project, containerName, zipFilePath, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,17 +401,18 @@ public class ProjectTools {
|
||||||
file.setContents(new ByteArrayInputStream(contents.getBytes()), false, false, null);
|
file.setContents(new ByteArrayInputStream(contents.getBytes()), false, false, null);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a linked folder for a project
|
* Create a linked folder for a project
|
||||||
* @param project The project
|
* @param project The project
|
||||||
* @param folderName Name of the linked folder in the project
|
* @param folderName Name of the linked folder in the project
|
||||||
* @param path The URI of the real file/folder
|
* @param path The URI of the real file/folder
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static IFolder createLinkedFolder(IProject project, String folderName, final URI linkTarget) throws Exception {
|
public static IFolder createLinkedFolder(IProject project, String folderName, final URI linkTarget)
|
||||||
|
throws Exception {
|
||||||
final IFolder folderHandle = root.getFolder(project.getFullPath().append(folderName));
|
final IFolder folderHandle = root.getFolder(project.getFullPath().append(folderName));
|
||||||
|
|
||||||
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
|
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
|
||||||
|
@ -439,14 +446,15 @@ public class ProjectTools {
|
||||||
* <code> org.eclipse.ui.dialogs.ContainerGenerator</code> is too heavy
|
* <code> org.eclipse.ui.dialogs.ContainerGenerator</code> is too heavy
|
||||||
* (creates a runnable)
|
* (creates a runnable)
|
||||||
*/
|
*/
|
||||||
public static void createFolder(IFolder folder, boolean force, boolean local, IProgressMonitor monitor) throws CoreException {
|
public static void createFolder(IFolder folder, boolean force, boolean local, IProgressMonitor monitor)
|
||||||
|
throws CoreException {
|
||||||
if (!folder.exists()) {
|
if (!folder.exists()) {
|
||||||
IContainer parent= folder.getParent();
|
IContainer parent = folder.getParent();
|
||||||
if (parent instanceof IFolder) {
|
if (parent instanceof IFolder) {
|
||||||
createFolder((IFolder)parent, force, local, null);
|
createFolder((IFolder) parent, force, local, null);
|
||||||
}
|
}
|
||||||
folder.create(force, local, monitor);
|
folder.create(force, local, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,24 +54,25 @@ import org.xml.sax.SAXException;
|
||||||
// This test verifies an autogen.sh project that builds configure, but
|
// This test verifies an autogen.sh project that builds configure, but
|
||||||
// does not run it.
|
// does not run it.
|
||||||
public class UpdateConfigureTest {
|
public class UpdateConfigureTest {
|
||||||
|
|
||||||
private IProject testProject;
|
private IProject testProject;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
testProject = ProjectTools.createProject("testProject2");
|
testProject = ProjectTools.createProject("testProject2");
|
||||||
if (testProject == null) {
|
if (testProject == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
testProject.open(new NullProgressMonitor());
|
testProject.open(new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test setting the special advanced options for gcov, gprof, and debug flags. Verify that
|
* Test setting the special advanced options for gcov, gprof, and debug flags. Verify that
|
||||||
* the configure script sets both the C and C++ flags.
|
* the configure script sets both the C and C++ flags.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGprofGcovDebugFlagOptions() throws Exception {
|
public void testGprofGcovDebugFlagOptions() throws Exception {
|
||||||
Path p = new Path("zip/project2.zip");
|
Path p = new Path("zip/project2.zip");
|
||||||
|
@ -80,48 +81,50 @@ public class UpdateConfigureTest {
|
||||||
ProjectTools.setConfigDir(testProject, "src");
|
ProjectTools.setConfigDir(testProject, "src");
|
||||||
ProjectTools.markExecutable(testProject, "src/autogen.sh");
|
ProjectTools.markExecutable(testProject, "src/autogen.sh");
|
||||||
assertTrue(ProjectTools.build());
|
assertTrue(ProjectTools.build());
|
||||||
ICConfigurationDescription cfgDes = CoreModel.getDefault().getProjectDescription(testProject).getActiveConfiguration();
|
ICConfigurationDescription cfgDes = CoreModel.getDefault().getProjectDescription(testProject)
|
||||||
|
.getActiveConfiguration();
|
||||||
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
|
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
|
||||||
assertTrue(cfg.getName().equals("Build (GNU)"));
|
assertTrue(cfg.getName().equals("Build (GNU)"));
|
||||||
Map<String, IAutotoolsOption> opts = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
Map<String, IAutotoolsOption> opts = AutotoolsConfigurationManager.getInstance()
|
||||||
|
.getAutotoolsCfgOptions(testProject, cfg.getId());
|
||||||
|
|
||||||
IAutotoolsOption k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
IAutotoolsOption k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
// Now update the options we changed
|
// Now update the options we changed
|
||||||
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
||||||
|
|
||||||
// Rebuild project
|
// Rebuild project
|
||||||
assertTrue(ProjectTools.build());
|
assertTrue(ProjectTools.build());
|
||||||
|
|
||||||
org.eclipse.core.runtime.Path x = new org.eclipse.core.runtime.Path("config.log");
|
org.eclipse.core.runtime.Path x = new org.eclipse.core.runtime.Path("config.log");
|
||||||
assertTrue(testProject.exists(x));
|
assertTrue(testProject.exists(x));
|
||||||
|
|
||||||
IResource r = testProject.findMember(x);
|
IResource r = testProject.findMember(x);
|
||||||
|
|
||||||
File f = r.getLocation().toFile();
|
File f = r.getLocation().toFile();
|
||||||
|
|
||||||
char[] cbuf = new char[2000];
|
char[] cbuf = new char[2000];
|
||||||
try (FileReader fr = new FileReader(f)) {
|
try (FileReader fr = new FileReader(f)) {
|
||||||
fr.read(cbuf);
|
fr.read(cbuf);
|
||||||
String s = new String(cbuf);
|
String s = new String(cbuf);
|
||||||
assertTrue(s.contains("testProject2/src/configure CFLAGS=-pg CXXFLAGS=-pg"));
|
assertTrue(s.contains("testProject2/src/configure CFLAGS=-pg CXXFLAGS=-pg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset gprof opt and set gcov opt
|
// Reset gprof opt and set gcov opt
|
||||||
opts = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
opts = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
||||||
k.setValue("false");
|
k.setValue("false");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
// Now update the options we changed
|
// Now update the options we changed
|
||||||
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
||||||
|
|
||||||
// Rebuild project
|
// Rebuild project
|
||||||
assertTrue(ProjectTools.build());
|
assertTrue(ProjectTools.build());
|
||||||
|
|
||||||
r = testProject.findMember(x);
|
r = testProject.findMember(x);
|
||||||
f = r.getLocation().toFile();
|
f = r.getLocation().toFile();
|
||||||
try (FileReader fr = new FileReader(f)) {
|
try (FileReader fr = new FileReader(f)) {
|
||||||
|
@ -131,21 +134,21 @@ public class UpdateConfigureTest {
|
||||||
"testProject2/src/configure CFLAGS=-fprofile-arcs -ftest-coverage CXXFLAGS=-fprofile-arcs -ftest-coverage"));
|
"testProject2/src/configure CFLAGS=-fprofile-arcs -ftest-coverage CXXFLAGS=-fprofile-arcs -ftest-coverage"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset gcov opt and set debug opt
|
// Reset gcov opt and set debug opt
|
||||||
opts = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
opts = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
||||||
k.setValue("false");
|
k.setValue("false");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG);
|
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG);
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
// Now update the options we changed
|
// Now update the options we changed
|
||||||
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
||||||
|
|
||||||
// Rebuild project
|
// Rebuild project
|
||||||
assertTrue(ProjectTools.build());
|
assertTrue(ProjectTools.build());
|
||||||
|
|
||||||
r = testProject.findMember(x);
|
r = testProject.findMember(x);
|
||||||
f = r.getLocation().toFile();
|
f = r.getLocation().toFile();
|
||||||
try (FileReader fr = new FileReader(f)) {
|
try (FileReader fr = new FileReader(f)) {
|
||||||
|
@ -154,12 +157,12 @@ public class UpdateConfigureTest {
|
||||||
assertTrue(s.contains("testProject2/src/configure CFLAGS=-g CXXFLAGS=-g"));
|
assertTrue(s.contains("testProject2/src/configure CFLAGS=-g CXXFLAGS=-g"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test getting and updating configuration options for an Autotools Project. The top-level
|
* Test getting and updating configuration options for an Autotools Project. The top-level
|
||||||
* contains autogen.sh which will build configure, but not run it.
|
* contains autogen.sh which will build configure, but not run it.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetAndUpdateConfigureOptions() throws Exception {
|
public void testGetAndUpdateConfigureOptions() throws Exception {
|
||||||
Path p = new Path("zip/project2.zip");
|
Path p = new Path("zip/project2.zip");
|
||||||
|
@ -168,10 +171,12 @@ public class UpdateConfigureTest {
|
||||||
ProjectTools.setConfigDir(testProject, "src");
|
ProjectTools.setConfigDir(testProject, "src");
|
||||||
ProjectTools.markExecutable(testProject, "src/autogen.sh");
|
ProjectTools.markExecutable(testProject, "src/autogen.sh");
|
||||||
assertTrue(ProjectTools.build());
|
assertTrue(ProjectTools.build());
|
||||||
ICConfigurationDescription cfgDes = CoreModel.getDefault().getProjectDescription(testProject).getActiveConfiguration();
|
ICConfigurationDescription cfgDes = CoreModel.getDefault().getProjectDescription(testProject)
|
||||||
|
.getActiveConfiguration();
|
||||||
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
|
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
|
||||||
assertTrue(cfg.getName().equals("Build (GNU)"));
|
assertTrue(cfg.getName().equals("Build (GNU)"));
|
||||||
Map<String, IAutotoolsOption> opts = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
Map<String, IAutotoolsOption> opts = AutotoolsConfigurationManager.getInstance()
|
||||||
|
.getAutotoolsCfgOptions(testProject, cfg.getId());
|
||||||
IAutotoolsOption configdir = opts.get(AutotoolsOptionConstants.OPT_CONFIGDIR);
|
IAutotoolsOption configdir = opts.get(AutotoolsOptionConstants.OPT_CONFIGDIR);
|
||||||
assertEquals(configdir.getType(), IAutotoolsOption.INTERNAL);
|
assertEquals(configdir.getType(), IAutotoolsOption.INTERNAL);
|
||||||
assertTrue(configdir.getValue().equals("src"));
|
assertTrue(configdir.getValue().equals("src"));
|
||||||
|
@ -203,7 +208,7 @@ public class UpdateConfigureTest {
|
||||||
k = opts.get(AutotoolsOptionConstants.FLAG_CFLAGS);
|
k = opts.get(AutotoolsOptionConstants.FLAG_CFLAGS);
|
||||||
assertFalse(k.canUpdate());
|
assertFalse(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.FLAG);
|
assertEquals(k.getType(), IAutotoolsOption.FLAG);
|
||||||
|
|
||||||
// Tools are ok to update
|
// Tools are ok to update
|
||||||
k = opts.get(AutotoolsOptionConstants.TOOL_AUTOGEN);
|
k = opts.get(AutotoolsOptionConstants.TOOL_AUTOGEN);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
|
@ -223,13 +228,13 @@ public class UpdateConfigureTest {
|
||||||
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
k = opts.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
assertEquals(k.getType(), IAutotoolsOption.FLAGVALUE);
|
||||||
|
@ -248,181 +253,181 @@ public class UpdateConfigureTest {
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/bin");
|
k.setValue("/usr/bin");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_BUILD);
|
k = opts.get(AutotoolsOptionConstants.OPT_BUILD);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("linux");
|
k.setValue("linux");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_CACHE_FILE);
|
k = opts.get(AutotoolsOptionConstants.OPT_CACHE_FILE);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("config.status");
|
k.setValue("config.status");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_DATADIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_DATADIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/data");
|
k.setValue("/usr/data");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE);
|
k = opts.get(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_EXEC_PREFIX);
|
k = opts.get(AutotoolsOptionConstants.OPT_EXEC_PREFIX);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/exec");
|
k.setValue("/usr/exec");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_HELP);
|
k = opts.get(AutotoolsOptionConstants.OPT_HELP);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_HOST);
|
k = opts.get(AutotoolsOptionConstants.OPT_HOST);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("linux");
|
k.setValue("linux");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_INCLUDEDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_INCLUDEDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/include");
|
k.setValue("/usr/include");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_INFODIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_INFODIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/info");
|
k.setValue("/usr/info");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_LIBDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_LIBDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/lib");
|
k.setValue("/usr/lib");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_LIBEXECDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_LIBEXECDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/libexec");
|
k.setValue("/usr/libexec");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_LOCALSTATEDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_LOCALSTATEDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/localstate");
|
k.setValue("/usr/localstate");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_MANDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_MANDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/man");
|
k.setValue("/usr/man");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_NO_CREATE);
|
k = opts.get(AutotoolsOptionConstants.OPT_NO_CREATE);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/oldinclude");
|
k.setValue("/usr/oldinclude");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_PREFIX);
|
k = opts.get(AutotoolsOptionConstants.OPT_PREFIX);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("prefix");
|
k.setValue("prefix");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX);
|
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("program_prefix");
|
k.setValue("program_prefix");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX);
|
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("program_suffix");
|
k.setValue("program_suffix");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME);
|
k = opts.get(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("program_transform_name");
|
k.setValue("program_transform_name");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_QUIET);
|
k = opts.get(AutotoolsOptionConstants.OPT_QUIET);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_SBINDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_SBINDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/sbin");
|
k.setValue("/usr/sbin");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/sharedstate");
|
k.setValue("/usr/sharedstate");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_SRCDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_SRCDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("src");
|
k.setValue("src");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_SYSCONFDIR);
|
k = opts.get(AutotoolsOptionConstants.OPT_SYSCONFDIR);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("/usr/sysconf");
|
k.setValue("/usr/sysconf");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_TARGET);
|
k = opts.get(AutotoolsOptionConstants.OPT_TARGET);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
assertEquals(k.getType(), IAutotoolsOption.STRING);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("target");
|
k.setValue("target");
|
||||||
|
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_USER);
|
k = opts.get(AutotoolsOptionConstants.OPT_USER);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.MULTIARG);
|
assertEquals(k.getType(), IAutotoolsOption.MULTIARG);
|
||||||
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
assertEquals(k.getValue(), ""); //$NON-NLS-1$
|
||||||
k.setValue("user opts");
|
k.setValue("user opts");
|
||||||
|
|
||||||
k = opts.get(AutotoolsOptionConstants.OPT_VERSION);
|
k = opts.get(AutotoolsOptionConstants.OPT_VERSION);
|
||||||
assertTrue(k.canUpdate());
|
assertTrue(k.canUpdate());
|
||||||
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
assertEquals(k.getType(), IAutotoolsOption.BIN);
|
||||||
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "false"); //$NON-NLS-1$
|
||||||
k.setValue("true");
|
k.setValue("true");
|
||||||
|
|
||||||
// Verify last option changed has changed in our copy, but not
|
// Verify last option changed has changed in our copy, but not
|
||||||
// in the actual options
|
// in the actual options
|
||||||
assertEquals(k.getValue(), "true");
|
assertEquals(k.getValue(), "true");
|
||||||
Map<String, IAutotoolsOption> opts2 = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
Map<String, IAutotoolsOption> opts2 = AutotoolsConfigurationManager.getInstance()
|
||||||
|
.getAutotoolsCfgOptions(testProject, cfg.getId());
|
||||||
IAutotoolsOption k2 = opts2.get(AutotoolsOptionConstants.OPT_VERSION);
|
IAutotoolsOption k2 = opts2.get(AutotoolsOptionConstants.OPT_VERSION);
|
||||||
assertEquals(k2.getValue(), "false");
|
assertEquals(k2.getValue(), "false");
|
||||||
|
|
||||||
// Now update the options we changed
|
// Now update the options we changed
|
||||||
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
AutotoolsConfigurationManager.getInstance().updateAutotoolCfgOptions(testProject, cfg.getId(), opts);
|
||||||
opts2 = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
opts2 = AutotoolsConfigurationManager.getInstance().getAutotoolsCfgOptions(testProject, cfg.getId());
|
||||||
|
|
||||||
// Verify new option values
|
// Verify new option values
|
||||||
k = opts2.get(AutotoolsOptionConstants.TOOL_AUTOGEN);
|
k = opts2.get(AutotoolsOptionConstants.TOOL_AUTOGEN);
|
||||||
assertEquals(k.getValue(), "autogen2.sh"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "autogen2.sh"); //$NON-NLS-1$
|
||||||
|
@ -432,10 +437,10 @@ public class UpdateConfigureTest {
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG);
|
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_GCOV);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
k = opts2.get(AutotoolsOptionConstants.OPT_CFLAGS_GPROF);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -444,85 +449,85 @@ public class UpdateConfigureTest {
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_BINDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_BINDIR);
|
||||||
assertEquals(k.getValue(), "/usr/bin"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/bin"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_BUILD);
|
k = opts2.get(AutotoolsOptionConstants.OPT_BUILD);
|
||||||
assertEquals(k.getValue(), "linux"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "linux"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_CACHE_FILE);
|
k = opts2.get(AutotoolsOptionConstants.OPT_CACHE_FILE);
|
||||||
assertEquals(k.getValue(), "config.status"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "config.status"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_DATADIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_DATADIR);
|
||||||
assertEquals(k.getValue(), "/usr/data"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/data"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE);
|
k = opts2.get(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_EXEC_PREFIX);
|
k = opts2.get(AutotoolsOptionConstants.OPT_EXEC_PREFIX);
|
||||||
assertEquals(k.getValue(), "/usr/exec"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/exec"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_HELP);
|
k = opts2.get(AutotoolsOptionConstants.OPT_HELP);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_HOST);
|
k = opts2.get(AutotoolsOptionConstants.OPT_HOST);
|
||||||
assertEquals(k.getValue(), "linux"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "linux"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_INCLUDEDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_INCLUDEDIR);
|
||||||
assertEquals(k.getValue(), "/usr/include"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/include"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_INFODIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_INFODIR);
|
||||||
assertEquals(k.getValue(), "/usr/info"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/info"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_LIBDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_LIBDIR);
|
||||||
assertEquals(k.getValue(), "/usr/lib"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/lib"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_LIBEXECDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_LIBEXECDIR);
|
||||||
assertEquals(k.getValue(), "/usr/libexec"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/libexec"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_LOCALSTATEDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_LOCALSTATEDIR);
|
||||||
assertEquals(k.getValue(), "/usr/localstate"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/localstate"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_MANDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_MANDIR);
|
||||||
assertEquals(k.getValue(), "/usr/man"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/man"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_NO_CREATE);
|
k = opts2.get(AutotoolsOptionConstants.OPT_NO_CREATE);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_OLDINCLUDEDIR);
|
||||||
assertEquals(k.getValue(), "/usr/oldinclude"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/oldinclude"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_PREFIX);
|
k = opts2.get(AutotoolsOptionConstants.OPT_PREFIX);
|
||||||
assertEquals(k.getValue(), "prefix"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "prefix"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX);
|
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX);
|
||||||
assertEquals(k.getValue(), "program_prefix"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "program_prefix"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX);
|
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX);
|
||||||
assertEquals(k.getValue(), "program_suffix"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "program_suffix"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME);
|
k = opts2.get(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME);
|
||||||
assertEquals(k.getValue(), "program_transform_name"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "program_transform_name"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_QUIET);
|
k = opts2.get(AutotoolsOptionConstants.OPT_QUIET);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_SBINDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_SBINDIR);
|
||||||
assertEquals(k.getValue(), "/usr/sbin"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/sbin"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_SHAREDSTATEDIR);
|
||||||
assertEquals(k.getValue(), "/usr/sharedstate"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/sharedstate"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_SRCDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_SRCDIR);
|
||||||
assertEquals(k.getValue(), "src"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "src"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_SYSCONFDIR);
|
k = opts2.get(AutotoolsOptionConstants.OPT_SYSCONFDIR);
|
||||||
assertEquals(k.getValue(), "/usr/sysconf"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "/usr/sysconf"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_TARGET);
|
k = opts2.get(AutotoolsOptionConstants.OPT_TARGET);
|
||||||
assertEquals(k.getValue(), "target"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "target"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_USER);
|
k = opts2.get(AutotoolsOptionConstants.OPT_USER);
|
||||||
assertEquals(k.getValue(), "user opts"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "user opts"); //$NON-NLS-1$
|
||||||
|
|
||||||
k = opts2.get(AutotoolsOptionConstants.OPT_VERSION);
|
k = opts2.get(AutotoolsOptionConstants.OPT_VERSION);
|
||||||
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
assertEquals(k.getValue(), "true"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -552,12 +557,12 @@ public class UpdateConfigureTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException|ParserConfigurationException|SAXException e) {
|
} catch (IOException | ParserConfigurationException | SAXException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
|
@ -40,39 +40,31 @@ import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class AutomakeColourizationTests {
|
public class AutomakeColourizationTests {
|
||||||
|
|
||||||
private ProjectTools tools;
|
private ProjectTools tools;
|
||||||
private IProject project;
|
private IProject project;
|
||||||
private IFile makefileAmFile;
|
private IFile makefileAmFile;
|
||||||
|
|
||||||
static String makefileAmContents =
|
static String makefileAmContents = "# This is a comment" + "\n" + "if CONDITION" + "\n" + "MACRO = case1" + "\n"
|
||||||
"# This is a comment" + "\n" +
|
+ "else" + "\n" + "MACRO = case2" + "\n" + "$(MACRO)" + "\n" + "${MACRO}" + "\n" + "";
|
||||||
"if CONDITION" + "\n" +
|
|
||||||
"MACRO = case1" + "\n" +
|
|
||||||
"else" + "\n" +
|
|
||||||
"MACRO = case2" + "\n" +
|
|
||||||
"$(MACRO)" + "\n" +
|
|
||||||
"${MACRO}" + "\n" +
|
|
||||||
"";
|
|
||||||
private IWorkbench workbench;
|
private IWorkbench workbench;
|
||||||
private AutomakefileCodeScanner codeScanner;
|
private AutomakefileCodeScanner codeScanner;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
tools = new ProjectTools();
|
tools = new ProjectTools();
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
|
|
||||||
project = ProjectTools.createProject("testProjectACT");
|
project = ProjectTools.createProject("testProjectACT");
|
||||||
|
|
||||||
if(project == null) {
|
if (project == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
|
|
||||||
project.open(new NullProgressMonitor());
|
project.open(new NullProgressMonitor());
|
||||||
|
|
||||||
Display.getDefault().syncExec(() -> {
|
Display.getDefault().syncExec(() -> {
|
||||||
try {
|
try {
|
||||||
makefileAmFile = tools.createFile(project, "Makefile.am", makefileAmContents);
|
makefileAmFile = tools.createFile(project, "Makefile.am", makefileAmContents);
|
||||||
|
@ -95,11 +87,12 @@ public class AutomakeColourizationTests {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IToken getNextToken() {
|
IToken getNextToken() {
|
||||||
return codeScanner.nextToken();
|
return codeScanner.nextToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAutomakeEditorColourization() {
|
public void testAutomakeEditorColourization() {
|
||||||
// # This is a comment
|
// # This is a comment
|
||||||
|
@ -211,7 +204,7 @@ public class AutomakeColourizationTests {
|
||||||
token = (Token) token0;
|
token = (Token) token0;
|
||||||
attribute = (TextAttribute) token.getData();
|
attribute = (TextAttribute) token.getData();
|
||||||
assertNull(attribute);
|
assertNull(attribute);
|
||||||
|
|
||||||
// ${MACRO}
|
// ${MACRO}
|
||||||
token0 = getNextToken();
|
token0 = getNextToken();
|
||||||
assertTrue(token0 instanceof Token);
|
assertTrue(token0 instanceof Token);
|
||||||
|
@ -222,6 +215,7 @@ public class AutomakeColourizationTests {
|
||||||
attribute = (TextAttribute) token.getData();
|
attribute = (TextAttribute) token.getData();
|
||||||
assertEquals(ColorManager.MAKE_MACRO_REF_RGB, attribute.getForeground().getRGB());
|
assertEquals(ColorManager.MAKE_MACRO_REF_RGB, attribute.getForeground().getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
project.delete(true, false, ProjectTools.getMonitor());
|
project.delete(true, false, ProjectTools.getMonitor());
|
||||||
|
|
|
@ -28,29 +28,28 @@ import org.eclipse.ui.PlatformUI;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class AutomakeEditorTests {
|
public class AutomakeEditorTests {
|
||||||
|
|
||||||
private ProjectTools tools;
|
private ProjectTools tools;
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
tools = new ProjectTools();
|
tools = new ProjectTools();
|
||||||
if (!ProjectTools.setup())
|
if (!ProjectTools.setup())
|
||||||
fail("could not perform basic project workspace setup");
|
fail("could not perform basic project workspace setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAutomakeEditorAssociation() throws Exception {
|
public void testAutomakeEditorAssociation() throws Exception {
|
||||||
project = ProjectTools.createProject("testProjectAET");
|
project = ProjectTools.createProject("testProjectAET");
|
||||||
|
|
||||||
if(project == null) {
|
if (project == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
|
|
||||||
project.open(new NullProgressMonitor());
|
project.open(new NullProgressMonitor());
|
||||||
|
|
||||||
Display.getDefault().syncExec(() -> {
|
Display.getDefault().syncExec(() -> {
|
||||||
try {
|
try {
|
||||||
IFile makefileAmFile = tools.createFile(project, "Makefile.am", "");
|
IFile makefileAmFile = tools.createFile(project, "Makefile.am", "");
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class AutomakeTextHoverTest {
|
public class AutomakeTextHoverTest {
|
||||||
|
|
||||||
private ProjectTools tools;
|
private ProjectTools tools;
|
||||||
|
@ -51,27 +50,24 @@ public class AutomakeTextHoverTest {
|
||||||
// ie. '\techo ' == 6 characters
|
// ie. '\techo ' == 6 characters
|
||||||
"MACRO = case1" + "\n" +
|
"MACRO = case1" + "\n" +
|
||||||
// 14
|
// 14
|
||||||
"target1:" + "\n" +
|
"target1:" + "\n" +
|
||||||
// 23 (before the tab)
|
// 23 (before the tab)
|
||||||
// 32 is after the M in MACRO
|
// 32 is after the M in MACRO
|
||||||
"\t" + "echo $(MACRO)" + "\n" +
|
"\t" + "echo $(MACRO)" + "\n" +
|
||||||
// 38 (before the tab)
|
// 38 (before the tab)
|
||||||
"\t" + "echo $@" + "\n" +
|
"\t" + "echo $@" + "\n" + "\n" +
|
||||||
"\n" +
|
// 48
|
||||||
// 48
|
"target2: target1" + "\n" +
|
||||||
"target2: target1" + "\n" +
|
// 65 (before the tab)
|
||||||
// 65 (before the tab)
|
"\t" + "echo ${MACRO}" + "\n" +
|
||||||
"\t" + "echo ${MACRO}" + "\n" +
|
// 80 (before the tab)
|
||||||
// 80 (before the tab)
|
"\t" + "echo $@" + "\n" +
|
||||||
"\t" + "echo $@" + "\n" +
|
// 89 (before the tab)
|
||||||
// 89 (before the tab)
|
"\t" + "echo $<" + "\n" + "\n" +
|
||||||
"\t" + "echo $<" + "\n" +
|
// 99
|
||||||
"\n" +
|
"target3: target1 target2" + "\n" +
|
||||||
// 99
|
// 124 (before the tab)
|
||||||
"target3: target1 target2" + "\n" +
|
"\t" + "echo $?" + "\n" + "";
|
||||||
// 124 (before the tab)
|
|
||||||
"\t" + "echo $?" + "\n" +
|
|
||||||
"";
|
|
||||||
private IWorkbench workbench;
|
private IWorkbench workbench;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -82,7 +78,7 @@ public class AutomakeTextHoverTest {
|
||||||
|
|
||||||
project = ProjectTools.createProject("testProjectATHT");
|
project = ProjectTools.createProject("testProjectATHT");
|
||||||
|
|
||||||
if(project == null) {
|
if (project == null) {
|
||||||
fail("Unable to create test project");
|
fail("Unable to create test project");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +127,7 @@ public class AutomakeTextHoverTest {
|
||||||
assertEquals("target1", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
assertEquals("target1", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHoverInfoTargetName2() {
|
public void testGetHoverInfoTargetName2() {
|
||||||
// hover between the $ and the @ in target2
|
// hover between the $ and the @ in target2
|
||||||
|
@ -149,6 +146,7 @@ public class AutomakeTextHoverTest {
|
||||||
assertEquals("target2", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
assertEquals("target2", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHoverInfoForTargetDependency() {
|
public void testGetHoverInfoForTargetDependency() {
|
||||||
// hover between the $ and the < in target2
|
// hover between the $ and the < in target2
|
||||||
|
@ -167,6 +165,7 @@ public class AutomakeTextHoverTest {
|
||||||
assertEquals("target1", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
assertEquals("target1", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHoverInfoForTargetDependencies() {
|
public void testGetHoverInfoForTargetDependencies() {
|
||||||
// hover between the $ and the ? in target3
|
// hover between the $ and the ? in target3
|
||||||
|
@ -186,6 +185,7 @@ public class AutomakeTextHoverTest {
|
||||||
textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHoverForMacro1() {
|
public void testGetHoverForMacro1() {
|
||||||
Display.getDefault().syncExec(() -> {
|
Display.getDefault().syncExec(() -> {
|
||||||
|
@ -204,6 +204,7 @@ public class AutomakeTextHoverTest {
|
||||||
assertEquals("case1", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
assertEquals("case1", textHover.getHoverInfo(automakeEditor.getAutomakeSourceViewer(), hoverRegion));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHoverForMacro2() {
|
public void testGetHoverForMacro2() {
|
||||||
// hover between the M and the A in the ${MACRO} reference in target2
|
// hover between the M and the A in the ${MACRO} reference in target2
|
||||||
|
|
|
@ -17,10 +17,6 @@ import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({ AutomakeColourizationTests.class, AutomakeTextHoverTest.class, AutomakeEditorTests.class })
|
||||||
AutomakeColourizationTests.class,
|
|
||||||
AutomakeTextHoverTest.class,
|
|
||||||
AutomakeEditorTests.class
|
|
||||||
})
|
|
||||||
public class EditorTests {
|
public class EditorTests {
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,7 @@ public abstract class AbstractTest {
|
||||||
SWTBotShell shell = bot.shell("Preferences");
|
SWTBotShell shell = bot.shell("Preferences");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
bot.text().setText("Workspace");
|
bot.text().setText("Workspace");
|
||||||
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General",
|
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Workspace"));
|
||||||
"Workspace"));
|
|
||||||
SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
|
SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
|
||||||
if (buildAuto != null && buildAuto.isChecked()) {
|
if (buildAuto != null && buildAuto.isChecked()) {
|
||||||
buildAuto.click();
|
buildAuto.click();
|
||||||
|
@ -135,10 +134,8 @@ public abstract class AbstractTest {
|
||||||
// Ensure that the C/C++ perspective is chosen automatically
|
// Ensure that the C/C++ perspective is chosen automatically
|
||||||
// and doesn't require user intervention
|
// and doesn't require user intervention
|
||||||
bot.text().setText("Perspectives");
|
bot.text().setText("Perspectives");
|
||||||
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General",
|
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Perspectives"));
|
||||||
"Perspectives"));
|
clickRadioButtonInGroup("Always open", "Open the associated perspective when creating a new project");
|
||||||
clickRadioButtonInGroup("Always open",
|
|
||||||
"Open the associated perspective when creating a new project");
|
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
|
|
||||||
AbstractTest.projectName = projectName;
|
AbstractTest.projectName = projectName;
|
||||||
|
@ -146,18 +143,15 @@ public abstract class AbstractTest {
|
||||||
shell = bot.shell("New Project");
|
shell = bot.shell("New Project");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
bot.text().setText("C Project");
|
bot.text().setText("C Project");
|
||||||
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++",
|
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++", "C Project"));
|
||||||
"C Project"));
|
|
||||||
bot.button("Next >").click();
|
bot.button("Next >").click();
|
||||||
|
|
||||||
bot.textWithLabel("Project name:").setText(projectName);
|
bot.textWithLabel("Project name:").setText(projectName);
|
||||||
bot.tree().expandNode("GNU Autotools")
|
bot.tree().expandNode("GNU Autotools").select("Hello World ANSI C Autotools Project");
|
||||||
.select("Hello World ANSI C Autotools Project");
|
|
||||||
bot.button("Finish").click();
|
bot.button("Finish").click();
|
||||||
bot.waitUntil(Conditions.shellCloses(shell));
|
bot.waitUntil(Conditions.shellCloses(shell));
|
||||||
|
|
||||||
IProjectNature nature = checkProject().getNature(
|
IProjectNature nature = checkProject().getNature("org.eclipse.cdt.autotools.core.autotoolsNatureV2");
|
||||||
"org.eclipse.cdt.autotools.core.autotoolsNatureV2");
|
|
||||||
assertNotNull(nature);
|
assertNotNull(nature);
|
||||||
|
|
||||||
projectExplorer = bot.viewByTitle("Project Explorer");
|
projectExplorer = bot.viewByTitle("Project Explorer");
|
||||||
|
@ -186,8 +180,7 @@ public abstract class AbstractTest {
|
||||||
* @param node
|
* @param node
|
||||||
* The text of the node to select.
|
* The text of the node to select.
|
||||||
*/
|
*/
|
||||||
public NodeAvailableAndSelect(SWTBotTree tree, String parent,
|
public NodeAvailableAndSelect(SWTBotTree tree, String parent, String node) {
|
||||||
String node) {
|
|
||||||
this.tree = tree;
|
this.tree = tree;
|
||||||
this.node = node;
|
this.node = node;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
@ -215,10 +208,8 @@ public abstract class AbstractTest {
|
||||||
*/
|
*/
|
||||||
public static void enterProjectFolder() {
|
public static void enterProjectFolder() {
|
||||||
projectExplorer.setFocus();
|
projectExplorer.setFocus();
|
||||||
projectExplorer.bot().tree().select(projectName).contextMenu("Go Into")
|
projectExplorer.bot().tree().select(projectName).contextMenu("Go Into").click();
|
||||||
.click();
|
bot.waitUntil(waitForWidget(WidgetMatcherFactory.withText(projectName), projectExplorer.getWidget()));
|
||||||
bot.waitUntil(waitForWidget(WidgetMatcherFactory.withText(projectName),
|
|
||||||
projectExplorer.getWidget()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,8 +224,7 @@ public abstract class AbstractTest {
|
||||||
// If the "Forward" button is not found, already at the top level.
|
// If the "Forward" button is not found, already at the top level.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SWTBotToolbarButton backButton = projectExplorer
|
SWTBotToolbarButton backButton = projectExplorer.toolbarPushButton("Back to Workspace");
|
||||||
.toolbarPushButton("Back to Workspace");
|
|
||||||
if (backButton.isEnabled()) {
|
if (backButton.isEnabled()) {
|
||||||
backButton.click();
|
backButton.click();
|
||||||
bot.waitUntil(widgetIsEnabled(forwardButton));
|
bot.waitUntil(widgetIsEnabled(forwardButton));
|
||||||
|
@ -247,8 +237,7 @@ public abstract class AbstractTest {
|
||||||
* other radio button in the group that is already selected. Workaround for
|
* other radio button in the group that is already selected. Workaround for
|
||||||
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=344484
|
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=344484
|
||||||
*/
|
*/
|
||||||
public static void clickRadioButtonInGroup(String mnemonicText,
|
public static void clickRadioButtonInGroup(String mnemonicText, final String inGroup) {
|
||||||
final String inGroup) {
|
|
||||||
UIThreadRunnable.syncExec(() -> {
|
UIThreadRunnable.syncExec(() -> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Matcher<Button> matcher = allOf(inGroup(inGroup), widgetOfType(Button.class),
|
Matcher<Button> matcher = allOf(inGroup(inGroup), widgetOfType(Button.class),
|
||||||
|
@ -270,13 +259,11 @@ public abstract class AbstractTest {
|
||||||
bot.radioInGroup(mnemonicText, inGroup).click();
|
bot.radioInGroup(mnemonicText, inGroup).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clickContextMenu(AbstractSWTBot<? extends Control> bot,
|
public static void clickContextMenu(AbstractSWTBot<? extends Control> bot, String... texts) {
|
||||||
String... texts) {
|
|
||||||
new SWTBotMenu(ContextMenuHelper.contextMenu(bot, texts)).click();
|
new SWTBotMenu(ContextMenuHelper.contextMenu(bot, texts)).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clickVolatileContextMenu(
|
public static void clickVolatileContextMenu(AbstractSWTBot<? extends Control> bot, String... texts) {
|
||||||
AbstractSWTBot<? extends Control> bot, String... texts) {
|
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
final int maxTries = 2;
|
final int maxTries = 2;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -292,8 +279,7 @@ public abstract class AbstractTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clickProjectContextMenu(String... texts) {
|
public static void clickProjectContextMenu(String... texts) {
|
||||||
clickVolatileContextMenu(bot.viewByTitle("Project Explorer").bot()
|
clickVolatileContextMenu(bot.viewByTitle("Project Explorer").bot().tree().select(projectName), texts);
|
||||||
.tree().select(projectName), texts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,15 +300,12 @@ public abstract class AbstractTest {
|
||||||
menu.click();
|
menu.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SWTBotShell openProperties(String parentCategory,
|
public static SWTBotShell openProperties(String parentCategory, String category) {
|
||||||
String category) {
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Properties");
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
|
||||||
"Properties");
|
|
||||||
SWTBotShell shell = bot.shell("Properties for " + projectName);
|
SWTBotShell shell = bot.shell("Properties for " + projectName);
|
||||||
shell.activate();
|
shell.activate();
|
||||||
bot.text().setText(category);
|
bot.text().setText(category);
|
||||||
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), parentCategory,
|
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), parentCategory, category));
|
||||||
category));
|
|
||||||
shell.activate();
|
shell.activate();
|
||||||
return shell;
|
return shell;
|
||||||
}
|
}
|
||||||
|
@ -340,10 +323,8 @@ public abstract class AbstractTest {
|
||||||
public static SWTBotView viewConsole(String consoleType) {
|
public static SWTBotView viewConsole(String consoleType) {
|
||||||
SWTBotView view = bot.viewByPartName("Console");
|
SWTBotView view = bot.viewByPartName("Console");
|
||||||
view.setFocus();
|
view.setFocus();
|
||||||
SWTBotToolbarDropDownButton b = view
|
SWTBotToolbarDropDownButton b = view.toolbarDropDownButton("Display Selected Console");
|
||||||
.toolbarDropDownButton("Display Selected Console");
|
org.hamcrest.Matcher<MenuItem> withRegex = withRegex(".*" + consoleType + ".*");
|
||||||
org.hamcrest.Matcher<MenuItem> withRegex = withRegex(".*" + consoleType
|
|
||||||
+ ".*");
|
|
||||||
focusMainShell();
|
focusMainShell();
|
||||||
b.menuItem(withRegex).click();
|
b.menuItem(withRegex).click();
|
||||||
try {
|
try {
|
||||||
|
@ -379,8 +360,7 @@ public abstract class AbstractTest {
|
||||||
for (final SWTBotShell shell : shells) {
|
for (final SWTBotShell shell : shells) {
|
||||||
if (!shell.equals(mainShell)) {
|
if (!shell.equals(mainShell)) {
|
||||||
String shellTitle = shell.getText();
|
String shellTitle = shell.getText();
|
||||||
if (shellTitle.length() > 0
|
if (shellTitle.length() > 0 && !shellTitle.startsWith("Quick Access")) {
|
||||||
&& !shellTitle.startsWith("Quick Access")) {
|
|
||||||
UIThreadRunnable.syncExec(() -> {
|
UIThreadRunnable.syncExec(() -> {
|
||||||
if (shell.widget.getParent() != null && !shell.isOpen()) {
|
if (shell.widget.getParent() != null && !shell.isOpen()) {
|
||||||
shell.close();
|
shell.close();
|
||||||
|
|
|
@ -25,15 +25,14 @@ import org.junit.runners.Suite;
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* TestToolActions.class,
|
* TestToolActions.class,
|
||||||
* TestEnvironmentVars.class,
|
* TestEnvironmentVars.class,
|
||||||
* TestMakeTargets.class,
|
* TestMakeTargets.class,
|
||||||
* SetConfigurationParameter.class,
|
* SetConfigurationParameter.class,
|
||||||
*/
|
*/
|
||||||
AutoconfTests.class
|
AutoconfTests.class })
|
||||||
})
|
|
||||||
|
|
||||||
public class AutomatedIntegrationSuite {
|
public class AutomatedIntegrationSuite {
|
||||||
// needed for this class to compile
|
// needed for this class to compile
|
||||||
|
@ -41,9 +40,7 @@ public class AutomatedIntegrationSuite {
|
||||||
public static void beforeClassMethod() {
|
public static void beforeClassMethod() {
|
||||||
// Verify that the necessary binaries are available, and if they are not,
|
// Verify that the necessary binaries are available, and if they are not,
|
||||||
// the tests will be ignored.
|
// the tests will be ignored.
|
||||||
String[] testBinaryCommands = { "libtool --version",
|
String[] testBinaryCommands = { "libtool --version", "autoconf --version", "automake --version" };
|
||||||
"autoconf --version",
|
|
||||||
"automake --version" };
|
|
||||||
try {
|
try {
|
||||||
for (String cmd : testBinaryCommands) {
|
for (String cmd : testBinaryCommands) {
|
||||||
Process process = ProcessFactory.getFactory().exec(cmd);
|
Process process = ProcessFactory.getFactory().exec(cmd);
|
||||||
|
|
|
@ -62,8 +62,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
// Set the configure parameters to be --enable-jeff via user-defined
|
// Set the configure parameters to be --enable-jeff via user-defined
|
||||||
// options
|
// options
|
||||||
SWTBotShell shell = openProperties("Autotools", "Configure Settings");
|
SWTBotShell shell = openProperties("Autotools", "Configure Settings");
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
||||||
text.typeText("--enable-jeff");
|
text.typeText("--enable-jeff");
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
|
@ -71,8 +70,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
|
|
||||||
// Create new build configurations that will be used throughout tests
|
// Create new build configurations that will be used throughout tests
|
||||||
projectExplorer.bot().tree().select(projectName);
|
projectExplorer.bot().tree().select(projectName);
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Configurations", "Manage...");
|
||||||
"Build Configurations", "Manage...");
|
|
||||||
shell = bot.shell(projectName + ": Manage Configurations");
|
shell = bot.shell(projectName + ": Manage Configurations");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
bot.button("New...").click();
|
bot.button("New...").click();
|
||||||
|
@ -80,8 +78,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
shell.activate();
|
shell.activate();
|
||||||
SWTBotText t = bot.textWithLabel("Name:");
|
SWTBotText t = bot.textWithLabel("Name:");
|
||||||
t.setText("debug");
|
t.setText("debug");
|
||||||
AbstractTest.clickRadioButtonInGroup("Existing configuration",
|
AbstractTest.clickRadioButtonInGroup("Existing configuration", "Copy settings from");
|
||||||
"Copy settings from");
|
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
shell = bot.shell(projectName + ": Manage Configurations");
|
shell = bot.shell(projectName + ": Manage Configurations");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
|
@ -90,8 +87,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
shell.activate();
|
shell.activate();
|
||||||
t = bot.textWithLabel("Name:");
|
t = bot.textWithLabel("Name:");
|
||||||
t.setText("default");
|
t.setText("default");
|
||||||
AbstractTest.clickRadioButtonInGroup("Default configuration",
|
AbstractTest.clickRadioButtonInGroup("Default configuration", "Copy settings from");
|
||||||
"Copy settings from");
|
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
shell = bot.shell(projectName + ": Manage Configurations");
|
shell = bot.shell(projectName + ": Manage Configurations");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
|
@ -145,8 +141,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
@Test
|
@Test
|
||||||
public void t2canBuildWithConfigParm() throws Exception {
|
public void t2canBuildWithConfigParm() throws Exception {
|
||||||
projectExplorer.bot().tree().select(projectName);
|
projectExplorer.bot().tree().select(projectName);
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Project");
|
||||||
"Build Project");
|
|
||||||
|
|
||||||
// Wait until the project is built
|
// Wait until the project is built
|
||||||
SWTBotShell shell = bot.shell("Build Project");
|
SWTBotShell shell = bot.shell("Build Project");
|
||||||
|
@ -192,8 +187,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
|
|
||||||
String output = viewConsole("Configure").bot().styledText().getText();
|
String output = viewConsole("Configure").bot().styledText().getText();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(
|
Pattern p = Pattern.compile(".*WARNING:.*unrecognized.*--enable-jeff.*", Pattern.DOTALL);
|
||||||
".*WARNING:.*unrecognized.*--enable-jeff.*", Pattern.DOTALL);
|
|
||||||
Matcher m = p.matcher(output);
|
Matcher m = p.matcher(output);
|
||||||
assertTrue(m.matches());
|
assertTrue(m.matches());
|
||||||
|
|
||||||
|
@ -201,8 +195,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
// Verifies fix for bug: #308261
|
// Verifies fix for bug: #308261
|
||||||
long oldDate = f.lastModified();
|
long oldDate = f.lastModified();
|
||||||
projectExplorer.bot().tree().select(projectName);
|
projectExplorer.bot().tree().select(projectName);
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Project");
|
||||||
"Build Project");
|
|
||||||
path = project.getLocation();
|
path = project.getLocation();
|
||||||
// We need to wait until the a.out file is created so
|
// We need to wait until the a.out file is created so
|
||||||
// sleep a bit and look for it...give up after 120 seconds
|
// sleep a bit and look for it...give up after 120 seconds
|
||||||
|
@ -225,8 +218,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
@Test
|
@Test
|
||||||
public void t3newConfigCopiesParms() throws Exception {
|
public void t3newConfigCopiesParms() throws Exception {
|
||||||
projectExplorer.bot().tree().select(projectName);
|
projectExplorer.bot().tree().select(projectName);
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Configurations", "Manage...");
|
||||||
"Build Configurations", "Manage...");
|
|
||||||
SWTBotShell shell = bot.shell(projectName + ": Manage Configurations");
|
SWTBotShell shell = bot.shell(projectName + ": Manage Configurations");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
shell = bot.shell(projectName + ": Manage Configurations");
|
shell = bot.shell(projectName + ": Manage Configurations");
|
||||||
|
@ -248,8 +240,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue(configs.getText().contains("debug"));
|
assertTrue(configs.getText().contains("debug"));
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
||||||
String val = text.getText();
|
String val = text.getText();
|
||||||
assertEquals("--enable-jeff", val);
|
assertEquals("--enable-jeff", val);
|
||||||
|
@ -266,16 +257,14 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
bot.tree().expandNode("Autotools").select("Configure Settings");
|
bot.tree().expandNode("Autotools").select("Configure Settings");
|
||||||
configs = bot.comboBoxWithLabel("Configuration: ");
|
configs = bot.comboBoxWithLabel("Configuration: ");
|
||||||
configs.setSelection("default");
|
configs.setSelection("default");
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
text = bot.textWithLabel("Additional command-line options");
|
text = bot.textWithLabel("Additional command-line options");
|
||||||
val = text.getText();
|
val = text.getText();
|
||||||
assertEquals("", val);
|
assertEquals("", val);
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
// Build the project again and verify we get a build-debug directory
|
// Build the project again and verify we get a build-debug directory
|
||||||
projectExplorer.bot().tree().select(projectName);
|
projectExplorer.bot().tree().select(projectName);
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Project");
|
||||||
"Build Project");
|
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
assertNotNull(workspace);
|
assertNotNull(workspace);
|
||||||
IWorkspaceRoot root = workspace.getRoot();
|
IWorkspaceRoot root = workspace.getRoot();
|
||||||
|
@ -362,8 +351,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
}
|
}
|
||||||
assertEquals(2, foundUser);
|
assertEquals(2, foundUser);
|
||||||
|
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Configurations", "Manage...");
|
||||||
"Build Configurations", "Manage...");
|
|
||||||
shell = bot.shell(projectName + ": Manage Configurations");
|
shell = bot.shell(projectName + ": Manage Configurations");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
table = bot.table();
|
table = bot.table();
|
||||||
|
@ -392,15 +380,13 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
SWTBotShell shell = bot.shell("Properties for " + projectName);
|
SWTBotShell shell = bot.shell("Properties for " + projectName);
|
||||||
shell.activate();
|
shell.activate();
|
||||||
configs = bot.comboBoxWithLabel("Configuration: ");
|
configs = bot.comboBoxWithLabel("Configuration: ");
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
||||||
String setting = text.getText();
|
String setting = text.getText();
|
||||||
assertEquals("--enable-jeff", setting);
|
assertEquals("--enable-jeff", setting);
|
||||||
configs.setFocus();
|
configs.setFocus();
|
||||||
configs.setSelection("debug");
|
configs.setSelection("debug");
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
text = bot.textWithLabel("Additional command-line options");
|
text = bot.textWithLabel("Additional command-line options");
|
||||||
setting = text.getText();
|
setting = text.getText();
|
||||||
assertEquals("", setting);
|
assertEquals("", setting);
|
||||||
|
@ -412,16 +398,14 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
configs = bot.comboBoxWithLabel("Configuration: ");
|
configs = bot.comboBoxWithLabel("Configuration: ");
|
||||||
configs.setSelection("debug");
|
configs.setSelection("debug");
|
||||||
assertTrue(configs.getText().contains("debug"));
|
assertTrue(configs.getText().contains("debug"));
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
text = bot.textWithLabel("Additional command-line options");
|
text = bot.textWithLabel("Additional command-line options");
|
||||||
setting = text.getText();
|
setting = text.getText();
|
||||||
assertEquals("--enable-jeff", setting);
|
assertEquals("--enable-jeff", setting);
|
||||||
configs.setFocus();
|
configs.setFocus();
|
||||||
configs.setSelection("default");
|
configs.setSelection("default");
|
||||||
assertTrue(configs.getText().contains("default"));
|
assertTrue(configs.getText().contains("default"));
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
text = bot.textWithLabel("Additional command-line options");
|
text = bot.textWithLabel("Additional command-line options");
|
||||||
setting = text.getText();
|
setting = text.getText();
|
||||||
assertEquals("", setting);
|
assertEquals("", setting);
|
||||||
|
@ -455,16 +439,14 @@ public class SetConfigurationParameter extends AbstractTest {
|
||||||
configs = bot.comboBoxWithLabel("Configuration: ");
|
configs = bot.comboBoxWithLabel("Configuration: ");
|
||||||
assertTrue(configs.getText().contains("release"));
|
assertTrue(configs.getText().contains("release"));
|
||||||
assertTrue(configs.getText().contains("Active"));
|
assertTrue(configs.getText().contains("Active"));
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
||||||
String setting = text.getText();
|
String setting = text.getText();
|
||||||
assertEquals("--enable-jeff", setting);
|
assertEquals("--enable-jeff", setting);
|
||||||
configs.setFocus();
|
configs.setFocus();
|
||||||
configs.setSelection("debug");
|
configs.setSelection("debug");
|
||||||
assertTrue(configs.getText().contains("debug"));
|
assertTrue(configs.getText().contains("debug"));
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
text = bot.textWithLabel("Additional command-line options");
|
text = bot.textWithLabel("Additional command-line options");
|
||||||
setting = text.getText();
|
setting = text.getText();
|
||||||
assertEquals("", setting);
|
assertEquals("", setting);
|
||||||
|
|
|
@ -45,15 +45,13 @@ public class TestEnvironmentVars extends AbstractTest {
|
||||||
SWTBotShell shell = openProperties("Autotools", "Configure Settings");
|
SWTBotShell shell = openProperties("Autotools", "Configure Settings");
|
||||||
// Set the configure parameters to be --enable-jeff via user-defined
|
// Set the configure parameters to be --enable-jeff via user-defined
|
||||||
// options
|
// options
|
||||||
bot.treeWithLabel("Configure Settings").expandNode("configure")
|
bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
|
||||||
.select("Advanced");
|
|
||||||
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
SWTBotText text = bot.textWithLabel("Additional command-line options");
|
||||||
text.typeText("${some_var}");
|
text.typeText("${some_var}");
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
bot.waitUntil(Conditions.shellCloses(shell), 120000);
|
bot.waitUntil(Conditions.shellCloses(shell), 120000);
|
||||||
|
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Reconfigure Project");
|
||||||
"Reconfigure Project");
|
|
||||||
IPath path = checkProject().getLocation();
|
IPath path = checkProject().getLocation();
|
||||||
File f = null;
|
File f = null;
|
||||||
// We need to wait until the config.status file is created so
|
// We need to wait until the config.status file is created so
|
||||||
|
@ -96,8 +94,7 @@ public class TestEnvironmentVars extends AbstractTest {
|
||||||
shell.activate();
|
shell.activate();
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
bot.waitUntil(Conditions.shellCloses(shell));
|
bot.waitUntil(Conditions.shellCloses(shell));
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Reconfigure Project");
|
||||||
"Reconfigure Project");
|
|
||||||
|
|
||||||
IPath path = checkProject().getLocation();
|
IPath path = checkProject().getLocation();
|
||||||
File f = null;
|
File f = null;
|
||||||
|
@ -148,20 +145,16 @@ public class TestEnvironmentVars extends AbstractTest {
|
||||||
bot.textWithLabel("Command").setText("");
|
bot.textWithLabel("Command").setText("");
|
||||||
// Choose three different forms, some using quotes to allow blanks in
|
// Choose three different forms, some using quotes to allow blanks in
|
||||||
// them
|
// them
|
||||||
bot.textWithLabel("Command")
|
bot.textWithLabel("Command").typeText(
|
||||||
.typeText(
|
"some_var1=\"a boat\" some_var2='a train' some_var3=car fake_configure some_var4=\"a wagon\" some_var5='a plane' some_var6=skates");
|
||||||
"some_var1=\"a boat\" some_var2='a train' some_var3=car fake_configure some_var4=\"a wagon\" some_var5='a plane' some_var6=skates");
|
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
// Reconfigure the project and make sure the env variables are seen in
|
// Reconfigure the project and make sure the env variables are seen in
|
||||||
// the script
|
// the script
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Reconfigure Project");
|
||||||
"Reconfigure Project");
|
|
||||||
focusMainShell();
|
focusMainShell();
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
Pattern p = Pattern.compile(
|
Pattern p = Pattern.compile(".*a boat.*a train.*car.*a wagon.*a plane.*skates.*", Pattern.DOTALL);
|
||||||
".*a boat.*a train.*car.*a wagon.*a plane.*skates.*",
|
|
||||||
Pattern.DOTALL);
|
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,7 @@ public class TestMakeTargets extends AbstractTest {
|
||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
|
|
||||||
projectExplorer.bot().tree().getTreeItem(projectName).select();
|
projectExplorer.bot().tree().getTreeItem(projectName).select();
|
||||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
clickContextMenu(projectExplorer.bot().tree().select(projectName), "Build Targets", "Build...");
|
||||||
"Build Targets", "Build...");
|
|
||||||
shell = bot.shell("Build Targets");
|
shell = bot.shell("Build Targets");
|
||||||
shell.activate();
|
shell.activate();
|
||||||
bot.table().getTableItem("info").select();
|
bot.table().getTableItem("info").select();
|
||||||
|
@ -79,8 +78,7 @@ public class TestMakeTargets extends AbstractTest {
|
||||||
bot.button("Build").click();
|
bot.button("Build").click();
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
p = Pattern.compile(".*make check.*Making check in src.*",
|
p = Pattern.compile(".*make check.*Making check in src.*", Pattern.DOTALL);
|
||||||
Pattern.DOTALL);
|
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking aclocal in.*" + projectName
|
Pattern p = Pattern.compile(".*Invoking aclocal in.*" + projectName + ".*aclocal --help.*Usage: aclocal.*",
|
||||||
+ ".*aclocal --help.*Usage: aclocal.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
// Verify we still don't have an aclocal.m4 file yet
|
// Verify we still don't have an aclocal.m4 file yet
|
||||||
f = new File(path.toOSString());
|
f = new File(path.toOSString());
|
||||||
|
@ -85,8 +85,7 @@ public class TestToolActions extends AbstractTest {
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
p = Pattern.compile(".*Invoking aclocal in.*" + projectName
|
p = Pattern.compile(".*Invoking aclocal in.*" + projectName + ".*aclocal.*", Pattern.DOTALL);
|
||||||
+ ".*aclocal.*", Pattern.DOTALL);
|
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
// We need to wait until the aclocal.m4 file is created so
|
// We need to wait until the aclocal.m4 file is created so
|
||||||
// sleep a bit and look for it...give up after 20 seconds
|
// sleep a bit and look for it...give up after 20 seconds
|
||||||
|
@ -115,8 +114,7 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking autoconf in.*" + projectName
|
Pattern p = Pattern.compile(".*Invoking autoconf in.*" + projectName + ".*autoconf.*", Pattern.DOTALL);
|
||||||
+ ".*autoconf.*", Pattern.DOTALL);
|
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
// We need to wait until the configure file is created so
|
// We need to wait until the configure file is created so
|
||||||
// sleep a bit and look for it...give up after 20 seconds
|
// sleep a bit and look for it...give up after 20 seconds
|
||||||
|
@ -134,13 +132,11 @@ public class TestToolActions extends AbstractTest {
|
||||||
// explorer menu directly from the configure.ac file.
|
// explorer menu directly from the configure.ac file.
|
||||||
assertTrue(f.delete());
|
assertTrue(f.delete());
|
||||||
enterProjectFolder();
|
enterProjectFolder();
|
||||||
clickVolatileContextMenu(
|
clickVolatileContextMenu(projectExplorer.bot().tree().select("configure.ac"), "Invoke Autotools",
|
||||||
projectExplorer.bot().tree().select("configure.ac"),
|
"Invoke Autoconf");
|
||||||
"Invoke Autotools", "Invoke Autoconf");
|
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
p = Pattern.compile(".*Invoking autoconf in.*" + projectName
|
p = Pattern.compile(".*Invoking autoconf in.*" + projectName + ".*autoconf.*", Pattern.DOTALL);
|
||||||
+ ".*autoconf.*", Pattern.DOTALL);
|
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
// We need to wait until the configure file is created so
|
// We need to wait until the configure file is created so
|
||||||
// sleep a bit and look for it...give up after 20 seconds
|
// sleep a bit and look for it...give up after 20 seconds
|
||||||
|
@ -181,8 +177,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking automake in.*" + projectName
|
Pattern p = Pattern.compile(".*Invoking automake in.*" + projectName + ".*automake --help.*Usage:.*",
|
||||||
+ ".*automake --help.*Usage:.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
// Verify we still don't have Makefile.in files yet
|
// Verify we still don't have Makefile.in files yet
|
||||||
f = new File(path.toOSString());
|
f = new File(path.toOSString());
|
||||||
|
@ -201,8 +197,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
bot.button("OK").click();
|
bot.button("OK").click();
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
p = Pattern.compile(".*Invoking automake in.*" + projectName
|
p = Pattern.compile(
|
||||||
+ ".*automake --add-missing Makefile src/Makefile.*",
|
".*Invoking automake in.*" + projectName + ".*automake --add-missing Makefile src/Makefile.*",
|
||||||
Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
// We need to wait until the Makefile.in files are created so
|
// We need to wait until the Makefile.in files are created so
|
||||||
|
@ -234,8 +230,9 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking libtoolize in.*" + projectName
|
Pattern p = Pattern.compile(
|
||||||
+ ".*libtoolize --help.*Usage: .*libtoolize.*", Pattern.DOTALL);
|
".*Invoking libtoolize in.*" + projectName + ".*libtoolize --help.*Usage: .*libtoolize.*",
|
||||||
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,8 +247,9 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking autoheader in.*" + projectName
|
Pattern p = Pattern.compile(
|
||||||
+ ".*autoheader --help.*Usage:.*autoheader.*", Pattern.DOTALL);
|
".*Invoking autoheader in.*" + projectName + ".*autoheader --help.*Usage:.*autoheader.*",
|
||||||
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,8 +286,9 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking autoreconf in.*" + projectName
|
Pattern p = Pattern.compile(
|
||||||
+ ".*autoreconf --help.*Usage: .*autoreconf.*", Pattern.DOTALL);
|
".*Invoking autoreconf in.*" + projectName + ".*autoreconf --help.*Usage: .*autoreconf.*",
|
||||||
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
clickProjectContextMenu("Invoke Autotools", "Invoke Autoreconf");
|
clickProjectContextMenu("Invoke Autotools", "Invoke Autoreconf");
|
||||||
shell = bot.shell("Autoreconf Options");
|
shell = bot.shell("Autoreconf Options");
|
||||||
|
@ -299,14 +298,14 @@ public class TestToolActions extends AbstractTest {
|
||||||
// We need to wait until the Makefile.in file is created so
|
// We need to wait until the Makefile.in file is created so
|
||||||
// sleep a bit and look for it
|
// sleep a bit and look for it
|
||||||
bot.sleep(5000);
|
bot.sleep(5000);
|
||||||
|
|
||||||
// Verify a number of generated files now exist
|
// Verify a number of generated files now exist
|
||||||
String[] fileList = { "Makefile.in", "src/Makefile.in", "configure", "config.sub" };
|
String[] fileList = { "Makefile.in", "src/Makefile.in", "configure", "config.sub" };
|
||||||
for (String name : fileList) {
|
for (String name : fileList) {
|
||||||
f = new File(path.append(name).toOSString());
|
f = new File(path.append(name).toOSString());
|
||||||
assertTrue("Missing: " + name, f.exists());
|
assertTrue("Missing: " + name, f.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = "config.status";
|
String name = "config.status";
|
||||||
f = new File(path.append(name).toOSString());
|
f = new File(path.append(name).toOSString());
|
||||||
assertTrue("Mistakenly found: " + name, !f.exists()); // shouldn't have run configure
|
assertTrue("Mistakenly found: " + name, !f.exists()); // shouldn't have run configure
|
||||||
|
@ -434,8 +433,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
SWTBotView consoleView = viewConsole("Autotools");
|
SWTBotView consoleView = viewConsole("Autotools");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
Pattern p = Pattern.compile(".*Invoking aclocal in.*" + projectName
|
Pattern p = Pattern.compile(".*Invoking aclocal in.*" + projectName + ".*automake --help.*Usage:.*automake.*",
|
||||||
+ ".*automake --help.*Usage:.*automake.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
|
|
||||||
clickProjectContextMenu("Invoke Autotools", "Invoke Automake");
|
clickProjectContextMenu("Invoke Autotools", "Invoke Automake");
|
||||||
|
@ -446,8 +445,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
p = Pattern.compile(".*Invoking automake in.*" + projectName
|
p = Pattern.compile(".*Invoking automake in.*" + projectName + ".*autoconf --help.*Usage:.*autoconf.*",
|
||||||
+ ".*autoconf --help.*Usage:.*autoconf.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
|
|
||||||
clickProjectContextMenu("Invoke Autotools", "Invoke Autoheader");
|
clickProjectContextMenu("Invoke Autotools", "Invoke Autoheader");
|
||||||
|
@ -458,8 +457,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
p = Pattern.compile(".*Invoking autoheader in.*" + projectName
|
p = Pattern.compile(".*Invoking autoheader in.*" + projectName + ".*autoreconf --help.*Usage:.*autoreconf.*",
|
||||||
+ ".*autoreconf --help.*Usage:.*autoreconf.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
|
|
||||||
clickProjectContextMenu("Invoke Autotools", "Invoke Autoreconf");
|
clickProjectContextMenu("Invoke Autotools", "Invoke Autoreconf");
|
||||||
|
@ -470,8 +469,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
p = Pattern.compile(".*Invoking autoreconf in.*" + projectName
|
p = Pattern.compile(".*Invoking autoreconf in.*" + projectName + ".*libtoolize --help.*Usage:.*libtoolize.*",
|
||||||
+ ".*libtoolize --help.*Usage:.*libtoolize.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
|
|
||||||
clickProjectContextMenu("Invoke Autotools", "Invoke Libtoolize");
|
clickProjectContextMenu("Invoke Autotools", "Invoke Libtoolize");
|
||||||
|
@ -482,8 +481,8 @@ public class TestToolActions extends AbstractTest {
|
||||||
consoleView = bot.viewByPartName("Console");
|
consoleView = bot.viewByPartName("Console");
|
||||||
consoleView.setFocus();
|
consoleView.setFocus();
|
||||||
// Verify we got some help output to the console
|
// Verify we got some help output to the console
|
||||||
p = Pattern.compile(".*Invoking libtoolize in.*" + projectName
|
p = Pattern.compile(".*Invoking libtoolize in.*" + projectName + ".*aclocal --help.*Usage:.*aclocal.*",
|
||||||
+ ".*aclocal --help.*Usage:.*aclocal.*", Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
bot.waitUntil(consoleTextMatches(consoleView, p));
|
bot.waitUntil(consoleTextMatches(consoleView, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,7 @@ import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({ TestMacroParser.class, TestTokenizer.class, TestShellParser.class })
|
||||||
TestMacroParser.class,
|
|
||||||
TestTokenizer.class,
|
|
||||||
TestShellParser.class
|
|
||||||
})
|
|
||||||
public class AutoconfTests {
|
public class AutoconfTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,9 +49,9 @@ public abstract class BaseParserTest {
|
||||||
assertNotNull(exception);
|
assertNotNull(exception);
|
||||||
errors.add(exception);
|
errors.add(exception);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.macroDetector = new AutoconfMacroDetector();
|
this.macroDetector = new AutoconfMacroDetector();
|
||||||
|
|
||||||
macroNames = new HashSet<>();
|
macroNames = new HashSet<>();
|
||||||
this.macroValidator = (AutoconfMacroElement element) -> {
|
this.macroValidator = (AutoconfMacroElement element) -> {
|
||||||
assertNotNull(element);
|
assertNotNull(element);
|
||||||
|
@ -83,14 +83,14 @@ public abstract class BaseParserTest {
|
||||||
* cleared out before use
|
* cleared out before use
|
||||||
* @param parser
|
* @param parser
|
||||||
* @param document
|
* @param document
|
||||||
* @return root
|
* @return root
|
||||||
*/
|
*/
|
||||||
protected AutoconfElement parseWithHandlers(IDocument document) {
|
protected AutoconfElement parseWithHandlers(IDocument document) {
|
||||||
AutoconfParser parser = new AutoconfParser(errorHandler, macroDetector, macroValidator);
|
AutoconfParser parser = new AutoconfParser(errorHandler, macroDetector, macroValidator);
|
||||||
|
|
||||||
errors.clear();
|
errors.clear();
|
||||||
macroNames.clear();
|
macroNames.clear();
|
||||||
|
|
||||||
AutoconfElement root = parser.parse(document);
|
AutoconfElement root = parser.parse(document);
|
||||||
assertNotNull(root);
|
assertNotNull(root);
|
||||||
return root;
|
return root;
|
||||||
|
@ -100,7 +100,7 @@ public abstract class BaseParserTest {
|
||||||
* Parse the document in 'string' twice, once without any handlers and once with the standard error or macro handlers,
|
* Parse the document in 'string' twice, once without any handlers and once with the standard error or macro handlers,
|
||||||
* cleared out before use
|
* cleared out before use
|
||||||
* @param string
|
* @param string
|
||||||
* @return root
|
* @return root
|
||||||
*/
|
*/
|
||||||
protected AutoconfElement parse(String string) {
|
protected AutoconfElement parse(String string) {
|
||||||
AutoconfElement tree = parse(string, false);
|
AutoconfElement tree = parse(string, false);
|
||||||
|
@ -113,34 +113,33 @@ public abstract class BaseParserTest {
|
||||||
assertNotNull(root1);
|
assertNotNull(root1);
|
||||||
AutoconfElement root2 = parseWithHandlers(document);
|
AutoconfElement root2 = parseWithHandlers(document);
|
||||||
assertNotNull(root2);
|
assertNotNull(root2);
|
||||||
|
|
||||||
validateSourceTree(root1);
|
validateSourceTree(root1);
|
||||||
validateSourceTree(root2);
|
validateSourceTree(root2);
|
||||||
|
|
||||||
// TODO: check root1 == root2
|
// TODO: check root1 == root2
|
||||||
|
|
||||||
// ensure the doc wasn't changed (sanity)
|
// ensure the doc wasn't changed (sanity)
|
||||||
assertEquals(string, document.get());
|
assertEquals(string, document.get());
|
||||||
|
|
||||||
if (!allowErrors) {
|
if (!allowErrors) {
|
||||||
if (!errors.isEmpty())
|
if (!errors.isEmpty())
|
||||||
fail("got errors" + errors.get(0));
|
fail("got errors" + errors.get(0));
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
assertFalse(errors.isEmpty());
|
assertFalse(errors.isEmpty());
|
||||||
|
|
||||||
return root2;
|
return root2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkError(String msgKey) {
|
protected void checkError(String msgKey) {
|
||||||
for (ParseException exc: errors) {
|
for (ParseException exc : errors) {
|
||||||
if (exc.getMessage().contains(msgKey))
|
if (exc.getMessage().contains(msgKey))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String any = "";
|
String any = "";
|
||||||
if (!errors.isEmpty())
|
if (!errors.isEmpty())
|
||||||
any = ", but saw " + errors.get(0).toString();
|
any = ", but saw " + errors.get(0).toString();
|
||||||
fail("did not find error: " + msgKey + any );
|
fail("did not find error: " + msgKey + any);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkError(String msgKey, int line) {
|
protected void checkError(String msgKey, int line) {
|
||||||
|
@ -160,7 +159,8 @@ public abstract class BaseParserTest {
|
||||||
if (possible == null)
|
if (possible == null)
|
||||||
fail("did not find any error: " + msgKey);
|
fail("did not find any error: " + msgKey);
|
||||||
else
|
else
|
||||||
fail("did not find error: " + msgKey + " on line: " + line +", but found one at " + possible.getLineNumber());
|
fail("did not find error: " + msgKey + " on line: " + line + ", but found one at "
|
||||||
|
+ possible.getLineNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,8 +176,7 @@ public abstract class BaseParserTest {
|
||||||
validateSourceElement(element);
|
validateSourceElement(element);
|
||||||
AutoconfElement[] kids = element.getChildren();
|
AutoconfElement[] kids = element.getChildren();
|
||||||
for (int i = 0; i < kids.length; i++) {
|
for (int i = 0; i < kids.length; i++) {
|
||||||
if (kids[i].getStartOffset() < element.getStartOffset()
|
if (kids[i].getStartOffset() < element.getStartOffset() || kids[i].getEndOffset() > element.getEndOffset())
|
||||||
|| kids[i].getEndOffset() > element.getEndOffset())
|
|
||||||
fail(describeElement(kids[i]) + " not inside parent " + describeElement(element));
|
fail(describeElement(kids[i]) + " not inside parent " + describeElement(element));
|
||||||
validateSourceTree(kids[i]);
|
validateSourceTree(kids[i]);
|
||||||
}
|
}
|
||||||
|
@ -226,16 +225,16 @@ public abstract class BaseParserTest {
|
||||||
assertEquals(elements.length, assertTreeStructure(tree, elements, 0));
|
assertEquals(elements.length, assertTreeStructure(tree, elements, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int assertTreeStructure(AutoconfElement tree, String[] elements,
|
private int assertTreeStructure(AutoconfElement tree, String[] elements, int elementIdx) {
|
||||||
int elementIdx) {
|
|
||||||
AutoconfElement[] kids = tree.getChildren();
|
AutoconfElement[] kids = tree.getChildren();
|
||||||
for (int j = 0; j < kids.length; j++) {
|
for (int j = 0; j < kids.length; j++) {
|
||||||
if (elementIdx >= elements.length || elements[elementIdx] == null) {
|
if (elementIdx >= elements.length || elements[elementIdx] == null) {
|
||||||
fail("extra children in " + tree + " at " + kids[j]);
|
fail("extra children in " + tree + " at " + kids[j]);
|
||||||
}
|
}
|
||||||
if (!kids[j].getName().equals(elements[elementIdx]))
|
if (!kids[j].getName().equals(elements[elementIdx]))
|
||||||
fail("did not match " + elements[elementIdx] + ", instead got " + kids[j].getClass().getSimpleName() + "=" + kids[j].getName());
|
fail("did not match " + elements[elementIdx] + ", instead got " + kids[j].getClass().getSimpleName()
|
||||||
|
+ "=" + kids[j].getName());
|
||||||
|
|
||||||
elementIdx++;
|
elementIdx++;
|
||||||
if (kids[j].getChildren().length > 0) {
|
if (kids[j].getChildren().length > 0) {
|
||||||
elementIdx = assertTreeStructure(kids[j], elements, elementIdx);
|
elementIdx = assertTreeStructure(kids[j], elements, elementIdx);
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfMacroElement;
|
||||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfParser;
|
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfParser;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test parsing with macros
|
* Test parsing with macros
|
||||||
* @author eswartz
|
* @author eswartz
|
||||||
|
@ -37,114 +36,103 @@ public class TestMacroParser extends BaseParserTest {
|
||||||
public void testEmpty() {
|
public void testEmpty() {
|
||||||
parse("");
|
parse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComments() {
|
public void testComments() {
|
||||||
//
|
//
|
||||||
String text =
|
String text = "dnl first line\n" + "dnl second line\n";
|
||||||
"dnl first line\n" +
|
|
||||||
"dnl second line\n";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
Object[] kids = root.getChildren();
|
Object[] kids = root.getChildren();
|
||||||
// these are stripped
|
// these are stripped
|
||||||
assertEquals(0, kids.length);
|
assertEquals(0, kids.length);
|
||||||
assertTreeStructure(root, new String[] {});
|
assertTreeStructure(root, new String[] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMacroParsing1() {
|
public void testMacroParsing1() {
|
||||||
//
|
//
|
||||||
String text =
|
String text = "AC_REQUIRE([AM_SANITY_CHECK])\n" + "";
|
||||||
"AC_REQUIRE([AM_SANITY_CHECK])\n" +
|
|
||||||
"";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
assertTreeStructure(root, new String[] { "AC_REQUIRE", "AM_SANITY_CHECK", null });
|
assertTreeStructure(root, new String[] { "AC_REQUIRE", "AM_SANITY_CHECK", null });
|
||||||
|
|
||||||
AutoconfElement[] kids = root.getChildren();
|
AutoconfElement[] kids = root.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
||||||
AutoconfMacroElement macro = (AutoconfMacroElement) kids[0];
|
AutoconfMacroElement macro = (AutoconfMacroElement) kids[0];
|
||||||
assertEquals("AC_REQUIRE", macro.getName());
|
assertEquals("AC_REQUIRE", macro.getName());
|
||||||
assertEquals(1, macro.getParameterCount());
|
assertEquals(1, macro.getParameterCount());
|
||||||
|
|
||||||
AutoconfElement[] args = macro.getChildren();
|
AutoconfElement[] args = macro.getChildren();
|
||||||
assertEquals(1, args.length);
|
assertEquals(1, args.length);
|
||||||
assertTrue(args[0] instanceof AutoconfMacroArgumentElement);
|
assertTrue(args[0] instanceof AutoconfMacroArgumentElement);
|
||||||
|
|
||||||
assertEquals("AM_SANITY_CHECK", ((AutoconfMacroArgumentElement)args[0]).getName());
|
assertEquals("AM_SANITY_CHECK", ((AutoconfMacroArgumentElement) args[0]).getName());
|
||||||
assertEquals("AM_SANITY_CHECK", macro.getParameter(0));
|
assertEquals("AM_SANITY_CHECK", macro.getParameter(0));
|
||||||
|
|
||||||
// keep quotes in source
|
// keep quotes in source
|
||||||
assertEqualSource("[AM_SANITY_CHECK]", args[0]);
|
assertEqualSource("[AM_SANITY_CHECK]", args[0]);
|
||||||
assertEqualSource("AC_REQUIRE([AM_SANITY_CHECK])", macro);
|
assertEqualSource("AC_REQUIRE([AM_SANITY_CHECK])", macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMacroParsing2() {
|
public void testMacroParsing2() {
|
||||||
//
|
//
|
||||||
String text =
|
String text = "AC_TWO_ARGS(first,second)\n" + "";
|
||||||
"AC_TWO_ARGS(first,second)\n" +
|
|
||||||
"";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
assertTreeStructure(root, new String[] { "AC_TWO_ARGS", "first", "second", null });
|
assertTreeStructure(root, new String[] { "AC_TWO_ARGS", "first", "second", null });
|
||||||
|
|
||||||
AutoconfElement[] kids = root.getChildren();
|
AutoconfElement[] kids = root.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
||||||
AutoconfMacroElement macro = (AutoconfMacroElement) kids[0];
|
AutoconfMacroElement macro = (AutoconfMacroElement) kids[0];
|
||||||
assertEquals("AC_TWO_ARGS", macro.getName());
|
assertEquals("AC_TWO_ARGS", macro.getName());
|
||||||
assertEquals(2, macro.getParameterCount());
|
assertEquals(2, macro.getParameterCount());
|
||||||
|
|
||||||
AutoconfElement[] args = macro.getChildren();
|
AutoconfElement[] args = macro.getChildren();
|
||||||
assertEquals(2, args.length);
|
assertEquals(2, args.length);
|
||||||
assertTrue(args[0] instanceof AutoconfMacroArgumentElement);
|
assertTrue(args[0] instanceof AutoconfMacroArgumentElement);
|
||||||
assertEquals("first", ((AutoconfMacroArgumentElement)args[0]).getName());
|
assertEquals("first", ((AutoconfMacroArgumentElement) args[0]).getName());
|
||||||
assertTrue(args[1] instanceof AutoconfMacroArgumentElement);
|
assertTrue(args[1] instanceof AutoconfMacroArgumentElement);
|
||||||
assertEquals("second", ((AutoconfMacroArgumentElement)args[1]).getName());
|
assertEquals("second", ((AutoconfMacroArgumentElement) args[1]).getName());
|
||||||
assertEquals("first", macro.getParameter(0));
|
assertEquals("first", macro.getParameter(0));
|
||||||
assertEquals("second", macro.getParameter(1));
|
assertEquals("second", macro.getParameter(1));
|
||||||
|
|
||||||
assertEqualSource("first", args[0]);
|
assertEqualSource("first", args[0]);
|
||||||
assertEqualSource("second", args[1]);
|
assertEqualSource("second", args[1]);
|
||||||
assertEqualSource("AC_TWO_ARGS(first,second)", macro);
|
assertEqualSource("AC_TWO_ARGS(first,second)", macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMacroParsing3() {
|
public void testMacroParsing3() {
|
||||||
//
|
//
|
||||||
String text =
|
String text = "AC_ONE_ARG( [quoted( arg ), second] )\n" + "";
|
||||||
"AC_ONE_ARG( [quoted( arg ), second] )\n" +
|
|
||||||
"";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
assertTreeStructure(root, new String[] { "AC_ONE_ARG", "quoted( arg ), second", null });
|
assertTreeStructure(root, new String[] { "AC_ONE_ARG", "quoted( arg ), second", null });
|
||||||
|
|
||||||
AutoconfElement[] kids = root.getChildren();
|
AutoconfElement[] kids = root.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
||||||
AutoconfMacroElement macro = (AutoconfMacroElement) kids[0];
|
AutoconfMacroElement macro = (AutoconfMacroElement) kids[0];
|
||||||
assertEquals("AC_ONE_ARG", macro.getName());
|
assertEquals("AC_ONE_ARG", macro.getName());
|
||||||
|
|
||||||
AutoconfElement[] args = macro.getChildren();
|
AutoconfElement[] args = macro.getChildren();
|
||||||
assertEquals(1, macro.getParameterCount());
|
assertEquals(1, macro.getParameterCount());
|
||||||
assertEquals(1, args.length);
|
assertEquals(1, args.length);
|
||||||
assertTrue(args[0] instanceof AutoconfMacroArgumentElement);
|
assertTrue(args[0] instanceof AutoconfMacroArgumentElement);
|
||||||
|
|
||||||
// spaces removed from outermost arguments, but not inner
|
// spaces removed from outermost arguments, but not inner
|
||||||
assertEquals("quoted( arg ), second", ((AutoconfMacroArgumentElement)args[0]).getName());
|
assertEquals("quoted( arg ), second", ((AutoconfMacroArgumentElement) args[0]).getName());
|
||||||
assertEquals("quoted( arg ), second", macro.getParameter(0));
|
assertEquals("quoted( arg ), second", macro.getParameter(0));
|
||||||
|
|
||||||
assertEqualSource("[quoted( arg ), second]", args[0]);
|
assertEqualSource("[quoted( arg ), second]", args[0]);
|
||||||
assertEqualSource("AC_ONE_ARG( [quoted( arg ), second] )", macro);
|
assertEqualSource("AC_ONE_ARG( [quoted( arg ), second] )", macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMacroParsing4() {
|
public void testMacroParsing4() {
|
||||||
//
|
//
|
||||||
String text =
|
String text = "AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],\r\n"
|
||||||
"AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],\r\n" +
|
+ " [AM_AUTOMAKE_VERSION([1.4-p6])])\r\n" + "\r\n" + "";
|
||||||
" [AM_AUTOMAKE_VERSION([1.4-p6])])\r\n" +
|
|
||||||
"\r\n" +
|
|
||||||
"";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
AutoconfElement[] kids = root.getChildren();
|
AutoconfElement[] kids = root.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
|
@ -156,7 +144,7 @@ public class TestMacroParser extends BaseParserTest {
|
||||||
assertEquals(2, macro.getParameterCount());
|
assertEquals(2, macro.getParameterCount());
|
||||||
assertEquals("AM_SET_CURRENT_AUTOMAKE_VERSION", macro.getParameter(0));
|
assertEquals("AM_SET_CURRENT_AUTOMAKE_VERSION", macro.getParameter(0));
|
||||||
assertEquals("AM_AUTOMAKE_VERSION([1.4-p6])", macro.getParameter(1));
|
assertEquals("AM_AUTOMAKE_VERSION([1.4-p6])", macro.getParameter(1));
|
||||||
|
|
||||||
// no spaces in source either, but quotes kept
|
// no spaces in source either, but quotes kept
|
||||||
assertEqualSource("[AM_SET_CURRENT_AUTOMAKE_VERSION]", macro.getChildren()[0]);
|
assertEqualSource("[AM_SET_CURRENT_AUTOMAKE_VERSION]", macro.getChildren()[0]);
|
||||||
assertEqualSource("[AM_AUTOMAKE_VERSION([1.4-p6])]", macro.getChildren()[1]);
|
assertEqualSource("[AM_AUTOMAKE_VERSION([1.4-p6])]", macro.getChildren()[1]);
|
||||||
|
@ -166,30 +154,15 @@ public class TestMacroParser extends BaseParserTest {
|
||||||
public void testMacroParsing5() {
|
public void testMacroParsing5() {
|
||||||
// check that complex shell constructs don't throw off the
|
// check that complex shell constructs don't throw off the
|
||||||
// parser, and also that we don't mistake shell tokens in a macro argument
|
// parser, and also that we don't mistake shell tokens in a macro argument
|
||||||
String arg2 =
|
String arg2 = "AC_MSG_CHECKING(for working $2)\n"
|
||||||
"AC_MSG_CHECKING(for working $2)\n" +
|
+ "# Run test in a subshell; some versions of sh will print an error if\n"
|
||||||
"# Run test in a subshell; some versions of sh will print an error if\n" +
|
+ "# an executable is not found, even if stderr is redirected.\n"
|
||||||
"# an executable is not found, even if stderr is redirected.\n" +
|
+ "# Redirect stdin to placate older versions of autoconf. Sigh.\n"
|
||||||
"# Redirect stdin to placate older versions of autoconf. Sigh.\n" +
|
+ "if ($2 --version) < /dev/null > /dev/null 2>&1; then\n" + " $1=$2\n" + " AC_MSG_RESULT(found)\n"
|
||||||
"if ($2 --version) < /dev/null > /dev/null 2>&1; then\n" +
|
+ "else\n" + " $1=\"$3/missing $2\"\n" + " AC_MSG_RESULT(missing)\n" + "fi\n" + "AC_SUBST($1)";
|
||||||
" $1=$2\n" +
|
String text = "AC_DEFUN([AM_MISSING_PROG],\n" + "[" + arg2 + "])\n" + "";
|
||||||
" AC_MSG_RESULT(found)\n" +
|
|
||||||
"else\n" +
|
|
||||||
" $1=\"$3/missing $2\"\n" +
|
|
||||||
" AC_MSG_RESULT(missing)\n" +
|
|
||||||
"fi\n" +
|
|
||||||
"AC_SUBST($1)";
|
|
||||||
String text =
|
|
||||||
"AC_DEFUN([AM_MISSING_PROG],\n" +
|
|
||||||
"[" + arg2 + "])\n" +
|
|
||||||
"";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
assertTreeStructure(root, new String[] {
|
assertTreeStructure(root, new String[] { "AC_DEFUN", "AM_MISSING_PROG", arg2, null, });
|
||||||
"AC_DEFUN",
|
|
||||||
"AM_MISSING_PROG",
|
|
||||||
arg2,
|
|
||||||
null,
|
|
||||||
});
|
|
||||||
AutoconfElement[] kids = root.getChildren();
|
AutoconfElement[] kids = root.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
assertTrue(kids[0] instanceof AutoconfMacroElement);
|
||||||
|
@ -200,19 +173,17 @@ public class TestMacroParser extends BaseParserTest {
|
||||||
// spaces dropped
|
// spaces dropped
|
||||||
assertEquals(2, macro.getParameterCount());
|
assertEquals(2, macro.getParameterCount());
|
||||||
assertEquals("AM_MISSING_PROG", macro.getParameter(0));
|
assertEquals("AM_MISSING_PROG", macro.getParameter(0));
|
||||||
|
|
||||||
// be sure complex arguments aren't mangled
|
// be sure complex arguments aren't mangled
|
||||||
assertEquals(arg2, macro.getParameter(1));
|
assertEquals(arg2, macro.getParameter(1));
|
||||||
assertEqualSource("[" + arg2 + "]", macro.getChildren()[1]);
|
assertEqualSource("[" + arg2 + "]", macro.getChildren()[1]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMacroParsing6() {
|
public void testMacroParsing6() {
|
||||||
// empty arguments
|
// empty arguments
|
||||||
String text =
|
String text = "AC_DEFUN( ,\n" + ")\n";
|
||||||
"AC_DEFUN( ,\n" +
|
|
||||||
")\n";
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
AutoconfElement[] kids = root.getChildren();
|
AutoconfElement[] kids = root.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
|
@ -232,34 +203,29 @@ public class TestMacroParser extends BaseParserTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithErrorUnmatchedLeftParen() {
|
public void testWithErrorUnmatchedLeftParen() {
|
||||||
String text =
|
String text = "AC_BAD_MACRO(\n";
|
||||||
"AC_BAD_MACRO(\n";
|
|
||||||
|
|
||||||
AutoconfElement root = parse(text, true);
|
AutoconfElement root = parse(text, true);
|
||||||
assertEquals(1, root.getChildren().length);
|
assertEquals(1, root.getChildren().length);
|
||||||
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
||||||
checkError(AutoconfEditorMessages.getString(AutoconfParser.UNMATCHED_LEFT_PARENTHESIS));
|
checkError(AutoconfEditorMessages.getString(AutoconfParser.UNMATCHED_LEFT_PARENTHESIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithErrorUnmatchedRightParen() {
|
public void testWithErrorUnmatchedRightParen() {
|
||||||
String text =
|
String text = "AC_BAD_MACRO())\n";
|
||||||
"AC_BAD_MACRO())\n";
|
|
||||||
|
|
||||||
AutoconfElement root = parse(text, true);
|
AutoconfElement root = parse(text, true);
|
||||||
assertEquals(1, root.getChildren().length);
|
assertEquals(1, root.getChildren().length);
|
||||||
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
||||||
checkError(AutoconfEditorMessages.getString(AutoconfParser.UNMATCHED_RIGHT_PARENTHESIS));
|
checkError(AutoconfEditorMessages.getString(AutoconfParser.UNMATCHED_RIGHT_PARENTHESIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoFalseUnmatchedRightParen() {
|
public void testNoFalseUnmatchedRightParen() {
|
||||||
String text =
|
String text = "AC_BAD_MACRO()\n" + "(\n" + "cd foo;\n" + "if test -f myfile; then exit 1; fi\n" + ")\n";
|
||||||
"AC_BAD_MACRO()\n" +
|
|
||||||
"(\n"+
|
// nothing but the macro and 'if' is detected as meaningful
|
||||||
"cd foo;\n"+
|
|
||||||
"if test -f myfile; then exit 1; fi\n"+
|
|
||||||
")\n";
|
|
||||||
|
|
||||||
// nothing but the macro and 'if' is detected as meaningful
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
assertEquals(2, root.getChildren().length);
|
assertEquals(2, root.getChildren().length);
|
||||||
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
||||||
|
@ -268,9 +234,8 @@ public class TestMacroParser extends BaseParserTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedMacro() {
|
public void testNestedMacro() {
|
||||||
String text =
|
String text = "AC_1(AC_2())\n";
|
||||||
"AC_1(AC_2())\n";
|
|
||||||
|
|
||||||
AutoconfElement root = parse(text);
|
AutoconfElement root = parse(text);
|
||||||
assertEquals(1, root.getChildren().length);
|
assertEquals(1, root.getChildren().length);
|
||||||
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
||||||
|
|
|
@ -32,249 +32,183 @@ public class TestShellParser extends BaseParserTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHERE() {
|
public void testHERE() {
|
||||||
String HERE_TEXT =
|
String HERE_TEXT = "\n" + "while true; do \n" + "AM_INIT_AUTOMAKE([confusion], [$2], EOF)\n" + "done\n";
|
||||||
"\n"+
|
String text = "cat <<EOF" + HERE_TEXT + "EOF\n" + "blah";
|
||||||
"while true; do \n"+
|
|
||||||
"AM_INIT_AUTOMAKE([confusion], [$2], EOF)\n"+
|
|
||||||
"done\n";
|
|
||||||
String text = "cat <<EOF"+
|
|
||||||
HERE_TEXT +
|
|
||||||
"EOF\n" +
|
|
||||||
"blah";
|
|
||||||
AutoconfElement tree = parse(text);
|
|
||||||
|
|
||||||
// only see a macro call, not a loop
|
|
||||||
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "confusion", "$2", "EOF", null });
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void testHERE2() {
|
|
||||||
String HERE_TEXT =
|
|
||||||
"\n"+
|
|
||||||
"while true; do \n"+
|
|
||||||
"AM_INIT_AUTOMAKE([confusion], [$2], EOF)\n"+
|
|
||||||
"done\n";
|
|
||||||
String text = "cat <<-EOF"+
|
|
||||||
HERE_TEXT +
|
|
||||||
"EOF\n" +
|
|
||||||
"blah";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
|
|
||||||
// only see a macro call, not a loop
|
// only see a macro call, not a loop
|
||||||
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "confusion", "$2", "EOF", null });
|
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "confusion", "$2", "EOF", null });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHERE2() {
|
||||||
|
String HERE_TEXT = "\n" + "while true; do \n" + "AM_INIT_AUTOMAKE([confusion], [$2], EOF)\n" + "done\n";
|
||||||
|
String text = "cat <<-EOF" + HERE_TEXT + "EOF\n" + "blah";
|
||||||
|
AutoconfElement tree = parse(text);
|
||||||
|
|
||||||
|
// only see a macro call, not a loop
|
||||||
|
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "confusion", "$2", "EOF", null });
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIf0() {
|
public void testIf0() {
|
||||||
String text = "# comment\n"+
|
String text = "# comment\n" + "\tif true; then\n" + "\t\tfoo;\n" + "\tfi\n";
|
||||||
"\tif true; then\n" +
|
|
||||||
"\t\tfoo;\n"+
|
|
||||||
"\tfi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] { "if" });
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIf1() {
|
public void testIf1() {
|
||||||
String text = "# comment\n"+
|
String text = "# comment\n" + "\tif true; then\n" + "\t\tAC_SOMETHING();\n" + "\tfi\n";
|
||||||
"\tif true; then\n" +
|
|
||||||
"\t\tAC_SOMETHING();\n"+
|
|
||||||
"\tfi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] { "if", "AC_SOMETHING", "", null, null });
|
assertTreeStructure(tree, new String[] { "if", "AC_SOMETHING", "", null, null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfElse0() {
|
public void testIfElse0() {
|
||||||
String text = "# comment\n"+
|
String text = "# comment\n" + "\tif true; then\n" + "\t\tfoo;\n" + "\telse\n" + "\t\tbar;\n" + "\tfi\n";
|
||||||
"\tif true; then\n" +
|
|
||||||
"\t\tfoo;\n"+
|
|
||||||
"\telse\n"+
|
|
||||||
"\t\tbar;\n"+
|
|
||||||
"\tfi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] { "if", "else", null });
|
assertTreeStructure(tree, new String[] { "if", "else", null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfElse1() {
|
public void testIfElse1() {
|
||||||
String text = "# comment\n"+
|
String text = "# comment\n" + "\tif true; then\n" + "\t\tAC_ONE(...);\n" + "\telse\n"
|
||||||
"\tif true; then\n" +
|
+ "\t\tAC_TWO(AC_THREE());\n" + "\tfi\n";
|
||||||
"\t\tAC_ONE(...);\n"+
|
|
||||||
"\telse\n"+
|
|
||||||
"\t\tAC_TWO(AC_THREE());\n"+
|
|
||||||
"\tfi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree, new String[] { "if", "AC_ONE", "...", null, "else", "AC_TWO", "AC_THREE", "AC_THREE",
|
||||||
"if",
|
"", null, null, null, null, null });
|
||||||
"AC_ONE",
|
|
||||||
"...",
|
|
||||||
null,
|
|
||||||
"else",
|
|
||||||
"AC_TWO",
|
|
||||||
"AC_THREE",
|
|
||||||
"AC_THREE",
|
|
||||||
"",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null});
|
|
||||||
|
|
||||||
AutoconfElement[] kids = tree.getChildren();
|
AutoconfElement[] kids = tree.getChildren();
|
||||||
assertEqualSource("AC_ONE(...)", kids[0].getChildren()[0]);
|
assertEqualSource("AC_ONE(...)", kids[0].getChildren()[0]);
|
||||||
assertEqualSource("AC_TWO(AC_THREE())", kids[0].getChildren()[1].getChildren()[0]);
|
assertEqualSource("AC_TWO(AC_THREE())", kids[0].getChildren()[1].getChildren()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIf2() {
|
public void testIf2() {
|
||||||
String text =
|
String text = "if blah\n" + "then fi\n";
|
||||||
"if blah\n" +
|
|
||||||
"then fi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] { "if" });
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfElif() {
|
public void testIfElif() {
|
||||||
String text = "# comment\n"+
|
String text = "# comment\n" + "\tif true; then\n" + "\t\tAC_ONE(...);\n" + "\telif false; then \n"
|
||||||
"\tif true; then\n" +
|
+ "\t\tAC_TWO(...);\n" + "\tfi\n";
|
||||||
"\t\tAC_ONE(...);\n"+
|
|
||||||
"\telif false; then \n"+
|
|
||||||
"\t\tAC_TWO(...);\n"+
|
|
||||||
"\tfi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree,
|
||||||
"if",
|
new String[] { "if", "AC_ONE", "...", null, "elif", "AC_TWO", "...", null, null, null });
|
||||||
"AC_ONE",
|
|
||||||
"...",
|
|
||||||
null,
|
|
||||||
"elif",
|
|
||||||
"AC_TWO",
|
|
||||||
"...",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfErr1() {
|
public void testIfErr1() {
|
||||||
String text =
|
String text = "if then fi\n";
|
||||||
"if then fi\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_SPECIFIER, "then"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_SPECIFIER, "then"));
|
||||||
assertTreeStructure(tree, new String[] { "if" });
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfErr2() {
|
public void testIfErr2() {
|
||||||
String text =
|
String text = "if true; do fi\n";
|
||||||
"if true; do fi\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getString(AutoconfParser.INVALID_DO));
|
checkError(AutoconfEditorMessages.getString(AutoconfParser.INVALID_DO));
|
||||||
assertTreeStructure(tree, new String[] { "if" });
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfErr3() {
|
public void testIfErr3() {
|
||||||
String text =
|
String text = "if; else bar; fi\n";
|
||||||
"if; else bar; fi\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.MISSING_SPECIFIER, "then"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.MISSING_SPECIFIER, "then"));
|
||||||
assertTreeStructure(tree, new String[] { "if", "else", null });
|
assertTreeStructure(tree, new String[] { "if", "else", null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfErr4() {
|
public void testIfErr4() {
|
||||||
String text =
|
String text = "if true; then stmt fi\n";
|
||||||
"if true; then stmt fi\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "fi"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "fi"));
|
||||||
assertTreeStructure(tree, new String[] { "if" });
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfErr5() {
|
public void testIfErr5() {
|
||||||
String text =
|
String text = "if true; then\n";
|
||||||
"if true; then\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "if"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "if"));
|
||||||
assertTreeStructure(tree, new String[] { "if" });
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfErr6() {
|
public void testIfErr6() {
|
||||||
String text =
|
String text = "if true; then foo; else\n";
|
||||||
"if true; then foo; else\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(2, errors.size());
|
assertEquals(2, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "if"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "if"));
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "else"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "else"));
|
||||||
assertTreeStructure(tree, new String[] { "if", "else", null });
|
assertTreeStructure(tree, new String[] { "if", "else", null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhile() {
|
public void testWhile() {
|
||||||
String text =
|
String text = "while true; do foo; done\n";
|
||||||
"while true; do foo; done\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] { "while" });
|
assertTreeStructure(tree, new String[] { "while" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhile2() {
|
public void testWhile2() {
|
||||||
String text =
|
String text = "while true\n" + "do\n" + "AC_SOMETHING(...); done\n";
|
||||||
"while true\n" +
|
|
||||||
"do\n"+
|
|
||||||
"AC_SOMETHING(...); done\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhileErr() {
|
public void testWhileErr() {
|
||||||
String text =
|
String text = "while; AC_SOMETHING(...) done\n";
|
||||||
"while; AC_SOMETHING(...) done\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(2, errors.size());
|
assertEquals(2, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.MISSING_SPECIFIER, "do"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.MISSING_SPECIFIER, "do"));
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "done"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "done"));
|
||||||
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhileErr2() {
|
public void testWhileErr2() {
|
||||||
String text =
|
String text = "while true; do AC_SOMETHING(...)\n";
|
||||||
"while true; do AC_SOMETHING(...)\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "while"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "while"));
|
||||||
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCase() {
|
public void testCase() {
|
||||||
String text =
|
String text = "case $VAL in\n" + "linux-*-*) AC_FIRST($VAL) ; true ;;\n" + "bsd-* | macosx-*) : ;;\n"
|
||||||
"case $VAL in\n"+
|
+ "*) echo \"I dunno $VAL\";;\n" + "esac\n";
|
||||||
"linux-*-*) AC_FIRST($VAL) ; true ;;\n"+
|
|
||||||
"bsd-* | macosx-*) : ;;\n"+
|
|
||||||
"*) echo \"I dunno $VAL\";;\n"+
|
|
||||||
"esac\n";
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree,
|
||||||
"case",
|
new String[] { "case", "linux-*-*", "AC_FIRST", "$VAL", null, null, "bsd-* | macosx-*", "*", null });
|
||||||
"linux-*-*",
|
|
||||||
"AC_FIRST",
|
|
||||||
"$VAL",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"bsd-* | macosx-*",
|
|
||||||
"*",
|
|
||||||
null
|
|
||||||
});
|
|
||||||
|
|
||||||
AutoconfElement[] kids = tree.getChildren();
|
AutoconfElement[] kids = tree.getChildren();
|
||||||
assertEquals(1, kids.length);
|
assertEquals(1, kids.length);
|
||||||
assertTrue(kids[0] instanceof AutoconfCaseElement);
|
assertTrue(kids[0] instanceof AutoconfCaseElement);
|
||||||
|
|
||||||
AutoconfCaseElement caseEl = (AutoconfCaseElement) kids[0];
|
AutoconfCaseElement caseEl = (AutoconfCaseElement) kids[0];
|
||||||
assertEqualSource(text.substring(0, text.length()-1), caseEl);
|
assertEqualSource(text.substring(0, text.length() - 1), caseEl);
|
||||||
|
|
||||||
assertEquals(3, caseEl.getChildren().length);
|
assertEquals(3, caseEl.getChildren().length);
|
||||||
|
|
||||||
assertTrue(caseEl.getChildren()[0] instanceof AutoconfCaseConditionElement);
|
assertTrue(caseEl.getChildren()[0] instanceof AutoconfCaseConditionElement);
|
||||||
assertTrue(caseEl.getChildren()[1] instanceof AutoconfCaseConditionElement);
|
assertTrue(caseEl.getChildren()[1] instanceof AutoconfCaseConditionElement);
|
||||||
assertTrue(caseEl.getChildren()[2] instanceof AutoconfCaseConditionElement);
|
assertTrue(caseEl.getChildren()[2] instanceof AutoconfCaseConditionElement);
|
||||||
|
|
||||||
AutoconfCaseConditionElement caseCond = (AutoconfCaseConditionElement) caseEl.getChildren()[0];
|
AutoconfCaseConditionElement caseCond = (AutoconfCaseConditionElement) caseEl.getChildren()[0];
|
||||||
assertEquals("linux-*-*) AC_FIRST($VAL) ; true ;;", caseCond.getSource());
|
assertEquals("linux-*-*) AC_FIRST($VAL) ; true ;;", caseCond.getSource());
|
||||||
assertEquals(1, caseCond.getChildren().length);
|
assertEquals(1, caseCond.getChildren().length);
|
||||||
|
@ -287,19 +221,19 @@ public class TestShellParser extends BaseParserTest {
|
||||||
caseCond = (AutoconfCaseConditionElement) caseEl.getChildren()[2];
|
caseCond = (AutoconfCaseConditionElement) caseEl.getChildren()[2];
|
||||||
assertEquals("*) echo \"I dunno $VAL\";;", caseCond.getSource());
|
assertEquals("*) echo \"I dunno $VAL\";;", caseCond.getSource());
|
||||||
assertEquals(0, caseCond.getChildren().length);
|
assertEquals(0, caseCond.getChildren().length);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCaseErr() {
|
public void testCaseErr() {
|
||||||
String text =
|
String text = "case $VAL; linux-*-*) AC_FIRST($VAL) ; true esac\n";
|
||||||
"case $VAL; linux-*-*) AC_FIRST($VAL) ; true esac\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(2, errors.size());
|
assertEquals(2, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getString(AutoconfParser.INVALID_IN));
|
checkError(AutoconfEditorMessages.getString(AutoconfParser.INVALID_IN));
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "esac"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "esac"));
|
||||||
|
|
||||||
assertTreeStructure(tree, new String[] { "case", "linux-*-*", "AC_FIRST", "$VAL", null, null, null });
|
assertTreeStructure(tree, new String[] { "case", "linux-*-*", "AC_FIRST", "$VAL", null, null, null });
|
||||||
|
|
||||||
AutoconfElement[] kids = tree.getChildren();
|
AutoconfElement[] kids = tree.getChildren();
|
||||||
AutoconfCaseElement caseEl = (AutoconfCaseElement) kids[0];
|
AutoconfCaseElement caseEl = (AutoconfCaseElement) kids[0];
|
||||||
AutoconfCaseConditionElement caseCond = (AutoconfCaseConditionElement) caseEl.getChildren()[0];
|
AutoconfCaseConditionElement caseCond = (AutoconfCaseConditionElement) caseEl.getChildren()[0];
|
||||||
|
@ -308,148 +242,95 @@ public class TestShellParser extends BaseParserTest {
|
||||||
assertEqualSource("AC_FIRST($VAL)", caseCond.getChildren()[0]);
|
assertEqualSource("AC_FIRST($VAL)", caseCond.getChildren()[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCaseErr2() {
|
public void testCaseErr2() {
|
||||||
String text =
|
String text = "case $VAL in\n";
|
||||||
"case $VAL in\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertEquals(1, errors.size());
|
assertEquals(1, errors.size());
|
||||||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "case"));
|
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "case"));
|
||||||
|
|
||||||
assertTreeStructure(tree, new String[] { "case" });
|
assertTreeStructure(tree, new String[] { "case" });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testForIn() {
|
public void testForIn() {
|
||||||
// don't get upset by 'in'
|
// don't get upset by 'in'
|
||||||
String text =
|
String text = "for VAL in 1 2 3 4; do echo $VAL; done\n";
|
||||||
"for VAL in 1 2 3 4; do echo $VAL; done\n";
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
|
|
||||||
assertTreeStructure(tree, new String[] { "for" });
|
assertTreeStructure(tree, new String[] { "for" });
|
||||||
AutoconfElement[] kids = tree.getChildren();
|
AutoconfElement[] kids = tree.getChildren();
|
||||||
|
|
||||||
AutoconfElement forEl = kids[0];
|
AutoconfElement forEl = kids[0];
|
||||||
assertEqualSource(text.substring(0, text.length()-1), forEl);
|
assertEqualSource(text.substring(0, text.length() - 1), forEl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testForDo() {
|
public void testForDo() {
|
||||||
// don't get upset by parentheses
|
// don't get upset by parentheses
|
||||||
String text =
|
String text = "for (( AC_1; AC_2(); AC_3(...) )); do echo $VAL; done\n";
|
||||||
"for (( AC_1; AC_2(); AC_3(...) )); do echo $VAL; done\n";
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
|
|
||||||
assertTreeStructure(tree, new String[] { "for", "AC_1", "AC_2", "", null, "AC_3", "...", null, null });
|
assertTreeStructure(tree, new String[] { "for", "AC_1", "AC_2", "", null, "AC_3", "...", null, null });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUntil() {
|
public void testUntil() {
|
||||||
String text =
|
String text = "until false; do AC_SOMETHING(...); done\n";
|
||||||
"until false; do AC_SOMETHING(...); done\n";
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
assertTreeStructure(tree, new String[] { "until", "AC_SOMETHING", "...", null, null });
|
assertTreeStructure(tree, new String[] { "until", "AC_SOMETHING", "...", null, null });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSelect() {
|
public void testSelect() {
|
||||||
String text =
|
String text = "select VAR in 1 2 3; do AC_SOMETHING(...); done\n" + "select VAR; do AC_SOMETHING; done\n";
|
||||||
"select VAR in 1 2 3; do AC_SOMETHING(...); done\n"+
|
|
||||||
"select VAR; do AC_SOMETHING; done\n";
|
|
||||||
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree,
|
||||||
"select",
|
new String[] { "select", "AC_SOMETHING", "...", null, null, "select", "AC_SOMETHING", null });
|
||||||
"AC_SOMETHING",
|
|
||||||
"...",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"select",
|
|
||||||
"AC_SOMETHING",
|
|
||||||
null
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComplex1() {
|
public void testComplex1() {
|
||||||
String text =
|
String text = "AM_INIT_AUTOMAKE([foo1], 1.96)\n" + "while true; do \n" + " var=shift;\n"
|
||||||
"AM_INIT_AUTOMAKE([foo1], 1.96)\n" +
|
+ " if [ test -f \"$var\"] ; then\n" + " AC_SOMETHING($var);\n" + " fi\n" + "done;\n"
|
||||||
"while true; do \n" +
|
+ "AM_GENERATE(Makefile)\n";
|
||||||
" var=shift;\n" +
|
|
||||||
" if [ test -f \"$var\"] ; then\n"+
|
|
||||||
" AC_SOMETHING($var);\n"+
|
|
||||||
" fi\n"+
|
|
||||||
"done;\n"+
|
|
||||||
"AM_GENERATE(Makefile)\n";
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "foo1", "1.96", null, "while", "if",
|
||||||
"AM_INIT_AUTOMAKE",
|
"AC_SOMETHING", "$var", null, null, null, "AM_GENERATE", "Makefile", null });
|
||||||
"foo1",
|
|
||||||
"1.96",
|
|
||||||
null,
|
|
||||||
"while",
|
|
||||||
"if",
|
|
||||||
"AC_SOMETHING",
|
|
||||||
"$var",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"AM_GENERATE",
|
|
||||||
"Makefile",
|
|
||||||
null
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComplex2() {
|
public void testComplex2() {
|
||||||
String text =
|
String text = "if true; then\n" + "AC_CANONICAL_HOST\n" + "else\n" + "case foo in \n" + " 3) 1 ;;\n"
|
||||||
"if true; then\n" +
|
+ "esac;\n" + "fi\n";
|
||||||
"AC_CANONICAL_HOST\n" +
|
|
||||||
"else\n" +
|
|
||||||
"case foo in \n" +
|
|
||||||
" 3) 1 ;;\n" +
|
|
||||||
"esac;\n" +
|
|
||||||
"fi\n";
|
|
||||||
AutoconfElement tree = parse(text, false);
|
AutoconfElement tree = parse(text, false);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree, new String[] { "if", "AC_CANONICAL_HOST", "else", "case", "3", null, null, null });
|
||||||
"if",
|
|
||||||
"AC_CANONICAL_HOST",
|
|
||||||
"else",
|
|
||||||
"case",
|
|
||||||
"3",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEarlyClose() {
|
public void testEarlyClose() {
|
||||||
String text =
|
String text = "if true; then foo ; fi\n" + "fi\n" + "while true; do done;\n";
|
||||||
"if true; then foo ; fi\n"+
|
|
||||||
"fi\n"+
|
|
||||||
"while true; do done;\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree, new String[] { "if", "while" });
|
||||||
"if",
|
|
||||||
"while"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOverlapping() {
|
public void testOverlapping() {
|
||||||
String text =
|
String text = "for foo\n" + "if bar\n";
|
||||||
"for foo\n"+
|
|
||||||
"if bar\n";
|
|
||||||
AutoconfElement tree = parse(text, true);
|
AutoconfElement tree = parse(text, true);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree, new String[] { "for", "if" });
|
||||||
"for",
|
|
||||||
"if"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDollar() {
|
public void testDollar() {
|
||||||
// dollars guard keywords
|
// dollars guard keywords
|
||||||
String text =
|
String text = "if [ $if == 3 ] ; then $for; fi\n";
|
||||||
"if [ $if == 3 ] ; then $for; fi\n";
|
|
||||||
AutoconfElement tree = parse(text);
|
AutoconfElement tree = parse(text);
|
||||||
assertTreeStructure(tree, new String[] {
|
assertTreeStructure(tree, new String[] { "if" });
|
||||||
"if"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.jface.text.Document;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test autoconf tokenizer. The tokenizer mainly is used to detect boundaries and keywords
|
* Test autoconf tokenizer. The tokenizer mainly is used to detect boundaries and keywords
|
||||||
* and is not a full shell tokenizer.
|
* and is not a full shell tokenizer.
|
||||||
|
@ -51,7 +50,7 @@ public class TestTokenizer {
|
||||||
tokenizerErrors.add(exception);
|
tokenizerErrors.add(exception);
|
||||||
});
|
});
|
||||||
tokenizer.setM4Context(isM4Mode);
|
tokenizer.setM4Context(isM4Mode);
|
||||||
|
|
||||||
return tokenize(tokenizer);
|
return tokenize(tokenizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +68,7 @@ public class TestTokenizer {
|
||||||
protected void checkNoErrors() {
|
protected void checkNoErrors() {
|
||||||
assertEquals(0, tokenizerErrors.size());
|
assertEquals(0, tokenizerErrors.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmpty() {
|
public void testEmpty() {
|
||||||
IDocument document = createDocument("");
|
IDocument document = createDocument("");
|
||||||
|
@ -76,6 +76,7 @@ public class TestTokenizer {
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(0, tokens.size());
|
assertEquals(0, tokens.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEOL1() {
|
public void testEOL1() {
|
||||||
IDocument document = createDocument("\n");
|
IDocument document = createDocument("\n");
|
||||||
|
@ -84,6 +85,7 @@ public class TestTokenizer {
|
||||||
assertEquals(1, tokens.size());
|
assertEquals(1, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEOL2() {
|
public void testEOL2() {
|
||||||
IDocument document = createDocument("\r\n");
|
IDocument document = createDocument("\r\n");
|
||||||
|
@ -92,6 +94,7 @@ public class TestTokenizer {
|
||||||
assertEquals(1, tokens.size());
|
assertEquals(1, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\r\n");
|
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEOL3() {
|
public void testEOL3() {
|
||||||
IDocument document = createDocument("\n\r\n\n");
|
IDocument document = createDocument("\n\r\n\n");
|
||||||
|
@ -102,6 +105,7 @@ public class TestTokenizer {
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\r\n");
|
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\r\n");
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellText() {
|
public void testShellText() {
|
||||||
// default mode is shell
|
// default mode is shell
|
||||||
|
@ -110,13 +114,12 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(4, tokens.size());
|
assertEquals(4, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "random");
|
||||||
"random");
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.WORD,
|
checkToken(tokens.get(2), document, ITokenConstants.WORD, "stuff");
|
||||||
"stuff");
|
|
||||||
checkToken(tokens.get(3), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(3), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellTokens() {
|
public void testShellTokens() {
|
||||||
// default mode is shell
|
// default mode is shell
|
||||||
|
@ -125,18 +128,16 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(8, tokens.size());
|
assertEquals(8, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.SH_WHILE,
|
checkToken(tokens.get(0), document, ITokenConstants.SH_WHILE, "while");
|
||||||
"while");
|
checkToken(tokens.get(1), document, ITokenConstants.WORD, "true");
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.WORD,
|
|
||||||
"true");
|
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.SEMI, ";");
|
checkToken(tokens.get(2), document, ITokenConstants.SEMI, ";");
|
||||||
checkToken(tokens.get(3), document, ITokenConstants.SH_DO, "do");
|
checkToken(tokens.get(3), document, ITokenConstants.SH_DO, "do");
|
||||||
checkToken(tokens.get(4), document, ITokenConstants.WORD, "ls");
|
checkToken(tokens.get(4), document, ITokenConstants.WORD, "ls");
|
||||||
checkToken(tokens.get(5), document, ITokenConstants.SEMI, ";");
|
checkToken(tokens.get(5), document, ITokenConstants.SEMI, ";");
|
||||||
checkToken(tokens.get(6), document, ITokenConstants.SH_DONE,
|
checkToken(tokens.get(6), document, ITokenConstants.SH_DONE, "done");
|
||||||
"done");
|
|
||||||
checkToken(tokens.get(7), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(7), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellTokens2() {
|
public void testShellTokens2() {
|
||||||
// don't misread partial tokens
|
// don't misread partial tokens
|
||||||
|
@ -145,11 +146,10 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(2, tokens.size());
|
assertEquals(2, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "while_stuff");
|
||||||
"while_stuff");
|
checkToken(tokens.get(1), document, ITokenConstants.WORD, "incase");
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.WORD,
|
|
||||||
"incase");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellTokens3() {
|
public void testShellTokens3() {
|
||||||
// don't interpret m4 strings in shell mode
|
// don't interpret m4 strings in shell mode
|
||||||
|
@ -160,6 +160,7 @@ public class TestTokenizer {
|
||||||
assertEquals(1, tokens.size());
|
assertEquals(1, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.SH_STRING_BACKTICK, "foo'", 5);
|
checkToken(tokens.get(0), document, ITokenConstants.SH_STRING_BACKTICK, "foo'", 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellTokens4() {
|
public void testShellTokens4() {
|
||||||
String text = "echo $if $((foo)) $\n";
|
String text = "echo $if $((foo)) $\n";
|
||||||
|
@ -181,6 +182,7 @@ public class TestTokenizer {
|
||||||
checkToken(tokens.get(10), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(10), document, ITokenConstants.EOL, "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellTokens5() {
|
public void testShellTokens5() {
|
||||||
String text = "while do select for until done\n";
|
String text = "while do select for until done\n";
|
||||||
|
@ -197,6 +199,7 @@ public class TestTokenizer {
|
||||||
checkToken(tokens.get(6), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(6), document, ITokenConstants.EOL, "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellComments() {
|
public void testShellComments() {
|
||||||
// comments are stripped and ignored in the shell mode
|
// comments are stripped and ignored in the shell mode
|
||||||
|
@ -205,10 +208,10 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(2, tokens.size());
|
assertEquals(2, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.SH_FOR,
|
checkToken(tokens.get(0), document, ITokenConstants.SH_FOR, "for");
|
||||||
"for");
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellComments2() {
|
public void testShellComments2() {
|
||||||
// comments are stripped and ignored in the shell mode
|
// comments are stripped and ignored in the shell mode
|
||||||
|
@ -221,6 +224,7 @@ public class TestTokenizer {
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Tokens0() {
|
public void testM4Tokens0() {
|
||||||
String text = "while_stuff incase";
|
String text = "while_stuff incase";
|
||||||
|
@ -228,56 +232,49 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(document, true);
|
List<Token> tokens = tokenize(document, true);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(2, tokens.size());
|
assertEquals(2, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "while_stuff");
|
||||||
"while_stuff");
|
checkToken(tokens.get(1), document, ITokenConstants.WORD, "incase");
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.WORD,
|
|
||||||
"incase");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellStrings() {
|
public void testShellStrings() {
|
||||||
String QUOTED =
|
String QUOTED = "ls -la \"*.c\"";
|
||||||
"ls -la \"*.c\"";
|
|
||||||
String text = "echo `" + QUOTED + "`\n";
|
String text = "echo `" + QUOTED + "`\n";
|
||||||
IDocument document = createDocument(text);
|
IDocument document = createDocument(text);
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(3, tokens.size());
|
assertEquals(3, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "echo");
|
||||||
"echo");
|
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_BACKTICK, QUOTED, QUOTED.length() + 2);
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_BACKTICK,
|
|
||||||
QUOTED, QUOTED.length() + 2);
|
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellStrings2() {
|
public void testShellStrings2() {
|
||||||
String QUOTED =
|
String QUOTED = "ls -la 'space file'";
|
||||||
"ls -la 'space file'";
|
|
||||||
String text = "echo \"" + QUOTED + "\"\n";
|
String text = "echo \"" + QUOTED + "\"\n";
|
||||||
IDocument document = createDocument(text);
|
IDocument document = createDocument(text);
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(3, tokens.size());
|
assertEquals(3, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "echo");
|
||||||
"echo");
|
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_DOUBLE, QUOTED, QUOTED.length() + 2);
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_DOUBLE,
|
|
||||||
QUOTED, QUOTED.length() + 2);
|
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShellStrings3() {
|
public void testShellStrings3() {
|
||||||
String QUOTED =
|
String QUOTED = "echo \"*.c\" | sed s/[a-z]/[A-Z]/g";
|
||||||
"echo \"*.c\" | sed s/[a-z]/[A-Z]/g";
|
|
||||||
String text = "echo '" + QUOTED + "'\n";
|
String text = "echo '" + QUOTED + "'\n";
|
||||||
IDocument document = createDocument(text);
|
IDocument document = createDocument(text);
|
||||||
List<Token> tokens = tokenize(document, false);
|
List<Token> tokens = tokenize(document, false);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(3, tokens.size());
|
assertEquals(3, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "echo");
|
||||||
"echo");
|
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_SINGLE, QUOTED, QUOTED.length() + 2);
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_SINGLE,
|
|
||||||
QUOTED, QUOTED.length() + 2);
|
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Tokens1() {
|
public void testM4Tokens1() {
|
||||||
String text = "define(`hi\', `HI\')\n";
|
String text = "define(`hi\', `HI\')\n";
|
||||||
|
@ -285,18 +282,16 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(document, true);
|
List<Token> tokens = tokenize(document, true);
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(7, tokens.size());
|
assertEquals(7, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "define");
|
||||||
"define");
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||||
// strings are unquoted in token text
|
// strings are unquoted in token text
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.M4_STRING,
|
checkToken(tokens.get(2), document, ITokenConstants.M4_STRING, "hi", 4);
|
||||||
"hi", 4);
|
|
||||||
checkToken(tokens.get(3), document, ITokenConstants.COMMA, ",");
|
checkToken(tokens.get(3), document, ITokenConstants.COMMA, ",");
|
||||||
checkToken(tokens.get(4), document, ITokenConstants.M4_STRING,
|
checkToken(tokens.get(4), document, ITokenConstants.M4_STRING, "HI", 4);
|
||||||
"HI", 4);
|
|
||||||
checkToken(tokens.get(5), document, ITokenConstants.RPAREN, ")");
|
checkToken(tokens.get(5), document, ITokenConstants.RPAREN, ")");
|
||||||
checkToken(tokens.get(6), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(6), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Comments() {
|
public void testM4Comments() {
|
||||||
String text = "dnl # comment\n";
|
String text = "dnl # comment\n";
|
||||||
|
@ -305,9 +300,9 @@ public class TestTokenizer {
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
assertEquals(2, tokens.size());
|
assertEquals(2, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.M4_COMMENT,
|
checkToken(tokens.get(1), document, ITokenConstants.M4_COMMENT, "# comment\n");
|
||||||
"# comment\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Comments2() {
|
public void testM4Comments2() {
|
||||||
String text = "dnl /* word(`quoted')\n" + "*/\n";
|
String text = "dnl /* word(`quoted')\n" + "*/\n";
|
||||||
|
@ -319,10 +314,10 @@ public class TestTokenizer {
|
||||||
List<Token> tokens = tokenize(tokenizer);
|
List<Token> tokens = tokenize(tokenizer);
|
||||||
assertEquals(3, tokens.size());
|
assertEquals(3, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.M4_COMMENT,
|
checkToken(tokens.get(1), document, ITokenConstants.M4_COMMENT, "/* word(`quoted')\n*/");
|
||||||
"/* word(`quoted')\n*/");
|
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Strings1() {
|
public void testM4Strings1() {
|
||||||
// double quotes only removes one level of quotes
|
// double quotes only removes one level of quotes
|
||||||
|
@ -333,10 +328,10 @@ public class TestTokenizer {
|
||||||
|
|
||||||
List<Token> tokens = tokenize(tokenizer);
|
List<Token> tokens = tokenize(tokenizer);
|
||||||
assertEquals(2, tokens.size());
|
assertEquals(2, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.M4_STRING,
|
checkToken(tokens.get(0), document, ITokenConstants.M4_STRING, "`double'", 8 + 1 + 1);
|
||||||
"`double'", 8 + 1 + 1);
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Strings2() {
|
public void testM4Strings2() {
|
||||||
String text = "myword(!!boundary==)\n";
|
String text = "myword(!!boundary==)\n";
|
||||||
|
@ -347,14 +342,13 @@ public class TestTokenizer {
|
||||||
|
|
||||||
List<Token> tokens = tokenize(tokenizer);
|
List<Token> tokens = tokenize(tokenizer);
|
||||||
assertEquals(5, tokens.size());
|
assertEquals(5, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "myword");
|
||||||
"myword");
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.M4_STRING,
|
checkToken(tokens.get(2), document, ITokenConstants.M4_STRING, "boundary", 8 + 2 + 2);
|
||||||
"boundary", 8 + 2 + 2);
|
|
||||||
checkToken(tokens.get(3), document, ITokenConstants.RPAREN, ")");
|
checkToken(tokens.get(3), document, ITokenConstants.RPAREN, ")");
|
||||||
checkToken(tokens.get(4), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(4), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4Tokens2() {
|
public void testM4Tokens2() {
|
||||||
// dollar is not seen in m4 mode (only important when expanding)
|
// dollar is not seen in m4 mode (only important when expanding)
|
||||||
|
@ -365,8 +359,7 @@ public class TestTokenizer {
|
||||||
|
|
||||||
List<Token> tokens = tokenize(tokenizer);
|
List<Token> tokens = tokenize(tokenizer);
|
||||||
assertEquals(8, tokens.size());
|
assertEquals(8, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
checkToken(tokens.get(0), document, ITokenConstants.WORD, "define");
|
||||||
"define");
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||||
checkToken(tokens.get(2), document, ITokenConstants.WORD, "foo");
|
checkToken(tokens.get(2), document, ITokenConstants.WORD, "foo");
|
||||||
checkToken(tokens.get(3), document, ITokenConstants.COMMA, ",");
|
checkToken(tokens.get(3), document, ITokenConstants.COMMA, ",");
|
||||||
|
@ -375,21 +368,22 @@ public class TestTokenizer {
|
||||||
checkToken(tokens.get(6), document, ITokenConstants.RPAREN, ")");
|
checkToken(tokens.get(6), document, ITokenConstants.RPAREN, ")");
|
||||||
checkToken(tokens.get(7), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(7), document, ITokenConstants.EOL, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testM4QuoteNesting() {
|
public void testM4QuoteNesting() {
|
||||||
String quote = "this is `nested\'!";
|
String quote = "this is `nested\'!";
|
||||||
String text = "`" + quote +"'\n";
|
String text = "`" + quote + "'\n";
|
||||||
IDocument document = createDocument(text);
|
IDocument document = createDocument(text);
|
||||||
AutoconfTokenizer tokenizer = createTokenizer(document);
|
AutoconfTokenizer tokenizer = createTokenizer(document);
|
||||||
tokenizer.setM4Context(true);
|
tokenizer.setM4Context(true);
|
||||||
|
|
||||||
List<Token> tokens = tokenize(tokenizer);
|
List<Token> tokens = tokenize(tokenizer);
|
||||||
assertEquals(2, tokens.size());
|
assertEquals(2, tokens.size());
|
||||||
checkToken(tokens.get(0), document, ITokenConstants.M4_STRING,
|
checkToken(tokens.get(0), document, ITokenConstants.M4_STRING, quote, quote.length() + 2);
|
||||||
quote, quote.length() + 2);
|
|
||||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMixedContext() {
|
public void testMixedContext() {
|
||||||
String text = "AM_INIT([arg])if true\n";
|
String text = "AM_INIT([arg])if true\n";
|
||||||
|
@ -441,18 +435,17 @@ public class TestTokenizer {
|
||||||
fail(exception.toString());
|
fail(exception.toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkToken(Token token, IDocument document, int type) {
|
private void checkToken(Token token, IDocument document, int type) {
|
||||||
assertEquals(type, token.getType());
|
assertEquals(type, token.getType());
|
||||||
assertSame(document, token.getDocument());
|
assertSame(document, token.getDocument());
|
||||||
assertTrue(token.getOffset() >= 0);
|
assertTrue(token.getOffset() >= 0);
|
||||||
assertTrue(token.getType() == ITokenConstants.EOF || token.getLength() > 0);
|
assertTrue(token.getType() == ITokenConstants.EOF || token.getLength() > 0);
|
||||||
assertEquals(document.get().substring(token.getOffset(),
|
assertEquals(document.get().substring(token.getOffset(), token.getOffset() + token.getLength()),
|
||||||
token.getOffset() + token.getLength()), token.getText());
|
token.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkToken(Token token, IDocument document, int type,
|
private void checkToken(Token token, IDocument document, int type, String text) {
|
||||||
String text) {
|
|
||||||
assertEquals(type, token.getType());
|
assertEquals(type, token.getType());
|
||||||
assertSame(document, token.getDocument());
|
assertSame(document, token.getDocument());
|
||||||
assertTrue(token.getOffset() >= 0);
|
assertTrue(token.getOffset() >= 0);
|
||||||
|
@ -460,8 +453,7 @@ public class TestTokenizer {
|
||||||
assertEquals(text.length(), token.getLength());
|
assertEquals(text.length(), token.getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkToken(Token token, IDocument document, int type,
|
private void checkToken(Token token, IDocument document, int type, String text, int length) {
|
||||||
String text, int length) {
|
|
||||||
assertEquals(type, token.getType());
|
assertEquals(type, token.getType());
|
||||||
assertSame(document, token.getDocument());
|
assertSame(document, token.getDocument());
|
||||||
assertTrue(token.getOffset() >= 0);
|
assertTrue(token.getOffset() >= 0);
|
||||||
|
|
|
@ -39,9 +39,9 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
|
|
||||||
// The shared instance
|
// The shared instance
|
||||||
private static AutotoolsUIPlugin plugin;
|
private static AutotoolsUIPlugin plugin;
|
||||||
|
|
||||||
private ResourceBundle resourceBundle;
|
private ResourceBundle resourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor.
|
* The constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +59,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
public static String getPluginId() {
|
public static String getPluginId() {
|
||||||
return PLUGIN_ID;
|
return PLUGIN_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUniqueIdentifier() {
|
public static String getUniqueIdentifier() {
|
||||||
if (getDefault() == null) {
|
if (getDefault() == null) {
|
||||||
// If the default instance is not yet initialized,
|
// If the default instance is not yet initialized,
|
||||||
|
@ -89,7 +89,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* Returns the string from the plugin's resource bundle,
|
* Returns the string from the plugin's resource bundle,
|
||||||
* or 'key' if not found.
|
* or 'key' if not found.
|
||||||
*
|
*
|
||||||
* @param key the message key
|
* @param key the message key
|
||||||
* @return the resource bundle message
|
* @return the resource bundle message
|
||||||
*/
|
*/
|
||||||
|
@ -146,7 +146,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
* Returns the active workbench page or <code>null</code> if none.
|
* Returns the active workbench page or <code>null</code> if none.
|
||||||
*/
|
*/
|
||||||
public static IWorkbenchPage getActivePage() {
|
public static IWorkbenchPage getActivePage() {
|
||||||
IWorkbenchWindow window= getActiveWorkbenchWindow();
|
IWorkbenchWindow window = getActiveWorkbenchWindow();
|
||||||
if (window != null) {
|
if (window != null) {
|
||||||
return window.getActivePage();
|
return window.getActivePage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.autotools.core.VersionComparator;
|
||||||
public class AcInitElement extends AutoconfMacroElement {
|
public class AcInitElement extends AutoconfMacroElement {
|
||||||
|
|
||||||
private static final String BAD_VERSION_NUMBER = "AC_INIT_badVersionNumber";
|
private static final String BAD_VERSION_NUMBER = "AC_INIT_badVersionNumber";
|
||||||
|
|
||||||
public AcInitElement(String name) {
|
public AcInitElement(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,14 @@ public class AcInitElement extends AutoconfMacroElement {
|
||||||
@Override
|
@Override
|
||||||
public void validate(String version) throws InvalidMacroException {
|
public void validate(String version) throws InvalidMacroException {
|
||||||
super.validate(version);
|
super.validate(version);
|
||||||
|
|
||||||
if (this.getChildren().length == 0)
|
if (this.getChildren().length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (VersionComparator.compare(version,
|
if (VersionComparator.compare(version, AutotoolsPropertyConstants.AC_VERSION_2_59) >= 0) {
|
||||||
AutotoolsPropertyConstants.AC_VERSION_2_59) >= 0){
|
|
||||||
if (this.getChildren().length < 2)
|
if (this.getChildren().length < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// autoconf 2.67 onwards allows a more relaxed VERSION string format,
|
// autoconf 2.67 onwards allows a more relaxed VERSION string format,
|
||||||
// so only validate arguments for earlier versions
|
// so only validate arguments for earlier versions
|
||||||
if (VersionComparator.compare(version, AutotoolsPropertyConstants.AC_VERSION_2_67) < 0)
|
if (VersionComparator.compare(version, AutotoolsPropertyConstants.AC_VERSION_2_67) < 0)
|
||||||
|
@ -48,8 +47,8 @@ public class AcInitElement extends AutoconfMacroElement {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateMultipleArguments () throws InvalidMacroException{
|
private void validateMultipleArguments() throws InvalidMacroException {
|
||||||
|
|
||||||
// There are no restrictions on the first argument.
|
// There are no restrictions on the first argument.
|
||||||
|
|
||||||
|
@ -57,7 +56,7 @@ public class AcInitElement extends AutoconfMacroElement {
|
||||||
AutoconfElement argument = this.getChildren()[1];
|
AutoconfElement argument = this.getChildren()[1];
|
||||||
// match a digit followed by a dot zero or more times
|
// match a digit followed by a dot zero or more times
|
||||||
// but always end with a digit
|
// but always end with a digit
|
||||||
if (!argument.getName().matches("(\\d*\\.)*((\\d+))")){
|
if (!argument.getName().matches("(\\d*\\.)*((\\d+))")) {
|
||||||
throw new InvalidMacroException(AutoconfEditorMessages.getString(BAD_VERSION_NUMBER), argument);
|
throw new InvalidMacroException(AutoconfEditorMessages.getString(BAD_VERSION_NUMBER), argument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,16 @@ import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
import org.eclipse.jface.text.source.LineRange;
|
import org.eclipse.jface.text.source.LineRange;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension {
|
public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distance to the ruler line.
|
* Returns the distance to the ruler line.
|
||||||
*/
|
*/
|
||||||
protected int compareRulerLine(Position position, IDocument document, int line) {
|
protected int compareRulerLine(Position position, IDocument document, int line) {
|
||||||
|
|
||||||
if (position.getOffset() > -1 && position.getLength() > -1) {
|
if (position.getOffset() > -1 && position.getLength() > -1) {
|
||||||
try {
|
try {
|
||||||
int markerLine= document.getLineOfOffset(position.getOffset());
|
int markerLine = document.getLineOfOffset(position.getOffset());
|
||||||
if (line == markerLine)
|
if (line == markerLine)
|
||||||
return 1;
|
return 1;
|
||||||
if (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()))
|
if (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()))
|
||||||
|
@ -52,10 +51,10 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects a set of markers from the two lists. By default, it just returns
|
* Selects a set of markers from the two lists. By default, it just returns
|
||||||
* the set of exact matches.
|
* the set of exact matches.
|
||||||
|
@ -68,32 +67,32 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
* Returns one marker which includes the ruler's line of activity.
|
* Returns one marker which includes the ruler's line of activity.
|
||||||
*/
|
*/
|
||||||
protected List<Annotation> getAnnotationsForLine(ISourceViewer viewer, int line) {
|
protected List<Annotation> getAnnotationsForLine(ISourceViewer viewer, int line) {
|
||||||
|
|
||||||
IDocument document= viewer.getDocument();
|
IDocument document = viewer.getDocument();
|
||||||
IAnnotationModel model= viewer.getAnnotationModel();
|
IAnnotationModel model = viewer.getAnnotationModel();
|
||||||
|
|
||||||
if (model == null)
|
if (model == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<Annotation> exact= new ArrayList<>();
|
List<Annotation> exact = new ArrayList<>();
|
||||||
List<Annotation> including= new ArrayList<>();
|
List<Annotation> including = new ArrayList<>();
|
||||||
|
|
||||||
Iterator<?> e = model.getAnnotationIterator();
|
Iterator<?> e = model.getAnnotationIterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
Object o= e.next();
|
Object o = e.next();
|
||||||
if (o instanceof Annotation) {
|
if (o instanceof Annotation) {
|
||||||
Annotation a= (Annotation) o;
|
Annotation a = (Annotation) o;
|
||||||
switch (compareRulerLine(model.getPosition(a), document, line)) {
|
switch (compareRulerLine(model.getPosition(a), document, line)) {
|
||||||
case 1:
|
case 1:
|
||||||
exact.add(a);
|
exact.add(a);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
including.add(a);
|
including.add(a);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return select(exact, including);
|
return select(exact, including);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,73 +100,72 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
|
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
|
||||||
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
|
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
|
||||||
if (annotations != null && annotations.size() > 0) {
|
if (annotations != null && annotations.size() > 0) {
|
||||||
|
|
||||||
if (annotations.size() == 1) {
|
if (annotations.size() == 1) {
|
||||||
|
|
||||||
// optimization
|
// optimization
|
||||||
Annotation annotation = annotations.get(0);
|
Annotation annotation = annotations.get(0);
|
||||||
String message= annotation.getText();
|
String message = annotation.getText();
|
||||||
if (message != null && message.trim().length() > 0)
|
if (message != null && message.trim().length() > 0)
|
||||||
return formatSingleMessage(message);
|
return formatSingleMessage(message);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
List<String> messages= new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
Iterator<Annotation> e= annotations.iterator();
|
Iterator<Annotation> e = annotations.iterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
Annotation annotation = e.next();
|
Annotation annotation = e.next();
|
||||||
String message= annotation.getText();
|
String message = annotation.getText();
|
||||||
if (message != null && message.trim().length() > 0)
|
if (message != null && message.trim().length() > 0)
|
||||||
messages.add(message.trim());
|
messages.add(message.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messages.size() == 1)
|
if (messages.size() == 1)
|
||||||
return formatSingleMessage(messages.get(0));
|
return formatSingleMessage(messages.get(0));
|
||||||
|
|
||||||
if (messages.size() > 1)
|
if (messages.size() > 1)
|
||||||
return formatMultipleMessages(messages);
|
return formatMultipleMessages(messages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formats a message as HTML text.
|
* Formats a message as HTML text.
|
||||||
*/
|
*/
|
||||||
private String formatSingleMessage(String message) {
|
private String formatSingleMessage(String message) {
|
||||||
StringBuilder buffer= new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
HTMLPrinter.addPageProlog(buffer);
|
HTMLPrinter.addPageProlog(buffer);
|
||||||
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
|
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
|
||||||
HTMLPrinter.addPageEpilog(buffer);
|
HTMLPrinter.addPageEpilog(buffer);
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formats several message as HTML text.
|
* Formats several message as HTML text.
|
||||||
*/
|
*/
|
||||||
private String formatMultipleMessages(List<String> messages) {
|
private String formatMultipleMessages(List<String> messages) {
|
||||||
StringBuilder buffer= new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
HTMLPrinter.addPageProlog(buffer);
|
HTMLPrinter.addPageProlog(buffer);
|
||||||
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(AutoconfEditorMessages.getString("AutoconfAnnotationHover.multipleMarkers"))); //$NON-NLS-1$
|
HTMLPrinter.addParagraph(buffer, HTMLPrinter
|
||||||
|
.convertToHTMLContent(AutoconfEditorMessages.getString("AutoconfAnnotationHover.multipleMarkers"))); //$NON-NLS-1$
|
||||||
|
|
||||||
HTMLPrinter.startBulletList(buffer);
|
HTMLPrinter.startBulletList(buffer);
|
||||||
Iterator<String> e= messages.iterator();
|
Iterator<String> e = messages.iterator();
|
||||||
while (e.hasNext())
|
while (e.hasNext())
|
||||||
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next()));
|
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next()));
|
||||||
HTMLPrinter.endBulletList(buffer);
|
HTMLPrinter.endBulletList(buffer);
|
||||||
|
|
||||||
HTMLPrinter.addPageEpilog(buffer);
|
HTMLPrinter.addPageEpilog(buffer);
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// IAnnotationHoverExtension members
|
// IAnnotationHoverExtension members
|
||||||
// We need to use the extension to get a Hover Control Creator which
|
// We need to use the extension to get a Hover Control Creator which
|
||||||
// handles html.
|
// handles html.
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IInformationControlCreator getHoverControlCreator() {
|
public IInformationControlCreator getHoverControlCreator() {
|
||||||
return new IInformationControlCreator() {
|
return new IInformationControlCreator() {
|
||||||
|
@ -177,17 +175,17 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandleMouseCursor() {
|
public boolean canHandleMouseCursor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
|
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
|
||||||
return new LineRange(lineNumber, 1);
|
return new LineRange(lineNumber, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) {
|
public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) {
|
||||||
return getHoverInfo(sourceViewer, lineRange.getStartLine());
|
return getHoverInfo(sourceViewer, lineRange.getStartLine());
|
||||||
|
|
|
@ -38,15 +38,14 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfCodeScanner extends RuleBasedScanner {
|
public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
|
|
||||||
private Map<String, IToken> fTokenMap= new HashMap<>();
|
private Map<String, IToken> fTokenMap = new HashMap<>();
|
||||||
private String[] fPropertyNamesColor;
|
private String[] fPropertyNamesColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference keys for boolean preferences which are <code>true</code>,
|
* Preference keys for boolean preferences which are <code>true</code>,
|
||||||
* iff the corresponding token should be rendered bold.
|
* iff the corresponding token should be rendered bold.
|
||||||
*/
|
*/
|
||||||
private String[] fPropertyNamesBold;
|
private String[] fPropertyNamesBold;
|
||||||
/**
|
/**
|
||||||
|
@ -55,49 +54,42 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
*/
|
*/
|
||||||
private String[] fPropertyNamesItalic;
|
private String[] fPropertyNamesItalic;
|
||||||
|
|
||||||
private static String[] keywords = {
|
private static String[] keywords = { "case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
"in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
|
||||||
static final String[] fTokenProperties = new String[] {
|
static final String[] fTokenProperties = new String[] { ColorManager.AUTOCONF_COMMENT_COLOR,
|
||||||
ColorManager.AUTOCONF_COMMENT_COLOR,
|
ColorManager.AUTOCONF_KEYWORD_COLOR, ColorManager.AUTOCONF_ACMACRO_COLOR,
|
||||||
ColorManager.AUTOCONF_KEYWORD_COLOR,
|
ColorManager.AUTOCONF_AMMACRO_COLOR, ColorManager.AUTOCONF_VAR_REF_COLOR,
|
||||||
ColorManager.AUTOCONF_ACMACRO_COLOR,
|
ColorManager.AUTOCONF_VAR_SET_COLOR, ColorManager.AUTOCONF_CODESEQ_COLOR,
|
||||||
ColorManager.AUTOCONF_AMMACRO_COLOR,
|
ColorManager.AUTOCONF_DEFAULT_COLOR, };
|
||||||
ColorManager.AUTOCONF_VAR_REF_COLOR,
|
|
||||||
ColorManager.AUTOCONF_VAR_SET_COLOR,
|
|
||||||
ColorManager.AUTOCONF_CODESEQ_COLOR,
|
|
||||||
ColorManager.AUTOCONF_DEFAULT_COLOR,
|
|
||||||
};
|
|
||||||
|
|
||||||
public AutoconfCodeScanner() {
|
public AutoconfCodeScanner() {
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
IToken other= getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
IToken other = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
||||||
IToken keyword = getToken(ColorManager.AUTOCONF_KEYWORD_COLOR);
|
IToken keyword = getToken(ColorManager.AUTOCONF_KEYWORD_COLOR);
|
||||||
IToken comment= getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
|
IToken comment = getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
|
||||||
IToken string = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
IToken string = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
||||||
IToken varRef = getToken(ColorManager.AUTOCONF_VAR_REF_COLOR);
|
IToken varRef = getToken(ColorManager.AUTOCONF_VAR_REF_COLOR);
|
||||||
IToken acmacro = getToken(ColorManager.AUTOCONF_ACMACRO_COLOR);
|
IToken acmacro = getToken(ColorManager.AUTOCONF_ACMACRO_COLOR);
|
||||||
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
||||||
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
|
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
|
||||||
|
|
||||||
List<IRule> rules= new ArrayList<>();
|
List<IRule> rules = new ArrayList<>();
|
||||||
|
|
||||||
// Add rule for single line comments.
|
// Add rule for single line comments.
|
||||||
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
|
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
|
||||||
rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
|
rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
|
||||||
|
|
||||||
// Add special recursive rule for strings which allows variable
|
// Add special recursive rule for strings which allows variable
|
||||||
// references to be internally tokenized.
|
// references to be internally tokenized.
|
||||||
RecursiveSingleLineRule stringRule =
|
RecursiveSingleLineRule stringRule = new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
stringRule.addRule(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
stringRule.addRule(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
rules.add(stringRule);
|
rules.add(stringRule);
|
||||||
|
|
||||||
// Add rule for variable references
|
// Add rule for variable references
|
||||||
rules.add(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
rules.add(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// Add rule for strings
|
// Add rule for strings
|
||||||
|
@ -114,31 +106,31 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
|
|
||||||
// Add rule for m4_ macros
|
// Add rule for m4_ macros
|
||||||
rules.add(new AutoconfMacroRule("m4_", new AutoconfM4WordDetector(), acmacro)); //$NON-NLS-1$
|
rules.add(new AutoconfMacroRule("m4_", new AutoconfM4WordDetector(), acmacro)); //$NON-NLS-1$
|
||||||
|
|
||||||
// Add rule for code sequences starting with <<EOF and ending with EOF
|
// Add rule for code sequences starting with <<EOF and ending with EOF
|
||||||
rules.add(new InlineDataRule(code));
|
rules.add(new InlineDataRule(code));
|
||||||
|
|
||||||
// Add word rule for keywords.
|
// Add word rule for keywords.
|
||||||
WordRule wordRule= new WordRule(new AutoconfWordDetector(), Token.UNDEFINED);
|
WordRule wordRule = new WordRule(new AutoconfWordDetector(), Token.UNDEFINED);
|
||||||
for (int i= 0; i < keywords.length; i++)
|
for (int i = 0; i < keywords.length; i++)
|
||||||
wordRule.addWord(keywords[i], keyword);
|
wordRule.addWord(keywords[i], keyword);
|
||||||
rules.add(wordRule);
|
rules.add(wordRule);
|
||||||
|
|
||||||
// Add word rule for identifier.
|
// Add word rule for identifier.
|
||||||
rules.add(new AutoconfIdentifierRule(other));
|
rules.add(new AutoconfIdentifierRule(other));
|
||||||
|
|
||||||
// Make sure we don't treat "\#" as comment start.
|
// Make sure we don't treat "\#" as comment start.
|
||||||
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
|
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
|
||||||
|
|
||||||
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
|
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
|
||||||
|
|
||||||
setDefaultReturnToken(other);
|
setDefaultReturnToken(other);
|
||||||
|
|
||||||
IRule[] result= new IRule[rules.size()];
|
IRule[] result = new IRule[rules.size()];
|
||||||
rules.toArray(result);
|
rules.toArray(result);
|
||||||
setRules(result);
|
setRules(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Token getToken(String key) {
|
protected Token getToken(String key) {
|
||||||
return (Token) fTokenMap.get(key);
|
return (Token) fTokenMap.get(key);
|
||||||
}
|
}
|
||||||
|
@ -150,26 +142,27 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
protected String[] getTokenProperties() {
|
protected String[] getTokenProperties() {
|
||||||
return fTokenProperties;
|
return fTokenProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int indexOf(String property) {
|
private int indexOf(String property) {
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
int length= fPropertyNamesColor.length;
|
int length = fPropertyNamesColor.length;
|
||||||
for (int i= 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]))
|
if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i])
|
||||||
|
|| property.equals(fPropertyNamesItalic[i]))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean affectsBehavior(PropertyChangeEvent event) {
|
public boolean affectsBehavior(PropertyChangeEvent event) {
|
||||||
return indexOf(event.getProperty()) >= 0;
|
return indexOf(event.getProperty()) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adaptToPreferenceChange(PropertyChangeEvent event) {
|
public void adaptToPreferenceChange(PropertyChangeEvent event) {
|
||||||
String p= event.getProperty();
|
String p = event.getProperty();
|
||||||
int index= indexOf(p);
|
int index = indexOf(p);
|
||||||
Token token= getToken(fPropertyNamesColor[index]);
|
Token token = getToken(fPropertyNamesColor[index]);
|
||||||
if (fPropertyNamesColor[index].equals(p))
|
if (fPropertyNamesColor[index].equals(p))
|
||||||
adaptToColorChange(event, token);
|
adaptToColorChange(event, token);
|
||||||
else if (fPropertyNamesBold[index].equals(p))
|
else if (fPropertyNamesBold[index].equals(p))
|
||||||
|
@ -179,72 +172,74 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
|
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
|
||||||
RGB rgb= null;
|
RGB rgb = null;
|
||||||
Object value= event.getNewValue();
|
Object value = event.getNewValue();
|
||||||
if (value instanceof RGB) {
|
if (value instanceof RGB) {
|
||||||
rgb= (RGB) value;
|
rgb = (RGB) value;
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
rgb= StringConverter.asRGB((String) value);
|
rgb = StringConverter.asRGB((String) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rgb != null) {
|
if (rgb != null) {
|
||||||
TextAttribute attr= (TextAttribute) token.getData();
|
TextAttribute attr = (TextAttribute) token.getData();
|
||||||
token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
|
token.setData(
|
||||||
|
new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
|
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean eventValue= false;
|
boolean eventValue = false;
|
||||||
Object value= event.getNewValue();
|
Object value = event.getNewValue();
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean) {
|
||||||
eventValue= ((Boolean) value).booleanValue();
|
eventValue = ((Boolean) value).booleanValue();
|
||||||
} else if (IPreferenceStore.TRUE.equals(value)) {
|
} else if (IPreferenceStore.TRUE.equals(value)) {
|
||||||
eventValue= true;
|
eventValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextAttribute attr= (TextAttribute) token.getData();
|
TextAttribute attr = (TextAttribute) token.getData();
|
||||||
boolean activeValue= (attr.getStyle() & styleAttribute) == styleAttribute;
|
boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute;
|
||||||
if (activeValue != eventValue) {
|
if (activeValue != eventValue) {
|
||||||
token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(), eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
|
token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(),
|
||||||
|
eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
|
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
|
||||||
Color color= null;
|
Color color = null;
|
||||||
if (colorID != null) {
|
if (colorID != null) {
|
||||||
color= AutoconfEditor.getPreferenceColor(colorID);
|
color = AutoconfEditor.getPreferenceColor(colorID);
|
||||||
}
|
}
|
||||||
IPreferenceStore store= AutotoolsPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore store = AutotoolsPlugin.getDefault().getPreferenceStore();
|
||||||
int style= store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
|
int style = store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
|
||||||
if (store.getBoolean(italicKey)) {
|
if (store.getBoolean(italicKey)) {
|
||||||
style |= SWT.ITALIC;
|
style |= SWT.ITALIC;
|
||||||
}
|
}
|
||||||
return new TextAttribute(color, null, style);
|
return new TextAttribute(color, null, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must be called after the constructor has been called.
|
* Must be called after the constructor has been called.
|
||||||
*/
|
*/
|
||||||
public final void initialize() {
|
public final void initialize() {
|
||||||
|
|
||||||
fPropertyNamesColor= getTokenProperties();
|
|
||||||
int length= fPropertyNamesColor.length;
|
|
||||||
fPropertyNamesBold= new String[length];
|
|
||||||
fPropertyNamesItalic= new String[length];
|
|
||||||
|
|
||||||
for (int i= 0; i < length; i++) {
|
fPropertyNamesColor = getTokenProperties();
|
||||||
fPropertyNamesBold[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
|
int length = fPropertyNamesColor.length;
|
||||||
fPropertyNamesItalic[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
|
fPropertyNamesBold = new String[length];
|
||||||
|
fPropertyNamesItalic = new String[length];
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
fPropertyNamesBold[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
|
||||||
|
fPropertyNamesItalic[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
|
||||||
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
|
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unread() {
|
public void unread() {
|
||||||
--fOffset;
|
--fOffset;
|
||||||
fColumn = UNDEFINED;
|
fColumn = UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,16 @@ import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
|
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
|
||||||
|
|
||||||
public class AutoconfDocumentProvider extends TextFileDocumentProvider {
|
public class AutoconfDocumentProvider extends TextFileDocumentProvider {
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
Iterator<?> e = getConnectedElementsIterator();
|
Iterator<?> e = getConnectedElementsIterator();
|
||||||
while (e.hasNext())
|
while (e.hasNext())
|
||||||
disconnect(e.next());
|
disconnect(e.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDocument getDocument(Object element) {
|
public IDocument getDocument(Object element) {
|
||||||
FileInfo info= getFileInfo(element);
|
FileInfo info = getFileInfo(element);
|
||||||
if (info != null)
|
if (info != null)
|
||||||
return info.fTextFileBuffer.getDocument();
|
return info.fTextFileBuffer.getDocument();
|
||||||
return getParentProvider().getDocument(element);
|
return getParentProvider().getDocument(element);
|
||||||
|
|
|
@ -19,30 +19,27 @@ import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IDocumentExtension3;
|
import org.eclipse.jface.text.IDocumentExtension3;
|
||||||
import org.eclipse.jface.text.IDocumentListener;
|
import org.eclipse.jface.text.IDocumentListener;
|
||||||
|
|
||||||
public class AutoconfDocumentSetupParticipant implements
|
public class AutoconfDocumentSetupParticipant implements IDocumentSetupParticipant, IDocumentListener {
|
||||||
IDocumentSetupParticipant, IDocumentListener {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup(IDocument document) {
|
public void setup(IDocument document) {
|
||||||
AutoconfPartitioner partitioner =
|
AutoconfPartitioner partitioner = new AutoconfPartitioner(new AutoconfPartitionScanner(),
|
||||||
new AutoconfPartitioner(
|
|
||||||
new AutoconfPartitionScanner(),
|
|
||||||
AutoconfPartitionScanner.AUTOCONF_PARTITION_TYPES);
|
AutoconfPartitionScanner.AUTOCONF_PARTITION_TYPES);
|
||||||
partitioner.connect(document, 1);
|
partitioner.connect(document, 1);
|
||||||
if (document instanceof IDocumentExtension3) {
|
if (document instanceof IDocumentExtension3) {
|
||||||
IDocumentExtension3 extension3= (IDocumentExtension3) document;
|
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
|
||||||
extension3.setDocumentPartitioner(AutoconfEditor.AUTOCONF_PARTITIONING, partitioner);
|
extension3.setDocumentPartitioner(AutoconfEditor.AUTOCONF_PARTITIONING, partitioner);
|
||||||
} else {
|
} else {
|
||||||
document.setDocumentPartitioner(partitioner);
|
document.setDocumentPartitioner(partitioner);
|
||||||
}
|
}
|
||||||
// document.addDocumentListener(this);
|
// document.addDocumentListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void documentAboutToBeChanged(DocumentEvent e) {
|
public void documentAboutToBeChanged(DocumentEvent e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void documentChanged(DocumentEvent e) {
|
public void documentChanged(DocumentEvent e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,7 +29,6 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a macro call by checking against the stored macro prototypes
|
* Validate a macro call by checking against the stored macro prototypes
|
||||||
*/
|
*/
|
||||||
|
@ -44,8 +43,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validateMacroCall(AutoconfMacroElement macro)
|
public void validateMacroCall(AutoconfMacroElement macro) throws ParseException, InvalidMacroException {
|
||||||
throws ParseException, InvalidMacroException {
|
|
||||||
AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor);
|
AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
boolean tooFew = false;
|
boolean tooFew = false;
|
||||||
|
@ -67,7 +65,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = macro.getEndOffset() - macro.getStartOffset();
|
int length = macro.getEndOffset() - macro.getStartOffset();
|
||||||
int start = macro.getStartOffset();
|
int start = macro.getStartOffset();
|
||||||
int end = macro.getEndOffset();
|
int end = macro.getEndOffset();
|
||||||
|
@ -75,31 +73,25 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
|
||||||
try {
|
try {
|
||||||
lineNumber = macro.getDocument().getLineOfOffset(start);
|
lineNumber = macro.getDocument().getLineOfOffset(start);
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!justRight) {
|
if (!justRight) {
|
||||||
if (tooFew) {
|
if (tooFew) {
|
||||||
String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_FEW,
|
String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_FEW,
|
||||||
AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
|
AutotoolsPlugin.getDefault().getPreferenceStore()
|
||||||
|
.getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
|
||||||
p.getName(), Integer.toString(minParms));
|
p.getName(), Integer.toString(minParms));
|
||||||
throw new ParseException(
|
throw new ParseException(formatString, start, end, lineNumber, 0, length, IMarker.SEVERITY_WARNING);
|
||||||
formatString,
|
|
||||||
start, end,
|
|
||||||
lineNumber, 0, length,
|
|
||||||
IMarker.SEVERITY_WARNING);
|
|
||||||
} else if (tooMany) {
|
} else if (tooMany) {
|
||||||
String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_MANY,
|
String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_MANY,
|
||||||
AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
|
AutotoolsPlugin.getDefault().getPreferenceStore()
|
||||||
|
.getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
|
||||||
p.getName(), Integer.toString(maxParms));
|
p.getName(), Integer.toString(maxParms));
|
||||||
throw new ParseException(
|
throw new ParseException(formatString, start, end, lineNumber, 0, length, IMarker.SEVERITY_WARNING);
|
||||||
formatString,
|
|
||||||
start, end,
|
|
||||||
lineNumber, 0, length,
|
|
||||||
IMarker.SEVERITY_WARNING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IProject project = fEditor.getProject();
|
IProject project = fEditor.getProject();
|
||||||
String acDocVer = AutoconfTextHover.getDefaultAutoconfMacrosVer();
|
String acDocVer = AutoconfTextHover.getDefaultAutoconfMacrosVer();
|
||||||
try {
|
try {
|
||||||
|
@ -114,7 +106,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
|
||||||
} catch (CoreException ce1) {
|
} catch (CoreException ce1) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
macro.validate(acDocVer);
|
macro.validate(acDocVer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,14 @@ import java.text.MessageFormat;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutoconfEditorMessages
|
* AutoconfEditorMessages
|
||||||
*/
|
*/
|
||||||
public class AutoconfEditorMessages {
|
public class AutoconfEditorMessages {
|
||||||
|
|
||||||
private static final String RESOURCE_BUNDLE= AutoconfEditorMessages.class.getName();
|
private static final String RESOURCE_BUNDLE = AutoconfEditorMessages.class.getName();
|
||||||
|
|
||||||
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
|
private static ResourceBundle fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
|
||||||
|
|
||||||
private AutoconfEditorMessages() {
|
private AutoconfEditorMessages() {
|
||||||
}
|
}
|
||||||
|
@ -34,7 +33,7 @@ public class AutoconfEditorMessages {
|
||||||
public static ResourceBundle getResourceBundle() {
|
public static ResourceBundle getResourceBundle() {
|
||||||
return fgResourceBundle;
|
return fgResourceBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
try {
|
try {
|
||||||
return fgResourceBundle.getString(key);
|
return fgResourceBundle.getString(key);
|
||||||
|
@ -42,75 +41,77 @@ public class AutoconfEditorMessages {
|
||||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string from the resource bundle and formats it with the argument
|
* Gets a string from the resource bundle and formats it with the argument
|
||||||
*
|
*
|
||||||
* @param key the string used to get the bundle value, must not be null
|
* @param key the string used to get the bundle value, must not be null
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, Object arg) {
|
public static String getFormattedString(String key, Object arg) {
|
||||||
String format= null;
|
String format = null;
|
||||||
try {
|
try {
|
||||||
format= fgResourceBundle.getString(key);
|
format = fgResourceBundle.getString(key);
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (arg == null)
|
if (arg == null)
|
||||||
arg= ""; //$NON-NLS-1$
|
arg = ""; //$NON-NLS-1$
|
||||||
return MessageFormat.format(format, new Object[] { arg });
|
return MessageFormat.format(format, new Object[] { arg });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string from the resource bundle and formats it with the arguments
|
* Gets a string from the resource bundle and formats it with the arguments
|
||||||
*
|
*
|
||||||
* @param key the string used to get the bundle value, must not be null
|
* @param key the string used to get the bundle value, must not be null
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, Object arg1, Object arg2) {
|
public static String getFormattedString(String key, Object arg1, Object arg2) {
|
||||||
String format= null;
|
String format = null;
|
||||||
try {
|
try {
|
||||||
format= fgResourceBundle.getString(key);
|
format = fgResourceBundle.getString(key);
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (arg1 == null)
|
if (arg1 == null)
|
||||||
arg1= ""; //$NON-NLS-1$
|
arg1 = ""; //$NON-NLS-1$
|
||||||
if (arg2 == null)
|
if (arg2 == null)
|
||||||
arg2= ""; //$NON-NLS-1$
|
arg2 = ""; //$NON-NLS-1$
|
||||||
return MessageFormat.format(format, new Object[] { arg1, arg2 });
|
return MessageFormat.format(format, new Object[] { arg1, arg2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string from the resource bundle and formats it with the arguments
|
* Gets a string from the resource bundle and formats it with the arguments
|
||||||
*
|
*
|
||||||
* @param key the string used to get the bundle value, must not be null
|
* @param key the string used to get the bundle value, must not be null
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, Object arg1, Object arg2, Object arg3) {
|
public static String getFormattedString(String key, Object arg1, Object arg2, Object arg3) {
|
||||||
String format= null;
|
String format = null;
|
||||||
try {
|
try {
|
||||||
format= fgResourceBundle.getString(key);
|
format = fgResourceBundle.getString(key);
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (arg1 == null)
|
if (arg1 == null)
|
||||||
arg1= ""; //$NON-NLS-1$
|
arg1 = ""; //$NON-NLS-1$
|
||||||
if (arg2 == null)
|
if (arg2 == null)
|
||||||
arg2= ""; //$NON-NLS-1$
|
arg2 = ""; //$NON-NLS-1$
|
||||||
if (arg3 == null)
|
if (arg3 == null)
|
||||||
arg3= ""; //$NON-NLS-1$
|
arg3 = ""; //$NON-NLS-1$
|
||||||
return MessageFormat.format(format, new Object[] { arg1, arg2, arg3 });
|
return MessageFormat.format(format, new Object[] { arg1, arg2, arg3 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a string from the resource bundle and formats it with the argument
|
* Gets a string from the resource bundle and formats it with the argument
|
||||||
*
|
*
|
||||||
* @param key the string used to get the bundle value, must not be null
|
* @param key the string used to get the bundle value, must not be null
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public static String getFormattedString(String key, boolean arg) {
|
public static String getFormattedString(String key, boolean arg) {
|
||||||
String format= null;
|
String format = null;
|
||||||
try {
|
try {
|
||||||
format= fgResourceBundle.getString(key);
|
format = fgResourceBundle.getString(key);
|
||||||
} catch (MissingResourceException e) {
|
} catch (MissingResourceException e) {
|
||||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,23 +26,23 @@ import org.eclipse.jface.text.source.Annotation;
|
||||||
import org.eclipse.jface.text.source.AnnotationModel;
|
import org.eclipse.jface.text.source.AnnotationModel;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfErrorHandler implements IAutoconfErrorHandler {
|
public class AutoconfErrorHandler implements IAutoconfErrorHandler {
|
||||||
|
|
||||||
public static final String CDT_ANNOTATION_INFO = "org.eclipse.cdt.ui.info"; //$NON-NLS-1$
|
public static final String CDT_ANNOTATION_INFO = "org.eclipse.cdt.ui.info"; //$NON-NLS-1$
|
||||||
public static final String CDT_ANNOTATION_WARNING = "org.eclipse.cdt.ui.warning"; //$NON-NLS-1$
|
public static final String CDT_ANNOTATION_WARNING = "org.eclipse.cdt.ui.warning"; //$NON-NLS-1$
|
||||||
public static final String CDT_ANNOTATION_ERROR = "org.eclipse.cdt.ui.error"; //$NON-NLS-1$
|
public static final String CDT_ANNOTATION_ERROR = "org.eclipse.cdt.ui.error"; //$NON-NLS-1$
|
||||||
|
|
||||||
private int CDT_WARNING = 1;
|
private int CDT_WARNING = 1;
|
||||||
private int CDT_ERROR = 2;
|
private int CDT_ERROR = 2;
|
||||||
|
|
||||||
private Map<Position, Annotation> annotations = new HashMap<>();
|
private Map<Position, Annotation> annotations = new HashMap<>();
|
||||||
private AnnotationModel fAnnotationModel;
|
private AnnotationModel fAnnotationModel;
|
||||||
|
|
||||||
public AutoconfErrorHandler(IEditorInput input) {
|
public AutoconfErrorHandler(IEditorInput input) {
|
||||||
this.fAnnotationModel = (AnnotationModel)AutoconfEditor.getAutoconfDocumentProvider().getAnnotationModel(input);
|
this.fAnnotationModel = (AnnotationModel) AutoconfEditor.getAutoconfDocumentProvider()
|
||||||
|
.getAnnotationModel(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: no quickfixes yet implemented, but maybe in the future
|
// TODO: no quickfixes yet implemented, but maybe in the future
|
||||||
private static class AutoconfAnnotation extends Annotation implements IQuickFixableAnnotation {
|
private static class AutoconfAnnotation extends Annotation implements IQuickFixableAnnotation {
|
||||||
public AutoconfAnnotation(String annotationType, boolean persist, String message) {
|
public AutoconfAnnotation(String annotationType, boolean persist, String message) {
|
||||||
|
@ -65,31 +65,29 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleError(ParseException e) {
|
public void handleError(ParseException e) {
|
||||||
Integer charStart = Integer.valueOf(e.getStartOffset());
|
Integer charStart = Integer.valueOf(e.getStartOffset());
|
||||||
Integer charEnd = Integer.valueOf(e.getEndOffset());
|
Integer charEnd = Integer.valueOf(e.getEndOffset());
|
||||||
|
|
||||||
String annotationType = CDT_ANNOTATION_INFO;
|
String annotationType = CDT_ANNOTATION_INFO;
|
||||||
if (e.getSeverity() == CDT_ERROR)
|
if (e.getSeverity() == CDT_ERROR)
|
||||||
annotationType = CDT_ANNOTATION_ERROR;
|
annotationType = CDT_ANNOTATION_ERROR;
|
||||||
else if (e.getSeverity() == CDT_WARNING)
|
else if (e.getSeverity() == CDT_WARNING)
|
||||||
annotationType = CDT_ANNOTATION_WARNING;
|
annotationType = CDT_ANNOTATION_WARNING;
|
||||||
Annotation annotation = new AutoconfAnnotation(annotationType, true, e.getLocalizedMessage());
|
Annotation annotation = new AutoconfAnnotation(annotationType, true, e.getLocalizedMessage());
|
||||||
Position p = new Position(charStart.intValue(),charEnd.intValue() - charStart.intValue());
|
Position p = new Position(charStart.intValue(), charEnd.intValue() - charStart.intValue());
|
||||||
fAnnotationModel.addAnnotation(annotation, p);
|
fAnnotationModel.addAnnotation(annotation, p);
|
||||||
annotations.put(p, annotation);
|
annotations.put(p, annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAllExistingMarkers()
|
public void removeAllExistingMarkers() {
|
||||||
{
|
|
||||||
fAnnotationModel.removeAllAnnotations();
|
fAnnotationModel.removeAllAnnotations();
|
||||||
annotations.clear();
|
annotations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeExistingMarkers(int offset, int length)
|
public void removeExistingMarkers(int offset, int length) {
|
||||||
{
|
|
||||||
Iterator<Annotation> i = fAnnotationModel.getAnnotationIterator();
|
Iterator<Annotation> i = fAnnotationModel.getAnnotationIterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
Annotation annotation = i.next();
|
Annotation annotation = i.next();
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class AutoconfIdentifierRule implements IPredicateRule {
|
||||||
|
|
||||||
private IToken fToken;
|
private IToken fToken;
|
||||||
private String fExtraChars = "_${@"; //$NON-NLS-1$
|
private String fExtraChars = "_${@"; //$NON-NLS-1$
|
||||||
|
|
||||||
public AutoconfIdentifierRule(IToken token) {
|
public AutoconfIdentifierRule(IToken token) {
|
||||||
Assert.isNotNull(token);
|
Assert.isNotNull(token);
|
||||||
fToken = token;
|
fToken = token;
|
||||||
|
@ -38,14 +38,14 @@ public class AutoconfIdentifierRule implements IPredicateRule {
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
return evaluate(scanner, false);
|
return evaluate(scanner, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
if (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0) {
|
if (Character.isLetterOrDigit((char) c) || fExtraChars.indexOf((char) c) >= 0) {
|
||||||
do {
|
do {
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
} while (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0);
|
} while (Character.isLetterOrDigit((char) c) || fExtraChars.indexOf((char) c) >= 0);
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
return fToken;
|
return fToken;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,3 @@ public class AutoconfKeywordDetector implements IWordDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,18 +44,18 @@ public class AutoconfMacro implements Comparable<Object> {
|
||||||
AutoconfMacro y = (AutoconfMacro) x;
|
AutoconfMacro y = (AutoconfMacro) x;
|
||||||
return getName().compareTo(y.getName());
|
return getName().compareTo(y.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object x) {
|
public boolean equals(Object x) {
|
||||||
if (x == null)
|
if (x == null)
|
||||||
return false;
|
return false;
|
||||||
AutoconfMacro y = (AutoconfMacro)x;
|
AutoconfMacro y = (AutoconfMacro) x;
|
||||||
return getName().equals(y.getName());
|
return getName().equals(y.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getName().hashCode();
|
return getName().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,16 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
|
|
||||||
private Map<String, IToken> fTokenMap= new HashMap<>();
|
private Map<String, IToken> fTokenMap = new HashMap<>();
|
||||||
private String[] fPropertyNamesColor;
|
private String[] fPropertyNamesColor;
|
||||||
|
|
||||||
private int quoteLevel;
|
private int quoteLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference keys for boolean preferences which are <code>true</code>,
|
* Preference keys for boolean preferences which are <code>true</code>,
|
||||||
* iff the corresponding token should be rendered bold.
|
* iff the corresponding token should be rendered bold.
|
||||||
*/
|
*/
|
||||||
private String[] fPropertyNamesBold;
|
private String[] fPropertyNamesBold;
|
||||||
/**
|
/**
|
||||||
|
@ -55,49 +54,42 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
*/
|
*/
|
||||||
private String[] fPropertyNamesItalic;
|
private String[] fPropertyNamesItalic;
|
||||||
|
|
||||||
private static String[] keywords = {
|
private static String[] keywords = { "case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
"in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
|
||||||
static final String[] fTokenProperties = new String[] {
|
static final String[] fTokenProperties = new String[] { ColorManager.AUTOCONF_COMMENT_COLOR,
|
||||||
ColorManager.AUTOCONF_COMMENT_COLOR,
|
ColorManager.AUTOCONF_KEYWORD_COLOR, ColorManager.AUTOCONF_ACMACRO_COLOR,
|
||||||
ColorManager.AUTOCONF_KEYWORD_COLOR,
|
ColorManager.AUTOCONF_AMMACRO_COLOR, ColorManager.AUTOCONF_VAR_REF_COLOR,
|
||||||
ColorManager.AUTOCONF_ACMACRO_COLOR,
|
ColorManager.AUTOCONF_VAR_SET_COLOR, ColorManager.AUTOCONF_CODESEQ_COLOR,
|
||||||
ColorManager.AUTOCONF_AMMACRO_COLOR,
|
ColorManager.AUTOCONF_DEFAULT_COLOR, };
|
||||||
ColorManager.AUTOCONF_VAR_REF_COLOR,
|
|
||||||
ColorManager.AUTOCONF_VAR_SET_COLOR,
|
|
||||||
ColorManager.AUTOCONF_CODESEQ_COLOR,
|
|
||||||
ColorManager.AUTOCONF_DEFAULT_COLOR,
|
|
||||||
};
|
|
||||||
|
|
||||||
public AutoconfMacroCodeScanner() {
|
public AutoconfMacroCodeScanner() {
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
IToken other= getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
IToken other = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
||||||
IToken keyword = getToken(ColorManager.AUTOCONF_KEYWORD_COLOR);
|
IToken keyword = getToken(ColorManager.AUTOCONF_KEYWORD_COLOR);
|
||||||
IToken comment= getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
|
IToken comment = getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
|
||||||
IToken string = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
IToken string = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
|
||||||
IToken varRef = getToken(ColorManager.AUTOCONF_VAR_REF_COLOR);
|
IToken varRef = getToken(ColorManager.AUTOCONF_VAR_REF_COLOR);
|
||||||
IToken acmacro = getToken(ColorManager.AUTOCONF_ACMACRO_COLOR);
|
IToken acmacro = getToken(ColorManager.AUTOCONF_ACMACRO_COLOR);
|
||||||
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
||||||
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
|
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
|
||||||
|
|
||||||
List<IRule> rules= new ArrayList<>();
|
List<IRule> rules = new ArrayList<>();
|
||||||
|
|
||||||
// Add rule for single line comments.
|
// Add rule for single line comments.
|
||||||
rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$
|
rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$
|
||||||
rules.add(new RestrictedEndOfLineRule("#", "[]", comment, '\\')); //$NON-NLS-1$
|
rules.add(new RestrictedEndOfLineRule("#", "[]", comment, '\\')); //$NON-NLS-1$
|
||||||
|
|
||||||
// Add special recursive rule for strings which allows variable
|
// Add special recursive rule for strings which allows variable
|
||||||
// references to be internally tokenized.
|
// references to be internally tokenized.
|
||||||
RecursiveSingleLineRule stringRule =
|
RecursiveSingleLineRule stringRule = new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
stringRule.addRule(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
stringRule.addRule(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
rules.add(stringRule);
|
rules.add(stringRule);
|
||||||
|
|
||||||
// Add rule for variable references
|
// Add rule for variable references
|
||||||
rules.add(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
rules.add(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// Add rule for strings
|
// Add rule for strings
|
||||||
|
@ -111,29 +103,29 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
|
|
||||||
// Add rule for m4_ macros
|
// Add rule for m4_ macros
|
||||||
rules.add(new AutoconfMacroRule("m4_", new AutoconfM4WordDetector(), acmacro)); //$NON-NLS-1$
|
rules.add(new AutoconfMacroRule("m4_", new AutoconfM4WordDetector(), acmacro)); //$NON-NLS-1$
|
||||||
|
|
||||||
// Add rule for code sequences starting with <<EOF and ending with EOF
|
// Add rule for code sequences starting with <<EOF and ending with EOF
|
||||||
rules.add(new InlineDataRule(code));
|
rules.add(new InlineDataRule(code));
|
||||||
|
|
||||||
// Add word rule for keywords.
|
// Add word rule for keywords.
|
||||||
WordRule wordRule= new WordRule(new AutoconfWordDetector(), other);
|
WordRule wordRule = new WordRule(new AutoconfWordDetector(), other);
|
||||||
for (int i= 0; i < keywords.length; i++)
|
for (int i = 0; i < keywords.length; i++)
|
||||||
wordRule.addWord(keywords[i], keyword);
|
wordRule.addWord(keywords[i], keyword);
|
||||||
rules.add(wordRule);
|
rules.add(wordRule);
|
||||||
|
|
||||||
// Add word rule for identifier.
|
// Add word rule for identifier.
|
||||||
rules.add(new AutoconfIdentifierRule(other));
|
rules.add(new AutoconfIdentifierRule(other));
|
||||||
|
|
||||||
// Make sure we don't treat "\#" as comment start.
|
// Make sure we don't treat "\#" as comment start.
|
||||||
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
|
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
|
||||||
|
|
||||||
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
|
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
|
||||||
|
|
||||||
IRule[] result= new IRule[rules.size()];
|
IRule[] result = new IRule[rules.size()];
|
||||||
rules.toArray(result);
|
rules.toArray(result);
|
||||||
setRules(result);
|
setRules(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken nextToken() {
|
public IToken nextToken() {
|
||||||
int ch = read();
|
int ch = read();
|
||||||
|
@ -159,30 +151,31 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
protected String[] getTokenProperties() {
|
protected String[] getTokenProperties() {
|
||||||
return fTokenProperties;
|
return fTokenProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int indexOf(String property) {
|
private int indexOf(String property) {
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
int length= fPropertyNamesColor.length;
|
int length = fPropertyNamesColor.length;
|
||||||
for (int i= 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]))
|
if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i])
|
||||||
|
|| property.equals(fPropertyNamesItalic[i]))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incQuoteLevel() {
|
public void incQuoteLevel() {
|
||||||
++quoteLevel;
|
++quoteLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decQuoteLevel() {
|
public void decQuoteLevel() {
|
||||||
--quoteLevel;
|
--quoteLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetQuoteLevel() {
|
public void resetQuoteLevel() {
|
||||||
quoteLevel = 0;
|
quoteLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getQuoteLevel() {
|
public int getQuoteLevel() {
|
||||||
return quoteLevel;
|
return quoteLevel;
|
||||||
}
|
}
|
||||||
|
@ -190,11 +183,11 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
public boolean affectsBehavior(PropertyChangeEvent event) {
|
public boolean affectsBehavior(PropertyChangeEvent event) {
|
||||||
return indexOf(event.getProperty()) >= 0;
|
return indexOf(event.getProperty()) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adaptToPreferenceChange(PropertyChangeEvent event) {
|
public void adaptToPreferenceChange(PropertyChangeEvent event) {
|
||||||
String p= event.getProperty();
|
String p = event.getProperty();
|
||||||
int index= indexOf(p);
|
int index = indexOf(p);
|
||||||
Token token= getToken(fPropertyNamesColor[index]);
|
Token token = getToken(fPropertyNamesColor[index]);
|
||||||
if (fPropertyNamesColor[index].equals(p))
|
if (fPropertyNamesColor[index].equals(p))
|
||||||
adaptToColorChange(event, token);
|
adaptToColorChange(event, token);
|
||||||
else if (fPropertyNamesBold[index].equals(p))
|
else if (fPropertyNamesBold[index].equals(p))
|
||||||
|
@ -204,73 +197,75 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
|
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
|
||||||
RGB rgb= null;
|
RGB rgb = null;
|
||||||
Object value= event.getNewValue();
|
Object value = event.getNewValue();
|
||||||
if (value instanceof RGB) {
|
if (value instanceof RGB) {
|
||||||
rgb= (RGB) value;
|
rgb = (RGB) value;
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
rgb= StringConverter.asRGB((String) value);
|
rgb = StringConverter.asRGB((String) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rgb != null) {
|
if (rgb != null) {
|
||||||
TextAttribute attr= (TextAttribute) token.getData();
|
TextAttribute attr = (TextAttribute) token.getData();
|
||||||
token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
|
token.setData(
|
||||||
|
new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
|
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean eventValue= false;
|
boolean eventValue = false;
|
||||||
Object value= event.getNewValue();
|
Object value = event.getNewValue();
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean) {
|
||||||
eventValue= ((Boolean) value).booleanValue();
|
eventValue = ((Boolean) value).booleanValue();
|
||||||
} else if (IPreferenceStore.TRUE.equals(value)) {
|
} else if (IPreferenceStore.TRUE.equals(value)) {
|
||||||
eventValue= true;
|
eventValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextAttribute attr= (TextAttribute) token.getData();
|
TextAttribute attr = (TextAttribute) token.getData();
|
||||||
boolean activeValue= (attr.getStyle() & styleAttribute) == styleAttribute;
|
boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute;
|
||||||
if (activeValue != eventValue) {
|
if (activeValue != eventValue) {
|
||||||
token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(), eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
|
token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(),
|
||||||
|
eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
|
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
|
||||||
Color color= null;
|
Color color = null;
|
||||||
if (colorID != null) {
|
if (colorID != null) {
|
||||||
color= AutoconfEditor.getPreferenceColor(colorID);
|
color = AutoconfEditor.getPreferenceColor(colorID);
|
||||||
}
|
}
|
||||||
IPreferenceStore store= AutotoolsPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore store = AutotoolsPlugin.getDefault().getPreferenceStore();
|
||||||
int style= store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
|
int style = store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
|
||||||
if (store.getBoolean(italicKey)) {
|
if (store.getBoolean(italicKey)) {
|
||||||
style |= SWT.ITALIC;
|
style |= SWT.ITALIC;
|
||||||
}
|
}
|
||||||
return new TextAttribute(color, null, style);
|
return new TextAttribute(color, null, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must be called after the constructor has been called.
|
* Must be called after the constructor has been called.
|
||||||
*/
|
*/
|
||||||
public final void initialize() {
|
public final void initialize() {
|
||||||
|
|
||||||
resetQuoteLevel();
|
|
||||||
fPropertyNamesColor= getTokenProperties();
|
|
||||||
int length= fPropertyNamesColor.length;
|
|
||||||
fPropertyNamesBold= new String[length];
|
|
||||||
fPropertyNamesItalic= new String[length];
|
|
||||||
|
|
||||||
for (int i= 0; i < length; i++) {
|
resetQuoteLevel();
|
||||||
fPropertyNamesBold[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
|
fPropertyNamesColor = getTokenProperties();
|
||||||
fPropertyNamesItalic[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
|
int length = fPropertyNamesColor.length;
|
||||||
|
fPropertyNamesBold = new String[length];
|
||||||
|
fPropertyNamesItalic = new String[length];
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
fPropertyNamesBold[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
|
||||||
|
fPropertyNamesItalic[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
|
||||||
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
|
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unread() {
|
public void unread() {
|
||||||
--fOffset;
|
--fOffset;
|
||||||
fColumn = UNDEFINED;
|
fColumn = UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,10 @@ import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
|
||||||
import org.eclipse.jface.text.contentassist.IContextInformation;
|
import org.eclipse.jface.text.contentassist.IContextInformation;
|
||||||
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
|
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
|
||||||
|
|
||||||
|
public class AutoconfMacroContentAssistProcessor implements IContentAssistProcessor {
|
||||||
|
|
||||||
public class AutoconfMacroContentAssistProcessor implements
|
|
||||||
IContentAssistProcessor {
|
|
||||||
|
|
||||||
protected AutoconfEditor editor;
|
protected AutoconfEditor editor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@ -48,11 +46,10 @@ public class AutoconfMacroContentAssistProcessor implements
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
|
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
|
||||||
int offset) {
|
|
||||||
|
|
||||||
IDocument document = viewer.getDocument();
|
IDocument document = viewer.getDocument();
|
||||||
String prefix = ""; //$NON-NLS-1$
|
String prefix = ""; //$NON-NLS-1$
|
||||||
AutoconfMacro[] macros = AutoconfTextHover.getMacroList(editor);
|
AutoconfMacro[] macros = AutoconfTextHover.getMacroList(editor);
|
||||||
|
@ -80,11 +77,12 @@ public class AutoconfMacroContentAssistProcessor implements
|
||||||
if (macros[i].hasParms()) {
|
if (macros[i].hasParms()) {
|
||||||
// Provide parameter info as context information that
|
// Provide parameter info as context information that
|
||||||
// is tied to the completion proposal.
|
// is tied to the completion proposal.
|
||||||
ci = new AutoconfMacroProposalContextInformation(macros[i].getParms(), macros[i].getParms());
|
ci = new AutoconfMacroProposalContextInformation(macros[i].getParms(),
|
||||||
|
macros[i].getParms());
|
||||||
ci.setContextInformationPosition(offset - prefixLen + cursorPos - 1);
|
ci.setContextInformationPosition(offset - prefixLen + cursorPos - 1);
|
||||||
}
|
}
|
||||||
ICompletionProposal cp = new CompletionProposal(template, offset - prefixLen, prefixLen, cursorPos, null,
|
ICompletionProposal cp = new CompletionProposal(template, offset - prefixLen, prefixLen,
|
||||||
name, ci, AutoconfTextHover.getIndexedInfo(name, editor));
|
cursorPos, null, name, ci, AutoconfTextHover.getIndexedInfo(name, editor));
|
||||||
validList.add(cp);
|
validList.add(cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,8 +94,7 @@ public class AutoconfMacroContentAssistProcessor implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IContextInformation[] computeContextInformation(ITextViewer viewer,
|
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
|
||||||
int offset) {
|
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
|
||||||
import org.eclipse.jface.text.rules.ITokenScanner;
|
import org.eclipse.jface.text.rules.ITokenScanner;
|
||||||
|
|
||||||
public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
|
public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
|
|
||||||
public final static String UNMATCHED_RIGHT_PARENTHESIS = "UnmatchedRightParenthesis"; //$NON-NLS-1$
|
public final static String UNMATCHED_RIGHT_PARENTHESIS = "UnmatchedRightParenthesis"; //$NON-NLS-1$
|
||||||
public final static String UNMATCHED_LEFT_PARENTHESIS = "UnmatchedLeftParenthesis"; //$NON-NLS-1$
|
public final static String UNMATCHED_LEFT_PARENTHESIS = "UnmatchedLeftParenthesis"; //$NON-NLS-1$
|
||||||
public final static String UNMATCHED_RIGHT_QUOTE = "UnmatchedRightQuote"; //$NON-NLS-1$
|
public final static String UNMATCHED_RIGHT_QUOTE = "UnmatchedRightQuote"; //$NON-NLS-1$
|
||||||
public final static String UNMATCHED_LEFT_QUOTE = "UnmatchedLeftQuote"; //$NON-NLS-1$
|
public final static String UNMATCHED_LEFT_QUOTE = "UnmatchedLeftQuote"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a damager/repairer that uses the given scanner. The scanner may
|
* Creates a damager/repairer that uses the given scanner. The scanner may
|
||||||
* not be <code>null</code> and is assumed to return only token that carry
|
* not be <code>null</code> and is assumed to return only token that carry
|
||||||
|
@ -35,5 +35,4 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
super(scanner);
|
super(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.eclipse.swt.custom.StyleRange;
|
||||||
/**
|
/**
|
||||||
* This class provides the macro call parameter parsing for the Autoconf Editor hover
|
* This class provides the macro call parameter parsing for the Autoconf Editor hover
|
||||||
* It is modified from the CDT class CParameterListValidator
|
* It is modified from the CDT class CParameterListValidator
|
||||||
*
|
*
|
||||||
* @author jjohnstn
|
* @author jjohnstn
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -36,25 +36,25 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
|
||||||
private int fPosition;
|
private int fPosition;
|
||||||
private ITextViewer fViewer;
|
private ITextViewer fViewer;
|
||||||
private IContextInformation fInformation;
|
private IContextInformation fInformation;
|
||||||
|
|
||||||
private int fCurrentParameter;
|
private int fCurrentParameter;
|
||||||
|
|
||||||
public AutoconfMacroParameterListValidator() {
|
public AutoconfMacroParameterListValidator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
|
public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
|
||||||
|
|
||||||
fPosition= documentPosition;
|
fPosition = documentPosition;
|
||||||
fViewer= viewer;
|
fViewer = viewer;
|
||||||
fInformation= info;
|
fInformation = info;
|
||||||
|
|
||||||
fCurrentParameter= -1;
|
fCurrentParameter = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getStringEnd(IDocument d, int pos, int end, char ch) throws BadLocationException {
|
private int getStringEnd(IDocument d, int pos, int end, char ch) throws BadLocationException {
|
||||||
while (pos < end) {
|
while (pos < end) {
|
||||||
char curr= d.getChar(pos);
|
char curr = d.getChar(pos);
|
||||||
pos++;
|
pos++;
|
||||||
if (curr == '\\') {
|
if (curr == '\\') {
|
||||||
// ignore escaped characters
|
// ignore escaped characters
|
||||||
|
@ -65,12 +65,12 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
|
||||||
}
|
}
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getCharCount(IDocument document, int start, int end,
|
private int getCharCount(IDocument document, int start, int end, char increment, char decrement,
|
||||||
char increment, char decrement, boolean considerNesting) throws BadLocationException {
|
boolean considerNesting) throws BadLocationException {
|
||||||
|
|
||||||
Assert.isTrue((increment != 0 || decrement != 0) && increment != decrement);
|
Assert.isTrue((increment != 0 || decrement != 0) && increment != decrement);
|
||||||
|
|
||||||
// There are two nesting levels to worry about. Arguments can be
|
// There are two nesting levels to worry about. Arguments can be
|
||||||
// quoted with [] which means to treat the contents as one arg.
|
// quoted with [] which means to treat the contents as one arg.
|
||||||
// As well, macro calls can be nested within macro calls so we
|
// As well, macro calls can be nested within macro calls so we
|
||||||
|
@ -81,131 +81,130 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
|
||||||
while (start < end) {
|
while (start < end) {
|
||||||
char curr = document.getChar(start++);
|
char curr = document.getChar(start++);
|
||||||
switch (curr) {
|
switch (curr) {
|
||||||
case 'd':
|
case 'd':
|
||||||
if (start < end - 2) {
|
if (start < end - 2) {
|
||||||
char next= document.getChar(start);
|
char next = document.getChar(start);
|
||||||
if (next == 'n') {
|
if (next == 'n') {
|
||||||
// a comment starts, advance to the comment end
|
// a comment starts, advance to the comment end
|
||||||
next = document.getChar(start + 1);
|
next = document.getChar(start + 1);
|
||||||
if (next == 'l')
|
if (next == 'l')
|
||||||
// dnl-comment: nothing to do anymore on this line
|
// dnl-comment: nothing to do anymore on this line
|
||||||
start= end;
|
start = end;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
case '\'':
|
||||||
|
start = getStringEnd(document, start, end, curr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if ('[' == curr)
|
||||||
|
++macroQuotingLevel;
|
||||||
|
else if (']' == curr)
|
||||||
|
--macroQuotingLevel;
|
||||||
|
if (macroQuotingLevel != 0)
|
||||||
break;
|
break;
|
||||||
case '"':
|
if (considerNesting) {
|
||||||
case '\'':
|
if ('(' == curr)
|
||||||
start= getStringEnd(document, start, end, curr);
|
++macroNestingLevel;
|
||||||
break;
|
else if (')' == curr) {
|
||||||
default:
|
--macroNestingLevel;
|
||||||
if ('[' == curr)
|
}
|
||||||
++ macroQuotingLevel;
|
if (macroNestingLevel != 0)
|
||||||
else if (']' == curr)
|
|
||||||
-- macroQuotingLevel;
|
|
||||||
if (macroQuotingLevel != 0)
|
|
||||||
break;
|
break;
|
||||||
if (considerNesting) {
|
}
|
||||||
if ('(' == curr)
|
if (increment != 0) {
|
||||||
++ macroNestingLevel;
|
if (curr == increment) {
|
||||||
else if (')' == curr) {
|
++charCount;
|
||||||
-- macroNestingLevel;
|
|
||||||
}
|
|
||||||
if (macroNestingLevel != 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (increment != 0) {
|
}
|
||||||
if (curr == increment) {
|
|
||||||
++charCount;
|
if (decrement != 0) {
|
||||||
}
|
if (curr == decrement) {
|
||||||
}
|
--charCount;
|
||||||
|
|
||||||
if (decrement != 0) {
|
|
||||||
if (curr == decrement) {
|
|
||||||
-- charCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return charCount;
|
return charCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isContextInformationValid(int position) {
|
public boolean isContextInformationValid(int position) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (position < fPosition)
|
if (position < fPosition)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IDocument document= fViewer.getDocument();
|
IDocument document = fViewer.getDocument();
|
||||||
IRegion line= document.getLineInformationOfOffset(fPosition);
|
IRegion line = document.getLineInformationOfOffset(fPosition);
|
||||||
|
|
||||||
if (position > line.getOffset() + line.getLength())
|
if (position > line.getOffset() + line.getLength())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (getCharCount(document, fPosition, position, '(', ')', false) >= 0);
|
return (getCharCount(document, fPosition, position, '(', ')', false) >= 0);
|
||||||
|
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updatePresentation(int position, TextPresentation presentation) {
|
public boolean updatePresentation(int position, TextPresentation presentation) {
|
||||||
|
|
||||||
int currentParameter= -1;
|
int currentParameter = -1;
|
||||||
try {
|
try {
|
||||||
currentParameter= getCharCount(fViewer.getDocument(), fPosition, position, ',', (char) 0, true);
|
currentParameter = getCharCount(fViewer.getDocument(), fPosition, position, ',', (char) 0, true);
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fCurrentParameter != -1) {
|
if (fCurrentParameter != -1) {
|
||||||
if (currentParameter == fCurrentParameter)
|
if (currentParameter == fCurrentParameter)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
presentation.clear();
|
presentation.clear();
|
||||||
fCurrentParameter= currentParameter;
|
fCurrentParameter = currentParameter;
|
||||||
|
|
||||||
//Don't presume what has been done to the string, rather use as is
|
//Don't presume what has been done to the string, rather use as is
|
||||||
String s= fInformation.getInformationDisplayString();
|
String s = fInformation.getInformationDisplayString();
|
||||||
|
|
||||||
//@@@ This is obviously going to have problems with functions such
|
//@@@ This is obviously going to have problems with functions such
|
||||||
//int myfunction(int (*function_argument)(void * extra, int param), void * extra)
|
//int myfunction(int (*function_argument)(void * extra, int param), void * extra)
|
||||||
//int myfunction(/*A comment, indeed */int a);
|
//int myfunction(/*A comment, indeed */int a);
|
||||||
int start= 0;
|
int start = 0;
|
||||||
int occurrences= 0;
|
int occurrences = 0;
|
||||||
while (occurrences < fCurrentParameter) {
|
while (occurrences < fCurrentParameter) {
|
||||||
int found= s.indexOf(',', start);
|
int found = s.indexOf(',', start);
|
||||||
if (found == -1)
|
if (found == -1)
|
||||||
break;
|
break;
|
||||||
start= found + 1;
|
start = found + 1;
|
||||||
++ occurrences;
|
++occurrences;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (occurrences < fCurrentParameter) {
|
if (occurrences < fCurrentParameter) {
|
||||||
presentation.addStyleRange(new StyleRange(0, s.length(), null, null, SWT.NORMAL));
|
presentation.addStyleRange(new StyleRange(0, s.length(), null, null, SWT.NORMAL));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start == -1)
|
if (start == -1)
|
||||||
start= 0;
|
start = 0;
|
||||||
|
|
||||||
int end= s.indexOf(',', start);
|
int end = s.indexOf(',', start);
|
||||||
if (end == -1)
|
if (end == -1)
|
||||||
end= s.length();
|
end = s.length();
|
||||||
|
|
||||||
if (start > 0)
|
if (start > 0)
|
||||||
presentation.addStyleRange(new StyleRange(0, start, null, null, SWT.NORMAL));
|
presentation.addStyleRange(new StyleRange(0, start, null, null, SWT.NORMAL));
|
||||||
|
|
||||||
if (end > start)
|
if (end > start)
|
||||||
presentation.addStyleRange(new StyleRange(start, end - start, null, null, SWT.BOLD));
|
presentation.addStyleRange(new StyleRange(start, end - start, null, null, SWT.BOLD));
|
||||||
|
|
||||||
if (end < s.length())
|
if (end < s.length())
|
||||||
presentation.addStyleRange(new StyleRange(end, s.length() - end, null, null, SWT.NORMAL));
|
presentation.addStyleRange(new StyleRange(end, s.length() - end, null, null, SWT.NORMAL));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.jface.text.rules.IWhitespaceDetector;
|
||||||
import org.eclipse.jface.text.rules.IWordDetector;
|
import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
import org.eclipse.jface.text.rules.Token;
|
import org.eclipse.jface.text.rules.Token;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfMacroPartitionRule implements IPredicateRule {
|
public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
/**
|
/**
|
||||||
* The default token to be returned on success and if nothing else has been
|
* The default token to be returned on success and if nothing else has been
|
||||||
|
@ -52,7 +51,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void matchParentheses(ICharacterScanner scanner) {
|
protected void matchParentheses(ICharacterScanner scanner) {
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
|
@ -61,50 +60,48 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
while (!finished && c != ICharacterScanner.EOF) {
|
while (!finished && c != ICharacterScanner.EOF) {
|
||||||
if (c == '[') {
|
if (c == '[') {
|
||||||
++quoteDepth;
|
++quoteDepth;
|
||||||
}
|
} else if (c == ']') {
|
||||||
else if (c == ']') {
|
|
||||||
--quoteDepth;
|
--quoteDepth;
|
||||||
if (quoteDepth < 0)
|
if (quoteDepth < 0)
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
}
|
||||||
if (quoteDepth == 0) {
|
if (quoteDepth == 0) {
|
||||||
if (c == ')') {
|
if (c == ')') {
|
||||||
--depth;
|
--depth;
|
||||||
if (depth <= 0)
|
if (depth <= 0)
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
} else if (c == '(') {
|
||||||
else if (c == '(') {
|
|
||||||
++depth;
|
++depth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
// if (resume)
|
// if (resume)
|
||||||
// return Token.UNDEFINED;
|
// return Token.UNDEFINED;
|
||||||
return evaluate(scanner);
|
return evaluate(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
fBuffer.setLength(0);
|
fBuffer.setLength(0);
|
||||||
|
|
||||||
fBuffer.append((char)c);
|
fBuffer.append((char) c);
|
||||||
if (c == 'A') {
|
if (c == 'A') {
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
fBuffer.append((char)c);
|
fBuffer.append((char) c);
|
||||||
if (c != 'C' && c != 'H' && c != 'M') {
|
if (c != 'C' && c != 'H' && c != 'M') {
|
||||||
unreadBuffer(scanner);
|
unreadBuffer(scanner);
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
fDetector = generalMacroWordDetector;
|
fDetector = generalMacroWordDetector;
|
||||||
} else if (c == 'm') {
|
} else if (c == 'm') {
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
fBuffer.append((char)c);
|
fBuffer.append((char) c);
|
||||||
if (c != 4) {
|
if (c != 4) {
|
||||||
unreadBuffer(scanner);
|
unreadBuffer(scanner);
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
|
@ -114,22 +111,19 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
unreadBuffer(scanner);
|
unreadBuffer(scanner);
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
while (c != ICharacterScanner.EOF
|
while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)) {
|
||||||
&& fDetector.isWordPart((char) c)) {
|
|
||||||
fBuffer.append((char) c);
|
fBuffer.append((char) c);
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != ICharacterScanner.EOF) {
|
if (c != ICharacterScanner.EOF) {
|
||||||
if (c == ';' || fWsDetector.isWhitespace((char)c)) {
|
if (c == ';' || fWsDetector.isWhitespace((char) c)) {
|
||||||
// We are done
|
// We are done
|
||||||
}
|
} else if (c == '(') {
|
||||||
else if (c == '(') {
|
|
||||||
matchParentheses(scanner);
|
matchParentheses(scanner);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
unreadBuffer(scanner);
|
unreadBuffer(scanner);
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
|
@ -142,7 +136,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the characters in the buffer to the scanner.
|
* Returns the characters in the buffer to the scanner.
|
||||||
*
|
*
|
||||||
* @param scanner
|
* @param scanner
|
||||||
* the scanner to be used
|
* the scanner to be used
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -51,41 +51,43 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
|
||||||
* @param informationDisplayString the string to be displayed when presenting the context information,
|
* @param informationDisplayString the string to be displayed when presenting the context information,
|
||||||
* may not be <code>null</code>
|
* may not be <code>null</code>
|
||||||
*/
|
*/
|
||||||
public AutoconfMacroProposalContextInformation(Image image, String contextDisplayString, String informationDisplayString) {
|
public AutoconfMacroProposalContextInformation(Image image, String contextDisplayString,
|
||||||
|
String informationDisplayString) {
|
||||||
//Assert.isNotNull(informationDisplayString);
|
//Assert.isNotNull(informationDisplayString);
|
||||||
fImage= image;
|
fImage = image;
|
||||||
fContextDisplayString= contextDisplayString;
|
fContextDisplayString = contextDisplayString;
|
||||||
fInformationDisplayString= informationDisplayString;
|
fInformationDisplayString = informationDisplayString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if (object instanceof IContextInformation) {
|
if (object instanceof IContextInformation) {
|
||||||
IContextInformation contextInformation= (IContextInformation) object;
|
IContextInformation contextInformation = (IContextInformation) object;
|
||||||
boolean equals= fInformationDisplayString.equalsIgnoreCase(contextInformation.getInformationDisplayString());
|
boolean equals = fInformationDisplayString
|
||||||
if (fContextDisplayString != null)
|
.equalsIgnoreCase(contextInformation.getInformationDisplayString());
|
||||||
equals= equals && fContextDisplayString.equalsIgnoreCase(contextInformation.getContextDisplayString());
|
if (fContextDisplayString != null)
|
||||||
|
equals = equals && fContextDisplayString.equalsIgnoreCase(contextInformation.getContextDisplayString());
|
||||||
return equals;
|
return equals;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase());
|
String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase());
|
||||||
return combined.hashCode();
|
return combined.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInformationDisplayString() {
|
public String getInformationDisplayString() {
|
||||||
return fInformationDisplayString;
|
return fInformationDisplayString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return fImage;
|
return fImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContextDisplayString() {
|
public String getContextDisplayString() {
|
||||||
if (fContextDisplayString != null)
|
if (fContextDisplayString != null)
|
||||||
|
@ -97,8 +99,8 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
|
||||||
public int getContextInformationPosition() {
|
public int getContextInformationPosition() {
|
||||||
return fInformationPosition;
|
return fInformationPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContextInformationPosition( int pos ){
|
public void setContextInformationPosition(int pos) {
|
||||||
fInformationPosition = pos;
|
fInformationPosition = pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ public class AutoconfMacroRule implements IRule {
|
||||||
|
|
||||||
private String fStartingSequence;
|
private String fStartingSequence;
|
||||||
|
|
||||||
public AutoconfMacroRule(String startingSequence,
|
public AutoconfMacroRule(String startingSequence, IWordDetector detector, IToken inToken) {
|
||||||
IWordDetector detector, IToken inToken) {
|
|
||||||
token = inToken;
|
token = inToken;
|
||||||
fDetector = detector;
|
fDetector = detector;
|
||||||
fStartingSequence = startingSequence;
|
fStartingSequence = startingSequence;
|
||||||
|
@ -62,14 +61,12 @@ public class AutoconfMacroRule implements IRule {
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (c != ICharacterScanner.EOF
|
while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)) {
|
||||||
&& fDetector.isWordPart((char) c)) {
|
|
||||||
fBuffer.append((char) c);
|
fBuffer.append((char) c);
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != ICharacterScanner.EOF && c != '(' && c != ';'
|
if (c != ICharacterScanner.EOF && c != '(' && c != ';' && !fWsDetector.isWhitespace((char) c)) {
|
||||||
&& !fWsDetector.isWhitespace((char)c)) {
|
|
||||||
unreadBuffer(scanner);
|
unreadBuffer(scanner);
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +77,7 @@ public class AutoconfMacroRule implements IRule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the characters in the buffer to the scanner.
|
* Returns the characters in the buffer to the scanner.
|
||||||
*
|
*
|
||||||
* @param scanner
|
* @param scanner
|
||||||
* the scanner to be used
|
* the scanner to be used
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,8 +19,7 @@ public class AutoconfMacroWordDetector implements IWordDetector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWordPart(char c) {
|
public boolean isWordPart(char c) {
|
||||||
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
|
return ((Character.isLetter(c) && Character.isUpperCase(c)) || Character.isDigit(c) || c == '_');
|
||||||
Character.isDigit(c) || c == '_');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,8 +19,7 @@ public class AutoconfPKGWordDetector implements IWordDetector {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWordPart(char c) {
|
public boolean isWordPart(char c) {
|
||||||
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
|
return ((Character.isLetter(c) && Character.isUpperCase(c)) || Character.isDigit(c) || c == '_');
|
||||||
Character.isDigit(c) || c == '_');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,37 +24,35 @@ import org.eclipse.jface.text.rules.SingleLineRule;
|
||||||
import org.eclipse.jface.text.rules.Token;
|
import org.eclipse.jface.text.rules.Token;
|
||||||
|
|
||||||
public class AutoconfPartitionScanner extends RuleBasedPartitionScanner {
|
public class AutoconfPartitionScanner extends RuleBasedPartitionScanner {
|
||||||
|
|
||||||
public final static String AUTOCONF_MACRO = "autoconf_macro"; //$NON-NLS-1$
|
public final static String AUTOCONF_MACRO = "autoconf_macro"; //$NON-NLS-1$
|
||||||
public final static String AUTOCONF_COMMENT = "autoconf_comment"; //$NON-NLS-1$
|
public final static String AUTOCONF_COMMENT = "autoconf_comment"; //$NON-NLS-1$
|
||||||
final static String[] AUTOCONF_PARTITION_TYPES=
|
final static String[] AUTOCONF_PARTITION_TYPES = new String[] { AUTOCONF_MACRO, AUTOCONF_COMMENT };
|
||||||
new String[] { AUTOCONF_MACRO, AUTOCONF_COMMENT };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the partitioner and sets up the appropriate rules.
|
* Creates the partitioner and sets up the appropriate rules.
|
||||||
*/
|
*/
|
||||||
public AutoconfPartitionScanner() {
|
public AutoconfPartitionScanner() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
List<IRule> rules= new ArrayList<>();
|
List<IRule> rules = new ArrayList<>();
|
||||||
Token macro = new Token(AUTOCONF_MACRO);
|
Token macro = new Token(AUTOCONF_MACRO);
|
||||||
Token comment = new Token(AUTOCONF_COMMENT);
|
Token comment = new Token(AUTOCONF_COMMENT);
|
||||||
|
|
||||||
// Add rule for target bodies.
|
// Add rule for target bodies.
|
||||||
rules.add(new AutoconfMacroPartitionRule(macro));
|
rules.add(new AutoconfMacroPartitionRule(macro));
|
||||||
|
|
||||||
|
|
||||||
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
|
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
|
||||||
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
|
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
|
||||||
rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
|
rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
|
||||||
|
|
||||||
// We want to process identifiers that might have macro
|
// We want to process identifiers that might have macro
|
||||||
// names inside them.
|
// names inside them.
|
||||||
rules.add(new AutoconfIdentifierRule(Token.UNDEFINED));
|
rules.add(new AutoconfIdentifierRule(Token.UNDEFINED));
|
||||||
|
|
||||||
IPredicateRule[] result= new IPredicateRule[rules.size()];
|
IPredicateRule[] result = new IPredicateRule[rules.size()];
|
||||||
rules.toArray(result);
|
rules.toArray(result);
|
||||||
setPredicateRules(result);
|
setPredicateRules(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,38 +25,32 @@ public class AutoconfPartitioner extends FastPartitioner {
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
super(scanner, legalContentTypes);
|
super(scanner, legalContentTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect(IDocument document, int blah) {
|
public void connect(IDocument document, int blah) {
|
||||||
super.connect(document);
|
super.connect(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
// To optionally show partitions, we must do so by overriding the computePartitioning
|
// To optionally show partitions, we must do so by overriding the computePartitioning
|
||||||
// method. We cannot do it at connect time because the document may be zero length
|
// method. We cannot do it at connect time because the document may be zero length
|
||||||
// at the time and we will end up getting default partitioning from then on.
|
// at the time and we will end up getting default partitioning from then on.
|
||||||
@Override
|
@Override
|
||||||
public ITypedRegion[] computePartitioning(int offset, int length,
|
public ITypedRegion[] computePartitioning(int offset, int length, boolean includeZeroLength) {
|
||||||
boolean includeZeroLength) {
|
|
||||||
ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength);
|
ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength);
|
||||||
// Uncomment the following line to see partitioning.
|
// Uncomment the following line to see partitioning.
|
||||||
// printPartitions(regions);
|
// printPartitions(regions);
|
||||||
return regions;
|
return regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printPartitions(ITypedRegion[] partitions)
|
public void printPartitions(ITypedRegion[] partitions) {
|
||||||
{
|
for (int i = 0; i < partitions.length; i++) {
|
||||||
for (int i = 0; i < partitions.length; i++)
|
try {
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
System.out.print("Partition type: " + partitions[i].getType() //$NON-NLS-1$
|
System.out.print("Partition type: " + partitions[i].getType() //$NON-NLS-1$
|
||||||
+ ", offset: " + partitions[i].getOffset() //$NON-NLS-1$
|
+ ", offset: " + partitions[i].getOffset() //$NON-NLS-1$
|
||||||
+ ", length: " + partitions[i].getLength() //$NON-NLS-1$
|
+ ", length: " + partitions[i].getLength() //$NON-NLS-1$
|
||||||
+"\nText:\n" //$NON-NLS-1$
|
+ "\nText:\n" //$NON-NLS-1$
|
||||||
+ super.fDocument.get(partitions[i].getOffset(), partitions[i].getLength())
|
+ super.fDocument.get(partitions[i].getOffset(), partitions[i].getLength())
|
||||||
+ "\n---------------------------\n\n\n"); //$NON-NLS-1$
|
+ "\n---------------------------\n\n\n"); //$NON-NLS-1$
|
||||||
}
|
} catch (BadLocationException e) {
|
||||||
catch (BadLocationException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,27 +21,26 @@ import org.eclipse.jface.text.reconciler.DirtyRegion;
|
||||||
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
|
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
|
public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
|
||||||
|
|
||||||
AutoconfContentOutlinePage outline;
|
AutoconfContentOutlinePage outline;
|
||||||
// int lastRegionOffset;
|
// int lastRegionOffset;
|
||||||
AutoconfEditor editor;
|
AutoconfEditor editor;
|
||||||
IDocumentProvider documentProvider;
|
IDocumentProvider documentProvider;
|
||||||
|
|
||||||
public AutoconfReconcilingStrategy(AutoconfEditor editor) {
|
public AutoconfReconcilingStrategy(AutoconfEditor editor) {
|
||||||
outline= editor.getOutlinePage();
|
outline = editor.getOutlinePage();
|
||||||
// lastRegionOffset = Integer.MAX_VALUE;
|
// lastRegionOffset = Integer.MAX_VALUE;
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
documentProvider = editor.getDocumentProvider();
|
documentProvider = editor.getDocumentProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reconcile(IRegion partition) {
|
public void reconcile(IRegion partition) {
|
||||||
try {
|
try {
|
||||||
AutoconfParser parser = editor.getAutoconfParser();
|
AutoconfParser parser = editor.getAutoconfParser();
|
||||||
((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers();
|
((AutoconfErrorHandler) parser.getErrorHandler()).removeAllExistingMarkers();
|
||||||
|
|
||||||
editor.setRootElement(parser.parse(documentProvider.getDocument(editor.getEditorInput())));
|
editor.setRootElement(parser.parse(documentProvider.getDocument(editor.getEditorInput())));
|
||||||
outline.update();
|
outline.update();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -29,19 +29,17 @@ import org.eclipse.jface.text.source.IAnnotationHover;
|
||||||
import org.eclipse.jface.text.source.ISourceViewer;
|
import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
|
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
|
||||||
|
|
||||||
|
public class AutoconfSourceViewerConfiguration extends TextSourceViewerConfiguration {
|
||||||
public class AutoconfSourceViewerConfiguration extends
|
|
||||||
TextSourceViewerConfiguration {
|
|
||||||
|
|
||||||
private ITextHover acHover;
|
private ITextHover acHover;
|
||||||
private IAnnotationHover aaHover;
|
private IAnnotationHover aaHover;
|
||||||
private AutoconfEditor fEditor;
|
private AutoconfEditor fEditor;
|
||||||
|
|
||||||
public AutoconfSourceViewerConfiguration(IPreferenceStore prefs, AutoconfEditor editor) {
|
public AutoconfSourceViewerConfiguration(IPreferenceStore prefs, AutoconfEditor editor) {
|
||||||
super(prefs);
|
super(prefs);
|
||||||
fEditor = editor;
|
fEditor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
|
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
|
||||||
return AutoconfEditor.AUTOCONF_PARTITIONING;
|
return AutoconfEditor.AUTOCONF_PARTITIONING;
|
||||||
|
@ -50,7 +48,7 @@ public class AutoconfSourceViewerConfiguration extends
|
||||||
@Override
|
@Override
|
||||||
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
||||||
ContentAssistant assistant = new ContentAssistant();
|
ContentAssistant assistant = new ContentAssistant();
|
||||||
|
|
||||||
IContentAssistProcessor macroContentAssistProcessor = new AutoconfMacroContentAssistProcessor(fEditor);
|
IContentAssistProcessor macroContentAssistProcessor = new AutoconfMacroContentAssistProcessor(fEditor);
|
||||||
assistant.setContentAssistProcessor(macroContentAssistProcessor, AutoconfPartitionScanner.AUTOCONF_MACRO);
|
assistant.setContentAssistProcessor(macroContentAssistProcessor, AutoconfPartitionScanner.AUTOCONF_MACRO);
|
||||||
assistant.setContentAssistProcessor(macroContentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
|
assistant.setContentAssistProcessor(macroContentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
|
||||||
|
@ -59,38 +57,38 @@ public class AutoconfSourceViewerConfiguration extends
|
||||||
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
||||||
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
|
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
|
||||||
assistant.setInformationControlCreator(AutoconfTextHover.getInformationControlCreator());
|
assistant.setInformationControlCreator(AutoconfTextHover.getInformationControlCreator());
|
||||||
|
|
||||||
return assistant;
|
return assistant;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
|
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
|
||||||
return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
|
return new String[] { IDocument.DEFAULT_CONTENT_TYPE, AutoconfPartitionScanner.AUTOCONF_MACRO,
|
||||||
AutoconfPartitionScanner.AUTOCONF_MACRO,
|
AutoconfPartitionScanner.AUTOCONF_COMMENT };
|
||||||
AutoconfPartitionScanner.AUTOCONF_COMMENT};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
||||||
if (acHover == null)
|
if (acHover == null)
|
||||||
acHover = new AutoconfTextHover(fEditor);
|
acHover = new AutoconfTextHover(fEditor);
|
||||||
return acHover;
|
return acHover;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
||||||
if (aaHover == null)
|
if (aaHover == null)
|
||||||
aaHover = new AutoconfAnnotationHover();
|
aaHover = new AutoconfAnnotationHover();
|
||||||
return aaHover;
|
return aaHover;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
||||||
MonoReconciler reconciler= new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
|
MonoReconciler reconciler = new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
|
||||||
reconciler.setDelay(1000);
|
reconciler.setDelay(1000);
|
||||||
reconciler.setProgressMonitor(new NullProgressMonitor());
|
reconciler.setProgressMonitor(new NullProgressMonitor());
|
||||||
return reconciler;
|
return reconciler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
|
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
|
||||||
return new AutoconfPresentationReconciler();
|
return new AutoconfPresentationReconciler();
|
||||||
|
|
|
@ -13,13 +13,12 @@ package org.eclipse.cdt.autotools.ui.editors;
|
||||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant;
|
import org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
|
||||||
|
|
||||||
public interface IAutotoolsEditor extends ITextEditor {
|
public interface IAutotoolsEditor extends ITextEditor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the given listener.
|
* Adds the given listener.
|
||||||
* Has no effect if an identical listener was not already registered.
|
* Has no effect if an identical listener was not already registered.
|
||||||
*
|
*
|
||||||
* @param listener The reconcile listener to be added
|
* @param listener The reconcile listener to be added
|
||||||
*/
|
*/
|
||||||
void addReconcilingParticipant(IReconcilingParticipant listener);
|
void addReconcilingParticipant(IReconcilingParticipant listener);
|
||||||
|
|
|
@ -49,11 +49,11 @@ public class InlineDataRule implements IRule {
|
||||||
protected boolean confirmDelimeter(ICharacterScanner scanner, char[] delimeter) {
|
protected boolean confirmDelimeter(ICharacterScanner scanner, char[] delimeter) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
buffer.append((char)c);
|
buffer.append((char) c);
|
||||||
for (int i = 1; i < delimeter.length; ++i) {
|
for (int i = 1; i < delimeter.length; ++i) {
|
||||||
if (c == delimeter[i]) {
|
if (c == delimeter[i]) {
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
buffer.append((char)c);
|
buffer.append((char) c);
|
||||||
} else {
|
} else {
|
||||||
for (int j = buffer.length() - 1; j >= 0; j--)
|
for (int j = buffer.length() - 1; j >= 0; j--)
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
|
@ -63,6 +63,7 @@ public class InlineDataRule implements IRule {
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
|
@ -81,31 +82,29 @@ public class InlineDataRule implements IRule {
|
||||||
char[][] lineDelimeters = scanner.getLegalLineDelimiters();
|
char[][] lineDelimeters = scanner.getLegalLineDelimiters();
|
||||||
StringBuilder endMarkerBuffer = new StringBuilder();
|
StringBuilder endMarkerBuffer = new StringBuilder();
|
||||||
if (c == '-') {
|
if (c == '-') {
|
||||||
fBuffer.append((char)c);
|
fBuffer.append((char) c);
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
} else if (c == '\'') {
|
} else if (c == '\'') {
|
||||||
fBuffer.append((char)c);
|
fBuffer.append((char) c);
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (c != ICharacterScanner.EOF &&
|
while (c != ICharacterScanner.EOF && Character.isJavaIdentifierPart((char) c) && c != '\'') {
|
||||||
Character.isJavaIdentifierPart((char)c) &&
|
fBuffer.append((char) c);
|
||||||
c != '\'') {
|
endMarkerBuffer.append((char) c);
|
||||||
fBuffer.append((char)c);
|
|
||||||
endMarkerBuffer.append((char)c);
|
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\'') {
|
if (c == '\'') {
|
||||||
fBuffer.append((char)c);
|
fBuffer.append((char) c);
|
||||||
c = scanner.read();
|
c = scanner.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endMarkerBuffer.length() == 0) {
|
if (endMarkerBuffer.length() == 0) {
|
||||||
unreadBuffer(scanner);
|
unreadBuffer(scanner);
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point we read until we find id by itself on its own line
|
// At this point we read until we find id by itself on its own line
|
||||||
boolean eol = false;
|
boolean eol = false;
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
|
@ -157,7 +156,7 @@ public class InlineDataRule implements IRule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the characters in the buffer to the scanner.
|
* Returns the characters in the buffer to the scanner.
|
||||||
*
|
*
|
||||||
* @param scanner
|
* @param scanner
|
||||||
* the scanner to be used
|
* the scanner to be used
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,8 +20,7 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
|
||||||
import org.eclipse.jface.text.rules.ITokenScanner;
|
import org.eclipse.jface.text.rules.ITokenScanner;
|
||||||
|
|
||||||
public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
|
public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a damager/repairer that uses the given scanner. The scanner may not be <code>null</code>
|
* Creates a damager/repairer that uses the given scanner. The scanner may not be <code>null</code>
|
||||||
* and is assumed to return only token that carry text attributes.
|
* and is assumed to return only token that carry text attributes.
|
||||||
|
@ -41,5 +40,5 @@ public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
// rule. It is easiest to just reparse the whole partition.
|
// rule. It is easiest to just reparse the whole partition.
|
||||||
return partition;
|
return partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,38 +14,47 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors;
|
package org.eclipse.cdt.autotools.ui.editors;
|
||||||
|
|
||||||
public class ParseException extends Exception {
|
public class ParseException extends Exception {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
String message;
|
String message;
|
||||||
int severity;
|
int severity;
|
||||||
int lineNumber;
|
int lineNumber;
|
||||||
int startColumn;
|
int startColumn;
|
||||||
int endColumn;
|
int endColumn;
|
||||||
|
|
||||||
public int getEndColumn() {
|
public int getEndColumn() {
|
||||||
return endColumn;
|
return endColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndColumn(int endColumn) {
|
public void setEndColumn(int endColumn) {
|
||||||
this.endColumn = endColumn;
|
this.endColumn = endColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLineNumber() {
|
public int getLineNumber() {
|
||||||
return lineNumber;
|
return lineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLineNumber(int lineNumber) {
|
public void setLineNumber(int lineNumber) {
|
||||||
this.lineNumber = lineNumber;
|
this.lineNumber = lineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStartColumn() {
|
public int getStartColumn() {
|
||||||
return startColumn;
|
return startColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartColumn(int startColumn) {
|
public void setStartColumn(int startColumn) {
|
||||||
this.startColumn = startColumn;
|
this.startColumn = startColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParseException(String message, int lineNumber, int startColumn, int endColumn, int severity) {
|
public ParseException(String message, int lineNumber, int startColumn, int endColumn, int severity) {
|
||||||
super();
|
super();
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
@ -54,9 +63,11 @@ public class ParseException extends Exception {
|
||||||
this.endColumn = endColumn;
|
this.endColumn = endColumn;
|
||||||
this.severity = severity;
|
this.severity = severity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSeverity() {
|
public int getSeverity() {
|
||||||
return severity;
|
return severity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSeverity(int severity) {
|
public void setSeverity(int severity) {
|
||||||
this.severity = severity;
|
this.severity = severity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.jface.text.rules.SingleLineRule;
|
||||||
import org.eclipse.jface.text.rules.Token;
|
import org.eclipse.jface.text.rules.Token;
|
||||||
|
|
||||||
public class RecursiveSingleLineRule extends SingleLineRule {
|
public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
|
|
||||||
private List<IRule> rules;
|
private List<IRule> rules;
|
||||||
private int evalIndex;
|
private int evalIndex;
|
||||||
private int startIndex;
|
private int startIndex;
|
||||||
|
@ -31,6 +31,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
private int endBoundary;
|
private int endBoundary;
|
||||||
private String startSequence;
|
private String startSequence;
|
||||||
private String endSequence;
|
private String endSequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a rule for the given starting and ending sequence
|
* Creates a rule for the given starting and ending sequence
|
||||||
* which, if detected, will return the specified token.
|
* which, if detected, will return the specified token.
|
||||||
|
@ -72,7 +73,8 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
* @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
|
* @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF) {
|
public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter,
|
||||||
|
boolean breaksOnEOF) {
|
||||||
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF);
|
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF);
|
||||||
this.startSequence = startSequence;
|
this.startSequence = startSequence;
|
||||||
this.endSequence = endSequence;
|
this.endSequence = endSequence;
|
||||||
|
@ -99,7 +101,8 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
* terminate the line, even if <code>breakOnEOL</code> is true
|
* terminate the line, even if <code>breakOnEOL</code> is true
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF, boolean escapeContinuesLine) {
|
public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter,
|
||||||
|
boolean breaksOnEOF, boolean escapeContinuesLine) {
|
||||||
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine);
|
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine);
|
||||||
this.startSequence = startSequence;
|
this.startSequence = startSequence;
|
||||||
this.endSequence = endSequence;
|
this.endSequence = endSequence;
|
||||||
|
@ -107,29 +110,29 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
endIndex = 0;
|
endIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRule(SingleLineRule rule) {
|
public void addRule(SingleLineRule rule) {
|
||||||
rules.add(rule);
|
rules.add(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
// We need to be aware of what success token we are referring to.
|
// We need to be aware of what success token we are referring to.
|
||||||
// The current internal rule index will help us determine which
|
// The current internal rule index will help us determine which
|
||||||
// one.
|
// one.
|
||||||
if (evalIndex < rules.size()) {
|
if (evalIndex < rules.size()) {
|
||||||
SingleLineRule x = (SingleLineRule)rules.get(evalIndex);
|
SingleLineRule x = (SingleLineRule) rules.get(evalIndex);
|
||||||
return x.getSuccessToken();
|
return x.getSuccessToken();
|
||||||
}
|
}
|
||||||
return super.getSuccessToken();
|
return super.getSuccessToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void backupScanner(ICharacterScanner scanner, int position) {
|
protected void backupScanner(ICharacterScanner scanner, int position) {
|
||||||
int count = scanner.getColumn() - position;
|
int count = scanner.getColumn() - position;
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
int column = scanner.getColumn();
|
int column = scanner.getColumn();
|
||||||
|
@ -153,8 +156,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
// Back up scanner to just after start sequence.
|
// Back up scanner to just after start sequence.
|
||||||
backupScanner(scanner, startIndex + startSequence.length());
|
backupScanner(scanner, startIndex + startSequence.length());
|
||||||
return super.getSuccessToken();
|
return super.getSuccessToken();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
// Outer rule doesn't hold.
|
// Outer rule doesn't hold.
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
@ -163,12 +165,12 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
// At this point, we want to subdivide up the area covered by the
|
// At this point, we want to subdivide up the area covered by the
|
||||||
// outer rule into success tokens for internal areas separated by
|
// outer rule into success tokens for internal areas separated by
|
||||||
// areas of the outer rule.
|
// areas of the outer rule.
|
||||||
|
|
||||||
int start = scanner.getColumn();
|
int start = scanner.getColumn();
|
||||||
column = start;
|
column = start;
|
||||||
while (column < endBoundary) {
|
while (column < endBoundary) {
|
||||||
while (evalIndex < rules.size()) {
|
while (evalIndex < rules.size()) {
|
||||||
SingleLineRule x = (SingleLineRule)rules.get(evalIndex);
|
SingleLineRule x = (SingleLineRule) rules.get(evalIndex);
|
||||||
IToken token = x.evaluate(scanner, false);
|
IToken token = x.evaluate(scanner, false);
|
||||||
if (!token.isUndefined()) {
|
if (!token.isUndefined()) {
|
||||||
// Found internal token. If we had to read to get
|
// Found internal token. If we had to read to get
|
||||||
|
@ -190,7 +192,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
scanner.read();
|
scanner.read();
|
||||||
++column;
|
++column;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outside internal area. Read until end of outer area and return
|
// Outside internal area. Read until end of outer area and return
|
||||||
// outer token.
|
// outer token.
|
||||||
while (column++ < endIndex)
|
while (column++ < endIndex)
|
||||||
|
|
|
@ -24,12 +24,13 @@ import org.eclipse.jface.text.rules.SingleLineRule;
|
||||||
import org.eclipse.jface.text.rules.Token;
|
import org.eclipse.jface.text.rules.Token;
|
||||||
|
|
||||||
public class RestrictedEndOfLineRule extends EndOfLineRule {
|
public class RestrictedEndOfLineRule extends EndOfLineRule {
|
||||||
|
|
||||||
private List<IRule> rules;
|
private List<IRule> rules;
|
||||||
private int startIndex;
|
private int startIndex;
|
||||||
private int endIndex;
|
private int endIndex;
|
||||||
private String startSequence;
|
private String startSequence;
|
||||||
private String restrictedChars;
|
private String restrictedChars;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a rule for the given starting and ending sequence
|
* Creates a rule for the given starting and ending sequence
|
||||||
* which, if detected, will return the specified token.
|
* which, if detected, will return the specified token.
|
||||||
|
@ -71,7 +72,8 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
|
||||||
* @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
|
* @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public RestrictedEndOfLineRule(String startSequence, String restrictedChars, IToken token, char escapeCharacter, boolean breaksOnEOF) {
|
public RestrictedEndOfLineRule(String startSequence, String restrictedChars, IToken token, char escapeCharacter,
|
||||||
|
boolean breaksOnEOF) {
|
||||||
super(startSequence, token, escapeCharacter, breaksOnEOF);
|
super(startSequence, token, escapeCharacter, breaksOnEOF);
|
||||||
this.startSequence = startSequence;
|
this.startSequence = startSequence;
|
||||||
this.restrictedChars = restrictedChars;
|
this.restrictedChars = restrictedChars;
|
||||||
|
@ -80,18 +82,16 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
|
||||||
endIndex = 0;
|
endIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addRule(SingleLineRule rule) {
|
public void addRule(SingleLineRule rule) {
|
||||||
rules.add(rule);
|
rules.add(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void backupScanner(ICharacterScanner scanner, int position) {
|
protected void backupScanner(ICharacterScanner scanner, int position) {
|
||||||
int count = scanner.getColumn() - position;
|
int count = scanner.getColumn() - position;
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
int column = scanner.getColumn();
|
int column = scanner.getColumn();
|
||||||
|
@ -108,21 +108,19 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
|
||||||
endIndex = scanner.getColumn();
|
endIndex = scanner.getColumn();
|
||||||
// Back up scanner to just after start sequence.
|
// Back up scanner to just after start sequence.
|
||||||
backupScanner(scanner, startIndex + startSequence.length());
|
backupScanner(scanner, startIndex + startSequence.length());
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
// Base rule doesn't hold.
|
// Base rule doesn't hold.
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we want to check for restricted chars in the
|
// At this point, we want to check for restricted chars in the
|
||||||
// token. If we find them, we stop there.
|
// token. If we find them, we stop there.
|
||||||
|
|
||||||
int start = scanner.getColumn();
|
int start = scanner.getColumn();
|
||||||
column = start;
|
column = start;
|
||||||
while (column < endIndex) {
|
while (column < endIndex) {
|
||||||
int ch = scanner.read();
|
int ch = scanner.read();
|
||||||
if (ch == ICharacterScanner.EOF
|
if (ch == ICharacterScanner.EOF || restrictedChars.indexOf(ch) >= 0) {
|
||||||
|| restrictedChars.indexOf(ch) >= 0) {
|
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
return getSuccessToken();
|
return getSuccessToken();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,12 @@ import org.eclipse.ui.part.IPageSite;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
|
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
|
|
||||||
private ITextEditor editor;
|
private ITextEditor editor;
|
||||||
private IEditorInput input;
|
private IEditorInput input;
|
||||||
private LexicalSortingAction sortAction;
|
private LexicalSortingAction sortAction;
|
||||||
|
|
||||||
public AutoconfContentOutlinePage(AutoconfEditor editor) {
|
public AutoconfContentOutlinePage(AutoconfEditor editor) {
|
||||||
super();
|
super();
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
|
@ -50,14 +49,14 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ISelection updateSelection(ISelection sel) {
|
protected ISelection updateSelection(ISelection sel) {
|
||||||
ArrayList<AutoconfElement> newSelection= new ArrayList<>();
|
ArrayList<AutoconfElement> newSelection = new ArrayList<>();
|
||||||
if (sel instanceof IStructuredSelection) {
|
if (sel instanceof IStructuredSelection) {
|
||||||
Iterator<?> iter = ((IStructuredSelection) sel).iterator();
|
Iterator<?> iter = ((IStructuredSelection) sel).iterator();
|
||||||
for (;iter.hasNext();) {
|
for (; iter.hasNext();) {
|
||||||
//ICElement elem= fInput.findEqualMember((ICElement)iter.next());
|
//ICElement elem= fInput.findEqualMember((ICElement)iter.next());
|
||||||
Object o = iter.next();
|
Object o = iter.next();
|
||||||
if (o instanceof AutoconfElement) {
|
if (o instanceof AutoconfElement) {
|
||||||
newSelection.add((AutoconfElement)o);
|
newSelection.add((AutoconfElement) o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,11 +68,9 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
//update the tree viewer state
|
//update the tree viewer state
|
||||||
final TreeViewer viewer = getTreeViewer();
|
final TreeViewer viewer = getTreeViewer();
|
||||||
|
|
||||||
if (viewer != null)
|
if (viewer != null) {
|
||||||
{
|
|
||||||
final Control control = viewer.getControl();
|
final Control control = viewer.getControl();
|
||||||
if (control != null && !control.isDisposed())
|
if (control != null && !control.isDisposed()) {
|
||||||
{
|
|
||||||
control.getDisplay().asyncExec(() -> {
|
control.getDisplay().asyncExec(() -> {
|
||||||
if (!control.isDisposed()) {
|
if (!control.isDisposed()) {
|
||||||
ISelection sel = viewer.getSelection();
|
ISelection sel = viewer.getSelection();
|
||||||
|
@ -84,13 +81,13 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
|
||||||
super.createControl(parent);
|
super.createControl(parent);
|
||||||
|
|
||||||
TreeViewer viewer= getTreeViewer();
|
TreeViewer viewer = getTreeViewer();
|
||||||
viewer.setContentProvider(new AutoconfContentProvider(editor));
|
viewer.setContentProvider(new AutoconfContentProvider(editor));
|
||||||
viewer.setLabelProvider(new AutoconfLabelProvider());
|
viewer.setLabelProvider(new AutoconfLabelProvider());
|
||||||
viewer.addSelectionChangedListener(this);
|
viewer.addSelectionChangedListener(this);
|
||||||
|
@ -100,23 +97,21 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
}
|
}
|
||||||
sortAction.setTreeViewer(viewer);
|
sortAction.setTreeViewer(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change in selection
|
* Change in selection
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event)
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
{
|
|
||||||
super.selectionChanged(event);
|
super.selectionChanged(event);
|
||||||
|
|
||||||
//find out which item in tree viewer we have selected, and set highlight range accordingly
|
//find out which item in tree viewer we have selected, and set highlight range accordingly
|
||||||
ISelection selection = event.getSelection();
|
ISelection selection = event.getSelection();
|
||||||
if (selection.isEmpty()) {
|
if (selection.isEmpty()) {
|
||||||
editor.resetHighlightRange();
|
editor.resetHighlightRange();
|
||||||
} else {
|
} else {
|
||||||
AutoconfElement element = (AutoconfElement) ((IStructuredSelection) selection)
|
AutoconfElement element = (AutoconfElement) ((IStructuredSelection) selection).getFirstElement();
|
||||||
.getFirstElement();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int offset = element.getStartOffset();
|
int offset = element.getStartOffset();
|
||||||
int length = element.getEndOffset() - offset;
|
int length = element.getEndOffset() - offset;
|
||||||
|
|
|
@ -24,21 +24,20 @@ import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfContentProvider implements ITreeContentProvider {
|
public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
private IDocumentProvider documentProvider;
|
private IDocumentProvider documentProvider;
|
||||||
private AutoconfEditor editor;
|
private AutoconfEditor editor;
|
||||||
protected final static String SECTION_POSITIONS = "section_positions";
|
protected final static String SECTION_POSITIONS = "section_positions";
|
||||||
protected IPositionUpdater positionUpdater = new DefaultPositionUpdater(SECTION_POSITIONS);
|
protected IPositionUpdater positionUpdater = new DefaultPositionUpdater(SECTION_POSITIONS);
|
||||||
|
|
||||||
public AutoconfContentProvider(ITextEditor editor) {
|
public AutoconfContentProvider(ITextEditor editor) {
|
||||||
if (editor instanceof AutoconfEditor) {
|
if (editor instanceof AutoconfEditor) {
|
||||||
this.editor = (AutoconfEditor) editor;
|
this.editor = (AutoconfEditor) editor;
|
||||||
}
|
}
|
||||||
this.documentProvider = editor.getDocumentProvider();
|
this.documentProvider = editor.getDocumentProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -47,27 +46,20 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
if (oldInput != null)
|
if (oldInput != null) {
|
||||||
{
|
|
||||||
IDocument document = documentProvider.getDocument(oldInput);
|
IDocument document = documentProvider.getDocument(oldInput);
|
||||||
if (document != null)
|
if (document != null) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
document.removePositionCategory(SECTION_POSITIONS);
|
document.removePositionCategory(SECTION_POSITIONS);
|
||||||
}
|
} catch (BadPositionCategoryException x) {
|
||||||
catch (BadPositionCategoryException x)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
document.removePositionUpdater(positionUpdater);
|
document.removePositionUpdater(positionUpdater);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newInput != null)
|
if (newInput != null) {
|
||||||
{
|
|
||||||
IDocument document = documentProvider.getDocument(newInput);
|
IDocument document = documentProvider.getDocument(newInput);
|
||||||
if (document != null)
|
if (document != null) {
|
||||||
{
|
|
||||||
document.addPositionCategory(SECTION_POSITIONS);
|
document.addPositionCategory(SECTION_POSITIONS);
|
||||||
document.addPositionUpdater(positionUpdater);
|
document.addPositionUpdater(positionUpdater);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +69,7 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
@Override
|
@Override
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
if (parentElement instanceof AutoconfElement) {
|
if (parentElement instanceof AutoconfElement) {
|
||||||
AutoconfElement element = (AutoconfElement)parentElement;
|
AutoconfElement element = (AutoconfElement) parentElement;
|
||||||
return element.getChildren();
|
return element.getChildren();
|
||||||
}
|
}
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
|
@ -91,8 +83,8 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
if (element instanceof AutoconfElement) {
|
if (element instanceof AutoconfElement) {
|
||||||
return ((AutoconfElement)element).hasChildren();
|
return ((AutoconfElement) element).hasChildren();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,12 @@ import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
|
|
||||||
public class AutoconfLabelProvider implements ILabelProvider {
|
public class AutoconfLabelProvider implements ILabelProvider {
|
||||||
|
|
||||||
public AutoconfLabelProvider() {
|
public AutoconfLabelProvider() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(ILabelProviderListener listener) {
|
public void addListener(ILabelProviderListener listener) {
|
||||||
}
|
}
|
||||||
|
@ -72,9 +71,9 @@ public class AutoconfLabelProvider implements ILabelProvider {
|
||||||
else if (element instanceof AutoconfWhileElement)
|
else if (element instanceof AutoconfWhileElement)
|
||||||
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE);
|
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE);
|
||||||
else if (element instanceof AutoconfUntilElement)
|
else if (element instanceof AutoconfUntilElement)
|
||||||
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
|
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
|
||||||
else if (element instanceof AutoconfSelectElement)
|
else if (element instanceof AutoconfSelectElement)
|
||||||
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
|
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
|
||||||
else if (element instanceof AutoconfMacroElement)
|
else if (element instanceof AutoconfMacroElement)
|
||||||
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_ACMACRO);
|
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_ACMACRO);
|
||||||
else if (element instanceof AutoconfMacroArgumentElement)
|
else if (element instanceof AutoconfMacroArgumentElement)
|
||||||
|
@ -85,7 +84,7 @@ public class AutoconfLabelProvider implements ILabelProvider {
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof AutoconfElement) {
|
if (element instanceof AutoconfElement) {
|
||||||
AutoconfElement e = (AutoconfElement)element;
|
AutoconfElement e = (AutoconfElement) element;
|
||||||
String result;
|
String result;
|
||||||
String name = e.getName();
|
String name = e.getName();
|
||||||
if (name.length() > 31)
|
if (name.length() > 31)
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors.parser;
|
package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
public class AutoconfCaseConditionElement extends AutoconfElement {
|
public class AutoconfCaseConditionElement extends AutoconfElement {
|
||||||
|
|
||||||
public AutoconfCaseConditionElement() {
|
public AutoconfCaseConditionElement() {
|
||||||
super("");
|
super("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfCaseConditionElement(String name) {
|
public AutoconfCaseConditionElement(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors.parser;
|
package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
public class AutoconfCaseElement extends AutoconfElement {
|
public class AutoconfCaseElement extends AutoconfElement {
|
||||||
|
|
||||||
public AutoconfCaseElement() {
|
public AutoconfCaseElement() {
|
||||||
super("case"); //$NON-NLS-1$
|
super("case"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
|
||||||
public class AutoconfElement {
|
public class AutoconfElement {
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String var;
|
protected String var;
|
||||||
protected int startOffset;
|
protected int startOffset;
|
||||||
|
@ -28,18 +28,17 @@ public class AutoconfElement {
|
||||||
protected List<AutoconfElement> children;
|
protected List<AutoconfElement> children;
|
||||||
protected AutoconfElement parent;
|
protected AutoconfElement parent;
|
||||||
private IDocument document;
|
private IDocument document;
|
||||||
|
|
||||||
public AutoconfElement(String name) {
|
public AutoconfElement(String name) {
|
||||||
this(name, null);
|
this(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfElement(String name, String var) {
|
public AutoconfElement(String name, String var) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.var = var;
|
this.var = var;
|
||||||
this.startOffset = 0;
|
this.startOffset = 0;
|
||||||
this.children = new ArrayList<>();
|
this.children = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -54,35 +53,35 @@ public class AutoconfElement {
|
||||||
}
|
}
|
||||||
return getClass().getSimpleName() + ": '" + source + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
return getClass().getSimpleName() + ": '" + source + "'"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addChild(AutoconfElement element) {
|
public void addChild(AutoconfElement element) {
|
||||||
children.add(element);
|
children.add(element);
|
||||||
if (element.getParent() == null)
|
if (element.getParent() == null)
|
||||||
element.setParent(this);
|
element.setParent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSibling(AutoconfElement element) {
|
public void addSibling(AutoconfElement element) {
|
||||||
parent.addChild(element);
|
parent.addChild(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfElement getLastChild() {
|
public AutoconfElement getLastChild() {
|
||||||
if (hasChildren())
|
if (hasChildren())
|
||||||
return children.get(children.size() - 1);
|
return children.get(children.size() - 1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfElement getParent() {
|
public AutoconfElement getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent(AutoconfElement parent) {
|
public void setParent(AutoconfElement parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfElement[] getChildren() {
|
public AutoconfElement[] getChildren() {
|
||||||
return children.toArray(new AutoconfElement[children.size()]);
|
return children.toArray(new AutoconfElement[children.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasChildren() {
|
public boolean hasChildren() {
|
||||||
return !children.isEmpty();
|
return !children.isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -90,40 +89,39 @@ public class AutoconfElement {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String string) {
|
public void setName(String string) {
|
||||||
this.name = string;
|
this.name = string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getVar() {
|
public String getVar() {
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVar(String value) {
|
public void setVar(String value) {
|
||||||
var = value;
|
var = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDocument(IDocument document) {
|
public void setDocument(IDocument document) {
|
||||||
this.document = document;
|
this.document = document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDocument getDocument() {
|
public IDocument getDocument() {
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartOffset(int offset) {
|
public void setStartOffset(int offset) {
|
||||||
this.startOffset = offset;
|
this.startOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStartOffset() {
|
public int getStartOffset() {
|
||||||
return startOffset;
|
return startOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndOffset(int offset) {
|
public void setEndOffset(int offset) {
|
||||||
this.endOffset = offset;
|
this.endOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEndOffset() {
|
public int getEndOffset() {
|
||||||
return endOffset;
|
return endOffset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors.parser;
|
package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
public class AutoconfElifElement extends AutoconfElement {
|
public class AutoconfElifElement extends AutoconfElement {
|
||||||
|
|
||||||
public AutoconfElifElement() {
|
public AutoconfElifElement() {
|
||||||
super("elif"); //$NON-NLS-1$
|
super("elif"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors.parser;
|
package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
public class AutoconfElseElement extends AutoconfElement {
|
public class AutoconfElseElement extends AutoconfElement {
|
||||||
|
|
||||||
public AutoconfElseElement() {
|
public AutoconfElseElement() {
|
||||||
super("else"); //$NON-NLS-1$
|
super("else"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors.parser;
|
package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
public class AutoconfForElement extends AutoconfElement {
|
public class AutoconfForElement extends AutoconfElement {
|
||||||
|
|
||||||
public AutoconfForElement() {
|
public AutoconfForElement() {
|
||||||
super("for"); //$NON-NLS-1$
|
super("for"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package org.eclipse.cdt.autotools.ui.editors.parser;
|
package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
public class AutoconfIfElement extends AutoconfElement {
|
public class AutoconfIfElement extends AutoconfElement {
|
||||||
|
|
||||||
public AutoconfIfElement() {
|
public AutoconfIfElement() {
|
||||||
super("if"); //$NON-NLS-1$
|
super("if"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class AutoconfMacroArgumentElement extends AutoconfElement {
|
||||||
public AutoconfMacroArgumentElement() {
|
public AutoconfMacroArgumentElement() {
|
||||||
super(""); // //$NON-NLS-N$
|
super(""); // //$NON-NLS-N$
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfMacroArgumentElement(String name) {
|
public AutoconfMacroArgumentElement(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.regex.Pattern;
|
||||||
public class AutoconfMacroDetector implements IAutoconfMacroDetector {
|
public class AutoconfMacroDetector implements IAutoconfMacroDetector {
|
||||||
|
|
||||||
private static final Pattern AUTOCONF_MACRO_PATTERN = Pattern.compile("PKG_.*|AC_.*|AM_.*|m4.*"); //$NON-NLS-1$
|
private static final Pattern AUTOCONF_MACRO_PATTERN = Pattern.compile("PKG_.*|AC_.*|AM_.*|m4.*"); //$NON-NLS-1$
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMacroIdentifier(String name) {
|
public boolean isMacroIdentifier(String name) {
|
||||||
return AUTOCONF_MACRO_PATTERN.matcher(name).matches();
|
return AUTOCONF_MACRO_PATTERN.matcher(name).matches();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue