mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
patch from Bala Torati with small modifications
1. Fix for [Bug 184449] [Template Engine] It should be possible to press "Finish" on the first wizard page for templates having default values assigned 2. Fix for [Bug 184593] [Template Engine] Need a way to add tool-chain associations to existing templates 3. Fix for [Bug 184455] [Template Engine] NPE in template engine tests
This commit is contained in:
parent
463823931b
commit
13968f3102
22 changed files with 391 additions and 114 deletions
|
@ -6657,34 +6657,42 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.core.templates">
|
point="org.eclipse.cdt.core.templates">
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.AppendToMBSStringOptionValue"
|
||||||
filterPattern=".*AppendToMBSStringOptionValue"
|
filterPattern=".*AppendToMBSStringOptionValue"
|
||||||
location="testdata/AppendToMBSStringOptionValue.xml"
|
location="testdata/AppendToMBSStringOptionValue.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.AppendToMBSStringListOptionValues"
|
||||||
filterPattern=".*AppendToMBSStringListOptionValues"
|
filterPattern=".*AppendToMBSStringListOptionValues"
|
||||||
location="testdata/AppendToMBSStringListOptionValues.xml"
|
location="testdata/AppendToMBSStringListOptionValues.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.CreateIncludeFolder"
|
||||||
filterPattern=".*CreateIncludeFolder"
|
filterPattern=".*CreateIncludeFolder"
|
||||||
location="testdata/CreateIncludeFolder.xml"
|
location="testdata/CreateIncludeFolder.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.ExcludeResources"
|
||||||
filterPattern=".*ExcludeResources"
|
filterPattern=".*ExcludeResources"
|
||||||
location="testdata/ExcludeResources.xml"
|
location="testdata/ExcludeResources.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.NewManagedProject"
|
||||||
filterPattern=".*NewManagedProject"
|
filterPattern=".*NewManagedProject"
|
||||||
location="testdata/NewManagedProject.xml"
|
location="testdata/NewManagedProject.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.SetMBSBooleanOptionValue"
|
||||||
filterPattern=".*SetMBSBooleanOptionValue"
|
filterPattern=".*SetMBSBooleanOptionValue"
|
||||||
location="testdata/SetMBSBooleanOptionValue.xml"
|
location="testdata/SetMBSBooleanOptionValue.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.SetMBSStringOptionValue"
|
||||||
filterPattern=".*SetMBSStringOptionValue"
|
filterPattern=".*SetMBSStringOptionValue"
|
||||||
location="testdata/SetMBSStringOptionValue.xml"
|
location="testdata/SetMBSStringOptionValue.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.tests.templates.SetMBSStringListOptionValues"
|
||||||
filterPattern=".*SetMBSStringListOptionValues"
|
filterPattern=".*SetMBSStringListOptionValues"
|
||||||
location="testdata/SetMBSStringListOptionValues.xml"
|
location="testdata/SetMBSStringListOptionValues.xml"
|
||||||
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.managedbuilder.core.tests.projectType"/>
|
||||||
|
|
|
@ -3733,29 +3733,42 @@
|
||||||
|
|
||||||
<extension point="org.eclipse.cdt.core.templates">
|
<extension point="org.eclipse.cdt.core.templates">
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.build.core.templates.HelloWorldCCProject"
|
||||||
filterPattern=".*"
|
filterPattern=".*"
|
||||||
location="templates/projecttemplates/HelloWorldCCProject/template.xml"
|
location="templates/projecttemplates/HelloWorldCCProject/template.xml"
|
||||||
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
|
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
|
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
|
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base"/>
|
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.solaris.base"/>
|
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.build.templates.HelloWorldCAnsiProject"
|
||||||
filterPattern=".*"
|
filterPattern=".*"
|
||||||
location="templates/projecttemplates/HelloWorldCAnsiProject/template.xml"
|
location="templates/projecttemplates/HelloWorldCAnsiProject/template.xml"
|
||||||
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
id="org.eclipse.cdt.build.core.templates.EmptyProject"
|
||||||
|
filterPattern=".*"
|
||||||
|
location="templates/projecttemplates/EmptyProject/template.xml"
|
||||||
|
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
||||||
|
</template>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.templateAssociations">
|
||||||
|
<template id="org.eclipse.cdt.build.core.templates.EmptyProject">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base"/>
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.solaris.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.solaris.base"/>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template id="org.eclipse.cdt.build.core.templates.HelloWorldCAnsiProject">
|
||||||
filterPattern=".*"
|
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
|
||||||
location="templates/projecttemplates/EmptyProject/template.xml"
|
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
|
||||||
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base"/>
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.solaris.base"/>
|
||||||
|
</template>
|
||||||
|
<template id="org.eclipse.cdt.build.core.templates.HelloWorldCCProject">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base"/>
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base"/>
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
|
<toolChain id="cdt.managedbuild.toolchain.gnu.base"/>
|
||||||
|
|
|
@ -65,12 +65,14 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.core.templates">
|
point="org.eclipse.cdt.core.templates">
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.AddFile"
|
||||||
filterPattern=".*AddFile"
|
filterPattern=".*AddFile"
|
||||||
isCategory="true"
|
isCategory="true"
|
||||||
location="testdata/AddFile.xml"
|
location="testdata/AddFile.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType">
|
projectType="org.eclipse.cdt.core.tests.projectType">
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.AddFiles"
|
||||||
filterPattern=".*AddFiles"
|
filterPattern=".*AddFiles"
|
||||||
location="testdata/AddFiles.xml"
|
location="testdata/AddFiles.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType">
|
projectType="org.eclipse.cdt.core.tests.projectType">
|
||||||
|
@ -78,30 +80,49 @@
|
||||||
<toolChain id="org.eclipse.cdt.core.tests.toolChain2"/>
|
<toolChain id="org.eclipse.cdt.core.tests.toolChain2"/>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.AddLink"
|
||||||
filterPattern=".*AddLink"
|
filterPattern=".*AddLink"
|
||||||
location="testdata/AddLink.xml"
|
location="testdata/AddLink.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType">
|
projectType="org.eclipse.cdt.core.tests.projectType">
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.Append"
|
||||||
filterPattern=".*Append"
|
filterPattern=".*Append"
|
||||||
location="testdata/Append.xml"
|
location="testdata/Append.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.AppendCreate"
|
||||||
filterPattern=".*AppendCreate"
|
filterPattern=".*AppendCreate"
|
||||||
location="testdata/AppendCreate.xml"
|
location="testdata/AppendCreate.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.Copy"
|
||||||
filterPattern=".*Copy"
|
filterPattern=".*Copy"
|
||||||
location="testdata/Copy.xml"
|
location="testdata/Copy.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.CreateResourceIdentifier"
|
||||||
filterPattern=".*CreateResourceIdentifier"
|
filterPattern=".*CreateResourceIdentifier"
|
||||||
location="testdata/CreateResourceIdentifier.xml"
|
location="testdata/CreateResourceIdentifier.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
||||||
<template
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.CreateSourceFolder"
|
||||||
filterPattern=".*CreateSourceFolder"
|
filterPattern=".*CreateSourceFolder"
|
||||||
location="testdata/CreateSourceFolder.xml"
|
location="testdata/CreateSourceFolder.xml"
|
||||||
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
projectType="org.eclipse.cdt.core.tests.projectType"/>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.templateAssociations">
|
||||||
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.AddFile">
|
||||||
|
<toolChain id="org.eclipse.cdt.core.tests.toolChain3"/>
|
||||||
|
<toolChain id="org.eclipse.cdt.core.tests.toolChain4"/>
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
id="org.eclipse.cdt.core.tests.templates.AddFiles">
|
||||||
|
<toolChain id="org.eclipse.cdt.core.tests.toolChain5"/>
|
||||||
|
<toolChain id="org.eclipse.cdt.core.tests.toolChain6"/>
|
||||||
|
</template>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.core.parser.failedTests.ASTFailedTests;
|
||||||
import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTTest;
|
import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTTest;
|
||||||
import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
|
import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
||||||
|
import org.eclipse.cdt.core.tests.templateengine.AllTemplateEngineTests;
|
||||||
import org.eclipse.cdt.internal.index.tests.IndexTests;
|
import org.eclipse.cdt.internal.index.tests.IndexTests;
|
||||||
import org.eclipse.cdt.internal.pdom.tests.PDOMTests;
|
import org.eclipse.cdt.internal.pdom.tests.PDOMTests;
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
suite.addTestSuite(STLFailedTests.class);
|
suite.addTestSuite(STLFailedTests.class);
|
||||||
suite.addTestSuite(FailedCompleteParseASTTest.class);
|
suite.addTestSuite(FailedCompleteParseASTTest.class);
|
||||||
|
|
||||||
// suite.addTest(AllTemplateEngineTests.suite());
|
suite.addTest(AllTemplateEngineTests.suite());
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,12 @@ package org.eclipse.cdt.core.tests.templateengine;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
|
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
|
@ -61,6 +63,17 @@ public class TemplateEngineTestsHelper {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TemplateCore[] getTestTemplates() {
|
||||||
|
TemplateCore[] templates = TemplateEngine.getDefault().getTemplates();
|
||||||
|
List testTemplates = new ArrayList();
|
||||||
|
for (int i =0; i < templates.length; i++) {
|
||||||
|
if (templates[i].getTemplateType().equals("TestTemplate")) {
|
||||||
|
testTemplates.add(templates[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (TemplateCore[]) testTemplates.toArray(new TemplateCore[testTemplates.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
public static int getChildCount(TemplateDescriptor templateDescriptor, String propertyGroupID){
|
public static int getChildCount(TemplateDescriptor templateDescriptor, String propertyGroupID){
|
||||||
List list = templateDescriptor.getPropertyGroupList();
|
List list = templateDescriptor.getPropertyGroupList();
|
||||||
for (int i = 0, l = list.size(); i < l; i++) {
|
for (int i = 0, l = list.size(); i < l; i++) {
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.core.tests.templateengine;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the functionality of Tempalte Class.
|
* Test the functionality of Tempalte Class.
|
||||||
|
@ -24,7 +23,7 @@ public class TestTemplateCore extends TestCase {
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
templates = TemplateEngine.getDefault().getTemplates();
|
templates = TemplateEngineTestsHelper.getTestTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -17,7 +17,6 @@ import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
|
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +48,7 @@ public class TestValueStore extends TestCase {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void testValueStoreNotNull(){
|
public void testValueStoreNotNull(){
|
||||||
TemplateCore[] templates = TemplateEngine.getDefault().getTemplates();
|
TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates();
|
||||||
for (int i=0; i <templates.length; i++) {
|
for (int i=0; i <templates.length; i++) {
|
||||||
Map valueStore = templates[i].getValueStore();
|
Map valueStore = templates[i].getValueStore();
|
||||||
assertNotNull(valueStore);
|
assertNotNull(valueStore);
|
||||||
|
@ -61,7 +60,7 @@ public class TestValueStore extends TestCase {
|
||||||
* FactoryDefaults. Test the same.
|
* FactoryDefaults. Test the same.
|
||||||
*/
|
*/
|
||||||
public void testCompareValueStoreWithTemplateDefaluts(){
|
public void testCompareValueStoreWithTemplateDefaluts(){
|
||||||
TemplateCore[] templates = TemplateEngine.getDefault().getTemplates();
|
TemplateCore[] templates = TemplateEngineTestsHelper.getTestTemplates();
|
||||||
for (int i=0; i <templates.length; i++) {
|
for (int i=0; i <templates.length; i++) {
|
||||||
Map valueStore = templates[i].getValueStore();
|
Map valueStore = templates[i].getValueStore();
|
||||||
TemplateDescriptor templateDescriptor = templates[i].getTemplateDescriptor();
|
TemplateDescriptor templateDescriptor = templates[i].getTemplateDescriptor();
|
||||||
|
|
|
@ -629,6 +629,7 @@
|
||||||
<extension-point id="templates" name="Templates Extension point"
|
<extension-point id="templates" name="Templates Extension point"
|
||||||
schema="schema/templates.exsd"/>
|
schema="schema/templates.exsd"/>
|
||||||
<extension-point id="templateProcessTypes" name="Process Types Extension point" schema="schema/templateProcessTypes.exsd"/>
|
<extension-point id="templateProcessTypes" name="Process Types Extension point" schema="schema/templateProcessTypes.exsd"/>
|
||||||
|
<extension-point id="templateAssociations" name="Template Associations" schema="schema/templateAssociations.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.core.templateProcessTypes">
|
point="org.eclipse.cdt.core.templateProcessTypes">
|
||||||
|
|
129
core/org.eclipse.cdt.core/schema/templateAssociations.exsd
Normal file
129
core/org.eclipse.cdt.core/schema/templateAssociations.exsd
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.cdt.core">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.schema plugin="org.eclipse.cdt.core" id="templateAssociations" name="Template Associations"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
This extension point facilitates adding new toolchains generated from a different plugin to already defined template without modifying template definition.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Extension point added to Template Engine plugin. Any plugin, which intends to contribute XML templates to Temaplate Engine has to extend this extension point, and add template element.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element ref="template" minOccurs="1" maxOccurs="unbounded"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Id for the extension in the extender plugin.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="toolChain">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="template">
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element ref="toolChain" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
This extension point was added in CDT 4.0
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="apiInfo"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="copyright"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
Copyright (c) 2007 Symbian Software Limited and others.
|
||||||
|
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
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Symbian - Initial API and implementation
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
</schema>
|
|
@ -108,6 +108,13 @@ This is an optional attribute.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class TemplateCore {
|
||||||
private static final String DESCRIPTION = "description"; //$NON-NLS-1$
|
private static final String DESCRIPTION = "description"; //$NON-NLS-1$
|
||||||
private static final String LABEL = "label"; //$NON-NLS-1$
|
private static final String LABEL = "label"; //$NON-NLS-1$
|
||||||
private static final String ID = "id"; //$NON-NLS-1$
|
private static final String ID = "id"; //$NON-NLS-1$
|
||||||
|
private static final String TYPE = "type"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static Map/*<TemplateInfo, Template>*/ templateCache = new HashMap/*<TemplateInfo, Template>*/();
|
private static Map/*<TemplateInfo, Template>*/ templateCache = new HashMap/*<TemplateInfo, Template>*/();
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ public class TemplateCore {
|
||||||
private String description;
|
private String description;
|
||||||
private String label;
|
private String label;
|
||||||
private String templateId;
|
private String templateId;
|
||||||
|
private String templateType;
|
||||||
private boolean fireDirtyEvents;
|
private boolean fireDirtyEvents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,13 +93,11 @@ public class TemplateCore {
|
||||||
*/
|
*/
|
||||||
public Set/*<String>*/ getAllMissingMacrosInProcesses() {
|
public Set/*<String>*/ getAllMissingMacrosInProcesses() {
|
||||||
Set/*<String>*/ set = new TreeSet/*<String>*/(allMacrosInProcesses);
|
Set/*<String>*/ set = new TreeSet/*<String>*/(allMacrosInProcesses);
|
||||||
if (set != null) {
|
|
||||||
for (Iterator iter = set.iterator(); iter.hasNext();) {
|
for (Iterator iter = set.iterator(); iter.hasNext();) {
|
||||||
if (valueStore.get(iter.next()) != null) {
|
if (valueStore.get(iter.next()) != null) {
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,16 @@ public class TemplateCore {
|
||||||
return templateId;
|
return templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return String, which contains the id of the template
|
||||||
|
*/
|
||||||
|
public String getTemplateType() {
|
||||||
|
if (templateType == null) {
|
||||||
|
templateType = templateDescriptor.getRootElement().getAttribute(TYPE).trim();
|
||||||
|
}
|
||||||
|
return templateType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return String, which contains the Label
|
* @return String, which contains the Label
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.templateengine;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -40,11 +41,17 @@ import org.w3c.dom.NodeList;
|
||||||
public class TemplateEngine {
|
public class TemplateEngine {
|
||||||
|
|
||||||
public static String TEMPLATES_EXTENSION_ID = CCorePlugin.PLUGIN_ID + ".templates"; //$NON-NLS-1$
|
public static String TEMPLATES_EXTENSION_ID = CCorePlugin.PLUGIN_ID + ".templates"; //$NON-NLS-1$
|
||||||
|
public static String TEMPLATE_ASSOCIATIONS_EXTENSION_ID = CCorePlugin.PLUGIN_ID + ".templateAssociations"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* static reference to the Singleton TemplateEngine instance.
|
* static reference to the Singleton TemplateEngine instance.
|
||||||
*/
|
*/
|
||||||
private static TemplateEngine TEMPLATE_ENGINE = new TemplateEngine();
|
private static TemplateEngine TEMPLATE_ENGINE;
|
||||||
|
|
||||||
|
static {
|
||||||
|
TEMPLATE_ENGINE = new TemplateEngine();
|
||||||
|
TEMPLATE_ENGINE.initializeTemplateInfoMap();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a Map <WizardID, TemplateInfo>.
|
* This is a Map <WizardID, TemplateInfo>.
|
||||||
|
@ -56,7 +63,6 @@ public class TemplateEngine {
|
||||||
*/
|
*/
|
||||||
private TemplateEngine() {
|
private TemplateEngine() {
|
||||||
templateInfoMap = new HashMap/*<String, List<TemplateInfo>>*/();
|
templateInfoMap = new HashMap/*<String, List<TemplateInfo>>*/();
|
||||||
initializeTemplateInfoMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,6 +196,7 @@ public class TemplateEngine {
|
||||||
* extension point "templates"
|
* extension point "templates"
|
||||||
*/
|
*/
|
||||||
private void initializeTemplateInfoMap() {
|
private void initializeTemplateInfoMap() {
|
||||||
|
String templateId = null;
|
||||||
String location = null;
|
String location = null;
|
||||||
String pluginId = null;
|
String pluginId = null;
|
||||||
String projectType = null;
|
String projectType = null;
|
||||||
|
@ -205,6 +212,7 @@ public class TemplateEngine {
|
||||||
pluginId = extension.getNamespaceIdentifier(); // Plugin-id of the extending plugin.
|
pluginId = extension.getNamespaceIdentifier(); // Plugin-id of the extending plugin.
|
||||||
for(int j=0; j<configElements.length; j++) {
|
for(int j=0; j<configElements.length; j++) {
|
||||||
IConfigurationElement config = configElements[j];
|
IConfigurationElement config = configElements[j];
|
||||||
|
templateId = config.getAttribute(TemplateEngineHelper.ID);
|
||||||
location = config.getAttribute(TemplateEngineHelper.LOCATION);
|
location = config.getAttribute(TemplateEngineHelper.LOCATION);
|
||||||
projectType = config.getAttribute(TemplateEngineHelper.PROJECT_TYPE);
|
projectType = config.getAttribute(TemplateEngineHelper.PROJECT_TYPE);
|
||||||
filterPattern = config.getAttribute(TemplateEngineHelper.FILTER_PATTERN);
|
filterPattern = config.getAttribute(TemplateEngineHelper.FILTER_PATTERN);
|
||||||
|
@ -218,7 +226,7 @@ public class TemplateEngine {
|
||||||
toolChainIdSet.add(toolChainConfigs[k].getAttribute(TemplateEngineHelper.ID));
|
toolChainIdSet.add(toolChainConfigs[k].getAttribute(TemplateEngineHelper.ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateInfo templateInfo = new TemplateInfo(projectType, filterPattern, location,
|
TemplateInfo templateInfo = new TemplateInfo(templateId, projectType, filterPattern, location,
|
||||||
pluginId, toolChainIdSet,
|
pluginId, toolChainIdSet,
|
||||||
usage, extraPagesProvider, isCategory);
|
usage, extraPagesProvider, isCategory);
|
||||||
if (!templateInfoMap.containsKey(projectType)) {
|
if (!templateInfoMap.containsKey(projectType)) {
|
||||||
|
@ -227,6 +235,40 @@ public class TemplateEngine {
|
||||||
((List/*<TemplateInfo>*/)templateInfoMap.get(projectType)).add(templateInfo);
|
((List/*<TemplateInfo>*/)templateInfoMap.get(projectType)).add(templateInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check for tool Chains added to the templates outside template info definition
|
||||||
|
addToolChainsToTemplates();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToolChainsToTemplates() {
|
||||||
|
String templateId = null;
|
||||||
|
TemplateCore[] templates = getTemplates();
|
||||||
|
|
||||||
|
IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(TEMPLATE_ASSOCIATIONS_EXTENSION_ID).getExtensions();
|
||||||
|
for(int i=0; i<extensions.length; i++) {
|
||||||
|
IExtension extension = extensions[i];
|
||||||
|
IConfigurationElement[] configElements = extension.getConfigurationElements();
|
||||||
|
for(int j=0; j<configElements.length; j++) {
|
||||||
|
IConfigurationElement config = configElements[j];
|
||||||
|
templateId = config.getAttribute(TemplateEngineHelper.ID);
|
||||||
|
|
||||||
|
IConfigurationElement[] toolChainConfigs = config.getChildren(TemplateEngineHelper.TOOL_CHAIN);
|
||||||
|
Set toolChainIdSet = new HashSet();
|
||||||
|
for (int k=0; k < toolChainConfigs.length; k++) {
|
||||||
|
toolChainIdSet.add(toolChainConfigs[k].getAttribute(TemplateEngineHelper.ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k=0; k < templates.length; k++) {
|
||||||
|
String id = templates[k].getTemplateInfo().getTemplateId();
|
||||||
|
if (id == null) {
|
||||||
|
id = templates[k].getTemplateId();
|
||||||
|
}
|
||||||
|
if (id != null && id.equals(templateId)) {
|
||||||
|
toolChainIdSet.addAll(Arrays.asList(templates[k].getTemplateInfo().getToolChainIds()));
|
||||||
|
templates[k].getTemplateInfo().setToolChainSet(toolChainIdSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,10 +27,12 @@ public class TemplateInfo {
|
||||||
private String pagesProvider;
|
private String pagesProvider;
|
||||||
private boolean isCategory;
|
private boolean isCategory;
|
||||||
private String icon;
|
private String icon;
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
public TemplateInfo(String projectTypeId, String filterPattern, String templatePath,
|
public TemplateInfo(String templateId, String projectTypeId, String filterPattern, String templatePath,
|
||||||
String pluginId, Set toolChainIdSet, String usageDescription,
|
String pluginId, Set toolChainIdSet, String usageDescription,
|
||||||
String pagesProvider, boolean isCategory) {
|
String pagesProvider, boolean isCategory) {
|
||||||
|
this.templateId = templateId;
|
||||||
this.filterPattern = filterPattern;
|
this.filterPattern = filterPattern;
|
||||||
this.templatePath = templatePath;
|
this.templatePath = templatePath;
|
||||||
this.pluginId = pluginId;
|
this.pluginId = pluginId;
|
||||||
|
@ -49,6 +51,14 @@ public class TemplateInfo {
|
||||||
return pluginId;
|
return pluginId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Template ID
|
||||||
|
* @return String contains the template id.
|
||||||
|
*/
|
||||||
|
public String getTemplateId() {
|
||||||
|
return templateId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Template path as String.
|
* Returns the Template path as String.
|
||||||
* @return String containing the path.
|
* @return String containing the path.
|
||||||
|
@ -90,6 +100,10 @@ public class TemplateInfo {
|
||||||
return (String[]) toolChainIdSet.toArray(new String[toolChainIdSet.size()]);
|
return (String[]) toolChainIdSet.toArray(new String[toolChainIdSet.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setToolChainSet(Set toolChainIdSet) {
|
||||||
|
this.toolChainIdSet = toolChainIdSet;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isCategory
|
* @return the isCategory
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,13 +77,10 @@ public class TemplateProcessHandler {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set/*<String>*/ getAllMacros() {
|
public Set/*<String>*/ getAllMacros() {
|
||||||
Set/*<String>*/ set = null;
|
Set/*<String>*/ set = new HashSet/*<String>*/();
|
||||||
for (Iterator i = conditionalProcessGroupList.iterator(); i.hasNext();) {
|
for (Iterator i = conditionalProcessGroupList.iterator(); i.hasNext();) {
|
||||||
Set/*<String>*/ subSet = ((ConditionalProcessGroup)i.next()).getAllMacros();
|
Set/*<String>*/ subSet = ((ConditionalProcessGroup)i.next()).getAllMacros();
|
||||||
if (subSet != null) {
|
if (subSet != null) {
|
||||||
if (set == null) {
|
|
||||||
set = new HashSet/*<String>*/();
|
|
||||||
}
|
|
||||||
set.addAll(subSet);
|
set.addAll(subSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ public abstract class UIPage extends DialogPage {
|
||||||
|
|
||||||
title = name;
|
title = name;
|
||||||
uiElement = element;
|
uiElement = element;
|
||||||
|
uiElement.setValues(valueStore);
|
||||||
this.valueStore = valueStore;
|
this.valueStore = valueStore;
|
||||||
//TODO: Check the from which plugin the PLUGIN_ID comes from i.e. from CCorePlugin or CUIPlugin
|
//TODO: Check the from which plugin the PLUGIN_ID comes from i.e. from CCorePlugin or CUIPlugin
|
||||||
pageId = CUIPlugin.getPluginId() + "." + //$NON-NLS-1$
|
pageId = CUIPlugin.getPluginId() + "." + //$NON-NLS-1$
|
||||||
|
@ -131,7 +132,7 @@ public abstract class UIPage extends DialogPage {
|
||||||
* @return HashMap. The data contained in the widgets on this page.
|
* @return HashMap. The data contained in the widgets on this page.
|
||||||
*/
|
*/
|
||||||
public Map/*<String, String>*/ getPageData() {
|
public Map/*<String, String>*/ getPageData() {
|
||||||
return uiComposite.getPageData();
|
return uiElement.getValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class UIWizardPage extends UIPage implements IWizardPage, PatternEventLis
|
||||||
/**
|
/**
|
||||||
* Indicates whether this page is complete.
|
* Indicates whether this page is complete.
|
||||||
*/
|
*/
|
||||||
private boolean isPageComplete = true;
|
private boolean isPageComplete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* That page that was shown right before this page became visible. null if none.
|
* That page that was shown right before this page became visible. null if none.
|
||||||
|
@ -63,8 +63,6 @@ public class UIWizardPage extends UIPage implements IWizardPage, PatternEventLis
|
||||||
|
|
||||||
private IWizardPage nextPage = null;
|
private IWizardPage nextPage = null;
|
||||||
|
|
||||||
private Map valueStore;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title of the page, Page Name and UIElement group are the parameters.
|
* Title of the page, Page Name and UIElement group are the parameters.
|
||||||
*
|
*
|
||||||
|
@ -79,7 +77,7 @@ public class UIWizardPage extends UIPage implements IWizardPage, PatternEventLis
|
||||||
super(title, uiElement, valueStore);
|
super(title, uiElement, valueStore);
|
||||||
name = pageName;
|
name = pageName;
|
||||||
validInvalid = new HashMap/*<Object, String>*/();
|
validInvalid = new HashMap/*<Object, String>*/();
|
||||||
this.valueStore = valueStore;
|
isPageComplete = uiElement.isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,7 +217,7 @@ public class UIWizardPage extends UIPage implements IWizardPage, PatternEventLis
|
||||||
* @return boolean, true if this page is complete, otherwise false.
|
* @return boolean, true if this page is complete, otherwise false.
|
||||||
*/
|
*/
|
||||||
public boolean isPageComplete() {
|
public boolean isPageComplete() {
|
||||||
return isPageComplete && getComposite() != null;
|
return isPageComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,8 +266,6 @@ public class UIWizardPage extends UIPage implements IWizardPage, PatternEventLis
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
super.createControl(parent);
|
super.createControl(parent);
|
||||||
(super.getComposite()).addPatternListener(this);
|
(super.getComposite()).addPatternListener(this);
|
||||||
(super.getComposite()).getUIElement().setValues(valueStore);
|
|
||||||
|
|
||||||
|
|
||||||
// Page complete is set true of false, based on Mandatory attribute
|
// Page complete is set true of false, based on Mandatory attribute
|
||||||
// and Widgets contents.
|
// and Widgets contents.
|
||||||
|
|
|
@ -14,6 +14,8 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
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.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
@ -35,22 +37,24 @@ public class UIBooleanWidget extends InputUIElement {
|
||||||
/**
|
/**
|
||||||
* Attributes associated with this widget.
|
* Attributes associated with this widget.
|
||||||
*/
|
*/
|
||||||
UIAttributes/*<String, String>*/ uiAttribute;
|
protected UIAttributes/*<String, String>*/ uiAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean widget.
|
* Boolean widget.
|
||||||
*/
|
*/
|
||||||
Button button;
|
protected Button button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label of this widget.
|
* Label of this widget.
|
||||||
*/
|
*/
|
||||||
Label label;
|
protected Label label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composite to which this widget control is added.
|
* Composite to which this widget control is added.
|
||||||
*/
|
*/
|
||||||
UIComposite uiComposite;
|
protected UIComposite uiComposite;
|
||||||
|
|
||||||
|
private boolean booleanValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -61,6 +65,7 @@ public class UIBooleanWidget extends InputUIElement {
|
||||||
public UIBooleanWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
public UIBooleanWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
||||||
super(uiAttribute);
|
super(uiAttribute);
|
||||||
this.uiAttribute = uiAttribute;
|
this.uiAttribute = uiAttribute;
|
||||||
|
this.booleanValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,8 +74,7 @@ public class UIBooleanWidget extends InputUIElement {
|
||||||
public Map/*<String, String>*/ getValues() {
|
public Map/*<String, String>*/ getValues() {
|
||||||
|
|
||||||
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
||||||
Boolean isCheck = new Boolean(button.getSelection());
|
retMap.put(uiAttribute.get(InputUIElement.ID), new Boolean(booleanValue).toString());
|
||||||
retMap.put(uiAttribute.get(InputUIElement.ID), isCheck.toString());
|
|
||||||
|
|
||||||
return retMap;
|
return retMap;
|
||||||
}
|
}
|
||||||
|
@ -81,11 +85,7 @@ public class UIBooleanWidget extends InputUIElement {
|
||||||
* @param valueMap
|
* @param valueMap
|
||||||
*/
|
*/
|
||||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||||
String val = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
booleanValue = new Boolean((String) valueMap.get(uiAttribute.get(InputUIElement.ID))).booleanValue();
|
||||||
Boolean bool = new Boolean(val);
|
|
||||||
if (val != null) {
|
|
||||||
button.setSelection(bool.booleanValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,6 +116,12 @@ public class UIBooleanWidget extends InputUIElement {
|
||||||
booleanConatiner.setLayoutData(gridcData);
|
booleanConatiner.setLayoutData(gridcData);
|
||||||
button = new Button(booleanConatiner, SWT.CHECK);
|
button = new Button(booleanConatiner, SWT.CHECK);
|
||||||
button.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
button.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
||||||
|
button.setSelection(new Boolean(booleanValue).booleanValue());
|
||||||
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
booleanValue = button.getSelection();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,7 +136,7 @@ public class UIBooleanWidget extends InputUIElement {
|
||||||
boolean retVal = true;
|
boolean retVal = true;
|
||||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||||
|
|
||||||
if ((button.getSelection() == false) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
|
if (!booleanValue && mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)) {
|
||||||
retVal = false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
@ -32,15 +32,11 @@ import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
||||||
/**
|
|
||||||
* Attributes associated with this widget.
|
|
||||||
*/
|
|
||||||
UIAttributes/*<String, String>*/ uiAttribute;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse Button of this widget.
|
* Browse Button of this widget.
|
||||||
*/
|
*/
|
||||||
Button button;
|
protected Button button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -51,6 +47,7 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
||||||
public UIBrowseWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
public UIBrowseWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
||||||
super(uiAttribute);
|
super(uiAttribute);
|
||||||
this.uiAttribute = uiAttribute;
|
this.uiAttribute = uiAttribute;
|
||||||
|
this.textValue = (String) uiAttribute.get(InputUIElement.DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,10 +80,7 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
||||||
text = new Text(textConatiner, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
|
text = new Text(textConatiner, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
|
||||||
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
text.addModifyListener(this);
|
text.addModifyListener(this);
|
||||||
|
text.setText(textValue);
|
||||||
// set Default values
|
|
||||||
if (uiAttribute.get(InputUIElement.DEFAULT) != null)
|
|
||||||
text.setText((String) uiAttribute.get(InputUIElement.DEFAULT));
|
|
||||||
|
|
||||||
button = new Button(textConatiner, SWT.PUSH | SWT.LEFT);
|
button = new Button(textConatiner, SWT.PUSH | SWT.LEFT);
|
||||||
button.setText(InputUIElement.BROWSELABEL);
|
button.setText(InputUIElement.BROWSELABEL);
|
||||||
|
@ -95,7 +89,8 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
String fileName = new FileDialog(uiComposite.getShell()).open();
|
String fileName = new FileDialog(uiComposite.getShell()).open();
|
||||||
if (fileName != null) {
|
if (fileName != null) {
|
||||||
text.setText(fileName.toString());
|
textValue = fileName.toString();
|
||||||
|
text.setText(textValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
@ -35,32 +37,32 @@ public class UISelectWidget extends InputUIElement {
|
||||||
/**
|
/**
|
||||||
* Attributes associated with this widget.
|
* Attributes associated with this widget.
|
||||||
*/
|
*/
|
||||||
UIAttributes/*<String, String>*/ uiAttribute;
|
protected UIAttributes/*<String, String>*/ uiAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select widget.
|
* Select widget.
|
||||||
*/
|
*/
|
||||||
Combo combo;
|
protected Combo combo = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label of this widget.
|
* Label of this widget.
|
||||||
*/
|
*/
|
||||||
Label label;
|
protected Label label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composite to which this widget control is added.
|
* Composite to which this widget control is added.
|
||||||
*/
|
*/
|
||||||
UIComposite uiComposite;
|
protected UIComposite uiComposite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map contains the values of Select Widget
|
* Map contains the values of Select Widget
|
||||||
*/
|
*/
|
||||||
HashMap/*<String, String>*/ itemMap;
|
protected HashMap/*<String, String>*/ itemMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default value of Select Widget
|
* Default value of Select Widget
|
||||||
*/
|
*/
|
||||||
String itemSelected;
|
protected String itemSelected;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for Select Widget.
|
* Constructor for Select Widget.
|
||||||
|
@ -70,20 +72,16 @@ public class UISelectWidget extends InputUIElement {
|
||||||
*/
|
*/
|
||||||
public UISelectWidget(UIAttributes/*<String, String>*/ attribute, HashMap/*<String, String>*/ itemMap,
|
public UISelectWidget(UIAttributes/*<String, String>*/ attribute, HashMap/*<String, String>*/ itemMap,
|
||||||
String itemSelected) {
|
String itemSelected) {
|
||||||
|
|
||||||
super(attribute);
|
super(attribute);
|
||||||
uiAttribute = attribute;
|
uiAttribute = attribute;
|
||||||
this.itemMap = itemMap;
|
this.itemMap = itemMap;
|
||||||
this.itemSelected = itemSelected;
|
this.itemSelected = itemSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Boolean value contained in the Boolean Widget.
|
|
||||||
*/
|
|
||||||
public Map/*<String, String>*/ getValues() {
|
public Map/*<String, String>*/ getValues() {
|
||||||
|
|
||||||
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
||||||
retMap.put(uiAttribute.get(InputUIElement.ID), itemMap.get(combo.getItem(combo.getSelectionIndex())));
|
retMap.put(uiAttribute.get(InputUIElement.ID), itemSelected);
|
||||||
|
|
||||||
return retMap;
|
return retMap;
|
||||||
}
|
}
|
||||||
|
@ -94,17 +92,17 @@ public class UISelectWidget extends InputUIElement {
|
||||||
* @param valueMap
|
* @param valueMap
|
||||||
*/
|
*/
|
||||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||||
|
itemSelected = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
||||||
|
|
||||||
String val = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
if (combo != null) {
|
||||||
if (val != null)
|
|
||||||
val = val.trim();
|
|
||||||
String[] items = combo.getItems();
|
String[] items = combo.getItems();
|
||||||
int index = 0;
|
for (int i=0; i < items.length; i++) {
|
||||||
for (int i = 0; i < items.length; i++)
|
if (items[i].equals(itemSelected)) {
|
||||||
if (itemMap.get(items[i]).equals(val))
|
combo.select(i);
|
||||||
index = i;
|
break;
|
||||||
|
}
|
||||||
combo.select(index);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,6 +147,14 @@ public class UISelectWidget extends InputUIElement {
|
||||||
|
|
||||||
combo.select(index);
|
combo.select(index);
|
||||||
combo.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
combo.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
||||||
|
combo.addSelectionListener(new SelectionListener() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
itemSelected = combo.getItem(combo.getSelectionIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,9 +169,8 @@ public class UISelectWidget extends InputUIElement {
|
||||||
boolean retVal = true;
|
boolean retVal = true;
|
||||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||||
|
|
||||||
if (((combo.getText() == null) || (combo.getText().equals("")) //$NON-NLS-1$
|
if ((itemSelected == null || itemSelected.equals("") //$NON-NLS-1$
|
||||||
|| (combo.getText().trim().length() < 1)) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
|
|| itemSelected.trim().length() < 1) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
|
||||||
|
|
||||||
retVal = false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.templateengine.uitree.uiwidgets;
|
package org.eclipse.cdt.ui.templateengine.uitree.uiwidgets;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
@ -20,6 +22,7 @@ import org.eclipse.cdt.ui.templateengine.uitree.InputUIElement;
|
||||||
import org.eclipse.cdt.ui.templateengine.uitree.UIAttributes;
|
import org.eclipse.cdt.ui.templateengine.uitree.UIAttributes;
|
||||||
import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
|
import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
|
||||||
import org.eclipse.cdt.utils.ui.controls.FileListControl;
|
import org.eclipse.cdt.utils.ui.controls.FileListControl;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.IFileListChangeListener;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +72,13 @@ public class UISpecialListWidget extends UIStringListWidget {
|
||||||
flcComposite.setLayoutData(gridData);
|
flcComposite.setLayoutData(gridData);
|
||||||
|
|
||||||
fileListControl = new FileListControl(flcComposite, (String) uiAttribute.get(InputUIElement.WIDGETLABEL), 1);
|
fileListControl = new FileListControl(flcComposite, (String) uiAttribute.get(InputUIElement.WIDGETLABEL), 1);
|
||||||
|
fileListControl.setList((String[])itemsList.toArray());
|
||||||
|
fileListControl.setSelection(0);
|
||||||
|
fileListControl.addChangeListener(new IFileListChangeListener(){
|
||||||
|
public void fileListChanged(FileListControl fileList, String oldValue[], String newValue[]) {
|
||||||
|
itemsList.addAll(Arrays.asList(newValue));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Limited and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
* 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
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,7 +9,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.templateengine.uitree.uiwidgets;
|
package org.eclipse.cdt.ui.templateengine.uitree.uiwidgets;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
@ -25,6 +27,7 @@ import org.eclipse.cdt.ui.templateengine.uitree.InputUIElement;
|
||||||
import org.eclipse.cdt.ui.templateengine.uitree.UIAttributes;
|
import org.eclipse.cdt.ui.templateengine.uitree.UIAttributes;
|
||||||
import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
|
import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
|
||||||
import org.eclipse.cdt.utils.ui.controls.FileListControl;
|
import org.eclipse.cdt.utils.ui.controls.FileListControl;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.IFileListChangeListener;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,22 +40,24 @@ public class UIStringListWidget extends InputUIElement {
|
||||||
/**
|
/**
|
||||||
* Attributes associated with this widget.
|
* Attributes associated with this widget.
|
||||||
*/
|
*/
|
||||||
UIAttributes/*<String, String>*/ uiAttribute;
|
protected UIAttributes/*<String, String>*/ uiAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StringList widget.
|
* StringList widget.
|
||||||
*/
|
*/
|
||||||
FileListControl fileListControl;
|
protected FileListControl fileListControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label of this widget.
|
* Label of this widget.
|
||||||
*/
|
*/
|
||||||
Label label;
|
protected Label label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composite to which this widget control is added.
|
* Composite to which this widget control is added.
|
||||||
*/
|
*/
|
||||||
UIComposite uiComposite;
|
protected UIComposite uiComposite;
|
||||||
|
|
||||||
|
protected List itemsList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -63,6 +68,7 @@ public class UIStringListWidget extends InputUIElement {
|
||||||
public UIStringListWidget(UIAttributes/*<String, String>*/ attribute) {
|
public UIStringListWidget(UIAttributes/*<String, String>*/ attribute) {
|
||||||
super(attribute);
|
super(attribute);
|
||||||
uiAttribute = attribute;
|
uiAttribute = attribute;
|
||||||
|
itemsList = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,12 +76,10 @@ public class UIStringListWidget extends InputUIElement {
|
||||||
*/
|
*/
|
||||||
public Map/*<String, String>*/ getValues() {
|
public Map/*<String, String>*/ getValues() {
|
||||||
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
||||||
String[] items = fileListControl.getItems();
|
|
||||||
String itemString = new String();
|
String itemString = new String();
|
||||||
|
for (int i = 0; i < itemsList.size(); i++) {
|
||||||
for (int i = 0; i < items.length; i++)
|
itemString = itemString + itemsList.get(i) + "|"; //$NON-NLS-1$
|
||||||
itemString = itemString + items[i] + "|"; //$NON-NLS-1$
|
}
|
||||||
|
|
||||||
retMap.put(uiAttribute.get(InputUIElement.ID), itemString);
|
retMap.put(uiAttribute.get(InputUIElement.ID), itemString);
|
||||||
|
|
||||||
return retMap;
|
return retMap;
|
||||||
|
@ -87,19 +91,14 @@ public class UIStringListWidget extends InputUIElement {
|
||||||
* @param valueMap
|
* @param valueMap
|
||||||
*/
|
*/
|
||||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||||
|
|
||||||
String items = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
String items = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
||||||
|
|
||||||
if (items != null) {
|
if (items != null) {
|
||||||
items = items.trim();
|
items = items.trim();
|
||||||
StringTokenizer st = new StringTokenizer(items, "|"); //$NON-NLS-1$
|
StringTokenizer st = new StringTokenizer(items, "|"); //$NON-NLS-1$
|
||||||
String[] itemList = new String[st.countTokens()];
|
for (int i = 0; st.hasMoreTokens(); i++) {
|
||||||
|
itemsList.add(st.nextToken());
|
||||||
for (int i = 0; st.hasMoreTokens(); i++)
|
}
|
||||||
itemList[i] = st.nextToken();
|
|
||||||
|
|
||||||
fileListControl.setList(itemList);
|
|
||||||
fileListControl.setSelection(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +132,14 @@ public class UIStringListWidget extends InputUIElement {
|
||||||
flcComposite.setLayoutData(gridData);
|
flcComposite.setLayoutData(gridData);
|
||||||
|
|
||||||
fileListControl = new FileListControl(flcComposite, (String) uiAttribute.get(InputUIElement.WIDGETLABEL), 0);
|
fileListControl = new FileListControl(flcComposite, (String) uiAttribute.get(InputUIElement.WIDGETLABEL), 0);
|
||||||
|
fileListControl.setList((String[])itemsList.toArray());
|
||||||
|
fileListControl.setSelection(0);
|
||||||
|
fileListControl.addChangeListener(new IFileListChangeListener(){
|
||||||
|
public void fileListChanged(FileListControl fileList, String oldValue[], String newValue[]) {
|
||||||
|
itemsList.addAll(Arrays.asList(newValue));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,8 +154,7 @@ public class UIStringListWidget extends InputUIElement {
|
||||||
boolean retVal = true;
|
boolean retVal = true;
|
||||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||||
|
|
||||||
if ((fileListControl.getItems() == null) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
|
if ((itemsList == null || itemsList.size() == 0) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
|
||||||
|
|
||||||
retVal = false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
/**
|
/**
|
||||||
* Attributes associated with this widget.
|
* Attributes associated with this widget.
|
||||||
*/
|
*/
|
||||||
private UIAttributes/*<String, String>*/ uiAttribute;
|
protected UIAttributes/*<String, String>*/ uiAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text widget.
|
* Text widget.
|
||||||
|
@ -68,6 +68,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
*/
|
*/
|
||||||
protected UIComposite uiComposite;
|
protected UIComposite uiComposite;
|
||||||
|
|
||||||
|
protected String textValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -77,6 +79,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
public UITextWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
public UITextWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
||||||
super(uiAttribute);
|
super(uiAttribute);
|
||||||
this.uiAttribute = uiAttribute;
|
this.uiAttribute = uiAttribute;
|
||||||
|
this.textValue = new String();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +87,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
*/
|
*/
|
||||||
public Map/*<String, String>*/ getValues() {
|
public Map/*<String, String>*/ getValues() {
|
||||||
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
||||||
retMap.put(uiAttribute.get(InputUIElement.ID), text.getText());
|
retMap.put(uiAttribute.get(InputUIElement.ID), textValue);
|
||||||
|
|
||||||
return retMap;
|
return retMap;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +111,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
val = subString;
|
val = subString;
|
||||||
}
|
}
|
||||||
val = val.trim();
|
val = val.trim();
|
||||||
text.setText(val);
|
textValue = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +144,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
text = getTextWidget((String) uiAttribute.get(UIElement.TYPE));
|
text = getTextWidget((String) uiAttribute.get(UIElement.TYPE));
|
||||||
text.addModifyListener(this);
|
text.addModifyListener(this);
|
||||||
text.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
text.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
||||||
|
text.setText(textValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,17 +217,17 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
// other classes, having Text widget. They can just make use of
|
// other classes, having Text widget. They can just make use of
|
||||||
// modifyText,
|
// modifyText,
|
||||||
// evaluatePattern and isValid.
|
// evaluatePattern and isValid.
|
||||||
String inputText = text.getText();
|
textValue = text.getText();
|
||||||
|
|
||||||
if ((patternValue == null) || (inputText == null))
|
if ((patternValue == null) || (textValue == null))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String mandatory = (String) attribute.get(InputUIElement.MANDATORY);
|
String mandatory = (String) attribute.get(InputUIElement.MANDATORY);
|
||||||
if ((mandatory == null || !mandatory.equalsIgnoreCase("true")) && inputText.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
|
if ((mandatory == null || !mandatory.equalsIgnoreCase("true")) && textValue.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
evaluatePattern(label.getText(), inputText, patternValue);
|
evaluatePattern(label.getText(), textValue, patternValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,8 +265,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||||
|
|
||||||
if (((mandatory != null) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)))
|
if (((mandatory != null) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)))
|
||||||
&& ((text.getText() == null) || (text.getText().equals("")) || //$NON-NLS-1$
|
&& ((textValue == null) || (textValue.equals("")) || //$NON-NLS-1$
|
||||||
(text.getText().trim().length() < 1))) {
|
(textValue.trim().length() < 1))) {
|
||||||
|
|
||||||
retVal = false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue