Search in sources :

Example 1 with TITANJob

use of org.eclipse.titan.designer.core.TITANJob in project titan.EclipsePlug-ins by eclipse.

the class ConvertXSD2TTCN method doConversion.

/**
 * Do the actual work of converting the selected files to TTCN-3
 */
private void doConversion() {
    if (!TITANInstallationValidator.check(true)) {
        return;
    }
    if (!LicenseValidator.check()) {
        return;
    }
    processSelection();
    if (files == null || files.isEmpty()) {
        ErrorReporter.parallelErrorDisplayInMessageDialog(JOB_TITLE + FAILURE_SUFFIX, NO_VALID_FILES);
        return;
    }
    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            final DirectoryDialog dialog = new DirectoryDialog(new Shell(Display.getDefault()), SWT.SAVE | SWT.PRIMARY_MODAL | SWT.FOCUSED | SWT.ON_TOP);
            dialog.setFilterPath(project.getLocation().toOSString());
            String outFolder = dialog.open();
            if (outFolder != null) {
                outFolder = outFolder.trim();
                if (outFolder.length() > 0) {
                    setOutputFolder(new File(outFolder));
                }
            }
        }
    });
    if (outputFolder == null) {
        return;
    }
    final TITANJob titanJob = new TITANJob(JOB_TITLE, files, outputFolder, project);
    titanJob.setPriority(Job.DECORATE);
    titanJob.setUser(true);
    titanJob.setRule(project);
    final boolean reportDebugInformation = Platform.getPreferencesService().getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, false, null);
    final List<String> command = new ArrayList<String>();
    final IPreferencesService prefs = Platform.getPreferencesService();
    final String pathOfTITAN = prefs.getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.TITAN_INSTALLATION_PATH, "", null);
    command.add(PathConverter.convert(new Path(pathOfTITAN + File.separatorChar + "bin" + File.separatorChar + "xsd2ttcn").toOSString(), reportDebugInformation, TITANDebugConsole.getConsole()));
    for (String filePath : files.keySet()) {
        command.add('\'' + filePath + '\'');
    }
    titanJob.addCommand(command, JOB_TITLE);
    titanJob.removeCompilerMarkers();
    final String markersAfterCompiler = Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.ONTHEFLYMARKERSAFTERCOMPILER, PreferenceConstantValues.ONTHEFLYOPTIONREMOVE, null);
    if (PreferenceConstantValues.ONTHEFLYOPTIONREMOVE.equals(markersAfterCompiler)) {
        titanJob.removeOnTheFlyMarkers();
    }
    titanJob.schedule();
}
Also used : Path(org.eclipse.core.runtime.Path) Shell(org.eclipse.swt.widgets.Shell) TITANJob(org.eclipse.titan.designer.core.TITANJob) ArrayList(java.util.ArrayList) File(java.io.File) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 2 with TITANJob

use of org.eclipse.titan.designer.core.TITANJob in project titan.EclipsePlug-ins by eclipse.

the class GenerateTestPortSkeleton method doGenerateSkeleton.

/**
 * Do generate the skeletons
 */
private void doGenerateSkeleton() {
    if (!TITANInstallationValidator.check(true)) {
        return;
    }
    if (!LicenseValidator.check()) {
        return;
    }
    processSelection();
    if (files.isEmpty()) {
        ErrorReporter.parallelErrorDisplayInMessageDialog(JOB_TITLE + FAILURE_SUFFIX, NO_VALID_FILES);
        return;
    }
    reportOnTheFlyOutdating();
    final TITANJob titanJob = new TITANJob(JOB_TITLE, files, workingDir, project);
    titanJob.setPriority(Job.DECORATE);
    titanJob.setUser(true);
    titanJob.setRule(project);
    final boolean reportDebugInformation = Platform.getPreferencesService().getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, false, null);
    final List<String> command = new ArrayList<String>();
    command.add(PathConverter.convert(getCompilerPath().toOSString(), reportDebugInformation, TITANDebugConsole.getConsole()));
    command.add('-' + GENERATE_TESTPORT_FLAG + getTITANActionFlags());
    for (String filePath : files.keySet()) {
        command.add('\'' + filePath + '\'');
    }
    titanJob.addCommand(command, JOB_TITLE);
    titanJob.removeCompilerMarkers();
    final String markersAfterCompiler = Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.ONTHEFLYMARKERSAFTERCOMPILER, PreferenceConstantValues.ONTHEFLYOPTIONREMOVE, null);
    if (PreferenceConstantValues.ONTHEFLYOPTIONREMOVE.equals(markersAfterCompiler)) {
        titanJob.removeOnTheFlyMarkers();
    }
    titanJob.schedule();
}
Also used : TITANJob(org.eclipse.titan.designer.core.TITANJob) ArrayList(java.util.ArrayList)

Example 3 with TITANJob

use of org.eclipse.titan.designer.core.TITANJob in project titan.EclipsePlug-ins by eclipse.

the class MakeArchive method doMakeArchive.

/**
 * This method creates the needed {@link TITANJob} and schedules it.
 * <p>
 * The actual work:
 * <ul>
 * <li>creates the command that invokes "make archive"
 * <li>creates a TITANJob for invoking the command and redirecting the results
 * <li>schedules the job.
 * </ul>
 */
