Commit 1b375b22 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Fixed syntax/semantic check actions to check ttcn3/asn/config files only (issue #484)


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent fc48ff00
......@@ -138,4 +138,11 @@ public final class CheckSemantic extends ExternalTitanAction {
titanJob.schedule();
}
@Override
/** {@inheritDoc} */
protected String getExtensionPattern() {
return CheckSyntax.COMPILEREXTENSIONS;
}
}
......@@ -32,6 +32,7 @@ import org.eclipse.titan.designer.productUtilities.ProductConstants;
*/
public final class CheckSyntax extends ExternalTitanAction {
private static final String JOB_TITLE = "Syntax check";
public static final String COMPILEREXTENSIONS = "^(ttcn|ttcn3|ttcnpp|asn|asn1|cfg)$";
/**
* This method creates the needed {@link TITANJob} and schedules it.
......@@ -112,4 +113,10 @@ public final class CheckSyntax extends ExternalTitanAction {
titanJob.schedule();
}
@Override
/** {@inheritDoc} */
protected String getExtensionPattern() {
return COMPILEREXTENSIONS;
}
}
......@@ -29,7 +29,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.titan.common.logging.ErrorReporter;
import org.eclipse.titan.designer.GeneralConstants;
import org.eclipse.titan.designer.commonFilters.ResourceExclusionHelper;
import org.eclipse.titan.designer.core.TITANJob;
import org.eclipse.titan.designer.parsers.GlobalParser;
import org.eclipse.titan.designer.preferences.PreferenceConstants;
import org.eclipse.titan.designer.productUtilities.ProductConstants;
......@@ -93,6 +92,13 @@ public abstract class ExternalTitanAction extends AbstractHandler implements IWo
}
final IFile file = (IFile) resource;
String extension = file.getFileExtension();
if (extension == null) {
extension = "";
}
if (! extension.matches(getExtensionPattern())) {
return false;
}
files.put(file.getLocation().toOSString(), file);
return true;
......@@ -283,6 +289,18 @@ public abstract class ExternalTitanAction extends AbstractHandler implements IWo
}
}
}
/**
* Gets the regex pattern for the file name extension; only files with a matching
* extension will be collected by the visitor.
*
* The default value matches everything.
*
* @return Regex string for filename extension matching
*/
protected String getExtensionPattern() {
return ".*";
}
/**
* This method tells the action what the user has selected.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment