diff --git a/Eclipse_Designer_userguide.doc b/Eclipse_Designer_userguide.doc index 0ca0154c28e9fb97f13cacc65a6a06cc0a0da3c5..5cec2bf02e6cd1663ab2d91f6a1b1f850475ba3e 100755 Binary files a/Eclipse_Designer_userguide.doc and b/Eclipse_Designer_userguide.doc differ diff --git a/Eclipse_installationguide.doc b/Eclipse_installationguide.doc index 94c7b49efc66b3aaef1de1efbe5802988d7b2b28..13953f70d8f4bf544413788c0416169bf27ffa61 100644 Binary files a/Eclipse_installationguide.doc and b/Eclipse_installationguide.doc differ diff --git a/README b/README index 8b54c7694bd7c6bc07116550c5e528421e5a34ce..f1142eaccfc97cd73bae95a879c11eb3d65d46d7 100644 --- a/README +++ b/README @@ -13,7 +13,7 @@ Java 1.6 or higher, recommended: 1.7 ANTLR 4 SDK 0.3.5 ANTLR Runtime 4.3 or higher, recommended: 4.3, available at Eclipse Orbit Ant 1.9.2 or higher - NOTE: For Ant version below 1.8, the build will fail + NOTE: Build will not work below 1.8 for sure! Eclipse Standard or Java 3.6 (Helios) or higher, recommended: 4.4 (Luna) ---------------------- @@ -26,8 +26,9 @@ Eclipse -> Help -> Install New Software... ANTLR http://antlreclipse.sourceforge.net/updates/ -Titan plug-ins can be obtained from the Titan download site: -https://projects.eclipse.org/projects/tools.titan/downloads +Titan plug-ins +from the Titan update site +TODO: add URL Set the new JDK in Window -> Preferences -> Java -> Installed JREs @@ -65,43 +66,33 @@ It modifies the source, you need to rebuild org.eclipse.titan.common plug-in pro 4.1. EXTERNAL JAR DEPENDENCIES - - antlr-4.3-complete.jar + antlr-4.3-complete.jar available at Eclipse Orbit - http://download.eclipse.org/tools/orbit/downloads/ - NOTE: Use a recommended or a stable repository; the drop version of the latter changes often. - - - junit.jar (JUnit4) - available at Eclipse Orbit - http://download.eclipse.org/tools/orbit/downloads/ - + http://download.eclipse.org/tools/orbit/downloads/drops/S20150519210750/ + NOTE: The drop version changes very often. + junit.jar (JUnit4) - The following jars are needed by help.plugin to create pdf documentation; + These jars are needed by help.plugin to create pdf documentation PDF documentation can be created only inside Ericcson network - - doc2pdf.jar (optional, pdf will not be created if file not found at this location) - For Ericsson users only: Download the plugin from http://ttcn.ericsson.se/download/third_party/ - OR write to any contact person at Project Titan - - ant-contrib.jar (mandatory if doc2pdf.jar exists) - - The following jars are needed by the Titanium plugin: - - - org.apache.commons.collections15/collections-generic-4.01.jar - For Ericsson users only: Download the Jung plugin from http://ttcn.ericsson.se/download/third_party/commons.collections.zip - OR for users outside Ericsson: - Dwonload the plug-in from https://www.eclipse.org/downloads/download.php?file=/titan/commons.collections.zip - - Jung 2.0.1 - - edu.uci.ics.jung/jung-graph-impl-2.0.1.jar - - edu.uci.ics.jung/jung-visualization-2.0.1.jar - - edu.uci.ics.jung/jung-algorithms-2.0.1.jar - - edu.uci.ics.jung/jung-io-2.0.1.jar - + doc2pdf.jar (optional, pdf will not be created if file not found at this location) + For Ericsson users only: Download the plugin from http://ttcn.ericsson.se/download/third_party/ OR write to any contact person at Project Titan + ant-contrib.jar (mandatory if doc2pdf.jar exists) + + These jars are needed by titanium.plugin + org.apache.commons.collections15/collections-generic-4.01.jar + Download Commons-Collections from http://commons.apache.org/proper/commons-collections/ + OR for Ericsson users only: Download the Jung plugin from http://ttcn.ericsson.se/download/third_party/commons.collections.zip + OR for users outside Ericsson: Write to any contact person on site https://projects.eclipse.org/projects/tools.titan and ask the commons.collections.zip . + edu.uci.ics.jung/jung-graph-impl-2.0.1.jar + edu.uci.ics.jung/jung-visualization-2.0.1.jar + edu.uci.ics.jung/jung-algorithms-2.0.1.jar + edu.uci.ics.jung/jung-io-2.0.1.jar For Ericsson users only: Download the Jung plugin from http://ttcn.ericsson.se/download/third_party/edu.uci.ics.jung.zip - OR for users outside Ericsson: - https://www.eclipse.org/downloads/download.php?file=/titan/edu.uci.ics.jung.zip - - - org.apache.poi_3.9.0.v201405241750.jar + OR for users outside Ericsson: Write to any contact person on site https://projects.eclipse.org/projects/tools.titan and ask the jung.zip + org.apache.poi_3.9.0.v201405241750.jar available at Eclipse Orbit - http://download.eclipse.org/tools/orbit/downloads + http://download.eclipse.org/tools/orbit/downloads/drops/S20150519210750/ + NOTE: The drop version changes very often. 4.2. BUILDING TITAN PLUG-INS FROM COMMAND LINE WITH ANT diff --git a/Semantic_Analizer_Tests/bin/config.cfg b/Semantic_Analizer_Tests/cfg/config.cfg similarity index 100% rename from Semantic_Analizer_Tests/bin/config.cfg rename to Semantic_Analizer_Tests/cfg/config.cfg diff --git a/Semantic_Analizer_Tests/bin/included.cfg b/Semantic_Analizer_Tests/cfg/included.cfg similarity index 100% rename from Semantic_Analizer_Tests/bin/included.cfg rename to Semantic_Analizer_Tests/cfg/included.cfg diff --git a/Semantic_Analizer_Tests/bin/ipv6addresses.cfg b/Semantic_Analizer_Tests/cfg/ipv6addresses.cfg similarity index 100% rename from Semantic_Analizer_Tests/bin/ipv6addresses.cfg rename to Semantic_Analizer_Tests/cfg/ipv6addresses.cfg diff --git a/TITAN_Designer_feature/feature.xml b/TITAN_Designer_feature/feature.xml index fc1f35e5a8fa2e96f3d1fbce5bc11d154118c842..21383b82d9279476a59230d5360dc6990bd49f17 100755 --- a/TITAN_Designer_feature/feature.xml +++ b/TITAN_Designer_feature/feature.xml @@ -1,4 +1,4 @@ - + - - - - CRL 113 200/5 R4A (5.4.pl0) version of the TITAN Designer plug-in. - - - + --> + + + + CRL 113 200/5 R4C (5.4.pl2) version of the TITAN Designer plug-in. + + + /******************************************************************************* * Copyright (c) 2000-2015 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials @@ -49,10 +49,10 @@ * Arpad Lovassy (Ericsson) - Java Executor API * Laszlo Baji (Ericsson) - maintenance * Marton Godar (Ericsson) - xsd2ttcn converter -*******************************************************************************/ - - - +*******************************************************************************/ + + + Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. @@ -122,54 +122,54 @@ All Recipient's rights under this Agreement shall terminate if it fails to Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT - - - - - - - - - - - - - - - - - - +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/TITAN_Executor_feature/feature.xml b/TITAN_Executor_feature/feature.xml index c09b700cf04664a850bc2a74fcc90fa4c0744f54..f2f0c88d0fa8c017b1f19781e36842162bb51b0a 100755 --- a/TITAN_Executor_feature/feature.xml +++ b/TITAN_Executor_feature/feature.xml @@ -1,4 +1,4 @@ - + - - - - CRL 113 200/5 R4A (5.4.pl0) version of the TITAN Executor -plug-in. - - - + --> + + + + CRL 113 200/5 R4C (5.4.pl2) version of the TITAN Executor +plug-in. + + + /******************************************************************************* * Copyright (c) 2000-2015 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials @@ -57,10 +57,10 @@ catch, support of pre-processor directives in Eclipse * Arpad Lovassy (Ericsson) - Java Executor API * Laszlo Baji (Ericsson) - maintenance * Marton Godar (Ericsson) - xsd2ttcn converter -*******************************************************************************/ - - - +*******************************************************************************/ + + + Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. @@ -130,47 +130,47 @@ All Recipient's rights under this Agreement shall terminate if it fails to Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT - - - - - - - - - - - - - - +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/TITAN_Log_Viewer_Feature/feature.xml b/TITAN_Log_Viewer_Feature/feature.xml index c83de22ee0c37f60a2b002b8e1a62bffb2e2ccad..8f5ddb9bc287247509f3a27f31f0a7c9938b7609 100755 --- a/TITAN_Log_Viewer_Feature/feature.xml +++ b/TITAN_Log_Viewer_Feature/feature.xml @@ -1,4 +1,4 @@ - + - - - - CRL 113 200/5 R4A (5.4.pl0) version of the TITAN Log Viewer plug-in. - - - + --> + + + + CRL 113 200/5 R4C (5.4.pl2) version of the TITAN Log Viewer plug-in. + + + /******************************************************************************* * Copyright (c) 2000-2015 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials @@ -49,10 +49,10 @@ * Arpad Lovassy (Ericsson) - Java Executor API * Laszlo Baji (Ericsson) - maintenance * Marton Godar (Ericsson) - xsd2ttcn converter -*******************************************************************************/ - - - +*******************************************************************************/ + + + Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. @@ -122,42 +122,42 @@ All Recipient's rights under this Agreement shall terminate if it fails to Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT - - - - - - - - - - - - - - - - - - - - - - - - +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Titanium_feature/feature.xml b/Titanium_feature/feature.xml index 1d5920d2a9f498d3a571ccbd42860aa930b986ed..5bb3b849575fca0cef79aa9523bd5bb289a0fb57 100755 --- a/Titanium_feature/feature.xml +++ b/Titanium_feature/feature.xml @@ -1,4 +1,4 @@ - + - - - - CRL 113 200/5 R4A (5.4.pl0) version of the Titanium -plug-in. - - - + --> + + + + CRL 113 200/5 R4C (5.4.pl2) version of the Titanium +plug-in. + + + /******************************************************************************* * Copyright (c) 2000-2015 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 +* are made available under the terms of the Eclipse Public License +v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: -* Zoltan Janos Szabo (Ericsson) - initial architecture design and implementation +* Zoltan Janos Szabo (Ericsson) - initial architecture design +and implementation * Roland Gecse (Ericsson) - initial architecture design -* Akos Cserveni (Ericsson) - Basic AST in compiler, semantic checking +* Akos Cserveni (Ericsson) - Basic AST in compiler, semantic +checking * Gabor Szalai (Ericsson) – RAW and TEXT codecs -* Matyas Forstner (Ericsson) - ASN.1 extension of the compiler and BER/CER/DER codecs -* Kristof Szabados (Ericsson) - Eclipse Designer, Executor, Titanium UIs +* Matyas Forstner (Ericsson) - ASN.1 extension of the compiler +and BER/CER/DER codecs +* Kristof Szabados (Ericsson) - Eclipse Designer, Executor, +Titanium UIs * Szabolcs Beres (Ericsson) - Eclipse LogViewer -* Ferenc Kovacs (Ericsson) – log interfaces, big number support, subtype checking +* Ferenc Kovacs (Ericsson) – log interfaces, big number support, +subtype checking * Csaba Raduly (Ericsson) – ASN.1 additions, XML encoder/decoder -* Adam Delic (Ericsson) – template restrictions, try and catch, support of pre-processor directives in Eclipse +* Adam Delic (Ericsson) – template restrictions, try and +catch, support of pre-processor directives in Eclipse * Krisztian Pandi (Ericsson) – import of imports * Peter Dimitrov (Ericsson)- maintenance * Balazs Andor Zalanyi (Ericsson) – code splitting @@ -50,10 +57,10 @@ plug-in. * Arpad Lovassy (Ericsson) - Java Executor API * Laszlo Baji (Ericsson) - maintenance * Marton Godar (Ericsson) - xsd2ttcn converter -*******************************************************************************/ - - - +*******************************************************************************/ + + + Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. @@ -123,65 +130,65 @@ All Recipient's rights under this Agreement shall terminate if it fails to Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT - - - - - - - - - - - - - - - - - - - - - - - - +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. LICENSE AGREEMENT + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/automatic_build/build_config.xml b/automatic_build/build_config.xml index 2c6fc0ae66562860661f4e658dd05f2cdb99b429..42d0c096f77525af1f26e225552d4074e69e5dbf 100644 --- a/automatic_build/build_config.xml +++ b/automatic_build/build_config.xml @@ -10,7 +10,7 @@ - + diff --git a/org.eclipse.titan.common/.antlr-eclipse b/org.eclipse.titan.common/.antlr-eclipse deleted file mode 100644 index 3da4e7bb39a143e783c0cb81899e286da6a6b785..0000000000000000000000000000000000000000 --- a/org.eclipse.titan.common/.antlr-eclipse +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.eclipse.titan.common/.project b/org.eclipse.titan.common/.project index 62b276fdbf878848ddaca297a59039e5955c95a0..7aa8f205a14823c1c972d0eb57d8c157a8a1dd71 100644 --- a/org.eclipse.titan.common/.project +++ b/org.eclipse.titan.common/.project @@ -10,11 +10,6 @@ - - org.antlr.eclipse.core.antlrbuilder - - - org.eclipse.jdt.core.javabuilder @@ -30,19 +25,8 @@ - - org.antlr.eclipse.core.warningcleanerbuilder - - - - - org.antlr.eclipse.core.smapbuilder - - - - org.antlr.eclipse.core.antlrnature org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature org.eclipse.xtext.ui.shared.xtextNature diff --git a/org.eclipse.titan.common/META-INF/MANIFEST.MF b/org.eclipse.titan.common/META-INF/MANIFEST.MF index 9687becde0556d249d71fc1d27077ef344c50358..8dde50182d69a838f4c2e39daf191c58dcd55889 100755 --- a/org.eclipse.titan.common/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.common/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Created-By: 23.6-b04 (Oracle Corporation) Bundle-ManifestVersion: 2 Bundle-Name: Common TITAN on Eclipse Plug-in Bundle-SymbolicName: org.eclipse.titan.common;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 +Bundle-Version: 5.4.2.CRL_113_200_5_R4C_20160105-1100 Bundle-Activator: org.eclipse.titan.common.Activator Bundle-Vendor: Eclipse Titan Project Require-Bundle: org.eclipse.ui, diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/fieldeditors/TITANResourceLocatorFieldEditor.java b/org.eclipse.titan.common/src/org/eclipse/titan/common/fieldeditors/TITANResourceLocatorFieldEditor.java index 9ff7d28a6e36d427a91683b5e8bea9f7826898cc..79ab4bcd97e7c2b096cc9d5b1d4993b43caef617 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/fieldeditors/TITANResourceLocatorFieldEditor.java +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/fieldeditors/TITANResourceLocatorFieldEditor.java @@ -283,11 +283,11 @@ public class TITANResourceLocatorFieldEditor extends StringFieldEditor { resolvedPathLabelText.setVisible(false); return; } - + //TODO: To change the next lines for this one: + //final URI uri1 = TITANPathUtilities.getURI(target, rootPath); final IPath path = new Path(target); - final IPath resolvedPath = TITANPathUtilities.resolvePath(target, rootPath); - - final URI uri = URIUtil.toURI(resolvedPath); + final IPath resolvedPath = TITANPathUtilities.resolvePath(target, rootPath); + final URI uri = URIUtil.toURI(resolvedPath); final String message = "Resolved location: " + uri.toString(); resolvedPathLabelText.setText(message); diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/SyntacticErrorStorage.java b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/SyntacticErrorStorage.java index 6de570e9c71795cfb07430b3019a3115df6a1bb9..3d8562774b5fcbdab66a2c0b94c0f187af2b389c 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/SyntacticErrorStorage.java +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/SyntacticErrorStorage.java @@ -12,9 +12,10 @@ import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.LexerNoViableAltException; import org.antlr.v4.runtime.InputMismatchException; import org.antlr.v4.runtime.FailedPredicateException; + /** * @author Kristof Szabados - * + * */ public class SyntacticErrorStorage { public final int lineNumber; @@ -22,23 +23,27 @@ public class SyntacticErrorStorage { public final int charEnd; public final String message; public final ExceptionType exceptionType; - public enum ExceptionType { LexerNoViableAltException, NoViableAltException, InputMismatchException, FailedPredicateException, InvalidExceptionType }; - - public SyntacticErrorStorage (final int lineNumber, final int charStart, final int charEnd, final String message, RecognitionException e) { + + public enum ExceptionType { + LexerNoViableAltException, NoViableAltException, InputMismatchException, FailedPredicateException, InvalidExceptionType + }; + + public SyntacticErrorStorage(final int lineNumber, final int charStart, final int charEnd, final String message, RecognitionException e) { this.lineNumber = lineNumber; this.charStart = charStart; this.charEnd = charEnd; this.message = message; - - if (e instanceof LexerNoViableAltException) + + if (e instanceof LexerNoViableAltException) { exceptionType = ExceptionType.LexerNoViableAltException; - else if (e instanceof NoViableAltException) + } else if (e instanceof NoViableAltException) { exceptionType = ExceptionType.NoViableAltException; - else if (e instanceof FailedPredicateException) + } else if (e instanceof FailedPredicateException) { exceptionType = ExceptionType.FailedPredicateException; - else if (e instanceof InputMismatchException) + } else if (e instanceof InputMismatchException) { exceptionType = ExceptionType.InputMismatchException; - else + } else { exceptionType = ExceptionType.InvalidExceptionType; + } } } diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgAnalyzer.java b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgAnalyzer.java index 07d914d7e6f7a6f76fa32c657a10f81f468c62c8..ea36737a5dc61a2ccf493c70a2399b16e89cd0ed 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgAnalyzer.java +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgAnalyzer.java @@ -65,6 +65,7 @@ public final class CfgAnalyzer { private DefineSectionHandler defineSectionHandler = null; private LoggingSectionHandler loggingSectionHandler = null; private ParserRuleContext mParseTreeRoot = null; + private String mLogFileName = null; public List getWarnings() { return warnings; @@ -78,6 +79,10 @@ public final class CfgAnalyzer { return logFileNameDefined; } + public String getLogFileName() { + return mLogFileName; + } + public Map getDefinitions(){ return definitions; } @@ -229,6 +234,7 @@ public final class CfgAnalyzer { loggingSectionHandler = parser.getLoggingSectionHandler(); logFileNameDefined = parser.isLogFileDefined(); + mLogFileName = parser.getLogFileName(); } } diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgParser.g4 b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgParser.g4 index b410f16d6c23ed98ec8c39b862e649d343b3fa05..593f49ac8fd4684c3d08c2305a6210abbcd51f8d 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgParser.g4 +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgParser.g4 @@ -34,6 +34,8 @@ import java.util.Map; private boolean mLogFileDefined = false; + private String mLogFileName = null; + private Map mEnvVariables; private Integer mTcpPort = null; @@ -91,6 +93,10 @@ import java.util.Map; return mLogFileDefined; } + public String getLogFileName() { + return mLogFileName; + } + public Integer getTcpPort() { return mTcpPort; } @@ -580,8 +586,18 @@ pr_PlainLoggingParam: | DISKFULLACTION ASSIGNMENTCHAR11 pr_DiskFullActionValue | LOGFILENUMBER ASSIGNMENTCHAR11 pr_Number | LOGFILESIZE ASSIGNMENTCHAR11 pr_Number -| LOGFILENAME ASSIGNMENTCHAR11 pr_LogfileName - { mLogFileDefined = true; } +| LOGFILENAME ASSIGNMENTCHAR11 f = pr_LogfileName + { mLogFileDefined = true; + mLogFileName = $f.text; + if ( mLogFileName != null ) { + if ( mLogFileName.length() > 0 && mLogFileName.startsWith( "\"" ) ) { + mLogFileName = mLogFileName.substring( 1 ); + } + if ( mLogFileName.length() > 0 && mLogFileName.endsWith( "\"" ) ) { + mLogFileName = mLogFileName.substring( 0, mLogFileName.length() - 1 ); + } + } + } | (TIMESTAMPFORMAT | CONSOLETIMESTAMPFORMAT) ASSIGNMENTCHAR11 TIMESTAMPVALUE | SOURCEINFOFORMAT ASSIGNMENTCHAR11 ( SOURCEINFOVALUE diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgResolverListener.java b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgResolverListener.java index b581a32069342f15feba6c94dce91e27f4eb40f8..f3e8562206f0582ce357f995022a6e2daf6b58b3 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgResolverListener.java +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/CfgResolverListener.java @@ -15,7 +15,6 @@ import java.util.Map; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.misc.NotNull; import org.eclipse.core.resources.IMarker; -import org.eclipse.titan.common.parsers.LocationAST; import org.eclipse.titan.common.parsers.TITANMarker; public class CfgResolverListener extends CfgParserBaseListener { diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/ConfigFileHandler.java b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/ConfigFileHandler.java index 739fb985f4be53fcae55a5a475edf15fefd2a503..f6f3aea8622ed234091dc81780beec3c27c379c8 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/ConfigFileHandler.java +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/parsers/cfg/ConfigFileHandler.java @@ -13,8 +13,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.antlr.v4.runtime.ParserRuleContext; -import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; @@ -58,6 +56,8 @@ public final class ConfigFileHandler { private boolean logFileNameDefined = false; + private String mLogFileName = null; + public ConfigFileHandler(){ // Do nothing } @@ -70,6 +70,10 @@ public final class ConfigFileHandler { return logFileNameDefined; } + public String getLogFileName() { + return mLogFileName; + } + public int getTcpPort(){ return tcpPort; } @@ -262,6 +266,7 @@ public final class ConfigFileHandler { if (analyzer.isLogFileNameDefined()) { logFileNameDefined = true; + mLogFileName = analyzer.getLogFileName(); } LocationAST rootNode = new LocationAST( analyzer.getParseTreeRoot() ); if ( rootNode != null ) { diff --git a/org.eclipse.titan.common/src/org/eclipse/titan/common/path/TITANPathUtilities.java b/org.eclipse.titan.common/src/org/eclipse/titan/common/path/TITANPathUtilities.java index f3ee05f210c119a5b2284a0e8bec302fea819c55..fdd5ca1c737bb2cb05dbe905822ae6476e58c775 100644 --- a/org.eclipse.titan.common/src/org/eclipse/titan/common/path/TITANPathUtilities.java +++ b/org.eclipse.titan.common/src/org/eclipse/titan/common/path/TITANPathUtilities.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.titan.common.logging.ErrorReporter; import org.eclipse.titan.common.utils.environment.EnvironmentVariableResolver; +import org.eclipse.titan.common.utils.environment.EnvironmentVariableResolver.VariableNotFoundException; /** * Utility class to resolve eclipse paths. @@ -32,7 +33,7 @@ public final class TITANPathUtilities { /** * Resolves the provided uri relative to the provided base uri. - * + * Environment variables and path variables will be resolved * @param pathToBeResolved * the path to be resolved. * @param basePath @@ -49,21 +50,28 @@ public final class TITANPathUtilities { envVariables = null; } - String tmp1 = EnvironmentVariableResolver.eclipseStyle().resolveIgnoreErrors(pathToBeResolved, envVariables); - + String tmp1 = null; + String tmp2 = null; + try { + tmp1 = EnvironmentVariableResolver.eclipseStyle().resolve(pathToBeResolved, envVariables); + tmp2 = EnvironmentVariableResolver.unixStyle().resolveIgnoreErrors(tmp1, envVariables); + } catch(VariableNotFoundException e){ + ErrorReporter.logError("There was an error while resolving `" + pathToBeResolved + "'"); + return null; + } + final IPathVariableManager pathVariableManager = ResourcesPlugin.getWorkspace().getPathVariableManager(); - final IPath path2 = new Path(tmp1); - final IPath resolvedPath = pathVariableManager.resolvePath(path2); - final URI pathURI = URIUtil.toURI(tmp1); - - if (basePath != null && !resolvedPath.isAbsolute()) { - final URI temp = org.eclipse.core.runtime.URIUtil.append(basePath, path2.toString()); - if (temp != null) { - return temp; + URI uri = URIUtil.toURI(tmp2); + uri = pathVariableManager.resolveURI(uri); + + if (basePath != null && uri != null && !uri.isAbsolute()) { + final URI mergedURI = org.eclipse.core.runtime.URIUtil.append(basePath, uri.toString()); + return mergedURI; + + } else { + return uri; } - } - - return pathVariableManager.resolveURI(pathURI); + } /** @@ -135,4 +143,32 @@ public final class TITANPathUtilities { return URIUtil.toURI(resolvedPath); } + + /** + * Converts the provided uri relative to the provided base uri + * Environment variables and path variables will not be resolved. + * If the pathToBeConverted is absolute or the basePath is null, the basePath is not used + * + * @param pathToBeConverted + * the path to be resolved. + * @param basePath + * the absolute URI with schema part and absolute path + * relative to. + * + * @return the resolved uri. + * */ + public static URI convertToAbsoluteURI(final String pathToBeConverted, final String basePath) { + return convertToAbsoluteURI(pathToBeConverted, URIUtil.toURI(basePath)); + } + + public static URI convertToAbsoluteURI(final String pathToBeConverted, final URI basePath) { + IPath tmp = new Path(pathToBeConverted); + if( basePath != null && tmp != null && !tmp.isAbsolute()) { + final URI convertedURI = org.eclipse.core.runtime.URIUtil.append(basePath, pathToBeConverted); + if(convertedURI != null) { + return convertedURI; + } + } + return URIUtil.toURI(tmp); //!! wrong if basePath == null && !tmp.isAbsolute() because ../ will be removed !! + } } diff --git a/org.eclipse.titan.debug/META-INF/MANIFEST.MF b/org.eclipse.titan.debug/META-INF/MANIFEST.MF index f47ebc422848ad450ae1e324892558a5a1c51bf9..9bccc88b578af6d176bf29b3b0153dac787419c1 100644 --- a/org.eclipse.titan.debug/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.debug/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Titan_Debug Bundle-SymbolicName: org.eclipse.titan.debug;singleton:=true -Bundle-Version: 5.4.0.20151030-1100 +Bundle-Version: 5.4.1.CRL_113_200_5_R4B_20151202-1100 Bundle-Activator: org.eclipse.titan.debug.Activator Bundle-Vendor: ekrisza Require-Bundle: org.eclipse.ui, @@ -10,8 +10,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.titan.common, org.eclipse.core.resources, org.eclipse.ui.console, - org.eclipse.titan.designer;bundle-version="5.4.0", - org.eclipse.titan.common, + org.eclipse.titan.common;bundle-version="5.4.1", + org.eclipse.titan.designer;bundle-version="5.4.1", org.eclipse.titan.designer Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff --git a/org.eclipse.titan.designer/.antlr-eclipse b/org.eclipse.titan.designer/.antlr-eclipse deleted file mode 100644 index b8872b7b75d2dca86f99c76aa3ab735f6fb68875..0000000000000000000000000000000000000000 --- a/org.eclipse.titan.designer/.antlr-eclipse +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.eclipse.titan.designer/.project b/org.eclipse.titan.designer/.project index 3888bb1f4327e6a6e4bea09bf6783456213a585e..7bce24264c210114f299e044440395708d33ba80 100644 --- a/org.eclipse.titan.designer/.project +++ b/org.eclipse.titan.designer/.project @@ -12,11 +12,6 @@ - - org.antlr.eclipse.core.antlrbuilder - - - org.eclipse.jdt.core.javabuilder @@ -32,19 +27,8 @@ - - org.antlr.eclipse.core.warningcleanerbuilder - - - - - org.antlr.eclipse.core.smapbuilder - - - - org.antlr.eclipse.core.antlrnature org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature org.eclipse.xtext.ui.shared.xtextNature diff --git a/org.eclipse.titan.designer/META-INF/MANIFEST.MF b/org.eclipse.titan.designer/META-INF/MANIFEST.MF index e38e830aeae7d08695f814517ed6df93f8307ec8..60106f34568ab5f13cdfe0961a7ff7fa7862f9a3 100644 --- a/org.eclipse.titan.designer/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.designer/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Created-By: 23.6-b04 (Oracle Corporation) Bundle-ManifestVersion: 2 Bundle-Name: TITAN_Designer Plug-in Bundle-SymbolicName: org.eclipse.titan.designer;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 +Bundle-Version: 5.4.2.CRL_113_200_5_R4C_20160105-1100 Bundle-Activator: org.eclipse.titan.designer.Activator Bundle-Vendor: Eclipse Titan Project Require-Bundle: org.eclipse.ui, @@ -22,7 +22,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.navigator.resources, org.eclipse.core.filesystem, org.eclipse.debug.core, - org.eclipse.titan.common;bundle-version="5.4.0", + org.eclipse.titan.common;bundle-version="5.4.1", org.antlr.runtime;bundle-version="4.3.0" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/Block.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/Block.java index 4bdb33756b7893da15912887ebabe15841ffdd7c..6af97274534961a88b6803c4d2f6e4861961f1c7 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/Block.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/Block.java @@ -121,7 +121,6 @@ public final class Block implements INamedNode, IVisitableNode, Token, TokenSour case ASTVisitor.V_SKIP: return true; } - // if (v.leave(this) == ASTVisitor.V_ABORT) { return false; } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/InformationFromObj.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/InformationFromObj.java index fce4a7f6a4070f701bb3f11d138111868ff1fb33..e064659af416fdbbab329f620f667eaac1cfbb4d 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/InformationFromObj.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/InformationFromObj.java @@ -110,6 +110,11 @@ public final class InformationFromObj extends Reference { reference.setMyScope(scope); } + @Override + public Identifier getId() { + return reference.getId(); + } + @Override public String getDisplayName() { return reference.getDisplayName() + fieldName.getDisplayName(); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ASN1Module.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ASN1Module.java index c662754c6b7c5d0d8ceb9185007dc0a5af412695..27c0e2fb9fdd6073ea11b91630c6ca770ac4a2fb 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ASN1Module.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ASN1Module.java @@ -262,7 +262,7 @@ public final class ASN1Module extends Module { module = imports.singularImportedSymbols_map.get(id.getName()); moduleId = module.getIdentifier(); imports.getImportedModuleById(moduleId).setUsedForImportation(); - } else if (imports.pluralImportedSymlos.contains(id.getName())) { + } else if (imports.pluralImportedSymbols.contains(id.getName())) { id.getLocation().reportSemanticError( MessageFormat.format(MORESYMBOLS, id.getDisplayName(), identifier.getDisplayName())); return null; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ImportModule.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ImportModule.java index ad3303f85efcd1e3fbf0d82925675fbe147287c7..82e99e18c1a9d256800494c2fd66a8a77e83c07f 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ImportModule.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/ImportModule.java @@ -32,6 +32,7 @@ import org.eclipse.titan.designer.parsers.ProjectSourceParser; /** * Import module. + * Models an asn.1 module of the section IMPORTS in the parent asn1.module * * @author Kristof Szabados */ @@ -40,7 +41,7 @@ public final class ImportModule extends ModuleImportation { private static final String NOTASN1MODULE = "The module referred by `{0}'' is not an ASN.1 module"; private static final String SYMBOLNOTEXPORTED = "Symbol `{0}'' is not exported from module `{1}''"; - /** imported symbols. */ + /** imported symbols FROM this module */ private final Symbols symbols; public ImportModule(final Identifier identifier, final Symbols symbols) { @@ -85,7 +86,8 @@ public final class ImportModule extends ModuleImportation { final ProjectSourceParser parser = GlobalParser.getProjectSourceParser(project); if (null == parser || null == identifier) { - lastImportCheckTimeStamp = timestamp; + lastImportCheckTimeStamp = timestamp; + //FIXME: is it correct? lastImportCheckTimeStamp will be set in extreme case only - very early running return; } @@ -107,7 +109,7 @@ public final class ImportModule extends ModuleImportation { if (!referenceChain.add(this)) { moduleStack.remove(moduleStack.size() - 1); lastImportCheckTimeStamp = timestamp; - return; + return; } referredModule.checkImports(timestamp, referenceChain, moduleStack); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/Imports.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/Imports.java index 8cb78b10c9aedbc23d486ee3768edf9ce8b630be..da951726b08f7ac398dfa26c91dd359ef6fe0182 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/Imports.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ASN1/definitions/Imports.java @@ -62,7 +62,7 @@ public final class Imports extends ASTNode implements IOutlineElement, ILocateab * A hashset of imported symbol names which were imported from multiple * locations. */ - protected final Set pluralImportedSymlos = new HashSet(); + protected final Set pluralImportedSymbols = new HashSet(); private CompilationTimeStamp lastImportCheckTimeStamp; private IProject project; @@ -164,7 +164,7 @@ public final class Imports extends ASTNode implements IOutlineElement, ILocateab importedModules_map.clear(); singularImportedSymbols_map.clear(); - pluralImportedSymlos.clear(); + pluralImportedSymbols.clear(); final ProjectSourceParser parser = GlobalParser.getProjectSourceParser(project); if (null == parser) { @@ -218,9 +218,9 @@ public final class Imports extends ASTNode implements IOutlineElement, ILocateab if (singularImportedSymbols_map.containsKey(name)) { if (!referredModule.equals(singularImportedSymbols_map.get(name))) { singularImportedSymbols_map.remove(name); - pluralImportedSymlos.add(name); + pluralImportedSymbols.add(name); } - } else if (!pluralImportedSymlos.contains(name)) { + } else if (!pluralImportedSymbols.contains(name)) { singularImportedSymbols_map.put(name, referredModule); } } @@ -326,7 +326,7 @@ public final class Imports extends ASTNode implements IOutlineElement, ILocateab * otherwise. * */ public boolean hasImportedSymbolWithId(final Identifier identifier) { - return singularImportedSymbols_map.containsKey(identifier.getName()) || pluralImportedSymlos.contains(identifier.getName()); + return singularImportedSymbols_map.containsKey(identifier.getName()) || pluralImportedSymbols.contains(identifier.getName()); } /** diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/IType.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/IType.java index 7dc627a498a4828e7fa4ec4a0e1ef110bfcbbf97..815b3cb7d7319f55b0ae8784e1746279712959c4 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/IType.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/IType.java @@ -165,8 +165,8 @@ public interface IType extends IGovernor, IIdentifierContainer, IVisitableNode, RAW, /** text encoding. */ TEXT, - /** json encoding. */ - JSON + /** json encoding. */ + JSON } /** @@ -569,6 +569,25 @@ public interface IType extends IGovernor, IIdentifierContainer, IVisitableNode, * */ boolean isCompatible(final CompilationTimeStamp timestamp, final IType otherType, TypeCompatibilityInfo info, final TypeCompatibilityInfo.Chain leftChain, final TypeCompatibilityInfo.Chain rightChain); + + /** + * Returns whether this type is strongly compatible with type that is exactly has the same type and they are both base types + *