private void doMakeArchive() {
    processSelection();
    if (singleSelectedProject == null) {
        TITANConsole.println("Make archive works only for single selected project");
        return;
    }
    final File binDir = new File(singleSelectedProject.getLocation().toFile(), BIN_SUBPATH);
    final TITANJob titanJob = new TITANJob(JOB_TITLE, new HashMap<String, IFile>(), binDir, project);
    titanJob.setPriority(Job.DECORATE);
    titanJob.setUser(true);
    titanJob.setRule(project);
    final List<String> command = new ArrayList<String>();
    command.add(COMMAND);
    titanJob.addCommand(command, JOB_TITLE);
    titanJob.schedule();
}
Also used : IFile(org.eclipse.core.resources.IFile) TITANJob(org.eclipse.titan.designer.core.TITANJob) ArrayList(java.util.ArrayList) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Example 4 with TITANJob

use of org.eclipse.titan.designer.core.TITANJob in project titan.EclipsePlug-ins by eclipse.

the class CheckSemantic method doCheckSemantics.

/**
 * do the actual work of checking the syntax of the selected resources.
 */
private void doCheckSemantics() {
    if (!TITANInstallationValidator.check(true)) {
        return;
    }
    if (!LicenseValidator.check()) {
        return;
    }
    processSelection();
    if (files == null || files.isEmpty()) {
        ErrorReporter.parallelErrorDisplayInMessageDialog(JOB_TITLE + FAILURE_SUFFIX, NO_VALID_FILES);
        return;
    }
    reportOnTheFlyOutdating();
    final TITANJob titanJob = new TITANJob(JOB_TITLE, files, workingDir, project);
    titanJob.setPriority(Job.DECORATE);
    titanJob.setUser(true);
    titanJob.setRule(project);
    final boolean reportDebugInformation = Platform.getPreferencesService().getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, false, null);
    final List<String> command = new ArrayList<String>();
    command.add(PathConverter.convert(getCompilerPath().toOSString(), reportDebugInformation, TITANDebugConsole.getConsole()));
    // If a single project is selected used than use it's attributes used to generate the Makefile, otherwise use the general preferences.
    if (singleSelectedProject == null) {
        TITANConsole.println("Using the general preferences to do the external semantic check");
        command.add('-' + SEMANTIC_CHECK_FLAG + getTITANActionFlags());
    } else {
        TITANConsole.println("Using the project properties to do the external semantic check");
        boolean useRuntime2 = false;
        try {
            if ("true".equals(project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.FUNCTIONTESTRUNTIME_PROPERTY)))) {
                useRuntime2 = true;
            }
        } catch (CoreException e) {
            ErrorReporter.logExceptionStackTrace("Error while reading persistent property", e);
        }
        final String flags = TITANFlagsOptionsData.getTITANFlags(singleSelectedProject, useRuntime2);
        command.add('-' + SEMANTIC_CHECK_FLAG + " " + flags);
    }
    for (String filePath : files.keySet()) {
        command.add('\'' + filePath + '\'');
    }
    titanJob.addCommand(command, JOB_TITLE);
    titanJob.removeCompilerMarkers();
    final String markersAfterCompiler = Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.ONTHEFLYMARKERSAFTERCOMPILER, PreferenceConstantValues.ONTHEFLYOPTIONREMOVE, null);
    if (PreferenceConstantValues.ONTHEFLYOPTIONREMOVE.equals(markersAfterCompiler)) {
        titanJob.removeOnTheFlyMarkers();
    }
    titanJob.schedule();
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) QualifiedName(org.eclipse.core.runtime.QualifiedName) TITANJob(org.eclipse.titan.designer.core.TITANJob) ArrayList(java.util.ArrayList)

Example 5 with TITANJob

use of org.eclipse.titan.designer.core.TITANJob in project titan.EclipsePlug-ins by eclipse.

the class CheckSyntax method doCheckSyntax.

/**
 * do the actual work of checking the syntax of the selected resources.
 */
private void doCheckSyntax() {
    if (!TITANInstallationValidator.check(true)) {
        return;
    }
    if (!LicenseValidator.check()) {
        return;
    }
    processSelection();
    if (files == null || files.isEmpty()) {
        ErrorReporter.parallelErrorDisplayInMessageDialog(JOB_TITLE + FAILURE_SUFFIX, NO_VALID_FILES);
        return;
    }
    reportOnTheFlyOutdating();
    final TITANJob titanJob = new TITANJob(JOB_TITLE, files, workingDir, project);
    titanJob.setPriority(Job.DECORATE);
    titanJob.setUser(true);
    titanJob.setRule(project);
    final boolean reportDebugInformation = Platform.getPreferencesService().getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, false, null);
    final List<String> command = new ArrayList<String>();
    command.add(PathConverter.convert(getCompilerPath().toOSString(), reportDebugInformation, TITANDebugConsole.getConsole()));
    command.add('-' + SYNTAX_CHECK_FLAG + getTITANActionFlags());
    for (String filePath : files.keySet()) {
        command.add('\'' + filePath + '\'');
    }
    titanJob.addCommand(command, JOB_TITLE);
    titanJob.removeCompilerMarkers();
    final String markersAfterCompiler = Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.ONTHEFLYMARKERSAFTERCOMPILER, PreferenceConstantValues.ONTHEFLYOPTIONREMOVE, null);
    if (PreferenceConstantValues.ONTHEFLYOPTIONREMOVE.equals(markersAfterCompiler)) {
        titanJob.removeOnTheFlyMarkers();
    }
    titanJob.schedule();
}
Also used : TITANJob(org.eclipse.titan.designer.core.TITANJob) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)6 TITANJob (org.eclipse.titan.designer.core.TITANJob)6 File (java.io.File)3 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)1 Path (org.eclipse.core.runtime.Path)1 QualifiedName (org.eclipse.core.runtime.QualifiedName)1 IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)1 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)1 Shell (org.eclipse.swt.widgets.Shell)1