+ * + * @param timestamp + * the time stamp of the actual semantic check cycle. + * @param otherType + * the type to check against. + * @param info + * the type compatibility information. + * @param leftChain + * to detect type recursion on the left side. + * @param rightChain + * to detect type recursion on the right side. + * @return true if they are compatible, false otherwise. + * */ + boolean isStronglyCompatible(final CompilationTimeStamp timestamp, final IType otherType, TypeCompatibilityInfo info, + final TypeCompatibilityInfo.Chain leftChain, final TypeCompatibilityInfo.Chain rightChain); /** * Returns whether this type and it's sub-type are compatible to the diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ModuleImportation.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ModuleImportation.java index 5773240eb52a494b23524082db28d65914755691..1de0d130b50533679b3b2ac7d5b56ef7fd53bcc3 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ModuleImportation.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/ModuleImportation.java @@ -37,7 +37,7 @@ public abstract class ModuleImportation implements IReferenceChainElement, IOutl protected CompilationTimeStamp lastImportCheckTimeStamp; /** - * Stores whether the module refered by this importation has changed + * Stores whether the module referred by this importation has changed * when the importation check was last done. */ private boolean hasUnhandledChange = false; @@ -64,7 +64,7 @@ public abstract class ModuleImportation implements IReferenceChainElement, IOutl } /** - * @return whether the module refered to by this importation has changed + * @return whether the module referred to by this importation has changed * to an other one since the last importation check. * */ public boolean hasUnhandledChange() { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/BitString_Pattern_Template.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/BitString_Pattern_Template.java index 013c85bf8da39dbe262a60a7f424189d8ed2f2ed..7ba6c701d24521efd777ddec86c4f97a7c8fe74d 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/BitString_Pattern_Template.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/BitString_Pattern_Template.java @@ -89,7 +89,7 @@ public final class BitString_Pattern_Template extends TTCN3Template { protected void checkTemplateSpecificLengthRestriction(final CompilationTimeStamp timestamp, final Type_type typeType) { if (Type_type.TYPE_BITSTRING.equals(typeType)) { boolean hasAnyOrNone = containsAnyornoneSymbol(); - lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), hasAnyOrNone, hasAnyOrNone, hasAnyOrNone, this); + lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), hasAnyOrNone, false, hasAnyOrNone, this); } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/CharString_Pattern_Template.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/CharString_Pattern_Template.java index 2f303e17a4b9a636d8277b4c36d78aded68fb498..3b13f046f4375b8782b2f249e03f8c576dfdb7ac 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/CharString_Pattern_Template.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/CharString_Pattern_Template.java @@ -24,7 +24,7 @@ public final class CharString_Pattern_Template extends TTCN3Template { private PatternString patternstring; public CharString_Pattern_Template() { - patternstring = new PatternString(PatternType.UNIVCHARSTRING_PATTERN); + patternstring = new PatternString(PatternType.CHARSTRING_PATTERN); } public CharString_Pattern_Template(final PatternString ps) { @@ -108,7 +108,7 @@ public final class CharString_Pattern_Template extends TTCN3Template { protected void checkTemplateSpecificLengthRestriction(final CompilationTimeStamp timestamp, final Type_type typeType) { if (Type_type.TYPE_CHARSTRING.equals(typeType) || Type_type.TYPE_UCHARSTRING.equals(typeType)) { boolean hasAnyOrNone = patternContainsAnyornoneSymbol(); - lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), false, hasAnyOrNone, hasAnyOrNone, this); + lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), hasAnyOrNone, false, hasAnyOrNone, this); } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/HexString_Pattern_Template.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/HexString_Pattern_Template.java index 9e7c1ac830b79ee7ed9dd540aa3027d2018f422b..b97e0f3148a714ef534b83fde9bb9d60e1444cf5 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/HexString_Pattern_Template.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/HexString_Pattern_Template.java @@ -89,7 +89,7 @@ public final class HexString_Pattern_Template extends TTCN3Template { protected void checkTemplateSpecificLengthRestriction(final CompilationTimeStamp timestamp, final Type_type typeType) { if (Type_type.TYPE_HEXSTRING.equals(typeType)) { boolean hasAnyOrNone = containsAnyornoneSymbol(); - lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), false, hasAnyOrNone, hasAnyOrNone, this); + lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), hasAnyOrNone, false, hasAnyOrNone, this); } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/OctetString_Pattern_Template.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/OctetString_Pattern_Template.java index 806367920861185285317874b82565030025f7fa..ff14c84c4c14149c725eecdc1889ee054316c061 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/OctetString_Pattern_Template.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/OctetString_Pattern_Template.java @@ -89,7 +89,7 @@ public final class OctetString_Pattern_Template extends TTCN3Template { protected void checkTemplateSpecificLengthRestriction(final CompilationTimeStamp timestamp, final Type_type typeType) { if (Type_type.TYPE_OCTETSTRING.equals(typeType)) { boolean hasAnyOrNone = containsAnyornoneSymbol(); - lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), false, hasAnyOrNone, hasAnyOrNone, this); + lengthRestriction.checkNofElements(timestamp, getMinLengthOfPattern(), hasAnyOrNone, false, hasAnyOrNone, this); } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/RangeLenghtRestriction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/RangeLenghtRestriction.java index 19fb468527376f1892ba21a441f871a2bea7d4e8..253aee00d2162cbb565fdbc108e5b61b18c4de6d 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/RangeLenghtRestriction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/RangeLenghtRestriction.java @@ -267,14 +267,6 @@ public final class RangeLenghtRestriction extends LengthRestriction { return; } - if (locatable instanceof BitString_Pattern_Template || - locatable instanceof CharString_Pattern_Template || - locatable instanceof HexString_Pattern_Template || - locatable instanceof UnivCharString_Pattern_Template - ) { - return; // xString Pattern Templates will not be checked to No of elements - } - if (!lessAllowed) { IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true); IValue last = lower.getValueRefdLast(timestamp, chain); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/Referenced_Template.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/Referenced_Template.java index 4bfd63cf6f4d1dfda3b58d4f8327258ecabffca7..ecdf116cc4be7c90e4f889afd92af609a889ca05 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/Referenced_Template.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/Referenced_Template.java @@ -12,10 +12,12 @@ import java.util.List; import org.eclipse.titan.designer.AST.ASTVisitor; import org.eclipse.titan.designer.AST.Assignment; +import org.eclipse.titan.designer.AST.Assignment.Assignment_type; import org.eclipse.titan.designer.AST.FieldSubReference; import org.eclipse.titan.designer.AST.IReferenceChain; import org.eclipse.titan.designer.AST.ISubReference; import org.eclipse.titan.designer.AST.IType; +import org.eclipse.titan.designer.AST.IType.Type_type; import org.eclipse.titan.designer.AST.IValue; import org.eclipse.titan.designer.AST.Identifier; import org.eclipse.titan.designer.AST.Location; @@ -23,10 +25,9 @@ import org.eclipse.titan.designer.AST.ParameterisedSubReference; import org.eclipse.titan.designer.AST.Reference; import org.eclipse.titan.designer.AST.ReferenceChain; import org.eclipse.titan.designer.AST.ReferenceFinder; -import org.eclipse.titan.designer.AST.Scope; -import org.eclipse.titan.designer.AST.Assignment.Assignment_type; -import org.eclipse.titan.designer.AST.IType.Type_type; import org.eclipse.titan.designer.AST.ReferenceFinder.Hit; +import org.eclipse.titan.designer.AST.Scope; +import org.eclipse.titan.designer.AST.TypeCompatibilityInfo; import org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type; import org.eclipse.titan.designer.AST.TTCN3.IIncrementallyUpdateable; import org.eclipse.titan.designer.AST.TTCN3.TemplateRestriction; @@ -181,9 +182,9 @@ public final class Referenced_Template extends TTCN3Template { * reference too. * * @param timestamp - * the time stamp of the actual semantic check cycle. + * the time stamp of the actual semantic check cycle. * @param referenceChain - * the reference chain used to detect cyclic references. + * the reference chain used to detect cyclic references. * * @return the template referenced * */ @@ -262,13 +263,13 @@ public final class Referenced_Template extends TTCN3Template { } /** - * Returns whether in the chain of referenced templates there is one - * which was defined to have the implicit omit attribute set + * Returns whether in the chain of referenced templates there is one which + * was defined to have the implicit omit attribute set * * @param timestamp - * the time stamp of the actual semantic check cycle. + * the time stamp of the actual semantic check cycle. * @param referenceChain - * the ReferenceChain used to detect circular references + * the ReferenceChain used to detect circular references * * @return true if it has, false otherwise. * */ @@ -365,7 +366,9 @@ public final class Referenced_Template extends TTCN3Template { return; } - if (!type.isCompatible(timestamp, governor, null, null, null)) { + TypeCompatibilityInfo info = new TypeCompatibilityInfo(type, governor, true); + + if (!type.isCompatible(timestamp, governor, info, null, null)) { IType last = type.getTypeRefdLast(timestamp); switch (last.getTypetype()) { @@ -374,13 +377,13 @@ public final class Referenced_Template extends TTCN3Template { break; case TYPE_SIGNATURE: getLocation().reportSemanticError(MessageFormat.format(TYPEMISSMATCH1, type.getTypename(), governor.getTypename())); + setIsErroneous(true); break; default: getLocation().reportSemanticError(MessageFormat.format(TYPEMISSMATCH2, type.getTypename(), governor.getTypename())); + setIsErroneous(true); break; } - setIsErroneous(true); - return; } // check for circular references @@ -399,7 +402,8 @@ public final class Referenced_Template extends TTCN3Template { } @Override - public boolean checkValueomitRestriction(final CompilationTimeStamp timestamp, final String definitionName, final boolean omitAllowed, final Location usageLocation) { + public boolean checkValueomitRestriction(final CompilationTimeStamp timestamp, final String definitionName, final boolean omitAllowed, + final Location usageLocation) { if (omitAllowed) { checkRestrictionCommon(definitionName, TemplateRestriction.Restriction_type.TR_OMIT, usageLocation); } else { @@ -420,15 +424,13 @@ public final class Referenced_Template extends TTCN3Template { case A_PAR_TEMP_INOUT: if (ass instanceof Definition) { TemplateRestriction.Restriction_type refdTemplateRestriction = ((Definition) ass).getTemplateRestriction(); - refdTemplateRestriction = TemplateRestriction - .getSubRestriction(refdTemplateRestriction, timestamp, reference); + refdTemplateRestriction = TemplateRestriction.getSubRestriction(refdTemplateRestriction, timestamp, reference); // if restriction not satisfied issue // warning if (TemplateRestriction.isLessRestrictive(omitAllowed ? TemplateRestriction.Restriction_type.TR_OMIT : TemplateRestriction.Restriction_type.TR_VALUE, refdTemplateRestriction)) { getLocation().reportSemanticError( - MessageFormat.format(INADEQUATETEMPLATERESTRICTION, ass.getAssignmentName(), - reference.getDisplayName())); + MessageFormat.format(INADEQUATETEMPLATERESTRICTION, ass.getAssignmentName(), reference.getDisplayName())); return true; } } @@ -457,15 +459,12 @@ public final class Referenced_Template extends TTCN3Template { case A_PAR_TEMP_INOUT: if (ass instanceof Definition) { TemplateRestriction.Restriction_type refdTemplateRestriction = ((Definition) ass).getTemplateRestriction(); - refdTemplateRestriction = TemplateRestriction - .getSubRestriction(refdTemplateRestriction, timestamp, reference); + refdTemplateRestriction = TemplateRestriction.getSubRestriction(refdTemplateRestriction, timestamp, reference); // if restriction not satisfied issue // warning - if (TemplateRestriction.isLessRestrictive(TemplateRestriction.Restriction_type.TR_PRESENT, - refdTemplateRestriction)) { + if (TemplateRestriction.isLessRestrictive(TemplateRestriction.Restriction_type.TR_PRESENT, refdTemplateRestriction)) { getLocation().reportSemanticError( - MessageFormat.format(INADEQUATETEMPLATERESTRICTION, ass.getAssignmentName(), - reference.getDisplayName())); + MessageFormat.format(INADEQUATETEMPLATERESTRICTION, ass.getAssignmentName(), reference.getDisplayName())); return true; } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/SingleLenghtRestriction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/SingleLenghtRestriction.java index d1275466b6a1ee8a9fa624e32ffac879aaf75cd0..6b9b26485a37b5c92066ab7c55de03e63c78dc8d 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/SingleLenghtRestriction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/templates/SingleLenghtRestriction.java @@ -92,6 +92,9 @@ public final class SingleLenghtRestriction extends LengthRestriction { lastTimeChecked = timestamp; Integer_Type integer = new Integer_Type(); + if( value == null) { + return; + } value.setMyGovernor(integer); IValue last = integer.checkThisValueRef(timestamp, value); integer.checkThisValue(timestamp, last, new ValueCheckingOptions(expected_value, false, false, true, false, false)); @@ -161,11 +164,6 @@ public final class SingleLenghtRestriction extends LengthRestriction { return; } - if (locatable instanceof CharString_Pattern_Template || - locatable instanceof UnivCharString_Pattern_Template) { - return; // CharString Pattern Template will not be checked to No of elements - } - IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true); IValue last = value.getValueRefdLast(timestamp, chain); chain.release(); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/ComponentTypeBody.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/ComponentTypeBody.java index a333c00786a108061751f82dfff4703f372c8e54..db08e7c71585b9ee614af42b92763aea8b83b630 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/ComponentTypeBody.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/ComponentTypeBody.java @@ -75,11 +75,14 @@ public final class ComponentTypeBody extends TTCN3Scope implements IReferenceCha public static final String HIDINGSCOPEELEMENT = "The name of the inherited definition `{0}'' is not unique in the scope hierarchy"; public static final String HIDDENSCOPEELEMENT = "Previous definition with identifier `{0}'' in higher scope unit is here"; public static final String HIDINGMODULEIDENTIFIER = "Inherited definition with name `{0}'' hides a module identifier"; + + public static final String MEMBERNOTVISIBLE = "The member definition `{0}'' in component type `{1}'' is not visible in this scope"; private Location location; private Location commentLocation = null; + /** the identifier of the component does not belong to the componentTypeBody naturally !*/ private final Identifier identifier; /** component references from the extends part or null if none */ private final ComponentTypeReferenceList extendsReferences; @@ -276,10 +279,25 @@ public final class ComponentTypeBody extends TTCN3Scope implements IReferenceCha definition = getExtendsInheritedDefinition(identifier); if (definition != null) { - return definition; + if (VisibilityModifier.Public.equals(definition.getVisibilityModifier())) { + return definition; + } else { + identifier.getLocation().reportSemanticError(MessageFormat.format( + MEMBERNOTVISIBLE, identifier.getDisplayName(), this.identifier.getDisplayName())); + } } - return getAttributesInheritedDefinition(identifier); + definition = getAttributesInheritedDefinition(identifier); + if (definition != null) { + if (VisibilityModifier.Public.equals(definition.getVisibilityModifier())) { + return definition; + } else { + identifier.getLocation().reportSemanticError(MessageFormat.format( + MEMBERNOTVISIBLE, identifier.getDisplayName(), this.identifier.getDisplayName())); + } + } + + return null; } @Override @@ -329,8 +347,7 @@ public final class ComponentTypeBody extends TTCN3Scope implements IReferenceCha } reference.getLocation().reportSemanticError(MessageFormat.format( - "The member definition `{0}'' in component type `{1}'' is not visible in this scope", - reference.getId().getDisplayName(), identifier.getDisplayName())); + MEMBERNOTVISIBLE, reference.getId().getDisplayName(), identifier.getDisplayName())); return null; } @@ -341,8 +358,7 @@ public final class ComponentTypeBody extends TTCN3Scope implements IReferenceCha } reference.getLocation().reportSemanticError(MessageFormat.format( - "The member definition `{0}'' in component type `{1}'' is not visible in this scope", - reference.getId().getDisplayName(), identifier.getDisplayName())); + MEMBERNOTVISIBLE, reference.getId().getDisplayName(), identifier.getDisplayName())); return null; } @@ -847,8 +863,6 @@ public final class ComponentTypeBody extends TTCN3Scope implements IReferenceCha throw new ReParseException(); } - reparser.updateLocation(identifier.getLocation()); - for (Definition definition : definitions) { definition.updateSyntax(reparser, false); reparser.updateLocation(definition.getLocation()); @@ -899,11 +913,7 @@ public final class ComponentTypeBody extends TTCN3Scope implements IReferenceCha case ASTVisitor.V_SKIP: return true; } - if (identifier != null) { - if (!identifier.accept(v)) { - return false; - } - } + if (definitions != null) { for (Definition def : definitions) { if (!def.accept(v)) { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SequenceOf_Type.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SequenceOf_Type.java index 9a87c2d31f8d54308fe9d4d0b522191f5e3e6666..9eac2d0408bf3561878a667ba1a2c1e6b3a0438a 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SequenceOf_Type.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SequenceOf_Type.java @@ -100,7 +100,14 @@ public final class SequenceOf_Type extends AbstractOfType implements IReferencea } if (info == null || noStructuredTypeCompatibility) { - return this == lastOtherType; + //There is another chance to be compatible: + //If records of/sets of are strongly compatible, then the records of/sets of are compatible + IType last = getTypeRefdLast(timestamp); + if(! last.isStronglyCompatible(timestamp, lastOtherType, info, leftChain, rightChain)) { + return false; + } else { + return true; + } } switch (lastOtherType.getTypetype()) { @@ -315,6 +322,56 @@ public final class SequenceOf_Type extends AbstractOfType implements IReferencea return false; } } + + @Override + public boolean isStronglyCompatible(final CompilationTimeStamp timestamp, final IType otherType, TypeCompatibilityInfo info, + final TypeCompatibilityInfo.Chain leftChain, final TypeCompatibilityInfo.Chain rightChain) { + + IType lastOtherType = otherType.getTypeRefdLast(timestamp); + if (Type_type.TYPE_SEQUENCE_OF.equals(lastOtherType.getTypetype())) { + IType oftOther = ((SequenceOf_Type) lastOtherType).getOfType(); + IType oft = getOfType().getTypeRefdLast(timestamp); // type of the + // fields + if (oft != null && oftOther != null) { + // For basic types pre-generated seq/set of is applied in titan: + switch (oft.getTypetype()) { + case TYPE_BOOL: + case TYPE_BITSTRING: + case TYPE_OCTETSTRING: + case TYPE_INTEGER: + case TYPE_REAL: + case TYPE_CHARSTRING: + case TYPE_HEXSTRING: + case TYPE_UCHARSTRING: + case TYPE_INTEGER_A: + case TYPE_ASN1_ENUMERATED: + case TYPE_BITSTRING_A: + case TYPE_UTF8STRING: + case TYPE_NUMERICSTRING: + case TYPE_PRINTABLESTRING: + case TYPE_TELETEXSTRING: + case TYPE_VIDEOTEXSTRING: + case TYPE_IA5STRING: + case TYPE_GRAPHICSTRING: + case TYPE_VISIBLESTRING: + case TYPE_GENERALSTRING: + case TYPE_UNIVERSALSTRING: + case TYPE_BMPSTRING: + case TYPE_UNRESTRICTEDSTRING: + case TYPE_UTCTIME: + case TYPE_GENERALIZEDTIME: + case TYPE_OBJECTDESCRIPTOR: + if (oft.isStronglyCompatible(timestamp, oftOther, info, leftChain, rightChain)) { + return true; + } + break; + default: + break; + } + } + } + return false; + } @Override public String getOutlineIcon() { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SetOf_Type.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SetOf_Type.java index 1e5172063a6fa3e7e6de44466d22f57f819689a3..4faae022cc28d37701b79877deabe5a05d8a18f0 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SetOf_Type.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/SetOf_Type.java @@ -14,21 +14,21 @@ import java.util.Map; import org.eclipse.titan.designer.AST.IReferenceChain; import org.eclipse.titan.designer.AST.IType; import org.eclipse.titan.designer.AST.IValue; +import org.eclipse.titan.designer.AST.IValue.Value_type; import org.eclipse.titan.designer.AST.ReferenceChain; import org.eclipse.titan.designer.AST.TypeCompatibilityInfo; import org.eclipse.titan.designer.AST.Value; import org.eclipse.titan.designer.AST.ASN1.ASN1Type; import org.eclipse.titan.designer.AST.ASN1.IASN1Type; import org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Type; -import org.eclipse.titan.designer.AST.IValue.Value_type; import org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template; +import org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template.Completeness_type; +import org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template.Template_type; import org.eclipse.titan.designer.AST.TTCN3.templates.IndexedTemplate; import org.eclipse.titan.designer.AST.TTCN3.templates.Indexed_Template_List; import org.eclipse.titan.designer.AST.TTCN3.templates.SubsetMatch_Template; import org.eclipse.titan.designer.AST.TTCN3.templates.SupersetMatch_Template; import org.eclipse.titan.designer.AST.TTCN3.templates.Template_List; -import org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template.Completeness_type; -import org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template.Template_type; import org.eclipse.titan.designer.AST.TTCN3.types.subtypes.SubType; import org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value; import org.eclipse.titan.designer.AST.TTCN3.values.SetOf_Value; @@ -78,7 +78,14 @@ public final class SetOf_Type extends AbstractOfType { } if (info == null || noStructuredTypeCompatibility) { - return this == lastOtherType; + //There is another chance to be compatible: + //If records of/sets of are strongly compatible, then the records of/sets of are compatible + IType last = getTypeRefdLast(timestamp); + if(! last.isStronglyCompatible(timestamp, lastOtherType, info, leftChain, rightChain)) { + return false; + } else { + return true; + } } switch (lastOtherType.getTypetype()) { @@ -243,6 +250,56 @@ public final class SetOf_Type extends AbstractOfType { return false; } } + + @Override + public boolean isStronglyCompatible(final CompilationTimeStamp timestamp, final IType otherType, TypeCompatibilityInfo info, + final TypeCompatibilityInfo.Chain leftChain, final TypeCompatibilityInfo.Chain rightChain) { + + IType lastOtherType = otherType.getTypeRefdLast(timestamp); + if (Type_type.TYPE_SET_OF.equals(lastOtherType.getTypetype())) { + IType oftOther = ((SetOf_Type) lastOtherType).getOfType(); + IType oft = getOfType().getTypeRefdLast(timestamp); // type of the + // fields + if (oft != null && oftOther != null) { + // For basic types pre-generated seq/set of is applied in titan: + switch (oft.getTypetype()) { + case TYPE_BOOL: + case TYPE_BITSTRING: + case TYPE_OCTETSTRING: + case TYPE_INTEGER: + case TYPE_REAL: + case TYPE_CHARSTRING: + case TYPE_HEXSTRING: + case TYPE_UCHARSTRING: + case TYPE_INTEGER_A: + case TYPE_ASN1_ENUMERATED: + case TYPE_BITSTRING_A: + case TYPE_UTF8STRING: + case TYPE_NUMERICSTRING: + case TYPE_PRINTABLESTRING: + case TYPE_TELETEXSTRING: + case TYPE_VIDEOTEXSTRING: + case TYPE_IA5STRING: + case TYPE_GRAPHICSTRING: + case TYPE_VISIBLESTRING: + case TYPE_GENERALSTRING: + case TYPE_UNIVERSALSTRING: + case TYPE_BMPSTRING: + case TYPE_UNRESTRICTEDSTRING: + case TYPE_UTCTIME: + case TYPE_GENERALIZEDTIME: + case TYPE_OBJECTDESCRIPTOR: + if (oft.isStronglyCompatible(timestamp, oftOther, info, leftChain, rightChain)) { + return true; + } + break; + default: + break; + } + } + } + return false; + } @Override public String getOutlineIcon() { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/subtypes/SubType.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/subtypes/SubType.java index d8c50ce5a233b87662ef2cc5efe629cc51b5c8cb..7e15d3cfe868bb56ade421447cae9a4ecbe1bd54 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/subtypes/SubType.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/subtypes/SubType.java @@ -781,7 +781,7 @@ public final class SubType implements IIncrementallyUpdateable { IValue lower = null, upper = null; if (lengthRestriction instanceof SingleLenghtRestriction) { lower = ((SingleLenghtRestriction) lengthRestriction).getRestriction(timestamp); - if (lower.getIsErroneous(timestamp) || !Value_type.INTEGER_VALUE.equals(lower.getValuetype()) + if (lower == null || lower.getIsErroneous(timestamp) || !Value_type.INTEGER_VALUE.equals(lower.getValuetype()) || lower.isUnfoldable(timestamp)) { return false; } @@ -793,7 +793,7 @@ public final class SubType implements IIncrementallyUpdateable { } lower = ((RangeLenghtRestriction) lengthRestriction).getLowerValue(timestamp); - if (lower.getIsErroneous(timestamp) || !Value_type.INTEGER_VALUE.equals(lower.getValuetype()) || lower.isUnfoldable(timestamp)) { + if (lower == null || lower.getIsErroneous(timestamp) || !Value_type.INTEGER_VALUE.equals(lower.getValuetype()) || lower.isUnfoldable(timestamp)) { return false; } if (!checkBoundaryValid(lower, "lower boundary")) { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/Type.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/Type.java index ba20ca49cedb830ff19f1546b3c5b4f30752ec70..ca125ea7ed33cae7923c01dab88a7e18450092b0 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/Type.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/Type.java @@ -697,6 +697,7 @@ public abstract class Type extends Governor implements IType, IIncrementallyUpda value.setIsErroneous(true); return; } + final TypeCompatibilityInfo info = new TypeCompatibilityInfo(this, governor, true); info.setStr1Elem(strElem); info.setStr2Elem(reference.refersToStringElement()); @@ -720,9 +721,9 @@ public abstract class Type extends Governor implements IType, IIncrementallyUpda value.getLocation().reportSemanticError(message); } break; + case TYPE_SEQUENCE_OF: case TYPE_ASN1_SEQUENCE: case TYPE_TTCN3_SEQUENCE: - case TYPE_SEQUENCE_OF: case TYPE_ARRAY: case TYPE_ASN1_SET: case TYPE_TTCN3_SET: @@ -956,6 +957,23 @@ public abstract class Type extends Governor implements IType, IIncrementallyUpda @Override public abstract boolean isCompatible(final CompilationTimeStamp timestamp, final IType otherType, TypeCompatibilityInfo info, final TypeCompatibilityInfo.Chain leftChain, final TypeCompatibilityInfo.Chain rightChain); + + @Override + public boolean isStronglyCompatible(final CompilationTimeStamp timestamp, final IType otherType, TypeCompatibilityInfo info, + final TypeCompatibilityInfo.Chain leftChain, final TypeCompatibilityInfo.Chain rightChain) { + + check(timestamp); + otherType.check(timestamp); + final IType thisTypeLast = this.getTypeRefdLast(timestamp); + final IType otherTypeLast = otherType.getTypeRefdLast(timestamp); + + if (thisTypeLast == null || otherTypeLast == null || thisTypeLast.getIsErroneous(timestamp) + || otherTypeLast.getIsErroneous(timestamp)) { + return true; + } + + return thisTypeLast.getTypetype().equals(otherTypeLast.getTypetype()); + } public enum CompatibilityLevel { INCOMPATIBLE_TYPE, INCOMPATIBLE_SUBTYPE, COMPATIBLE @@ -971,6 +989,11 @@ public abstract class Type extends Governor implements IType, IIncrementallyUpda if (!isCompatible(timestamp, type, info, leftChain, rightChain)) { return CompatibilityLevel.INCOMPATIBLE_TYPE; } + + // if there is noStructuredTypeCompatibility and isCompatible then it should be strong compatibility: + if( noStructuredTypeCompatibility ) { + return CompatibilityLevel.COMPATIBLE; + } SubType otherSubType = type.getSubtype(); if ((info != null) && (subType != null) && (otherSubType != null)) { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/GeneralConstants.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/GeneralConstants.java index 923fd386f610aa1e9cb0ccd6ca9c436c222e8d4a..2636ea22e64178db235a4ccd2c2076a7910de91a 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/GeneralConstants.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/GeneralConstants.java @@ -20,7 +20,7 @@ import org.eclipse.titan.designer.properties.data.FolderBuildPropertyData; */ public final class GeneralConstants { public static final ProductIdentity ON_THE_FLY_ANALYZER_VERSION = - ProductIdentity.getProductIdentity(ProductIdentity.TITAN_PRODUCT_NUMBER, 5, 4, 0, 0); + ProductIdentity.getProductIdentity(ProductIdentity.TITAN_PRODUCT_NUMBER, 5, 4, 2, 0); public static final boolean DEBUG = true; public static final boolean ETSI_BUILD = false; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/CheckSemantic.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/CheckSemantic.java index 99a998c0a02b85b68db6bf576bef2a2e159f90cc..2f8652ffa3edc2d4761d7ed43c6d56acfc0be7be 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/CheckSemantic.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/CheckSemantic.java @@ -102,11 +102,9 @@ public final class CheckSemantic extends ExternalTitanAction { // 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.getConsole().newMessageStream().println("Using the general preferences to do the external semantic check"); TITANConsole.println("Using the general preferences to do the external semantic check"); command.add('-' + SEMANTIC_CHECK_FLAG + getTITANActionFlags()); } else { - //TITANConsole.getConsole().newMessageStream().println("Using the project properties to do the external semantic check"); TITANConsole.println("Using the project properties to do the external semantic check"); boolean useRuntime2 = false; try { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/RemoteBuilder.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/RemoteBuilder.java index b20a58ddf9040865b1db01fcad062a7f4975681a..179e0900ab373cbe439bd816c689a08451f86316 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/RemoteBuilder.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/actions/RemoteBuilder.java @@ -131,7 +131,7 @@ public final class RemoteBuilder extends AbstractHandler implements IObjectActio Process proc = null; BufferedReader stdout; - MessageConsoleStream stream = TITANConsole.getConsole().newMessageStream(); //ethbaat + MessageConsoleStream stream = TITANConsole.getConsole().newMessageStream(); String actualCommand; for (int i = 0; i < commands.size(); i++) { @@ -148,14 +148,12 @@ public final class RemoteBuilder extends AbstractHandler implements IObjectActio for (String c : finalCommand) { builder.append(c + ' '); } - //TITANConsole.getConsole().newMessageStream().println(builder.toString()); TITANConsole.println(builder.toString(),stream); pb.command(finalCommand); try { proc = pb.start(); } catch (IOException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.EXECUTION_FAILED); TITANConsole.println(ExternalTitanAction.EXECUTION_FAILED,stream); ErrorReporter.logExceptionStackTrace(e); TITANJob.reportExecutionProblem(project, Platform.getPreferencesService(), getName(), finalCommand, null, false); @@ -175,16 +173,13 @@ public final class RemoteBuilder extends AbstractHandler implements IObjectActio MarkerHandler.removeAllMarkedMarkers(project); return Status.CANCEL_STATUS; } - //TITANConsole.getConsole().newMessageStream().println(hostnames.get(i) + ": " + line); TITANConsole.println(hostnames.get(i) + ": " + line,stream); line = stdout.readLine(); } int exitval = proc.waitFor(); if (exitval == 0) { - //TITANConsole.getConsole().newMessageStream().println("The process on " + hostnames.get(i) + " finished without indicating an error."); TITANConsole.println("The process on " + hostnames.get(i) + " finished without indicating an error.",stream); } else { - //TITANConsole.getConsole().newMessageStream().println(hostnames.get(i) + " finished with return value: " + exitval); TITANConsole.println(hostnames.get(i) + " finished with return value: " + exitval,stream); if (stderr.ready()) { @@ -203,11 +198,9 @@ public final class RemoteBuilder extends AbstractHandler implements IObjectActio return Status.CANCEL_STATUS; } } catch (IOException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.EXECUTION_FAILED); TITANConsole.println(ExternalTitanAction.EXECUTION_FAILED,stream); ErrorReporter.logExceptionStackTrace(e); } catch (InterruptedException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.INTERRUPTION); TITANConsole.println(ExternalTitanAction.INTERRUPTION,stream); ErrorReporter.logExceptionStackTrace(e); } finally { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/application/LoadFromTpd.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/application/LoadFromTpd.java index 422209891d937d88e16c4f329dc7e8d792026591..bf91507a887041f2e4ae5c4fc5da9e348b25609a 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/application/LoadFromTpd.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/application/LoadFromTpd.java @@ -14,9 +14,10 @@ import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPlatformRunnable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.swt.widgets.Display; @@ -30,7 +31,7 @@ import org.eclipse.titan.designer.wizards.projectFormat.TpdImporter; * * @author Kristof Szabados * */ -public class LoadFromTpd implements IPlatformRunnable { +public class LoadFromTpd implements IApplication { private boolean result; private void reportResult(final boolean result) { @@ -38,18 +39,19 @@ public class LoadFromTpd implements IPlatformRunnable { } @Override - public Object run(final Object args) throws Exception { + public Object start(IApplicationContext context) throws Exception { if (!GeneralConstants.DEBUG) { ErrorReporter.INTERNAL_ERROR("Loading Tpd files in headless mode is in prototype mode and so should not be available in released versions yet"); } Platform.getBundle("org.eclipse.titan.designer").start(); - if (!(args instanceof String[])) { + Object arguments = context.getArguments().get(IApplicationContext.APPLICATION_ARGS); + if (!(arguments instanceof String[])) { System.out.println("A list of strings was expected as argument."); return Integer.valueOf(-1); } - final String[] projectFiles = (String[]) args; + final String[] projectFiles = (String[]) arguments; if (projectFiles.length != 1) { System.out.println("This application takes as parameter the location of the Tpd file it should load projects from."); @@ -101,4 +103,10 @@ public class LoadFromTpd implements IPlatformRunnable { return Integer.valueOf(-1); } + + @Override + public void stop() { + // nothing to be done + + } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/consoles/TITANDebugConsole.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/consoles/TITANDebugConsole.java index 884397311b75deb645886535162bc98ebb827dd3..49aa9ec3e836590f8ab0013e37235951ac56719b 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/consoles/TITANDebugConsole.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/consoles/TITANDebugConsole.java @@ -90,14 +90,14 @@ public final class TITANDebugConsole { if(inHeadLessMode) { return; } - String msg = ""; + StringBuilder msg = new StringBuilder(); for (int i = 0; i < message.length; i++) { - msg += message[i]; + msg.append(message[i]); if (i < message.length-1) { - msg += ": "; + msg.append(": "); } } - println(msg, getConsole().newMessageStream()); + println(msg.toString(), getConsole().newMessageStream()); } public static void print(String message, MessageConsoleStream stream) { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/CompilerVersionInformationCollector.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/CompilerVersionInformationCollector.java index 6b89cc8b534feb676bbcd6ca1567bcfdc267b2c5..326785d7e15a35f1bb285bc84e0684c2694cc057 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/CompilerVersionInformationCollector.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/CompilerVersionInformationCollector.java @@ -199,7 +199,6 @@ public final class CompilerVersionInformationCollector { try { proc = pb.start(); } catch (IOException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.EXECUTION_FAILED); TITANConsole.println(ExternalTitanAction.EXECUTION_FAILED); ErrorReporter.logExceptionStackTrace(e); return null; @@ -217,7 +216,6 @@ public final class CompilerVersionInformationCollector { return null; } if (reportDebugInformation) { - //TITANConsole.getConsole().newMessageStream().println(line); TITANConsole.println(line); } line = stdout.readLine(); @@ -225,7 +223,6 @@ public final class CompilerVersionInformationCollector { int exitval = proc.waitFor(); if (exitval != 0) { if (reportDebugInformation) { - //TITANConsole.getConsole().newMessageStream().println(FAILURE + exitval); TITANConsole.println(FAILURE + exitval); } proc.destroy(); @@ -233,7 +230,6 @@ public final class CompilerVersionInformationCollector { } if (reportDebugInformation) { - //TITANConsole.getConsole().newMessageStream().println(SUCCESS); TITANConsole.println(SUCCESS); } } catch (IOException e) { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/OutputAnalyzer.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/OutputAnalyzer.java index aa1868b3e58c8f6f1273623bd21679827a545c09..bc63b69b150e9757c9299541688eed7168ba85cc 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/OutputAnalyzer.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/OutputAnalyzer.java @@ -18,6 +18,7 @@ import java.util.regex.Pattern; import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.ITextFileBufferManager; +import org.eclipse.core.filebuffers.LocationKind; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; @@ -113,7 +114,7 @@ public final class OutputAnalyzer { ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); for (IPath path : filesOpened) { try { - manager.disconnect(path, null); + manager.disconnect(path,LocationKind.IFILE,null); } catch (CoreException e) { ErrorReporter.logExceptionStackTrace(e); } @@ -310,8 +311,8 @@ public final class OutputAnalyzer { ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); IPath fullPath = resource.getFullPath(); if (manager != null) { - manager.connect(fullPath, null); - ITextFileBuffer buffer = manager.getTextFileBuffer(fullPath); + manager.connect(fullPath, LocationKind.IFILE, null); + ITextFileBuffer buffer = manager.getTextFileBuffer(fullPath,LocationKind.IFILE); document = buffer.getDocument(); documentMap.put(resource, document); filesOpened.add(fullPath); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/TITANJob.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/TITANJob.java index 59e3d17ced720fc0e52f187baf3d81853bd1ca93..ab4d8c646effc21ab158e3ad2ee8dceb7ff23f9d 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/TITANJob.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/TITANJob.java @@ -229,7 +229,7 @@ public class TITANJob extends WorkspaceJob { pb.redirectErrorStream(true); Process proc = null; - MessageConsoleStream stream = TITANConsole.getConsole().newMessageStream(); //ethbaat + MessageConsoleStream stream = TITANConsole.getConsole().newMessageStream(); String line; BufferedReader stdout; @@ -277,14 +277,12 @@ public class TITANJob extends WorkspaceJob { for (String c : finalCommand) { builder.append(c + SPACE); } - //TITANConsole.getConsole().newMessageStream().println(builder.toString()); TITANConsole.println(builder.toString(),stream); pb.command(finalCommand); try { proc = pb.start(); } catch (IOException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.EXECUTION_FAILED); TITANConsole.println(ExternalTitanAction.EXECUTION_FAILED,stream); ErrorReporter.logExceptionStackTrace(e); reportExecutionProblem(project, prefs, getName(), finalCommand, null, false); @@ -312,12 +310,10 @@ public class TITANJob extends WorkspaceJob { return Status.CANCEL_STATUS; } analyzer.parseTitanErrors(line); - //TITANConsole.getConsole().newMessageStream().println(line); TITANConsole.println(line,stream); } int exitval = proc.waitFor(); if (exitval != 0) { - //TITANConsole.getConsole().newMessageStream().println(FAILURE + exitval); TITANConsole.println(FAILURE + exitval,stream); if (!analyzer.hasProcessedErrorMessages()) { if (stderr.ready()) { @@ -339,14 +335,11 @@ public class TITANJob extends WorkspaceJob { return Status.CANCEL_STATUS; } - //TITANConsole.getConsole().newMessageStream().println(SUCCESS); TITANConsole.println(SUCCESS,stream); } catch (IOException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.EXECUTION_FAILED); TITANConsole.println(ExternalTitanAction.EXECUTION_FAILED,stream); ErrorReporter.logExceptionStackTrace(ExternalTitanAction.EXECUTION_FAILED, e); } catch (InterruptedException e) { - //TITANConsole.getConsole().newMessageStream().println(ExternalTitanAction.INTERRUPTION); TITANConsole.println(ExternalTitanAction.INTERRUPTION,stream); ErrorReporter.logExceptionStackTrace(ExternalTitanAction.INTERRUPTION, e); } finally { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/makefile/MakefileGenerator.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/makefile/MakefileGenerator.java index 53b3c2414f7cf2ecc410a0327b12a1b2a4009da7..22049f2de2b916897b20de62de7568b81ac0b59a 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/makefile/MakefileGenerator.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/core/makefile/MakefileGenerator.java @@ -2151,7 +2151,6 @@ public final class MakefileGenerator { project, ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.INCREMENTAL_DEPENDENCY_PROPERTY)) { incrementalDependencyRefresh = true; if (!gnuMake) { - //TITANConsole.getConsole().newMessageStream().println(INVALID_OPTIONS); TITANConsole.println(INVALID_OPTIONS); ErrorReporter.logError("Incremental dependency refresh is only supported if generating GNU makefiles. The GNU make option was turned on."); ResourceUtils.setPersistentProperty(project, ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.GNU_MAKE_PROPERTY, true); @@ -2162,7 +2161,6 @@ public final class MakefileGenerator { if (!Platform.OS_WIN32.equals(Platform.getOS())) { dynamicLinking = true; } else { - //TITANConsole.getConsole().newMessageStream().println(INVALID_OPTIONS); TITANConsole.println(INVALID_OPTIONS); ErrorReporter.logError("Could not create Makefile with dynamic linking enabled for project " + project.getName() + " as this is not supported on Windows"); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/AbstractIndentAction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/AbstractIndentAction.java index b18a1379a1c1cd78b7daef6c5304051df698e1fc..14482e2c29d7ce0cf843400bf6ef9150dde7533b 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/AbstractIndentAction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/AbstractIndentAction.java @@ -16,6 +16,7 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.RewriteSessionEditProcessor; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.text.edits.MultiTextEdit; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/RewriteSessionEditProcessor.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/RewriteSessionEditProcessor.java deleted file mode 100644 index 700796b67c95af9679315f0ce2e9ef3580648ba1..0000000000000000000000000000000000000000 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/RewriteSessionEditProcessor.java +++ /dev/null @@ -1,61 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2000-2015 Ericsson Telecom AB - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - ******************************************************************************/ -package org.eclipse.titan.designer.editors; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DocumentRewriteSession; -import org.eclipse.jface.text.DocumentRewriteSessionType; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension4; -import org.eclipse.text.edits.TextEdit; -import org.eclipse.text.edits.TextEditProcessor; -import org.eclipse.text.edits.UndoEdit; - -/** - * - * FIXME this class was taken from JFace as the one there only appeared in - * Eclipse 3.3, please remove this class once support for earlier versions is - * dropped on our side. - * */ -public final class RewriteSessionEditProcessor extends TextEditProcessor { - - /** - * Constructs a new edit processor for the given document. - * - * @param document - * the document to manipulate - * @param root - * the root of the text edit tree describing the - * modifications. By passing a text edit a a text edit - * processor the ownership of the edit is transfered to - * the text edit processors. Clients must not modify the - * edit (e.g adding new children) any longer. - * @param style - * {@link TextEdit#NONE}, {@link TextEdit#CREATE_UNDO} or - * {@link TextEdit#UPDATE_REGIONS}) - */ - public RewriteSessionEditProcessor(final IDocument document, final TextEdit root, final int style) { - super(document, root, style); - } - - @Override - public UndoEdit performEdits() throws BadLocationException { - IDocument document = getDocument(); - if (!(document instanceof IDocumentExtension4)) { - return super.performEdits(); - } - - IDocumentExtension4 extension = (IDocumentExtension4) document; - DocumentRewriteSession session = extension.startRewriteSession(DocumentRewriteSessionType.SEQUENTIAL); - try { - return super.performEdits(); - } finally { - extension.stopRewriteSession(session); - } - } -} diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ASN1CodeSkeletons.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ASN1CodeSkeletons.java index 1990885c0bb7b92691db83ced572ea86bc113ee3..f7b639ad1871571a67e5203b9eb37081920f2e70 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ASN1CodeSkeletons.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ASN1CodeSkeletons.java @@ -57,6 +57,14 @@ public final class ASN1CodeSkeletons { new SkeletonTemplateProposal("VALUESET", new Template("Value Set", "", CONTEXT_IDENTIFIER, "${Identifier} ${type} := {" + NEWLINE + "${first-value} |" + NEWLINE + "${second-value}" + NEWLINE + "}", false)) }; + private static final String ASN1_MODULE_EMPTY = " DEFINITIONS" + NEWLINE + + NEWLINE + + " AUTOMATIC TAGS ::=" + NEWLINE + + NEWLINE + + "BEGIN" + NEWLINE + + NEWLINE + + "END" + NEWLINE; + private static final String ASN1_MODULE_SKELETON = " DEFINITIONS" + NEWLINE + NEWLINE + "-- [(AUTOMATIC|EXPLICIT|IMPLICIT) TAGS]" + NEWLINE @@ -90,6 +98,20 @@ public final class ASN1CodeSkeletons { collector.addTemplateProposal(templateProposal.getPrefix(), templateProposal.getProposal(), skeletonImage); } } + + /** + * Returns a valid ASN1 module with almost empty content. + * + * @param moduleName + * the name of the module to be used to create the + * skeleton + * @return the ASN1 module skeleton + * */ + public static String getASN1ModuleWithEmptyBody(final String moduleName) { + StringBuilder buffer = new StringBuilder(moduleName); + buffer.append(ASN1_MODULE_EMPTY); + return buffer.toString(); + } /** * Returns a valid ASN1 module skeleton. diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/IndentAction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/IndentAction.java index 6198fdb936ab12af29b7932b3682a1256318cdf5..d5dd795733c375999bf83d2e8bd5c18e38518536 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/IndentAction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/IndentAction.java @@ -9,10 +9,10 @@ package org.eclipse.titan.designer.editors.asn1editor; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.RewriteSessionEditProcessor; import org.eclipse.titan.common.parsers.Interval; import org.eclipse.titan.common.parsers.Interval.interval_type; import org.eclipse.titan.designer.editors.AbstractIndentAction; -import org.eclipse.titan.designer.editors.RewriteSessionEditProcessor; import org.eclipse.ui.IEditorPart; /** diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ReconcilingStrategy.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ReconcilingStrategy.java index 117a92dfed9716c2b148d8f6284b392d37aa6bde..3585e8de16d0ca1cb98eaa66558e08849caeace6 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ReconcilingStrategy.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/asn1editor/ReconcilingStrategy.java @@ -27,6 +27,7 @@ import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; import org.eclipse.swt.widgets.Display; import org.eclipse.titan.designer.GeneralConstants; import org.eclipse.titan.designer.AST.MarkerHandler; +import org.eclipse.titan.designer.commonFilters.ResourceExclusionHelper; import org.eclipse.titan.designer.graphics.ImageCache; import org.eclipse.titan.designer.parsers.GlobalIntervalHandler; import org.eclipse.titan.designer.parsers.GlobalParser; @@ -95,19 +96,16 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci } void analyze(final boolean is_initial) { - final IFile file = (IFile) editor.getEditorInput().getAdapter(IFile.class); - - if (file == null) { + final IFile editedFile = (IFile) editor.getEditorInput().getAdapter(IFile.class); + if (editedFile == null || ResourceExclusionHelper.isExcluded(editedFile)) { return; } - IProject project = file.getProject(); + IProject project = editedFile.getProject(); if (project == null) { return; } - ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project); - Display.getDefault().asyncExec(new Runnable() { @Override public void run() { @@ -116,7 +114,8 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci } }); - projectSourceParser.reportOutdating(file); + ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project); + projectSourceParser.reportOutdating(editedFile); if (is_initial || !editor.isSemanticCheckingDelayed()) { projectSourceParser.setFullSemanticAnalysisNeeded(); @@ -130,8 +129,8 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci Display.getDefault().asyncExec(new Runnable() { @Override public void run() { - if (!MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_SYNTACTIC_MARKER, file) || - !MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_MIXED_MARKER, file) ) { + if (!MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_SYNTACTIC_MARKER, editedFile) || + !MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_MIXED_MARKER, editedFile) ) { getEditor().updateOutlinePage(); } } @@ -145,6 +144,7 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci op.setRule(project); op.schedule(); } else { + projectSourceParser.reportSyntacticOutdatingOnly(editedFile); projectSourceParser.analyzeAllOnlySyntactically(); } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/ConfigEditor.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/ConfigEditor.java index dbc7b7d5d6d2c4cdb144ddfa250698e8b967ca26..d0a1ce1baab1d019661adbeaff8cbfb6a6ba4814 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/ConfigEditor.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/ConfigEditor.java @@ -15,7 +15,6 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.swt.widgets.Display; -import org.eclipse.titan.common.logging.ErrorReporter; import org.eclipse.titan.common.parsers.LocationAST; import org.eclipse.titan.common.parsers.cfg.CfgAnalyzer; import org.eclipse.titan.common.parsers.cfg.ConfigTreeNodeUtilities; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/IndentAction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/IndentAction.java index bba5564c334bf0f7107daa89d2f277b5b8f6cd43..d127ca1dac3749bfed8729c07be6db379bb0764a 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/IndentAction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/configeditor/IndentAction.java @@ -9,10 +9,10 @@ package org.eclipse.titan.designer.editors.configeditor; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.RewriteSessionEditProcessor; import org.eclipse.titan.common.parsers.Interval; import org.eclipse.titan.common.parsers.Interval.interval_type; import org.eclipse.titan.designer.editors.AbstractIndentAction; -import org.eclipse.titan.designer.editors.RewriteSessionEditProcessor; import org.eclipse.ui.IEditorPart; /** diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/AddImport.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/AddImport.java index 87eb3838769a78e46853eba44a0bc9a108e80944..f241f3a2f9b5e5a7e03e00290471453f45e62d8d 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/AddImport.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/AddImport.java @@ -15,6 +15,7 @@ import org.eclipse.core.runtime.preferences.IPreferencesService; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.RewriteSessionEditProcessor; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.window.Window; @@ -33,7 +34,6 @@ import org.eclipse.titan.designer.editors.DeclarationCollectionHelper; import org.eclipse.titan.designer.editors.DeclarationCollector; import org.eclipse.titan.designer.editors.OpenDeclarationHelper; import org.eclipse.titan.designer.editors.OpenDeclarationLabelProvider; -import org.eclipse.titan.designer.editors.RewriteSessionEditProcessor; import org.eclipse.titan.designer.parsers.GlobalParser; import org.eclipse.titan.designer.parsers.ProjectSourceParser; import org.eclipse.titan.designer.preferences.PreferenceConstants; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/IndentAction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/IndentAction.java index eff1f15b62ec64fbfc44d46fd67c68df25b7ba23..907918cca9862562c2efeb0553f58efb18a76a8f 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/IndentAction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/IndentAction.java @@ -9,10 +9,10 @@ package org.eclipse.titan.designer.editors.ttcn3editor; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.RewriteSessionEditProcessor; import org.eclipse.titan.common.parsers.Interval; import org.eclipse.titan.common.parsers.Interval.interval_type; import org.eclipse.titan.designer.editors.AbstractIndentAction; -import org.eclipse.titan.designer.editors.RewriteSessionEditProcessor; import org.eclipse.ui.IEditorPart; /** diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/OutlineContentProvider.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/OutlineContentProvider.java index 0d504d12bf5abc6fbe3aa66b8a3c8227084847bd..c5dc68e7919ff1363c89cdbffa9df37fe3a3b517 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/OutlineContentProvider.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/OutlineContentProvider.java @@ -15,6 +15,8 @@ import org.eclipse.titan.designer.AST.IOutlineElement; /** * @author Kristof Szabados + * + * TODO: instead of getOutlineChildren we should use visitors * */ public final class OutlineContentProvider implements ITreeContentProvider { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/ReconcilingStrategy.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/ReconcilingStrategy.java index 84a208eddf8e9ed1cee08998a784000f42998817..b42f8144940bc319c648dfb3c56e3d2872a2a9d7 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/ReconcilingStrategy.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/ReconcilingStrategy.java @@ -114,7 +114,6 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci return; } - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); int lineBreaks = 0; try { if (DirtyRegion.INSERT.equals(dirtyRegion.getType())) { @@ -215,6 +214,7 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci op.setProperty(IProgressConstants.ICON_PROPERTY, ImageCache.getImageDescriptor("titan.gif")); op.schedule(); + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); if (store.getBoolean(PreferenceConstants.DISPLAYDEBUGINFORMATION)) { TITANDebugConsole.println("Refreshing the syntax took " + (System.nanoTime() - parserStart) * (1e-9) + " secs"); } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/TTCN3CodeSkeletons.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/TTCN3CodeSkeletons.java index ad398158b97e4c71abe2b479180c4a11bd5b2759..4a140871ee866c207c17fdfd23ba3b2093b21aa4 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/TTCN3CodeSkeletons.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcn3editor/TTCN3CodeSkeletons.java @@ -660,6 +660,21 @@ public final class TTCN3CodeSkeletons { } } + /** + * Returns a valid TTCN3 module with empty body. + * + * @param moduleName + * the name of the module to be used to create the + * module + * @return the TTCN3 module content + * */ + public static String getTTCN3ModuleWithEmptyBody(final String moduleName) { + StringBuilder buffer = new StringBuilder(MODULE_KEYWORD); + buffer.append(moduleName).append(" {\n\n}\n"); + return buffer.toString(); + } + + /** * Returns a valid TTCN3 module skeleton. * @@ -670,7 +685,9 @@ public final class TTCN3CodeSkeletons { * */ public static String getTTCN3ModuleSkeleton(final String moduleName) { StringBuilder buffer = new StringBuilder(TTCN3_MODULE_HEADER_SKELETON); - buffer.append(MODULE_KEYWORD).append(moduleName).append('\n').append(TTCN3_MODULE_BODY_SKELETON); + buffer.append(MODULE_KEYWORD).append(moduleName).append(NEWLINE).append(TTCN3_MODULE_BODY_SKELETON); return buffer.toString(); } + + } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/IndentAction.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/IndentAction.java index c5979180d9144428d8f312ba4484f42a4f0f220b..6319b328371436661ec4b76b2ea2e83e10ed4eb4 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/IndentAction.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/IndentAction.java @@ -11,11 +11,11 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.IPreferencesService; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.RewriteSessionEditProcessor; import org.eclipse.jface.text.reconciler.MonoReconciler; import org.eclipse.titan.common.parsers.Interval; import org.eclipse.titan.common.parsers.Interval.interval_type; import org.eclipse.titan.designer.editors.AbstractIndentAction; -import org.eclipse.titan.designer.editors.RewriteSessionEditProcessor; import org.eclipse.titan.designer.preferences.PreferenceConstants; import org.eclipse.titan.designer.productUtilities.ProductConstants; import org.eclipse.ui.IEditorPart; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/ReconcilingStrategy.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/ReconcilingStrategy.java index 0463818fa51bb7c4db07f1cc0a1925cd40becbf2..c50b9cb614070efaa2b13d20553a84bd41dcc3ad 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/ReconcilingStrategy.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/editors/ttcnppeditor/ReconcilingStrategy.java @@ -27,6 +27,9 @@ import org.eclipse.jface.text.reconciler.IReconcilingStrategy; import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; import org.eclipse.swt.widgets.Display; import org.eclipse.titan.common.logging.ErrorReporter; +import org.eclipse.titan.designer.GeneralConstants; +import org.eclipse.titan.designer.AST.MarkerHandler; +import org.eclipse.titan.designer.commonFilters.ResourceExclusionHelper; import org.eclipse.titan.designer.editors.ttcn3editor.TTCN3FoldingSupport; import org.eclipse.titan.designer.graphics.ImageCache; import org.eclipse.titan.designer.parsers.GlobalIntervalHandler; @@ -178,10 +181,10 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci } private void fullReconciliation(final boolean is_initial) { - IPreferencesService prefs = Platform.getPreferencesService(); - // if (prefs.getBoolean(Activator.PLUGIN_ID, - // PreferenceConstants.TREATTTCNPPASTTCN, true, null)) { + actualCode = new StringBuilder(document.get()); + GlobalIntervalHandler.putInterval(document, null); + IPreferencesService prefs = Platform.getPreferencesService(); if (prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, true, null)) { analyze(is_initial); } else { @@ -194,22 +197,11 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci } }); } - // } else { - // Display.getDefault().asyncExec(new Runnable() { - // public void run() { - // ArrayList positions = (new - // TTCN3FoldingSupport()).calculatePositions(document); - // editor.updateFoldingStructure(positions); - // editor.updateOutlinePage(); - // } - // }); - // } } public void analyze(final boolean is_initial) { - IFile editedFile = (IFile) editor.getEditorInput().getAdapter(IFile.class); - - if (editedFile == null) { + final IFile editedFile = (IFile) editor.getEditorInput().getAdapter(IFile.class); + if (editedFile == null || ResourceExclusionHelper.isExcluded(editedFile)) { return; } @@ -218,9 +210,6 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci return; } - final ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project); - projectSourceParser.setFullSemanticAnalysisNeeded(); - Display.getDefault().asyncExec(new Runnable() { @Override public void run() { @@ -229,6 +218,8 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci } }); + final ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project); + projectSourceParser.setFullSemanticAnalysisNeeded(); if (is_initial || !editor.isSemanticCheckingDelayed()) { projectSourceParser.reportOutdating(editedFile); projectSourceParser.analyzeAll(); @@ -242,7 +233,9 @@ public final class ReconcilingStrategy implements IReconcilingStrategy, IReconci Display.getDefault().asyncExec(new Runnable() { @Override public void run() { - editor.updateOutlinePage(); + if (!MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_SYNTACTIC_MARKER, editedFile)) { + getEditor().updateOutlinePage(); + } } }); return Status.OK_STATUS; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/nativewin32actions/CheckSemantic.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/nativewin32actions/CheckSemantic.java index bc1bc731b8b81583c0884414bc6ba38e1d053bbd..e7cb703382ea5f25a96617402c42c3958a6936f3 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/nativewin32actions/CheckSemantic.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/nativewin32actions/CheckSemantic.java @@ -115,12 +115,10 @@ public final class CheckSemantic extends ExternalTitanAction { // used to generate the Makefile, otherwise use the general // preferences. if (singleSelectedProject == null) { - //TITANConsole.getConsole().newMessageStream().println("Using the general preferences to do the external semantic check"); TITANConsole.println("Using the general preferences to do the external semantic check"); titanFlags += getTITANActionFlags(); command.add(titanFlags); } else { - //TITANConsole.getConsole().newMessageStream().println("Using the project properties to do the external semantic check"); TITANConsole.println("Using the project properties to do the external semantic check"); boolean useRuntime2 = false; try { diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/asn1parser/Asn1Parser.g4 b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/asn1parser/Asn1Parser.g4 index b3ba241c93c78be3f8b8d5d8ca5b25cc49779244..3d7bdbed2290310a566e8d28ccfacd9f787c70b6 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/asn1parser/Asn1Parser.g4 +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/asn1parser/Asn1Parser.g4 @@ -624,15 +624,19 @@ locals [ASN1Type subType, NamedType_Helper namedType_Helper, Constraint constrai e = pr_Constraints { $constraints = $e.constraints; } )? // pr_BuiltinType_reg, pr_ConstrainedType { - $type.setLocation(new Location(actualFile, $builtin.start, $builtin.start)); - $type.addConstraints($constraints); + if ( $type != null ) { + $type.setLocation(new Location(actualFile, $builtin.start, $builtin.start)); + $type.addConstraints($constraints); + } } | ref = pr_ReferencedType { $type = $ref.type; } f = pr_Constraints { $constraints = $f.constraints; - $type.setLocation(new Location(actualFile, $ref.start, $ref.start)); - $type.addConstraints($constraints); + if ( $type != null ) { + $type.setLocation(new Location(actualFile, $ref.start, $ref.start)); + $type.addConstraints($constraints); + } } ) /* ( ( pr_ReferencedType diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3BaseLexer.g4 b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3BaseLexer.g4 index b6be2525d954a2fba316a5727ceeadc545c96e52..445e2716f715455e02b25a7ceb87820452ab28bd 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3BaseLexer.g4 +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3BaseLexer.g4 @@ -354,6 +354,12 @@ HSTRINGMATCH: '\'' WS? ( HEXORMATCH WS? )* '\'H'; OSTRING: '\'' WS? ( OCT WS? )* '\'O'; OSTRINGMATCH: '\'' WS? ( OCTORMATCH WS? )* '\'O'; +// Tokens for erroneous cases for [BHO]STRING(MATCH)? rules +// - wrong character between the quotes +// - odd number of hex digits in case of OSTRING(MATCH)?) +// These tokens are not used in any parser rules, but these cases must be parser errors instead of lexer errors +BHOSTRING_WRONG: '\'' ~( '\'' )* '\'' [BHO]; + // Macros MACRO_MODULEID: '%moduleId' | '__MODULE__'; MACRO_DEFINITION_ID: '%definitionId'; diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Parser.g4 b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Parser.g4 index 6f5bc349ba60bc1b9c4af1f0f007924da7ef681f..3330fc3dacea96ecff508d64259c3061df7f96c3 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Parser.g4 +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Parser.g4 @@ -21,6 +21,55 @@ NOTE: Rule pr_CString is for CSTRING to remove the beginning and ending '"' characters, as lexer cannot remove them as it was done in the ANTLR V2 Parser. Do NOT use CSTRING in any rule, use this instead. + +-------------------------- +Precedence of Operators with precedence levels (higher number is higher precedence) + +15 ( ... ) +14 +, - (unary) +13 *, /, mod, rem +12 +, -, & +11 not4b (unary) +10 and4b + 9 xor4b + 8 or4b + 7 <<, >>, <@, @> + 6 <, >, <=, >= + 5 ==, != + 4 not (unary) + 3 and + 2 xor + 1 or + +Simplified* expression rules using precedence climbing method: + +E1 : E2 ( OR E2 )* +E2 : E3 ( XOR E3 )* +E3 : E4 ( AND E4 )* +E4 : NOT E4 | E5 +E5 : E6 ( ( '==' | '!=' ) E6 )* +E6 : E7 ( ( '<' | '>' | '<=' | '>=' ) E7 )* +E7 : E8 ( ( '<<' | '>>' | '<@' | '@>' ) E8 )* +E8 : E9 ( OR4B E9 )* +E9 : E10 ( XOR4B E10 )* +E10: E11 ( AND4B E11 )* +E11: NOT4B E11 | E12 +E12: E13 ( ( '+' | '-' | '&' ) E13 )* +E13: P ( ( '*' | '/' | MOD | REM ) P )* +P : NOT E4 | NOT4B E11 | ( '+' | '-' ) P | '(' E1 ')' | v + +*: without java code, but the structure is identical to the used rules, where + En: rule for the n-th precedence level + E1: pr_SingleExpression in case of Ttcn3Parser.g4 + P: last rule with unary operations + v: atomic expression without any operators, pr_Primary in case of Ttcn3Parser.g4 + +NOTE: unary operators, which are not on the highest priority level, are used twice, because they must be handled at their precendence level, + and also at the last (highest precedence) level, if there is no match to other operators. + If any of these unary operators was matched in the last rule, control must jump back to the rule of its precedence level ( NOT E4, NOT4B E11 ). + Example case: + not4b a & not4b b <=> not4b ( a & ( not4b b ) ) + 1st not4b matches at rule E4, but the 2nd not4b matches at rule P. */ options { @@ -6120,8 +6169,10 @@ pr_NotExpression returns[Value value = null]: pr_EqualExpression returns[Value value = null]: ( v = pr_RelExpression { $value = $v.value; } - ( EQUAL v2 = pr_RelExpression { $value = new EqualsExpression($value, $v2.value); - $value.setLocation(getLocation( $v.start, $v2.stop)); } + ( EQUAL v1 = pr_RelExpression { $value = new EqualsExpression($value, $v1.value); + $value.setLocation(getLocation( $v.start, $v1.stop)); } + | NOTEQUALS v2 = pr_ShiftExpression { $value = new NotequalesExpression($value, $v2.value); + $value.setLocation(getLocation( $v.start, $v2.stop)); } )* ); @@ -6131,13 +6182,11 @@ pr_RelExpression returns[Value value = null]: $value.setLocation(getLocation( $v.start, $v1.stop)); } | MORETHAN v2 = pr_ShiftExpression { $value = new GreaterThanExpression($value, $v2.value); $value.setLocation(getLocation( $v.start, $v2.stop)); } - | NOTEQUALS v3 = pr_ShiftExpression { $value = new NotequalesExpression($value, $v3.value); + | MOREOREQUAL v3 = pr_ShiftExpression { $value = new GreaterThanOrEqualExpression($value, $v3.value); $value.setLocation(getLocation( $v.start, $v3.stop)); } - | MOREOREQUAL v4 = pr_ShiftExpression { $value = new GreaterThanOrEqualExpression($value, $v4.value); + | LESSOREQUAL v4 = pr_ShiftExpression { $value = new LessThanOrEqualExpression($value, $v4.value); $value.setLocation(getLocation( $v.start, $v4.stop)); } - | LESSOREQUAL v5 = pr_ShiftExpression { $value = new LessThanOrEqualExpression($value, $v5.value); - $value.setLocation(getLocation( $v.start, $v5.stop)); } - )? + )* ); pr_ShiftExpression returns[Value value = null]: @@ -6176,8 +6225,8 @@ pr_BitAndExpression returns[Value value = null]: pr_BitNotExpression returns[Value value = null]: ( NOT4B - v = pr_AddExpression { $value = new Not4bExpression($v.value); - $value.setLocation(getLocation( $start, getStopToken())); } + v = pr_BitNotExpression { $value = new Not4bExpression($v.value); + $value.setLocation(getLocation( $start, getStopToken())); } | v2 = pr_AddExpression { $value = $v2.value; } ); @@ -6185,8 +6234,8 @@ pr_AddExpression returns[Value value = null]: ( v = pr_MulExpression { $value = $v.value; } ( PLUS v1 = pr_MulExpression { $value = new AddExpression($value, $v1.value); $value.setLocation(getLocation( $v.start, $v1.stop)); } - | pr_Minus v2 = pr_MulExpression { $value = new SubstractExpression($value, $v2.value); - $value.setLocation(getLocation( $v.start, $v2.stop)); } + | MINUS v2 = pr_MulExpression { $value = new SubstractExpression($value, $v2.value); + $value.setLocation(getLocation( $v.start, $v2.stop)); } | STRINGOP v3 = pr_MulExpression { $value = new StringConcatenationExpression($value, $v3.value); $value.setLocation(getLocation( $v.start, $v3.stop)); } )* @@ -6206,13 +6255,20 @@ pr_MulExpression returns[Value value = null]: ); pr_UnaryExpression returns [Value value = null]: -( PLUS - v1 = pr_Primary { $value = new UnaryPlusExpression($v1.value); - $value.setLocation(getLocation( $PLUS, $v1.stop)); } +( NOT + v1 = pr_NotExpression { $value = new NotExpression($v1.value); + $value.setLocation(getLocation( $NOT, $v1.stop )); } +| NOT4B + v2 = pr_BitNotExpression { $value = new Not4bExpression($v2.value); + $value.setLocation(getLocation( $NOT4B, $v2.stop )); } +| PLUS + v3 = pr_Primary { $value = new UnaryPlusExpression($v3.value); + $value.setLocation(getLocation( $PLUS, $v3.stop)); } | MINUS - v2 = pr_Primary { $value = new UnaryMinusExpression($v2.value); - $value.setLocation(getLocation( $MINUS, $v2.stop)); } -| v3 = pr_Primary { $value = $v3.value; } + v4 = pr_Primary { $value = new UnaryMinusExpression($v4.value); + $value.setLocation(getLocation( $MINUS, $v4.stop)); } +| pr_LParen v5 = pr_SingleExpression pr_RParen { $value = $v5.value; } +| v6 = pr_Primary { $value = $v6.value; } ); pr_Primary returns[Value value = null] diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Reparser.g4 b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Reparser.g4 index db1f8da0be8f82d3389a83494db3eb0df4b11f2f..c1e6b28b23f7d83da27ec3f9f5d41f2504313476 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Reparser.g4 +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/parsers/ttcn3parser/Ttcn3Reparser.g4 @@ -133,7 +133,7 @@ pr_reparse_ImportDef [Group parent_group, List all_imports, List newConfigurations = ProjectFileHandler.getConfigurations(document); - if (newConfigurations.contains(newName)) { + List configurations = ProjectFileHandler.getConfigurations(document); + if (configurations.contains(newName)) { errorText.setText("It is not possible to create a new configuration with name `" + newName + "' as there is already one with that name."); errorText.setEnabled(true); @@ -214,18 +214,18 @@ public class ConfigurationManagerControl { Node configurationRoot = ProjectFileHandler.findConfigurationNode(document.getDocumentElement(), newName); if (configurationRoot == null) { - Element temp = document.createElement("Configuration"); + Element newConfiguration = document.createElement("Configuration"); - temp.setAttribute("name", newName); - configurationsRoot.appendChild(temp); - configurationRoot = temp; + newConfiguration.setAttribute("name", newName); + configurationsRoot.appendChild(newConfiguration); + configurationRoot = newConfiguration; } ProjectFileHandler.saveProjectInfoToNode(project, configurationRoot, document); - newConfigurations = ProjectFileHandler.getConfigurations(ProjectDocumentHandlingUtility + configurations = ProjectFileHandler.getConfigurations(ProjectDocumentHandlingUtility .getDocument(project)); - hostViewer.setInput(newConfigurations.toArray(new String[newConfigurations.size()])); + hostViewer.setInput(configurations.toArray(new String[configurations.size()])); } } }); diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/properties/pages/ProjectBuildPropertyPage.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/properties/pages/ProjectBuildPropertyPage.java index ded04a8bbcbcffcd9d1fff00ffa876b893796f35..5619b5155a52c6631bd25faccc9960ee98e3adf0 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/properties/pages/ProjectBuildPropertyPage.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/properties/pages/ProjectBuildPropertyPage.java @@ -29,7 +29,6 @@ import org.eclipse.titan.designer.properties.PropertyNotificationManager; import org.eclipse.titan.designer.properties.data.ProjectBuildPropertyData; import org.eclipse.titan.designer.properties.data.ProjectDocumentHandlingUtility; import org.eclipse.titan.designer.wizards.projectFormat.TITANAutomaticProjectExporter; -import org.eclipse.titan.designer.wizards.projectFormat.TITANProjectExporter; import org.eclipse.ui.dialogs.PropertyPage; /** diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleCreationWizardPage.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleCreationWizardPage.java index d2a6c9adeb193e968c0e2014b3c0f6282962d5e6..f2729d4ca95a334a9131507b97c47cacad2ec4f2 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleCreationWizardPage.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleCreationWizardPage.java @@ -162,16 +162,27 @@ public final class NewASN1ModuleCreationWizardPage extends WizardNewFileCreation @Override protected InputStream getInitialContents() { - if (wizard.getOptionsPage().isGenerateSkeletonSelected()) { - String moduleName = getFileName(); - int dotIndex = moduleName.indexOf('.'); - moduleName = dotIndex == -1 ? moduleName : moduleName.substring(0, dotIndex); - String temporalModuleSkeleton = ASN1CodeSkeletons.getASN1ModuleSkeleton(moduleName); + switch (wizard.getOptionsPage().getGeneratedModuleType()) { + case EMPTY: + return super.getInitialContents(); + case NAME_AND_EMPTY_BODY: + String temporalModule = ASN1CodeSkeletons.getASN1ModuleWithEmptyBody(getModuleName()); + return new BufferedInputStream(new ByteArrayInputStream(temporalModule.getBytes())); + case SKELETON: + String temporalModuleSkeleton = ASN1CodeSkeletons.getASN1ModuleSkeleton(getModuleName()); return new BufferedInputStream(new ByteArrayInputStream(temporalModuleSkeleton.getBytes())); + default: + return super.getInitialContents(); } - return super.getInitialContents(); + } + + private String getModuleName() { + String moduleName = getFileName(); + int dotIndex = moduleName.indexOf('.'); + moduleName = dotIndex == -1 ? moduleName : moduleName.substring(0, dotIndex); + return moduleName; } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleOptionsWizardPage.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleOptionsWizardPage.java index 208a6933362248464f9a3326f18c1687a3acf6d5..a3fb0c4cd9dec4e3371f568c7e6218e751094c3e 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleOptionsWizardPage.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewASN1ModuleOptionsWizardPage.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2000-2015 Ericsson Telecom AB + * Copyright (c) 2000-2016 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,36 +7,17 @@ ******************************************************************************/ package org.eclipse.titan.designer.wizards; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - /** - * @author Kristof Szabados - * */ -public final class NewASN1ModuleOptionsWizardPage extends WizardPage { - +* @author Kristof Szabados, Jeno Balasko +* */ +public final class NewASN1ModuleOptionsWizardPage extends NewModuleOptionsWizardPage { private static final String TITLE = "ASN1 Module creation options"; private static final String DESCRIPTION = "Create the new ASN1 module according to these options"; - private static final String GEN_EXCLUDED = "Generate as excluded from build"; - private static final String GEN_SKELETON = "Generate with module skeleton inserted"; - - private Composite pageComposite; - private Button excludeFromBuildButton; - private boolean isExcludedFromBuildSelected = false; - private Button generateSkeletonButton; - private boolean isGenerateSkeletonSelected = true; - public NewASN1ModuleOptionsWizardPage() { + NewASN1ModuleOptionsWizardPage() { super(TITLE); } - + @Override public String getDescription() { return DESCRIPTION; @@ -46,60 +27,4 @@ public final class NewASN1ModuleOptionsWizardPage extends WizardPage { public String getTitle() { return TITLE; } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt - * .widgets.Composite) - */ - @Override - public void createControl(final Composite parent) { - pageComposite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - pageComposite.setLayout(layout); - GridData data = new GridData(GridData.FILL); - data.grabExcessHorizontalSpace = true; - pageComposite.setLayoutData(data); - - excludeFromBuildButton = new Button(pageComposite, SWT.CHECK); - excludeFromBuildButton.setText(GEN_EXCLUDED); - excludeFromBuildButton.setEnabled(true); - excludeFromBuildButton.setSelection(false); - isExcludedFromBuildSelected = false; - excludeFromBuildButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - isExcludedFromBuildSelected = excludeFromBuildButton.getSelection(); - } - }); - - generateSkeletonButton = new Button(pageComposite, SWT.CHECK); - generateSkeletonButton.setText(GEN_SKELETON); - generateSkeletonButton.setEnabled(true); - generateSkeletonButton.setSelection(true); - isGenerateSkeletonSelected = true; - generateSkeletonButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - isGenerateSkeletonSelected = generateSkeletonButton.getSelection(); - } - }); - - setControl(pageComposite); - } - - public boolean isExcludeFromBuildSelected() { - return isExcludedFromBuildSelected; - } - - public boolean isGenerateSkeletonSelected() { - return isGenerateSkeletonSelected; - } - - @Override - public void setWizard(final IWizard newWizard) { - super.setWizard(newWizard); - } -} +} \ No newline at end of file diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewModuleOptionsWizardPage.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewModuleOptionsWizardPage.java new file mode 100644 index 0000000000000000000000000000000000000000..ef73e40799d3d4c2baa09bc143a0d397a4c35614 --- /dev/null +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewModuleOptionsWizardPage.java @@ -0,0 +1,126 @@ + /****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + ******************************************************************************/ +package org.eclipse.titan.designer.wizards; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; + +/** + * @author Kristof Szabados, Jeno Balasko + * */ +public abstract class NewModuleOptionsWizardPage extends WizardPage { + + private static final String GEN_EXCLUDED = "Generate as excluded from build"; + + //Module generation + private static final String GEN_WITH = "Generate module with this content:"; + private static final String GEN_EMPTY_CONT = "Empty module"; + private static final String GEN_MODULE_NAME = "Module name and empty body"; + private static final String GEN_MODULE_SKEL = "Module skeleton"; + private static final String GEN_MODULE_TOOLTIP = "What will be in the module"; + /** + * The items of the combo box. + */ + private static final String[] GEN_MODULE_OPTIONS = new String[] { + GEN_EMPTY_CONT, + GEN_MODULE_NAME, + GEN_MODULE_SKEL + }; + + public static enum GeneratedModuleType { + EMPTY, NAME_AND_EMPTY_BODY, SKELETON + }; + + private static GeneratedModuleType[] GeneratedModuleTypeValues = GeneratedModuleType.values(); + + private Composite pageComposite; + + private Button excludeFromBuildButton; + private boolean isExcludedFromBuildSelected = false; + + private Label generateModuleLabel; + + private Combo generateModuleCombo; + private GeneratedModuleType generatedModuleType = GeneratedModuleType.NAME_AND_EMPTY_BODY; + + public NewModuleOptionsWizardPage(String title) { + super(title); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt + * .widgets.Composite) + */ + @Override + public void createControl(final Composite parent) { + pageComposite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + pageComposite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.grabExcessHorizontalSpace = true; + pageComposite.setLayoutData(data); + + excludeFromBuildButton = new Button(pageComposite, SWT.CHECK); + excludeFromBuildButton.setText(GEN_EXCLUDED); + excludeFromBuildButton.setEnabled(true); + excludeFromBuildButton.setSelection(false); + isExcludedFromBuildSelected = false; + excludeFromBuildButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + isExcludedFromBuildSelected = excludeFromBuildButton.getSelection(); + } + }); + + generateModuleLabel = new org.eclipse.swt.widgets.Label(pageComposite, SWT.READ_ONLY|SWT.LEFT); + generateModuleLabel.setText(GEN_WITH); + + generateModuleCombo = new Combo(pageComposite,SWT.READ_ONLY|SWT.RIGHT); + generateModuleCombo.setEnabled(true); + generateModuleCombo.setItems(GEN_MODULE_OPTIONS); + generateModuleCombo.setText(GEN_MODULE_NAME); + generateModuleCombo.setToolTipText(GEN_MODULE_TOOLTIP); + generateModuleCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + setGeneratedModuleType(generateModuleCombo.getSelectionIndex()); + return; + } + }); + setControl(pageComposite); + } + + public boolean isExcludeFromBuildSelected() { + return isExcludedFromBuildSelected; + } + + public GeneratedModuleType getGeneratedModuleType() { + return generatedModuleType; + } + + private void setGeneratedModuleType(int index) { + generatedModuleType = GeneratedModuleTypeValues[index]; + } + + @Override + public void setWizard(final IWizard newWizard) { + super.setWizard(newWizard); + } +} diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleCreationWizardPage.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleCreationWizardPage.java index 9523a52f68236853102a8cb71118bebaae05b4be..b5e2ebd74af70129536395c9cb09f21e298acb25 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleCreationWizardPage.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleCreationWizardPage.java @@ -40,7 +40,7 @@ public final class NewTTCN3ModuleCreationWizardPage extends WizardNewFileCreatio private static final String DESCRIPTION = "Create a new TTCN3 module"; private static final String ERROR_MESSAGE = "When provided the extension of the TTCN3 Module must be \"ttcn\" or \"ttcn3\""; private static final String OCCUPIED = "This module name would create a file that already exists."; - + private boolean hasLicense; private final NewTTCN3ModuleWizard wizard; @@ -152,16 +152,26 @@ public final class NewTTCN3ModuleCreationWizardPage extends WizardNewFileCreatio @Override protected InputStream getInitialContents() { - if (wizard.getOptionsPage().isGenerateSkeletonSelected()) { - String moduleName = getFileName(); - int dotIndex = moduleName.indexOf('.'); - moduleName = dotIndex == -1 ? moduleName : moduleName.substring(0, dotIndex); - String temporalModuleSkeleton = TTCN3CodeSkeletons.getTTCN3ModuleSkeleton(moduleName); - + switch (wizard.getOptionsPage().getGeneratedModuleType()) { + case EMPTY: + return super.getInitialContents(); + case NAME_AND_EMPTY_BODY: + String temporalModule = TTCN3CodeSkeletons.getTTCN3ModuleWithEmptyBody(getModuleName()); + return new BufferedInputStream(new ByteArrayInputStream(temporalModule.getBytes())); + case SKELETON: + String temporalModuleSkeleton = TTCN3CodeSkeletons.getTTCN3ModuleSkeleton(getModuleName()); return new BufferedInputStream(new ByteArrayInputStream(temporalModuleSkeleton.getBytes())); + default: + return super.getInitialContents(); } - return super.getInitialContents(); + } + + private String getModuleName() { + String moduleName = getFileName(); + int dotIndex = moduleName.indexOf('.'); + moduleName = dotIndex == -1 ? moduleName : moduleName.substring(0, dotIndex); + return moduleName; } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleOptionsWizardPage.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleOptionsWizardPage.java index c1f8e5ce2c11c5397f37f485ff7a17e4b6bc985d..3fef8afc64a551fdd877c39a41d496da21acbe34 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleOptionsWizardPage.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/NewTTCN3ModuleOptionsWizardPage.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2000-2015 Ericsson Telecom AB + * Copyright (c) 2000-2016 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,36 +7,17 @@ ******************************************************************************/ package org.eclipse.titan.designer.wizards; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - /** - * @author Kristof Szabados + * @author Kristof Szabados, Jeno Balasko * */ -public final class NewTTCN3ModuleOptionsWizardPage extends WizardPage { - +public final class NewTTCN3ModuleOptionsWizardPage extends NewModuleOptionsWizardPage { private static final String TITLE = "TTCN3 Module creation options"; private static final String DESCRIPTION = "Create the new TTCN3 module according to these options"; - private static final String GEN_EXCLUDED = "Generate as excluded from build"; - private static final String GEN_SKELETON = "Generate with module skeleton inserted"; - - private Composite pageComposite; - private Button excludeFromBuildButton; - private boolean isExcludedFromBuildSelected = false; - private Button generateSkeletonButton; - private boolean isGenerateSkeletonSelected = true; - - public NewTTCN3ModuleOptionsWizardPage() { + + NewTTCN3ModuleOptionsWizardPage() { super(TITLE); } - + @Override public String getDescription() { return DESCRIPTION; @@ -47,59 +28,5 @@ public final class NewTTCN3ModuleOptionsWizardPage extends WizardPage { return TITLE; } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt - * .widgets.Composite) - */ - @Override - public void createControl(final Composite parent) { - pageComposite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - pageComposite.setLayout(layout); - GridData data = new GridData(GridData.FILL); - data.grabExcessHorizontalSpace = true; - pageComposite.setLayoutData(data); - - excludeFromBuildButton = new Button(pageComposite, SWT.CHECK); - excludeFromBuildButton.setText(GEN_EXCLUDED); - excludeFromBuildButton.setEnabled(true); - excludeFromBuildButton.setSelection(false); - isExcludedFromBuildSelected = false; - excludeFromBuildButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - isExcludedFromBuildSelected = excludeFromBuildButton.getSelection(); - } - }); - - generateSkeletonButton = new Button(pageComposite, SWT.CHECK); - generateSkeletonButton.setText(GEN_SKELETON); - generateSkeletonButton.setEnabled(true); - generateSkeletonButton.setSelection(true); - isGenerateSkeletonSelected = true; - generateSkeletonButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - isGenerateSkeletonSelected = generateSkeletonButton.getSelection(); - } - }); - - setControl(pageComposite); - } - - public boolean isExcludeFromBuildSelected() { - return isExcludedFromBuildSelected; - } - - public boolean isGenerateSkeletonSelected() { - return isGenerateSkeletonSelected; - } - - @Override - public void setWizard(final IWizard newWizard) { - super.setWizard(newWizard); - } } + diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TITANProjectExporter.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TITANProjectExporter.java index 34b14edb7f180ebd01cecb474fed88b22aa532c0..661c1671464a24b669f6eae866dbe27a1b36dae9 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TITANProjectExporter.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TITANProjectExporter.java @@ -168,7 +168,7 @@ public final class TITANProjectExporter { project.setPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, ProjectBuildPropertyData.LOAD_LOCATION),projectFile); } - if( projectFile.startsWith("/")) + if( projectFile.matches("/[a-zA-Z]:.*")) { projectFile = projectFile.substring(1); project.setPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, @@ -198,7 +198,7 @@ public final class TITANProjectExporter { /** * Saves all project information of "project" into the tpd file given output - * file "projectFile" Prerequites: project and projectFile are set properly + * file "projectFile" Prerequisites: project and projectFile are set properly * * @return true if the save was successful */ @@ -542,9 +542,9 @@ public final class TITANProjectExporter { for (String name : namesArray) { final Element variableRoot = document.createElement(ProjectFormatConstants.PATH_VARIABLE); variablesRoot.appendChild(variableRoot); - // IPath value = pathVariableManager.getValue(name); - URI uri = pathVariableManager.getURIValue(name); - variableRoot.setAttribute("value", uri.toString()); + URI value = pathVariableManager.getURIValue(name); + variableRoot.setAttribute("value", value.toString()); + variableRoot.setAttribute("name", name); } } diff --git a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TpdImporter.java b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TpdImporter.java index 04e98b67048039f54e75493caab67276374034c0..b97f013c913881d9070e4b8defa139ef25ace908 100644 --- a/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TpdImporter.java +++ b/org.eclipse.titan.designer/src/org/eclipse/titan/designer/wizards/projectFormat/TpdImporter.java @@ -13,7 +13,6 @@ import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.net.URI; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -55,6 +54,7 @@ import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.titan.common.logging.ErrorReporter; +import org.eclipse.titan.common.path.TITANPathUtilities; import org.eclipse.titan.common.path.TitanURIUtil; import org.eclipse.titan.common.utils.IOUtils; import org.eclipse.titan.designer.Activator; @@ -121,21 +121,21 @@ public class TpdImporter { } /** - * Internal function used to do the import job. It is needed to extract - * this functionality i order to be able to handle erroneous situations. + * Internal function used to do the import job. It is needed to extract this + * functionality i order to be able to handle erroneous situations. * * @param projectFile - * the file path string of the project descriptor file (tpd) + * the file path string of the project descriptor file (tpd) * @param projectsCreated - * the list of projects created so far. In case of - * problems we will try to delete them. + * the list of projects created so far. In case of problems we + * will try to delete them. * @param monitor - * the monitor used to report progress. + * the monitor used to report progress. * * @return true if the import was successful, false otherwise. * */ - public boolean internalFinish(final String projectFile, final boolean isSkipExistingProjects, final boolean isOpenPropertiesForAllImports, - final List projectsCreated, final IProgressMonitor monitor) { + public boolean internalFinish(final String projectFile, final boolean isSkipExistingProjects, + final boolean isOpenPropertiesForAllImports, final List projectsCreated, final IProgressMonitor monitor) { if (projectFile == null || "".equals(projectFile.trim())) { return false; } @@ -175,13 +175,16 @@ public class TpdImporter { final Schema tpdXsd = getTPDSchema(); tpdValidator = tpdXsd.newValidator(); } catch (Exception e) { - ErrorReporter.INTERNAL_ERROR(e.getMessage());//Hint: cp $TTCN3_DIR/etc/xsd/TPD.xsd designer/schema/ + ErrorReporter.INTERNAL_ERROR(e.getMessage()); + // Hint: cp $TTCN3_DIR/etc/xsd/TPD.xsd designer/schema/ } - IPath projectFilePath = Path.fromOSString(projectFile); - URI projectFileURI = URIUtil.toURI(projectFilePath); - - if (!loadURIDocuments(projectFileURI, null, tpdValidator)) { + URI resolvedProjectFileURI = TITANPathUtilities.convertToAbsoluteURI(projectFile, (URI) null); + //==================================== + // Loading all URI Documents (tpds) + // and collect projects to be imported + //==================================== + if (!loadURIDocuments(resolvedProjectFileURI, null, tpdValidator)) { return false; } @@ -189,12 +192,16 @@ public class TpdImporter { internalMonitor.beginTask("Loading data", 3); IProgressMonitor projectCreationMonitor = new SubProgressMonitor(internalMonitor, 1); projectCreationMonitor.beginTask("Creating required projects", projectsToImport.size()); - + //======================== + // Create projects and + // store load location + // (where they are loaded from) + //======================== Map projectMap = new HashMap(); for (URI file : projectsToImport.keySet()) { Document actualDocument = projectsToImport.get(file); - IProject project = createProject(actualDocument.getDocumentElement(), file.equals(projectFileURI) || !isSkipExistingProjects); + IProject project = createProject(actualDocument.getDocumentElement(), file.equals(resolvedProjectFileURI) || !isSkipExistingProjects); if (project == null) { projectCreationMonitor.worked(1); continue; @@ -202,8 +209,9 @@ public class TpdImporter { projectsCreated.add(project); projectMap.put(file, project); try { - project.setPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, - ProjectBuildPropertyData.LOAD_LOCATION), file.getPath().toString()); + project.setPersistentProperty( + new QualifiedName(ProjectBuildPropertyData.QUALIFIER, ProjectBuildPropertyData.LOAD_LOCATION), file.getPath() + .toString()); } catch (CoreException e) { ErrorReporter.logExceptionStackTrace("While loading referenced project from `" + file.getPath() + "'", e); } @@ -214,6 +222,9 @@ public class TpdImporter { IProgressMonitor normalInformationLoadingMonitor = new SubProgressMonitor(internalMonitor, 1); normalInformationLoadingMonitor.beginTask("Loading directly stored project information", projectsToImport.size()); + //==================================== + //Load Project Data from all projects: + //==================================== for (URI file : projectsToImport.keySet()) { if (!projectMap.containsKey(file)) { normalInformationLoadingMonitor.worked(1); @@ -233,11 +244,13 @@ public class TpdImporter { normalInformationLoadingMonitor.worked(1); } normalInformationLoadingMonitor.done(); - - IPath mainProjectFileFolderPath = new Path(projectFileURI.getPath()).removeLastSegments(1); + //===================================== + //Load information from packed projects + //===================================== + IPath mainProjectFileFolderPath = new Path(resolvedProjectFileURI.getPath()).removeLastSegments(1); URI mainProjectFileFolderURI = URIUtil.toURI(mainProjectFileFolderPath); - List packedProjects = loadPackedProjects(projectsToImport.get(projectFileURI)); + List packedProjects = loadPackedProjects(projectsToImport.get(resolvedProjectFileURI)); IProgressMonitor packedInformationLoadingMonitor = new SubProgressMonitor(internalMonitor, 1); packedInformationLoadingMonitor.beginTask("Loading packed project information", packedProjects.size()); for (Node node : packedProjects) { @@ -249,10 +262,11 @@ public class TpdImporter { projectsCreated.add(project); try { - project.setPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, - ProjectBuildPropertyData.LOAD_LOCATION), projectFileURI.toString()); + project.setPersistentProperty( + new QualifiedName(ProjectBuildPropertyData.QUALIFIER, ProjectBuildPropertyData.LOAD_LOCATION), + resolvedProjectFileURI.toString()); } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While loading packed project `" + project.getName() + "'",e); + ErrorReporter.logExceptionStackTrace("While loading packed project `" + project.getName() + "'", e); } if (!loadProjectDataFromNode(node, project, mainProjectFileFolderURI)) { @@ -263,7 +277,7 @@ public class TpdImporter { } packedInformationLoadingMonitor.done(); - IProject mainProject = projectMap.get(projectFileURI); + IProject mainProject = projectMap.get(resolvedProjectFileURI); if (mainProject == null) { internalMonitor.done(); return false; @@ -309,7 +323,7 @@ public class TpdImporter { try { job.join(); } catch (InterruptedException e) { - ErrorReporter.logExceptionStackTrace("Interrupted while performing: " + job.getName(),e); + ErrorReporter.logExceptionStackTrace("Interrupted while performing: " + job.getName(), e); } } } @@ -347,7 +361,7 @@ public class TpdImporter { try { ResourcesPlugin.getWorkspace().setDescription(description); } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("Resetting autobuild settings to" + wasAutoBuilding,e); + ErrorReporter.logExceptionStackTrace("Resetting autobuild settings to" + wasAutoBuilding, e); } } Activator.getDefault().resumeHandlingResourceChanges(); @@ -357,7 +371,7 @@ public class TpdImporter { * Collects the list of packed projects from the provided document. * * @param document - * the document to check. + * the document to check. * * @return the list of found packed projects, an empty list if none. * */ @@ -381,16 +395,14 @@ public class TpdImporter { } /** - * Loads the project data from the provided node onto the provided - * project. + * Loads the project data from the provided node onto the provided project. * * @param mainElement - * the node to load the data from. + * the node to load the data from. * @param project - * the project to set the loaded data on. + * the project to set the loaded data on. * @param projectFileFolderURI - * the URI of the folder to calculate all paths relative - * to. + * the URI of the folder to calculate all paths relative to. * * @return true if the import was successful, false otherwise. * */ @@ -438,10 +450,9 @@ public class TpdImporter { * Load the data related to project references. * * @param referencedProjectsNode - * the node containing information on referenced - * projects. + * the node containing information on referenced projects. * @param project - * the project to set the data on. + * the project to set the data on. * * @return true if the import was successful, false otherwise. * */ @@ -459,9 +470,8 @@ public class TpdImporter { } Node nameNode = attributeMap.getNamedItem(ProjectFormatConstants.REFERENCED_PROJECT_NAME_ATTRIBUTE); if (nameNode == null) { - displayError("Import failed", - "Error while importing project " + project.getName() + " the name attribute of the " - + i + " th referenced project is missing"); + displayError("Import failed", "Error while importing project " + project.getName() + " the name attribute of the " + i + + " th referenced project is missing"); return false; } @@ -472,6 +482,7 @@ public class TpdImporter { IProject tempProject = ResourcesPlugin.getWorkspace().getRoot().getProject(realProjectName); referencedProjects.add(tempProject); } else { + //already existing projects: IProject tempProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); referencedProjects.add(tempProject); } @@ -481,7 +492,7 @@ public class TpdImporter { description.setReferencedProjects(referencedProjects.toArray(new IProject[referencedProjects.size()])); project.setDescription(description, null); } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While setting project references for `" + project.getName() + "'",e); + ErrorReporter.logExceptionStackTrace("While setting project references for `" + project.getName() + "'", e); return false; } @@ -492,11 +503,11 @@ public class TpdImporter { * Load the information describing folders. * * @param foldersNode - * the node to load from. + * the node to load from. * @param project - * the project to set this information on. + * the project to set this information on. * @param projectFileFolderURI - * the location of the project file's folder. + * the location of the project file's folder. * * @return true if the import was successful, false otherwise. * */ @@ -515,10 +526,8 @@ public class TpdImporter { } Node projectRelativePathNode = attributeMap.getNamedItem(ProjectFormatConstants.FOLDER_ECLIPSE_LOCATION_NODE); if (projectRelativePathNode == null) { - displayError("Import failed", - "Error while importing project " + project.getName() - + " the project relative path attribute of the " + i - + " th folder is missing"); + displayError("Import failed", "Error while importing project " + project.getName() + + " the project relative path attribute of the " + i + " th folder is missing"); return false; } @@ -528,36 +537,59 @@ public class TpdImporter { Node rawURINode = attributeMap.getNamedItem(ProjectFormatConstants.FOLDER_RAW_LOCATION); IFolder folder = project.getFolder(projectRelativePath); - try { - if (relativeURINode != null) { - String relativeLocation = relativeURINode.getTextContent(); - - URI locationuri; - try { - locationuri = org.eclipse.core.runtime.URIUtil.fromString(relativeLocation); - } catch (URISyntaxException e) { - continue; - } - URI absoluteURI = org.eclipse.core.runtime.URIUtil.makeAbsolute(locationuri, projectFileFolderURI); - - if (TitanURIUtil.isPrefix(projectLocationURI, absoluteURI)) { - folder.create(false, true, null); + if (!folder.exists()) { + try { + if (relativeURINode != null) { + String relativeLocation = relativeURINode.getTextContent(); + URI absoluteURI = TITANPathUtilities.convertToAbsoluteURI(relativeLocation, projectFileFolderURI); + if (absoluteURI == null) { + // The URI cannot be resolved - for example it + // contains not existing environment variables + continue; + } + if (TitanURIUtil.isPrefix(projectLocationURI, absoluteURI)) { + folder.create(false, true, null); + } else { + File tmpFolder = new File(absoluteURI); + if (tmpFolder.exists()) { + folder.createLink(absoluteURI, IResource.ALLOW_MISSING_LOCAL, null); + } else { + ErrorReporter.logError("Error while importing folders into project `" + project.getName() + "'. Folder `" + + absoluteURI + "' does not exist"); + continue; + } + } + } else if (rawURINode != null) { + String rawLocation = rawURINode.getTextContent(); + URI absoluteURI = TITANPathUtilities.convertToAbsoluteURI(rawLocation, projectFileFolderURI); + if (TitanURIUtil.isPrefix(projectLocationURI, absoluteURI)) { + folder.create(false, true, null); + } else { + File tmpFolder = new File(absoluteURI); + if (tmpFolder.exists()) { + folder.createLink(absoluteURI, IResource.ALLOW_MISSING_LOCAL, null); + } else { + ErrorReporter.logError("Error while importing folders into project `" + project.getName() + "'. Folder `" + + absoluteURI + "' does not exist"); + continue; + } + } } else { - folder.createLink(absoluteURI, IResource.ALLOW_MISSING_LOCAL, null); + TITANDebugConsole + .getConsole() + .newMessageStream() + .println( + "Cannot create the resource " + folder.getFullPath().toString() + + " the location information is missing or corrupted"); } - } else if (rawURINode != null) { - String rawURI = rawURINode.getTextContent(); - folder.createLink(URI.create(rawURI), IResource.ALLOW_MISSING_LOCAL, null); - } else { - TITANDebugConsole.getConsole().newMessageStream() - .println("Can not create the resource " + folder.getFullPath().toString() - + " the location information is missing or corrupted"); + } catch (CoreException e) { + ErrorReporter.logExceptionStackTrace("While creating folder `" + folder.getName() + "'", e); } - } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While creating folder `" + folder.getName() + "'",e); + } else { + ErrorReporter.logWarning("Folder to be imported `" + folder.getName() + "' already exists in project `" + project.getName() + + "'"); } } - return true; } @@ -565,11 +597,11 @@ public class TpdImporter { * Load the information describing files. * * @param filesNode - * the node to load from. + * the node to load from. * @param project - * the project to set this information on. + * the project to set this information on. * @param projectFileFolderURI - * the location of the project file's folder. + * the location of the project file's folder. * * @return true if the import was successful, false otherwise. * */ @@ -587,10 +619,9 @@ public class TpdImporter { } Node projectRelativePathNode = attributeMap.getNamedItem(ProjectFormatConstants.FILE_ECLIPSE_LOCATION_NODE); if (projectRelativePathNode == null) { - displayError("Import failed", - "Error while importing project " + project.getName() + " some attributes of the " - + i + " th file are missing"); - return false; + displayError("Import failed", "Error while importing project " + project.getName() + " some attributes of the " + i + + " th file are missing"); + continue; } String projectRelativePath = projectRelativePathNode.getTextContent(); @@ -603,26 +634,44 @@ public class TpdImporter { try { if (relativeURINode != null) { String relativeLocation = relativeURINode.getTextContent(); - - URI locationuri; - try { - locationuri = org.eclipse.core.runtime.URIUtil.fromString(relativeLocation); - } catch (URISyntaxException e) { + URI absoluteURI = TITANPathUtilities.convertToAbsoluteURI(relativeLocation, projectFileFolderURI); + if (absoluteURI == null) { + continue; + } + File file = new File(absoluteURI); + if (file.exists()) { + targetFile.createLink(absoluteURI, IResource.ALLOW_MISSING_LOCAL, null); + } else { + ErrorReporter.logError("Error while importing files into project `" + project.getName() + "'. File `" + + absoluteURI + "' does not exist"); continue; } - URI absoluteURI = org.eclipse.core.runtime.URIUtil.makeAbsolute(locationuri, projectFileFolderURI); - - targetFile.createLink(absoluteURI, IResource.ALLOW_MISSING_LOCAL, null); } else if (rawURINode != null) { String rawURI = rawURINode.getTextContent(); - targetFile.createLink(URI.create(rawURI), IResource.ALLOW_MISSING_LOCAL, null); + URI absoluteURI = TITANPathUtilities.convertToAbsoluteURI(rawURI, projectFileFolderURI); + if (absoluteURI == null) { + continue; + } + File file = new File(absoluteURI); + if (file.exists()) { + targetFile.createLink(absoluteURI, IResource.ALLOW_MISSING_LOCAL, null); + } else { + ErrorReporter.logError("Error while importing files into project `" + project.getName() + "'. File `" + + absoluteURI + "' does not exist"); + continue; + } } else { - TITANDebugConsole.getConsole().newMessageStream() - .println("Can not create the resource " + targetFile.getFullPath().toString() - + " the location information is missing or corrupted"); + TITANDebugConsole + .getConsole() + .newMessageStream() + .println( + "Can not create the resource " + targetFile.getFullPath().toString() + + " the location information is missing or corrupted"); + continue; } } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While creating link for `" + targetFile + "'",e); + ErrorReporter.logExceptionStackTrace("While creating link for `" + targetFile + "'", e); + return false; } } } @@ -634,10 +683,9 @@ public class TpdImporter { * Load the information on path variables. * * @param rootNode - * the node to load from. + * the node to load from. * @param projectName - * the name of the project to be used on the user - * interface. + * the name of the project to be used on the user interface. * * @return true if the import was successful, false otherwise. * */ @@ -659,9 +707,8 @@ public class TpdImporter { Node valueNode = attributeMap.getNamedItem("value"); if (nameNode == null || valueNode == null) { - displayError("Import failed", - "Error while importing project " + projectName - + " some attributes of a path variable are missing"); + displayError("Import failed", "Error while importing project " + projectName + + " some attributes of a path variable are missing"); return false; } @@ -672,7 +719,7 @@ public class TpdImporter { try { pathVariableManager.setValue(variableName, new Path(variableValue)); } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While setting path variable `" + variableName + "' in headless mode",e); + ErrorReporter.logExceptionStackTrace("While setting path variable `" + variableName + "' in headless mode", e); } } else { Display.getDefault().syncExec(new Runnable() { @@ -682,8 +729,8 @@ public class TpdImporter { if (pathVariableManager.isDefined(variableName)) { IPath path = pathVariableManager.getValue(variableName); if (!variableValue.equals(path.toString())) { - EditPathVariableDialog dialog = new EditPathVariableDialog(shell, - variableName, path, new Path(variableValue)); + EditPathVariableDialog dialog = new EditPathVariableDialog(shell, variableName, path, new Path( + variableValue)); if (Window.OK == dialog.open()) { IPath actualValue = dialog.getActualValue(); pathVariableManager.setValue(variableName, actualValue); @@ -692,8 +739,7 @@ public class TpdImporter { } else { // check whether we have non null shell if (shell != null) { - NewPathVariableDialog dialog = new NewPathVariableDialog(shell, variableName, - new Path(variableValue)); + NewPathVariableDialog dialog = new NewPathVariableDialog(shell, variableName, new Path(variableValue)); if (Window.OK == dialog.open()) { IPath actualValue = dialog.getActualValue(); pathVariableManager.setValue(variableName, actualValue); @@ -701,7 +747,7 @@ public class TpdImporter { } } } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While setting path variable `" + variableName + "' in GUI mode",e); + ErrorReporter.logExceptionStackTrace("While setting path variable `" + variableName + "' in GUI mode", e); } } }); @@ -710,18 +756,15 @@ public class TpdImporter { return true; } - - /** * Loads the configuration related options onto the project from the * document being loaded. * * @param project - * the project to load onto. + * the project to load onto. * @param mainNodes - * the mainNodes to check for the configuration related - * options. + * the mainNodes to check for the configuration related options. * * @return true if the import was successful, false otherwise. * */ @@ -742,7 +785,7 @@ public class TpdImporter { "While setting `" + activeConfiguration + "' as configuration for project `" + project.getName() + "'", e); } - // Remove possible target configuration nodes in existance + // Remove possible target configuration nodes in existence removeConfigurationNodes(targetDocument.getDocumentElement()); Node configurationsNode = ProjectFileHandler.getNodebyName(mainNodes, ProjectFormatConstants.CONFIGURATIONS_NODE); @@ -766,9 +809,8 @@ public class TpdImporter { } Node nameNode = attributeMap.getNamedItem(ProjectFormatConstants.CONFIGURATION_NAME_ATTRIBUTE); if (nameNode == null) { - displayError("Import failed", - "Error while importing project " + project.getName() - + " the name attribute of a referenced project is missing"); + displayError("Import failed", "Error while importing project " + project.getName() + + " the name attribute of a referenced project is missing"); return false; } @@ -786,7 +828,7 @@ public class TpdImporter { } ProjectDocumentHandlingUtility.saveDocument(project); - ProjectBuildPropertyData.setProjectAlreadyExported(project,false); + ProjectBuildPropertyData.setProjectAlreadyExported(project, false); ProjectFileHandler handler = new ProjectFileHandler(project); handler.loadProjectSettingsFromDocument(targetDocument); @@ -798,7 +840,7 @@ public class TpdImporter { * handling configuration data. * * @param rootNode - * the node to use. + * the node to use. * */ private void removeConfigurationNodes(final Node rootNode) { NodeList rootNodeList = rootNode.getChildNodes(); @@ -826,14 +868,13 @@ public class TpdImporter { } /** - * Copies the configuration related data from the source node, to the - * target node. + * Copies the configuration related data from the source node, to the target + * node. * * @param targetRoot - * the node where the configuration data should be moved - * to. + * the node where the configuration data should be moved to. * @param sourceRoot - * the node from where the configuration data is moved. + * the node from where the configuration data is moved. * */ private void copyConfigurationData(final Element targetRoot, final Node sourceRoot) { final Document document = targetRoot.getOwnerDocument(); @@ -842,8 +883,7 @@ public class TpdImporter { for (int i = 0, size = rootList.getLength(); i < size; i++) { Node tempNode = rootList.item(i); String nodeName = tempNode.getNodeName(); - if (ProjectFileHandler.PROJECTPROPERTIESXMLNODE.equals(nodeName) - || ProjectFileHandler.FOLDERPROPERTIESXMLNODE.equals(nodeName) + if (ProjectFileHandler.PROJECTPROPERTIESXMLNODE.equals(nodeName) || ProjectFileHandler.FOLDERPROPERTIESXMLNODE.equals(nodeName) || ProjectFileHandler.FILEPROPERTIESXMLNODE.equals(nodeName)) { targetNode = document.importNode(tempNode, true); ProjectFileHandler.clearNode(targetNode); @@ -903,15 +943,25 @@ public class TpdImporter { } String originalProjectName = projectNameNode.getFirstChild().getTextContent(); String projectName = originalProjectName; - finalProjectNames.put(originalProjectName, projectName); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (project.exists()) { + if (!treatExistingProjectAsError || headless) { - ErrorReporter.logWarning("A project with the name " + projectName + " already exists, skipping it !"); + + if(!project.isOpen()) { + try { + project.open(null); + } catch(CoreException e) { + ErrorReporter.logError("An existing project with the name " + projectName + " cannot be opened!"); + } + } + ErrorReporter.logWarning("A project with the name " + projectName + " already exists, skipping it!"); + //It will be skipped => return null; } - + //Error dialog: + //gets a new project name instead of the existing one: ProjectSelector temp = new ProjectSelector(projectName); Display.getDefault().syncExec(temp); if (temp.cancelled) { @@ -933,7 +983,7 @@ public class TpdImporter { try { TITANNature.addTITANBuilderToProject(project); } catch (CoreException e) { - ErrorReporter.logExceptionStackTrace("While adding builder to `" + project.getName() + "'",e); + ErrorReporter.logExceptionStackTrace("While adding builder to `" + project.getName() + "'", e); } return project; @@ -941,16 +991,15 @@ public class TpdImporter { /** * Load the project information document from the provided file and - * recursively for all project files mentioned in the referenced - * projects section. + * recursively for all project files mentioned in the referenced projects + * section. * * @param file - * the file to load the data from. + * the file to load the data from. * @param source - * the source file referencing the target, or null if - * none. + * the source file referencing the target, or null if none - NOT USED, TO BE REMOVED * @param validator - * the xml validator. can be null + * the xml validator. can be null * * @return true if there were no errors, false otherwise. * */ @@ -981,7 +1030,8 @@ public class TpdImporter { try { validator.validate(new StreamSource(new File(file))); } catch (final Exception e) { - ErrorReporter.logExceptionStackTrace("Error while importing from file " + file + ": " + System.getProperty("line.separator"), e); + ErrorReporter.logExceptionStackTrace( + "Error while importing from file " + file + ": " + System.getProperty("line.separator"), e); return false; } } @@ -997,6 +1047,7 @@ public class TpdImporter { return true; } + // === Get referenced projects === final IPath projectFileFolderPath = new Path(file.getPath()).removeLastSegments(1); NodeList referencedProjectsList = referencedProjectsNode.getChildNodes(); boolean result = true; @@ -1011,9 +1062,8 @@ public class TpdImporter { } Node nameNode = attributeMap.getNamedItem(ProjectFormatConstants.REFERENCED_PROJECT_NAME_ATTRIBUTE); if (nameNode == null) { - displayError("Import failed", - "Error while importing from file " + file - + " the name attribute of a referenced project is missing"); + displayError("Import failed", "Error while importing from file " + file + + " the name attribute of a referenced project is missing"); return false; } @@ -1021,25 +1071,18 @@ public class TpdImporter { Node locationNode = attributeMap.getNamedItem(ProjectFormatConstants.REFERENCED_PROJECT_LOCATION_ATTRIBUTE); if (locationNode == null) { displayError("Import failed", "Error while importing from file " + file - + " the location attribute of the referenced project " + projectName - + " is not given."); + + " the location attribute of the referenced project " + projectName + " is not given."); return false; } - String relativeLocation = locationNode.getTextContent(); + String unresolvedProjectLocationURI = locationNode.getTextContent(); - URI locationuri = null; - try { - locationuri = org.eclipse.core.runtime.URIUtil.fromString(relativeLocation); - } catch (URISyntaxException e) { - ErrorReporter.logExceptionStackTrace("While converting relative location from `" + relativeLocation + "'",e); - return false; - } - URI absoluteURI = org.eclipse.core.runtime.URIUtil.makeAbsolute(locationuri, URIUtil.toURI(projectFileFolderPath)); - if (!"file".equals(absoluteURI.getScheme())) { + URI absoluteURI = TITANPathUtilities.convertToAbsoluteURI(unresolvedProjectLocationURI, URIUtil.toURI(projectFileFolderPath)); + + if (absoluteURI!=null && !"file".equals(absoluteURI.getScheme())) { final StringBuilder builder = new StringBuilder( - "Loading of project information is only supported for local files right now. " - + absoluteURI.toString() + " could not be loaded\n"); + "Loading of project information is only supported for local files right now. " + absoluteURI.toString() + + " could not be loaded\n"); for (int j = importChain.size() - 1; j >= 0; --j) { builder.append("imported by: '"); builder.append(importChain.get(j).toString()); @@ -1050,7 +1093,10 @@ public class TpdImporter { } importChain.add(file); - result &= loadURIDocuments(absoluteURI, file, validator); +// if( !projectsWithUnresolvedName.containsKey(absoluteURI) ) { +// projectsWithUnresolvedName.put(absoluteURI, unresolvedProjectLocationURI); +// } + result &= loadURIDocuments(absoluteURI, null, validator); importChain.remove(importChain.size() - 1); } @@ -1068,7 +1114,7 @@ public class TpdImporter { * Extracts an XML document from the provided file. * * @param file - * the file to read from. + * the file to read from. * @return the extracted XML document, or null if there were some error. * */ public Document getDocumentFromFile(final String file) { @@ -1080,7 +1126,7 @@ public class TpdImporter { document = parser.parse(lsInput); istream.close(); } catch (Exception e) { - ErrorReporter.logExceptionStackTrace("While getting the document from `" + file + "'",e); + ErrorReporter.logExceptionStackTrace("While getting the document from `" + file + "'", e); } return document; @@ -1098,9 +1144,9 @@ public class TpdImporter { final IProjectDescription description = workspace.newProjectDescription(name); /* - * A new project description in normal conditions does not - * contain any natures but as internal behavior tends to change - * without notification we can not rely on it. + * A new project description in normal conditions does not contain any + * natures but as internal behavior tends to change without notification + * we can not rely on it. */ List newIds = new ArrayList(); newIds.addAll(Arrays.asList(description.getNatureIds())); @@ -1150,18 +1196,16 @@ public class TpdImporter { * Creating a new project. * * @param description - * - IProjectDescription that belongs to the newly - * created project. + * - IProjectDescription that belongs to the newly created + * project. * @param projectHandle - * - a project handle that is used to create the new - * project. + * - a project handle that is used to create the new project. * @param monitor - * - reference to the monitor object + * - reference to the monitor object * @exception CoreException - * thrown if access to the resources throws a - * CoreException. + * thrown if access to the resources throws a CoreException. * @exception OperationCanceledException - * if the operation was canceled by the user. + * if the operation was canceled by the user. */ protected void createProject(final IProjectDescription description, final IProject projectHandle, final IProgressMonitor monitor) throws CoreException { diff --git a/org.eclipse.titan.executor/META-INF/MANIFEST.MF b/org.eclipse.titan.executor/META-INF/MANIFEST.MF index a9d4146b2c932a2fef115e68be38d9d2f1322250..767f645e7eee8b95f9200e07e752c1f6d36eefb2 100755 --- a/org.eclipse.titan.executor/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.executor/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Created-By: 23.6-b04 (Oracle Corporation) Bundle-ManifestVersion: 2 Bundle-Name: TITAN_Executor Plug-in Bundle-SymbolicName: org.eclipse.titan.executor;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 +Bundle-Version: 5.4.2.CRL_113_200_5_R4C_20160105-1100 Bundle-Activator: org.eclipse.titan.executor.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.variables, org.eclipse.debug.ui, org.eclipse.core.expressions, - org.eclipse.titan.common;bundle-version="5.4.0" + org.eclipse.titan.common;bundle-version="5.4.1" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-Vendor: Eclipse Titan Project diff --git a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/BaseExecutor.java b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/BaseExecutor.java index dd3d4fae1fb4102a7f1f19ed906986b123627cde..50b84d09e85faa1e416e71c3d414d192d4ab95f2 100644 --- a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/BaseExecutor.java +++ b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/BaseExecutor.java @@ -139,6 +139,7 @@ public abstract class BaseExecutor { protected boolean verdictExtraction; protected boolean keepTemporarilyGeneratedConfigFiles; protected boolean logFileNameDefined = false; + protected String mLogFileName = null; protected boolean logFilesMerged = false; protected String mcPort; @@ -451,10 +452,7 @@ public abstract class BaseExecutor { return; } - if (!logFileNameDefined) { - mergeLogFiles(); - return; // resources are refreshed during the merge - } + mergeLogFiles(); if (project == null) { return; @@ -600,26 +598,53 @@ public abstract class BaseExecutor { protected abstract String getDefaultLogFileName(); /** - * Creates the content of the configuration file - * @return the generated cfg string + * @return the relative directory path of the default log file from the preferences */ - protected String generateCfgString() { - StringBuilder builder = new StringBuilder(); + private String getDefaultLogFileDir() { + //TODO + /* final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); String logFolder = getOverlayedPreferenceValue(preferenceStore, project, PreferenceConstants.EXECUTOR_PREFERENCE_PAGE_ID, PreferenceConstants.SET_LOG_FOLDER); if (!logFileNameDefined && Boolean.parseBoolean(logFolder)) { - String workingDirRelative = getOverlayedPreferenceValue(preferenceStore, project, + return getOverlayedPreferenceValue(preferenceStore, project, PreferenceConstants.EXECUTOR_PREFERENCE_PAGE_ID, PreferenceConstants.LOG_FOLDER_PATH_NAME); - - if (workingDirRelative != null && workingDirRelative.length() != 0) { - builder.append("\n//This part was added by the TITAN Executor.\n"); - builder.append("[LOGGING]\n"); - builder.append("LogFile := "); - builder.append("\"" + "." + IPath.SEPARATOR + workingDirRelative + IPath.SEPARATOR); - builder.append(getDefaultLogFileName()); - builder.append("\"\n\n"); - } + } + return null; + */ + // log files are created in the bin (actual) directory + // until temporary cfg file creation is fixed: + // - ../log/MyExample-%n.log file is set as LogFile if it's not provided by the input cfg file + return "."; + } + + /** + * @return the relative path of the log dir (from the cfg file, or the default from the preferences) + */ + private String getLogDir() { + if ( this.logFileNameDefined && mLogFileName != null ) { + File file = new File(mLogFileName); + String parent = file.getParent(); + return parent != null ? parent : ""; + } + + return this.getDefaultLogFileDir(); + } + + /** + * Creates the content of the configuration file + * @return the generated cfg string + */ + protected String generateCfgString() { + StringBuilder builder = new StringBuilder(); + String workingDirRelative = getDefaultLogFileDir(); + if (workingDirRelative != null && workingDirRelative.length() != 0) { + builder.append("\n//This part was added by the TITAN Executor.\n"); + builder.append("[LOGGING]\n"); + builder.append("LogFile := "); + builder.append("\"" + "." + IPath.SEPARATOR + workingDirRelative + IPath.SEPARATOR); + builder.append(getDefaultLogFileName()); + builder.append("\"\n\n"); } return builder.toString(); } @@ -649,7 +674,7 @@ public abstract class BaseExecutor { configHandler.setEnvMap(env); configHandler.processASTs(); logFileNameDefined = configHandler.isLogFileNameDefined(); - + mLogFileName = configHandler.getLogFileName(); return configHandler; } @@ -658,14 +683,14 @@ public abstract class BaseExecutor { */ protected void deleteLogFiles() { final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); - if (logFileNameDefined - ||!isLogFolderSet(preferenceStore) - || !isDeleteLogFilesSet(preferenceStore)) { + if ( !isDeleteLogFilesSet( preferenceStore ) ) { return; } - String workingDirRelative = getOverlayedPreferenceValue( - preferenceStore, project, PreferenceConstants.EXECUTOR_PREFERENCE_PAGE_ID, PreferenceConstants.LOG_FOLDER_PATH_NAME); + String workingDirRelative = getLogDir(); + if ( workingDirRelative == null ) { + return; + } String logFileFolder = workingdirectoryPath + File.separator + workingDirRelative + File.separator; Path path = new Path(logFileFolder); @@ -716,20 +741,20 @@ public abstract class BaseExecutor { * Merges the generated log files together. */ protected void mergeLogFiles() { - if (logFilesMerged) { + if (logFilesMerged) { return; } else { logFilesMerged = true; } final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); - if (!isLogFolderSet(preferenceStore) - || !isAutomaticMergeEnabled(preferenceStore)) { + if ( !isAutomaticMergeEnabled( preferenceStore ) ) { return; } - String workingDirRelative = getOverlayedPreferenceValue( - preferenceStore, project, PreferenceConstants.EXECUTOR_PREFERENCE_PAGE_ID, PreferenceConstants.LOG_FOLDER_PATH_NAME); - //old: preferenceStore.getString(PreferenceConstants.LOG_FOLDER_PATH_NAME); + String workingDirRelative = getLogDir(); + if ( workingDirRelative == null ) { + return; + } String logFileFolder = workingdirectoryPath + File.separator + workingDirRelative + File.separator; Path path = new Path(logFileFolder); diff --git a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/TitanLaunchConfigurationDelegate.java b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/TitanLaunchConfigurationDelegate.java index e713a4d848d151db209f31a842916a076d213f68..5f292d144e4252bec60288763a58ec93f12b1978 100644 --- a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/TitanLaunchConfigurationDelegate.java +++ b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/TitanLaunchConfigurationDelegate.java @@ -37,6 +37,7 @@ public abstract class TitanLaunchConfigurationDelegate extends LaunchConfigurati protected IProject[] getBuildOrder(final ILaunchConfiguration configuration, final String mode) throws CoreException { IResource[] resources = configuration.getMappedResources(); + if( resources == null) { return null; } final List result = new ArrayList(); for (final IResource resource : resources) { if (resource instanceof IProject) { diff --git a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/jni/LaunchConfigurationDelegate.java b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/jni/LaunchConfigurationDelegate.java index d0ece584561b0f60d01bfdad53ce3fb5f00f8d32..00c6554ea8d3e5278de56de2e934e3a6eba89a75 100644 --- a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/jni/LaunchConfigurationDelegate.java +++ b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/executors/jni/LaunchConfigurationDelegate.java @@ -24,8 +24,8 @@ import org.eclipse.titan.executor.jni.JNIMiddleWare; public final class LaunchConfigurationDelegate extends TitanLaunchConfigurationDelegate { /** { ttcn3_major, ttcn3_minor, ttcn3_patchlevel, ttcn3_buildnumber } */ - private final ProductIdentity versionLow = ProductIdentity.getProductIdentity(ProductIdentity.TITAN_PRODUCT_NUMBER, 5, 4, 0, 0); - private final ProductIdentity versionHigh = ProductIdentity.getProductIdentity(ProductIdentity.TITAN_PRODUCT_NUMBER, 5, 4, 0, 0); + private final ProductIdentity versionLow = ProductIdentity.getProductIdentity(ProductIdentity.TITAN_PRODUCT_NUMBER, 5, 4, 2, 0); + private final ProductIdentity versionHigh = ProductIdentity.getProductIdentity(ProductIdentity.TITAN_PRODUCT_NUMBER, 5, 4, 2, 0); @Override public void launch(final ILaunchConfiguration arg0, final String arg1, final ILaunch arg2, final IProgressMonitor arg3) throws CoreException { diff --git a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/preferences/PreferenceInitializer.java b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/preferences/PreferenceInitializer.java index 853f5dd074394d0d57d330eff15a08d35b0784fb..d15b5a70b96d461aee7de1daf58be5d778bbdf0a 100644 --- a/org.eclipse.titan.executor/src/org/eclipse/titan/executor/preferences/PreferenceInitializer.java +++ b/org.eclipse.titan.executor/src/org/eclipse/titan/executor/preferences/PreferenceInitializer.java @@ -9,7 +9,6 @@ package org.eclipse.titan.executor.preferences; import java.io.File; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.titan.executor.Activator; diff --git a/org.eclipse.titan.help/META-INF/MANIFEST.MF b/org.eclipse.titan.help/META-INF/MANIFEST.MF index c8125b4d0e9722e195ee82a5a4da9149f73c0764..c7d6157a6b7cfae8de6ea47717339ef8bc925f41 100755 --- a/org.eclipse.titan.help/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.help/META-INF/MANIFEST.MF @@ -4,6 +4,6 @@ Created-By: 23.6-b04 (Oracle Corporation) Bundle-ManifestVersion: 2 Bundle-Name: TITAN_Help Plug-in Bundle-SymbolicName: org.eclipse.titan.help;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 +Bundle-Version: 5.4.2.CRL_113_200_5_R4C_20160105-1100 Bundle-Vendor: Eclipse Titan Project diff --git a/org.eclipse.titan.log.viewer/META-INF/MANIFEST.MF b/org.eclipse.titan.log.viewer/META-INF/MANIFEST.MF index 85e63748d96f8bd10c0599309993a8532f0d3978..9ab2f59d2539bd23b56204d50d314747d1462aa1 100755 --- a/org.eclipse.titan.log.viewer/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.log.viewer/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Created-By: 23.6-b04 (Oracle Corporation) Bundle-ManifestVersion: 2 Bundle-Name: TITAN Log Viewer Bundle-SymbolicName: org.eclipse.titan.log.viewer;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 +Bundle-Version: 5.4.2.CRL_113_200_5_R4C_20160105-1100 Bundle-Activator: org.eclipse.titan.log.viewer.Activator Bundle-Vendor: Eclipse Titan Project Require-Bundle: org.eclipse.core.resources, @@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.jface.text, org.eclipse.ui.editors, org.eclipse.ui.workbench.texteditor, - org.eclipse.titan.common;bundle-version="5.4.0" + org.eclipse.titan.common;bundle-version="5.4.2" Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-ClassPath: . diff --git a/org.eclipse.titan.regressiontests/META-INF/MANIFEST.MF b/org.eclipse.titan.regressiontests/META-INF/MANIFEST.MF index f30dbf7b8fe373209b03061a4660acccd4d7ca19..32cf471b2ba48e1902b10d36a43894b7e42fa10a 100644 --- a/org.eclipse.titan.regressiontests/META-INF/MANIFEST.MF +++ b/org.eclipse.titan.regressiontests/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Test_fragment Fragment Bundle-SymbolicName: org.eclipse.titan.regressiontests;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 -Fragment-Host: org.eclipse.titan.designer;bundle-version="5.4.0.CRL_113_200_5_R4A_20151030-1100" +Bundle-Version: 5.4.1.CRL_113_200_5_R4B_20151202-1100 +Fragment-Host: org.eclipse.titan.designer;bundle-version="5.4.1.CRL_113_200_5_R4B_20151202-1100" Require-Bundle: org.eclipse.ui, org.eclipse.core.resources, org.junit diff --git a/org.eclipse.titan.regressiontests/src/org/eclipse/titan/regressiontests/common/cfg/ConfigFileTest.java b/org.eclipse.titan.regressiontests/src/org/eclipse/titan/regressiontests/common/cfg/ConfigFileTest.java index 732494f36da2f266a2b32aed945e4e88b99ef4b4..8bda261f588dcac54ca11808347e744933b12beb 100644 --- a/org.eclipse.titan.regressiontests/src/org/eclipse/titan/regressiontests/common/cfg/ConfigFileTest.java +++ b/org.eclipse.titan.regressiontests/src/org/eclipse/titan/regressiontests/common/cfg/ConfigFileTest.java @@ -18,7 +18,7 @@ public class ConfigFileTest { @Test public void configFileParserTest() { - Designer_plugin_tests.checkSyntaxMarkersOnFile(config_cfg_initializer(), "bin/config.cfg"); + Designer_plugin_tests.checkSyntaxMarkersOnFile(config_cfg_initializer(), "cfg/config.cfg"); } private ArrayList config_cfg_initializer() { diff --git a/org.eclipse.titanium/META-INF/MANIFEST.MF b/org.eclipse.titanium/META-INF/MANIFEST.MF index 0b8cca21f7d51c6e7a40ff80eee04022fcd5939e..18d02f7e743dbae42b7293eb4889d2bf9d792514 100644 --- a/org.eclipse.titanium/META-INF/MANIFEST.MF +++ b/org.eclipse.titanium/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Titanium Bundle-SymbolicName: org.eclipse.titanium;singleton:=true -Bundle-Version: 5.4.0.CRL_113_200_5_R4A_20151030-1100 +Bundle-Version: 5.4.2.CRL_113_200_5_R4C_20160105-1100 Bundle-Activator: org.eclipse.titanium.Activator Bundle-Vendor: Eclipse Titan Project Require-Bundle: org.eclipse.ui, @@ -14,8 +14,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ltk.core.refactoring, org.eclipse.ui.forms, - org.eclipse.titan.common;bundle-version="5.4.0", - org.eclipse.titan.designer;bundle-version="5.4.0", + org.eclipse.titan.common;bundle-version="5.4.2", + org.eclipse.titan.designer;bundle-version="5.4.2", org.eclipse.core.filesystem;bundle-version="1.3.200", org.eclipse.core.resources, org.apache.poi;bundle-version="3.9.0" diff --git a/org.eclipse.titanium/docs/referenceguide.docx b/org.eclipse.titanium/docs/referenceguide.docx index 54b43e48c3915de919ba7e5c2152b816c12b80a2..9facb42ab70148465e12039ff537a65c274944d0 100644 Binary files a/org.eclipse.titanium/docs/referenceguide.docx and b/org.eclipse.titanium/docs/referenceguide.docx differ diff --git a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/InfiniteLoop.java b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/InfiniteLoop.java index 8222a9e73ab5885aade00517d6dbdfaeeb8403ab..1182d143dca40351073c7ba66528e049b47fcf24 100644 --- a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/InfiniteLoop.java +++ b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/InfiniteLoop.java @@ -75,6 +75,9 @@ public class InfiniteLoop { } Value finalExpression = s.getFinalExpression(); + if (finalExpression == null) { + return; + } CompilationTimeStamp timestamp = CompilationTimeStamp.getBaseTimestamp(); finalExpression.setLoweridToReference(timestamp); IValue lastValue = finalExpression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null); diff --git a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/IterateOnWrongArray.java b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/IterateOnWrongArray.java index 664cc2d8f23d857b3544ce64957107d65a00a290..84d40f18fd659fdc53a49442a6aae0bcf52ba942 100644 --- a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/IterateOnWrongArray.java +++ b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/IterateOnWrongArray.java @@ -69,6 +69,9 @@ public class IterateOnWrongArray extends BaseModuleCodeSmellSpotter { //find the array over which the loop iterates Value finalExpr = fs.getFinalExpression(); FinalExprVisitor exprVisitor = new FinalExprVisitor(); + if (finalExpr == null) { + return; + } finalExpr.accept(exprVisitor); List arraysIterated = exprVisitor.getArraysIterated(); if (arraysIterated.isEmpty()) { diff --git a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/Lazy.java b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/Lazy.java index 10e33bf839f591da2c10a916a153cb140a619fa7..5fec4d66dbd36583e2428156408acfcdd064cfa4 100644 --- a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/Lazy.java +++ b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/Lazy.java @@ -43,7 +43,7 @@ import org.eclipse.titanium.markers.types.CodeSmellType; * Also ... if an "in" parameter is not used on every possible execution path, * the code might become faster if it is set as @lazy. * - * @author Péter Oláh + * @author Peter Olah */ public class Lazy extends BaseModuleCodeSmellSpotter { private static final String ERROR_MESSAGE = "The {0} parameter should {1}be @lazy"; @@ -109,7 +109,7 @@ public class Lazy extends BaseModuleCodeSmellSpotter { * Def_Altstep or Def_Function or Def_Testcase as root because it is the * StartNode. * - * @author Péter Oláh + * @author Peter Olah */ public class RelevantNodeBuilder extends ASTVisitor { @@ -226,7 +226,7 @@ public class Lazy extends BaseModuleCodeSmellSpotter { /** * This class collects default and in FormalParameters. * - * @author Péter Oláh + * @author Peter Olah */ public class RelevantFormalParameterCollector extends ASTVisitor { private List items; diff --git a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/PrivateViaPublic.java b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/PrivateViaPublic.java index f1b740a0cd7796d6a529dc3851b1b5d7d2375d33..5d2acd4c0fefbc71dc4be19887eb0f694bd94ff7 100644 --- a/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/PrivateViaPublic.java +++ b/org.eclipse.titanium/src/org/eclipse/titanium/markers/spotters/implementation/PrivateViaPublic.java @@ -40,7 +40,7 @@ import org.eclipse.titanium.markers.types.CodeSmellType; * parts. PrivateViaPublic.Field class marks references and explicit field * assignments. PrivateViaPublic.Value class marks value of private field assignments. * - * @author Péter Oláh + * @author Peter Olah */ public class PrivateViaPublic { diff --git a/org.eclipse.titanium/src/org/eclipse/titanium/markers/types/CodeSmellType.java b/org.eclipse.titanium/src/org/eclipse/titanium/markers/types/CodeSmellType.java index bf1b9407da6ec445a05fc83dc3877486abd1a341..8d2f28e002b2dcab3c5c219b22cd3fff92aa471a 100644 --- a/org.eclipse.titanium/src/org/eclipse/titanium/markers/types/CodeSmellType.java +++ b/org.eclipse.titanium/src/org/eclipse/titanium/markers/types/CodeSmellType.java @@ -36,11 +36,11 @@ public enum CodeSmellType implements ProblemType{ MISSING_FRIEND("Missing friend module", 0.0, 0.5, 3.5), MISSING_IMPORT("Missing import", 0.0, 0.5, 3.5), MODULENAME_IN_DEFINITION("Module name in definition", 0.0, 1.0, 3.5), - LAZY("Lazy formalparameter", 0.0, 2.0, 5.0), + LAZY("Lazy formalparameter", 0.5, 0.5, 1.0), LOGIC_INVERSION("Logic inversion", 0.0, 0.5, 3.5), NONPRIVATE_PRIVATE("Definition should be private", 0.0, 0.5, 4.5), - PRIVATE_FIELD_VIA_PUBLIC("Private field wrapped into public definition", 0.0, 0.0, 0.0), - PRIVATE_VALUE_VIA_PUBLIC("Private field wrapped into public definition", 0.0, 0.0, 0.0), + PRIVATE_FIELD_VIA_PUBLIC("Private field wrapped into public definition", 1.0, 2.0, 6.5), + PRIVATE_VALUE_VIA_PUBLIC("Private field wrapped into public definition", 1.0, 2.0, 6.5), READING_OUT_PAR_BEFORE_WRITTEN("Reading out parameter before written", 0.0, 0.5, 2.0), READONLY_LOC_VARIABLE("Readonly local variable", 0.0, 2.0, 5.0), READONLY_OUT_PARAM("Readonly out formal parameter", 0.0, 2.0, 5.0),