Moved swconfigapps content under oss repository.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/.classpath Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.pde.test.utils</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/META-INF/MANIFEST.MF Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: PDE Test Utilities Plug-in
+Bundle-SymbolicName: com.symbian.pde.test.utils;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Eclipse-AutoStart: true
+Export-Package: com.symbian.pde.test.utils
+Require-Bundle: org.junit;bundle-version="3.8.2",
+ org.eclipse.jdt.junit;bundle-version="3.3.2",
+ org.apache.ant;bundle-version="1.7.0"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/build-for-testing.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,69 @@
+<!-- Build file for the SMM plug-ins -->
+<project name="pdetestutils" default="help" basedir=".">
+ <property name="plugin.dir" location="${basedir}"/>
+ <property name="projects.dir" location="${basedir}/.."/>
+ <property file="${projects.dir}/project.properties"/>
+
+ <property name="plugin.name" value="com.symbian.pde.test.utils"/>
+ <property name="plugin.version" value="1.0.0"/>
+ <property name="test.eclipse.dir" location="c:/opt/eclipse-for-pde-unit-tests"/>
+ <property name="target.dir" location="${projects.dir}/target"/>
+ <property name="published.plugins.dir" location="${target.dir}/plugins"/>
+ <property name="src.dir" location="${plugin.dir}/src"/>
+ <property name="test.dir" location="${plugin.dir}/test"/>
+ <property name="plugin.target.dir" location="${plugin.dir}/target"/>
+ <property name="reports.dir" location="${plugin.target.dir}/reports"/>
+ <property name="classes.dir" location="${plugin.target.dir}/classes"/>
+
+ <path id="build.class.path">
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.apache.ant_*/**/ant.jar"/>
+ <include name="org.apache.ant_*/**/ant-junit.jar"/>
+ <include name="org.junit_3*/**/junit.jar"/>
+ <include name="org.eclipse.jdt.junit_*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="clean">
+ <delete dir="${plugin.dir}/bin"/>
+ <delete dir="${plugin.target.dir}"/>
+ </target>
+
+ <target name="build">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" classpathref="build.class.path" includeantruntime="false"/>
+ <antcall target="create_eclipse_plugin"/>
+ <copy todir="${published.plugins.dir}" file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar" overwrite="true"/>
+ </target>
+
+ <target name="create_eclipse_plugin">
+ <property file="${plugin.dir}/build.properties"/>
+ <delete file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar"/>
+ <zip destfile="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar">
+ <zipfileset dir="." includes="${bin.includes}"/>
+ <zipfileset dir="${classes.dir}"/>
+ </zip>
+ </target>
+
+ <target name="test">
+ <!-- no regular junit test -->
+ </target>
+
+ <target name="help">
+ <echo>
+This is the Ant build file for the com.symbian.pde.test.utils PDE Test project.
+
+Usage:
+
+Target Description
+============== ==============================================
+[default] Displays this message.
+
+build Builds the source and creates the plugin jar.
+
+clean Cleans all the build and generated artefacts.
+ </echo>
+ </target>
+
+</project>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/build.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/plugin.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/src/com/symbian/pde/test/utils/PDETestListener.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,179 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.pde.test.utils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
+import org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter;
+import org.eclipse.jdt.internal.junit.model.ITestRunListener2;
+
+public class PDETestListener implements ITestRunListener2 {
+ private Object resultsCollector;
+ private int totalNumberOfTests;
+ private int testsRunCount;
+ private int numberOfTestsPassed;
+ private int numberOfTestsFailed;
+ private int numberOfTestsWithError;
+ private boolean testRunEnded = false;
+ private XMLJUnitResultFormatter xmlResultsFormatter;
+ private File outputFile;
+ private String suiteName;
+ private JUnitTest junitTestSuite;
+ private TestCase currentTest;
+
+ public PDETestListener(Object collector, String suite) {
+ resultsCollector = collector;
+ suiteName = suite;
+ junitTestSuite = new JUnitTest(suiteName);
+ junitTestSuite.setProperties(System.getProperties());
+ }
+
+ public void setOutputFile(String filename) {
+ outputFile = new File(filename);
+ }
+
+ public File getOutputFile() {
+ if (outputFile == null) {
+ setOutputFile("TEST-" + suiteName + ".xml");
+ }
+ return outputFile;
+ }
+
+ public boolean failed() {
+ return ((numberOfTestsFailed + numberOfTestsWithError) > 0) || (testRunEnded && (testsRunCount == 0));
+ }
+
+ public int count() {
+ return testsRunCount;
+ }
+
+ private XMLJUnitResultFormatter getXMLJUnitResultFormatter() {
+ if (xmlResultsFormatter == null) {
+ xmlResultsFormatter = new XMLJUnitResultFormatter();
+ try {
+ xmlResultsFormatter.setOutput(new FileOutputStream(getOutputFile()));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ return xmlResultsFormatter;
+ }
+
+ public synchronized void testRunStarted(int testCount) {
+ totalNumberOfTests = testCount;
+ testsRunCount = 0;
+ numberOfTestsPassed = 0;
+ numberOfTestsFailed = 0;
+ numberOfTestsWithError = 0;
+ testRunEnded = false;
+ getXMLJUnitResultFormatter().startTestSuite(junitTestSuite);
+ System.out.println("PDE Test Run Started - running " + totalNumberOfTests + " tests ...");
+ }
+
+ public synchronized void testRunEnded(long elapsedTime) {
+ testRunEnded = true;
+ junitTestSuite.setCounts(testsRunCount, numberOfTestsFailed, numberOfTestsWithError);
+ junitTestSuite.setRunTime(elapsedTime);
+ getXMLJUnitResultFormatter().endTestSuite(junitTestSuite);
+ System.out.println("Test Run Ended - " + (failed() ? "FAILED" : "PASSED") + " - Total: " + totalNumberOfTests
+ + " (Errors: " + numberOfTestsWithError
+ + ", Failed: " + numberOfTestsFailed
+ + ", Passed: " + numberOfTestsPassed + "), duration " + elapsedTime + "ms.");
+
+ synchronized (resultsCollector) {
+ resultsCollector.notifyAll();
+ }
+ }
+
+ public synchronized void testRunStopped(long elapsedTime) {
+ System.out.println("Test Run Stopped");
+ testRunEnded(elapsedTime);
+ }
+
+ public synchronized void testRunTerminated() {
+ System.out.println("Test Run Terminated");
+ testRunEnded(0);
+ }
+
+ public synchronized void testStarted(String testId, String testName) {
+ testsRunCount++;
+ currentTest = new WrapperTestCase(testName);
+ getXMLJUnitResultFormatter().startTest(currentTest);
+ System.out.println(" Test Started - " + count() + " - " + testName);
+ }
+
+ public synchronized void testEnded(String testId, String testName) {
+ numberOfTestsPassed = count() - (numberOfTestsFailed + numberOfTestsWithError);
+ getXMLJUnitResultFormatter().endTest(currentTest);
+ System.out.println(" Test Ended - " + count() + " - " + testName);
+ }
+
+ public synchronized void testFailed(int status, String testId, String testName, String trace, String expected, String actual) {
+ String statusMessage = String.valueOf(status);
+ if (status == ITestRunListener2.STATUS_OK) {
+ numberOfTestsPassed++;
+ statusMessage = "OK";
+ } else if (status == ITestRunListener2.STATUS_FAILURE) {
+ numberOfTestsFailed++;
+ statusMessage = "FAILED";
+ getXMLJUnitResultFormatter().addFailure(currentTest, new AssertionFailedError(trace));
+ } else if (status == ITestRunListener2.STATUS_ERROR) {
+ numberOfTestsWithError++;
+ statusMessage = "ERROR";
+ getXMLJUnitResultFormatter().addError(currentTest, new Exception(trace));
+ }
+ System.out.println(" Test Failed - " + count() + " - " + testName + " - status: " + statusMessage
+ + ", trace: " + trace + ", expected: " + expected + ", actual: " + actual);
+ }
+
+ public synchronized void testReran(String testId, String testClass, String testName, int status, String trace, String expected, String actual) {
+ String statusMessage = String.valueOf(status);
+ if (status == ITestRunListener2.STATUS_OK) {
+ statusMessage = "OK";
+ } else if (status == ITestRunListener2.STATUS_FAILURE) {
+ statusMessage = "FAILED";
+ } else if (status == ITestRunListener2.STATUS_ERROR) {
+ statusMessage = "ERROR";
+ }
+
+ System.out.println(" Test ReRan - " + testName + " - test class: " + testClass + ", status: " + statusMessage
+ + ", trace: " + trace + ", expected: " + expected + ", actual: " + actual);
+ }
+
+ public synchronized void testTreeEntry(String description) {
+ System.out.println("Test Tree Entry - Description: " + description);
+ }
+
+ class WrapperTestCase extends TestCase {
+
+ public WrapperTestCase(String name) {
+ super(name);
+ }
+
+ public int countTestCases() {
+ return 1;
+ }
+
+ public void run(TestResult result) {
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/src/com/symbian/pde/test/utils/PDETestPortLocator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,71 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.pde.test.utils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+
+public class PDETestPortLocator {
+
+ public static void main(String[] args) {
+ new PDETestPortLocator().savePortToFile();
+ }
+
+ public void savePortToFile() {
+ int port = locatePDETestPortNumber();
+ File propsFile = new File("pde_test_port.properties");
+ System.out.println("PDE Test port: " + port);
+ OutputStream os = null;
+ try {
+ os = new FileOutputStream(propsFile);
+ os.write(new String("pde.test.port=" + port).getBytes());
+ os.flush();
+ System.out.println("PDE Test port saved to file " + propsFile.getAbsolutePath());
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+ os = null;
+ }
+ }
+
+ private int locatePDETestPortNumber() {
+ ServerSocket socket = null;
+ try {
+ socket = new ServerSocket(0);
+ return socket.getLocalPort();
+ } catch (IOException e) {
+ // ignore
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return -1;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.pde.test.utils/src/com/symbian/pde/test/utils/PDETestResultsCollector.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,54 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.pde.test.utils;
+
+import org.eclipse.jdt.internal.junit.model.ITestRunListener2;
+import org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient;
+
+public final class PDETestResultsCollector {
+ private static PDETestListener pdeTestListener;
+
+ private String suiteName;
+
+ private PDETestResultsCollector(String suite) {
+ suiteName = suite;
+ }
+
+ private void run(int port) throws InterruptedException {
+ pdeTestListener = new PDETestListener(this, suiteName);
+ new RemoteTestRunnerClient().startListening(new ITestRunListener2[] {pdeTestListener}, port);
+ System.out.println("Listening on port " + port + " for test suite " + suiteName + " results ...");
+ synchronized (this) {
+ wait();
+ }
+ }
+
+ public static void main(String[] args) {
+ if (args.length != 2) {
+ System.out.println("usage: PDETestResultsCollector <test suite name> <port number>");
+ System.exit(0);
+ }
+
+ try {
+ new PDETestResultsCollector(args[0]).run(Integer.parseInt(args[1]));
+ } catch (Throwable th) {
+ th.printStackTrace();
+ }
+
+ if (pdeTestListener != null && pdeTestListener.failed()) {
+ System.exit(1);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.feature/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.smt.gui.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.feature/build.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,1 @@
+bin.includes = feature.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.feature/build.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="com.symbian.smt.gui.feature" default="build.update.jar" basedir=".">
+
+ <target name="init">
+ <property name="feature.temp.folder" value="${basedir}/feature.temp.folder"/>
+ <property name="feature.destination" value="${basedir}"/>
+ </target>
+
+ <target name="all.plugins" depends="init">
+ <ant antfile="build.xml" dir="../com.symbian.smt.gui" target="${target}">
+ </ant>
+ </target>
+ <target name="all.features" depends="init">
+ </target>
+ <target name="update.feature" depends="init">
+ </target>
+
+ <target name="all.children" depends="init,all.features,all.plugins,update.feature">
+ </target>
+
+ <target name="children" if="include.children">
+ <antcall target="all.children"/>
+ </target>
+
+ <target name="build.jars" depends="init" description="Build all the jars for the feature: com.symbian.smt.gui.feature.">
+ <antcall target="all.children">
+ <param name="target" value="build.jars"/>
+ </antcall>
+ </target>
+
+ <target name="build.sources" depends="init">
+ <antcall target="all.children">
+ <param name="target" value="build.sources"/>
+ </antcall>
+ </target>
+
+ <target name="build.zips" depends="init">
+ <antcall target="all.children">
+ <param name="target" value="build.zips"/>
+ </antcall>
+ </target>
+
+ <target name="build.update.jar" depends="init" description="Build the feature jar of: com.symbian.smt.gui.feature for an update site.">
+ <antcall target="all.children">
+ <param name="target" value="build.update.jar"/>
+ </antcall>
+ <property name="feature.base" value="${feature.temp.folder}"/>
+ <delete dir="${feature.temp.folder}"/>
+ <mkdir dir="${feature.temp.folder}"/>
+ <antcall target="gather.bin.parts" inheritAll="false">
+ <param name="arch" value="*"/>
+ <param name="ws" value="*"/>
+ <param name="nl" value="*"/>
+ <param name="os" value="*"/>
+ <param name="feature.base" value="${feature.temp.folder}"/>
+ </antcall>
+ <jar destfile="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.jar" basedir="${feature.temp.folder}/features/com.symbian.smt.gui.feature_1.0.0"/>
+ <delete dir="${feature.temp.folder}"/>
+ </target>
+
+ <target name="gather.bin.parts" depends="init" if="feature.base">
+ <mkdir dir="${feature.base}/features/com.symbian.smt.gui.feature_1.0.0"/>
+ <antcall target="children">
+ <param name="destination.temp.folder" value="${feature.base}/plugins"/>
+ <param name="target" value="gather.bin.parts"/>
+ </antcall>
+ <copy todir="${feature.base}/features/com.symbian.smt.gui.feature_1.0.0" failonerror="true" overwrite="false">
+ <fileset dir="${basedir}" includes="feature.xml" />
+ </copy>
+ <eclipse.idReplacer featureFilePath="${feature.base}/features/com.symbian.smt.gui.feature_1.0.0/feature.xml" selfVersion="1.0.0" featureIds="" pluginIds="com.symbian.smt.gui,0.0.1,"/>
+ <antcall target="rootFiles${os}_${ws}_${arch}"/>
+ </target>
+ <target name="rootFiles*_*_*">
+ </target>
+ <target name="rootFilesgroup_group_group">
+ <antcall target="rootFiles*_*_*"/>
+ </target>
+
+ <target name="zip.distribution" depends="init" description="Create a zip containing all the plug-ins and features for the feature: com.symbian.smt.gui.feature.">
+ <delete dir="${feature.temp.folder}"/>
+ <mkdir dir="${feature.temp.folder}"/>
+ <antcall target="gather.bin.parts">
+ <param name="arch" value="*"/>
+ <param name="ws" value="*"/>
+ <param name="nl" value="*"/>
+ <param name="include.children" value="true"/>
+ <param name="feature.base" value="${feature.temp.folder}"/>
+ <param name="os" value="*"/>
+ </antcall>
+ <zip destfile="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.bin.dist.zip" basedir="${feature.temp.folder}" filesonly="false" whenempty="skip" update="false"/>
+ <delete dir="${feature.temp.folder}"/>
+ </target>
+
+ <target name="zip.sources" depends="init">
+ <delete dir="${feature.temp.folder}"/>
+ <mkdir dir="${feature.temp.folder}"/>
+ <antcall target="all.children">
+ <param name="destination.temp.folder" value="${feature.temp.folder}/plugins/com.symbian.smt.gui.feature.source_1.0.0/src"/>
+ <param name="include.children" value="true"/>
+ <param name="target" value="gather.sources"/>
+ </antcall>
+ <zip destfile="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.src.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/>
+ <delete dir="${feature.temp.folder}"/>
+ </target>
+
+ <target name="zip.logs" depends="init">
+ <delete dir="${feature.temp.folder}"/>
+ <mkdir dir="${feature.temp.folder}"/>
+ <antcall target="all.children" inheritAll="false">
+ <param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/>
+ <param name="include.children" value="true"/>
+ <param name="target" value="gather.logs"/>
+ </antcall>
+ <zip destfile="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.log.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/>
+ <delete dir="${feature.temp.folder}"/>
+ </target>
+
+ <target name="clean" depends="init" description="Clean the feature: com.symbian.smt.gui.feature of all the zips, jars and logs created.">
+ <delete file="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.jar"/>
+ <delete file="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.bin.dist.zip"/>
+ <delete file="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.log.zip"/>
+ <delete file="${feature.destination}/com.symbian.smt.gui.feature_1.0.0.src.zip"/>
+ <delete dir="${feature.temp.folder}"/>
+ <antcall target="all.children">
+ <param name="target" value="clean"/>
+ </antcall>
+ </target>
+
+ <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
+ <eclipse.convertPath fileSystemPath="D:/eclipse/eclipse/workspace/smt/com.symbian.smt.gui.feature/" property="resourcePath"/>
+ <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
+ <antcall target="all.children">
+ <param name="target" value="refresh"/>
+ </antcall>
+ </target>
+ <target name="gather.sources">
+ <antcall target="children">
+ <param name="destination.temp.folder" value="${feature.temp.folder}/plugins/com.symbian.smt.gui.feature.source_1.0.0/src"/>
+ <param name="target" value="gather.sources"/>
+ </antcall>
+ </target>
+
+ <target name="gather.logs" depends="init">
+ <mkdir dir="${feature.temp.folder}"/>
+ <antcall target="all.children" inheritAll="false">
+ <param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/>
+ <param name="target" value="gather.logs"/>
+ </antcall>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.feature/feature.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="com.symbian.smt.gui.feature"
+ label="System Model Manager Feature"
+ version="1.0.0"
+ provider-name="Symbian Software Ltd.">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.ui.console"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ </requires>
+
+ <plugin
+ id="com.symbian.smt.gui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.properties/.classpath Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.properties/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.smt.gui.properties</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.properties/META-INF/MANIFEST.MF Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: System Model Manager Properties
+Bundle-SymbolicName: com.symbian.smt.gui.properties
+Bundle-Version: 1.1.1
+Bundle-Vendor: Nokia Corporation
+Fragment-Host: com.symbian.smt.gui;bundle-version="0.0.1"
+Bundle-Localization: plugin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.properties/build-for-testing.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,79 @@
+<!-- Build file for testing the com.symbian.smt.gui.properties plugin -->
+<project name="com.symbian.smt.gui" default="help" basedir=".">
+ <property name="plugin.dir" location="${basedir}"/>
+ <property name="projects.dir" location="${basedir}/.."/>
+ <property file="${projects.dir}/project.properties"/>
+
+ <property name="plugin.name" value="com.symbian.smt.gui.properties"/>
+ <property name="plugin.version" value="1.1.1"/>
+ <property name="test.eclipse.dir" location="c:/opt/eclipse-for-pde-unit-tests"/>
+ <property name="target.dir" location="${projects.dir}/target"/>
+ <property name="published.plugins.dir" location="${target.dir}/plugins"/>
+ <property name="src.dir" location="${plugin.dir}"/>
+ <property name="test.dir" location="${plugin.dir}/test"/>
+ <property name="plugin.target.dir" location="${plugin.dir}/target"/>
+ <property name="reports.dir" location="${plugin.target.dir}/reports"/>
+ <property name="classes.dir" location="${plugin.target.dir}/classes"/>
+
+ <path id="build.class.path">
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.eclipse.ui_3.4*.jar"/>
+ <include name="org.eclipse.ui.workbench_3.4*.jar"/>
+ <include name="org.eclipse.core.runtime_3.4*.jar"/>
+ <include name="org.eclipse.core.resources_3.4*.jar"/>
+ <include name="org.eclipse.jface_3.4*.jar"/>
+ <include name="org.eclipse.osgi_3.4*.jar"/>
+ <include name="org.eclipse.swt_3.4*.jar"/>
+ <include name="org.eclipse.swt.win32.win32.x86_3.4*.jar"/>
+ <include name="org.eclipse.equinox.preferences_3.2*.jar"/>
+ <include name="org.eclipse.equinox.common_3.4*.jar"/>
+ <include name="org.eclipse.equinox.registry_3.4*.jar"/>
+ <include name="org.eclipse.ui.ide_3.4*.jar"/>
+ <include name="org.eclipse.core.jobs_3.4*.jar"/>
+ <include name="org.eclipse.core.commands_3.4*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="clean">
+ <delete dir="${plugin.dir}/bin"/>
+ <delete dir="${plugin.target.dir}"/>
+ </target>
+
+ <target name="build">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" classpathref="build.class.path" includeantruntime="false"/>
+ <antcall target="create_eclipse_plugin"/>
+ <copy todir="${published.plugins.dir}" file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar" overwrite="true"/>
+ </target>
+
+ <target name="create_eclipse_plugin">
+ <property file="${plugin.dir}/build.properties"/>
+ <delete file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar"/>
+ <zip destfile="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar">
+ <zipfileset dir="." includes="${bin.includes}, location.properties"/>
+ <!--<zipfileset dir="${classes.dir}"/>-->
+ </zip>
+ </target>
+
+ <target name="test">
+ <!-- no regular junit test -->
+ </target>
+
+ <target name="help">
+ <echo>
+This is the overall Ant build file for the com.symbian.smt.gui.prpoerties PDE Test projects.
+
+Usage:
+
+Target Description
+============== ==============================================
+[default] Displays this message.
+
+build Builds the source and creates the plugin jar.
+
+clean Cleans all the build and generated artefacts.
+ </echo>
+ </target>
+
+</project>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.properties/build.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,3 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.properties/build.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="com.symbian.smt.gui.frag" default="build.jars" basedir=".">
+
+ <property name="basews" value="${ws}"/>
+ <property name="baseos" value="${os}"/>
+ <property name="basearch" value="${arch}"/>
+ <property name="basenl" value="${nl}"/>
+
+ <!-- Compiler settings. -->
+ <property name="javacFailOnError" value="false"/>
+ <property name="javacDebugInfo" value="on"/>
+ <property name="javacVerbose" value="false"/>
+ <property name="logExtension" value=".log"/>
+ <property name="compilerArg" value=""/>
+ <property name="javacSource" value="1.3"/>
+ <property name="javacTarget" value="1.2"/>
+ <path id="path_bootclasspath">
+ <fileset dir="${java.home}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <property name="bootclasspath" refid="path_bootclasspath"/>
+ <property name="bundleJavacSource" value="${javacSource}"/>
+ <property name="bundleJavacTarget" value="${javacTarget}"/>
+ <property name="bundleBootClasspath" value="${bootclasspath}"/>
+
+ <target name="init" depends="properties">
+ <condition property="pluginTemp" value="${buildTempFolder}/plugins">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="pluginTemp" value="${basedir}"/>
+ <condition property="build.result.folder" value="${pluginTemp}/com.symbian.smt.gui.properties">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="build.result.folder" value="${basedir}"/>
+ <property name="temp.folder" value="${basedir}/temp.folder"/>
+ <property name="plugin.destination" value="${release.folder}"/>
+ </target>
+
+ <target name="properties" if="eclipse.running">
+ <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
+
+ </target>
+
+ <target name="build.update.jar" depends="init" description="Build the plug-in: com.symbian.smt.gui.frag for an update site.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <zip destfile="${plugin.destination}/com.symbian.smt.gui.properties.jar" basedir="${temp.folder}/com.symbian.smt.gui.properties" filesonly="false" whenempty="skip" update="false"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="build.jars" depends="init" description="Build all the jars for the plug-in: com.symbian.smt.gui.properties">
+ </target>
+
+ <target name="build.sources" depends="init">
+ </target>
+
+ <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui.frag"/>
+ <copy todir="${destination.temp.folder}/com.symbian.smt.gui.properties" failonerror="true" overwrite="false">
+ <fileset dir="${basedir}" includes="META-INF/,." />
+ </copy>
+ </target>
+
+ <target name="build.zips" depends="init">
+ </target>
+
+ <target name="gather.sources" depends="init" if="destination.temp.folder">
+ </target>
+
+ <target name="gather.logs" depends="init" if="destination.temp.folder">
+ </target>
+
+ <target name="clean" depends="init" description="Clean the plug-in: com.symbian.smt.gui.frag of all the zips, jars and logs created.">
+ <delete file="${plugin.destination}/com.symbian.smt.gui.properties_1.0.0.jar"/>
+ <delete file="${plugin.destination}/com.symbian.smt.gui.properties_1.0.0.zip"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: com.symbian.smt.gui.frag.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="build.sources"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <antcall target="gather.sources">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <delete>
+ <fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" />
+ </delete>
+
+ <copy todir="${plugin.destination}/com.symbian.smt.gui.properties">
+ <fileset dir="${temp.folder}/com.symbian.smt.gui.properties" >
+ <exclude name="**/distribution.policy*"/>
+ </fileset>
+ </copy>
+
+ <delete dir="${temp.folder}"/>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/.classpath Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.smt.gui.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/.settings/org.eclipse.jdt.core.prefs Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,7 @@
+#Wed Nov 12 12:18:47 GMT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/META-INF/MANIFEST.MF Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: com.symbian.smt.gui.test Fragment
+Bundle-SymbolicName: com.symbian.smt.gui.test
+Bundle-Version: 1.0.0
+Bundle-Vendor: Symbian Software Ltd.
+Fragment-Host: com.symbian.smt.gui
+Require-Bundle: org.junit;bundle-version="3.8.2"
Binary file sysmodelmgr/com.symbian.smt.gui.test/bin/com/symbian/smt/gui/wizard/NewSMTProjectWizardTest.class has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/build.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/build.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,194 @@
+<!-- Build file for the com.symbian.smt.gui.test plug-in PDE unit test fragment -->
+<project name="com.symbian.smt.gui.test" default="help" basedir=".">
+ <property name="plugin.dir" location="${basedir}"/>
+ <property name="projects.dir" location="${basedir}/.."/>
+ <property file="${projects.dir}/project.properties"/>
+
+ <property name="plugin.name" value="com.symbian.smt.gui.test"/>
+ <property name="plugin.version" value="1.0.0"/>
+ <property name="plugin.under.test.version" value="1.1.1"/>
+ <property name="properties.plugin.under.test.version" value="1.1.1"/>
+ <property name="test.eclipse.dir" location="c:/opt/eclipse-for-pde-unit-tests"/>
+ <property name="target.dir" location="${projects.dir}/target"/>
+ <property name="published.plugins.dir" location="${target.dir}/plugins"/>
+ <property name="src.dir" location="${plugin.dir}/src"/>
+ <property name="test.dir" location="${plugin.dir}/src"/>
+ <property name="plugin.target.dir" location="${plugin.dir}/target"/>
+ <property name="reports.dir" location="${plugin.target.dir}/reports"/>
+ <property name="classes.dir" location="${plugin.target.dir}/classes"/>
+ <property name="test.reports.dir" location="${reports.dir}/test"/>
+ <property name="pde.test.utils.version" value="1.0.0"/>
+
+ <path id="build.class.path">
+ <pathelement location="${published.plugins.dir}/com.symbian.smt.gui_${plugin.under.test.version}.jar"/>
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.eclipse.core.runtime_*.jar"/>
+ <include name="org.eclipse.equinox.common_*.jar"/>
+ <include name="org.eclipse.ui.workbench_*.jar"/>
+ <include name="org.eclipse.jface_*.jar"/>
+ <include name="org.eclipse.swt_*.jar"/>
+ <include name="org.eclipse.swt.win32.win32.x86_*.jar"/>
+ <include name="org.junit_3*/**/junit.jar"/>
+ <include name="org.eclipse.equinox.preferences_3.2*.jar"/>
+ <include name="org.eclipse.core.resources_3.4*.jar"/>
+ <include name="org.eclipse.ui.ide_3.4*.jar"/>
+ <include name="org.eclipse.core.jobs_3.4*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="pde.test.listener.class.path">
+ <path refid="build.class.path"/>
+ <pathelement location="${published.plugins.dir}/com.symbian.pde.test.utils_${pde.test.utils.version}.jar"/>
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.apache.ant_*/**/ant.jar"/>
+ <include name="org.apache.ant_*/**/ant-junit.jar"/>
+ <include name="org.eclipse.jdt.junit_*.jar"/>
+ <include name="org.eclipse.debug.core_*.jar"/>
+ <include name="org.eclipse.osgi_*.jar"/>
+ <include name="org.eclipse.core.resources_*.jar"/>
+ <include name="org.eclipse.swt_*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="pde.test.port.locator.class.path">
+ <pathelement location="${published.plugins.dir}/com.symbian.pde.test.utils_${pde.test.utils.version}.jar"/>
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.junit_3*/**/junit.jar"/>
+ </fileset>
+ </path>
+
+ <path id="equinox.launcher.class.path">
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.eclipse.equinox.launcher_*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="build">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${test.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" classpathref="build.class.path" includeantruntime="false"/>
+ <antcall target="create_eclipse_plugin"/>
+ <copy todir="${published.plugins.dir}" file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar" overwrite="true"/>
+ </target>
+
+ <target name="create_eclipse_plugin">
+ <property file="${plugin.dir}/build.properties"/> <!-- Load bin.includes property from plugin's eclipse build.properties file -->
+ <delete file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar"/>
+ <zip destfile="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar">
+ <zipfileset dir="." includes="${bin.includes}"/>
+ <zipfileset dir="${classes.dir}"/>
+ </zip>
+ </target>
+
+ <target name="test" depends="build, pde_test, generate_report, check_results"/>
+
+ <target name="pde_test">
+ <delete>
+ <fileset dir="${test.eclipse.dir}/plugins" includes="com.symbian.smt.gui*.jar"/>
+ <fileset dir="${test.eclipse.dir}/plugins" includes="com.symbian.pde.test.utils*.jar"/>
+ </delete>
+
+ <!-- Load plugin and pde tests plugin fragment into test eclipse installation -->
+ <copy todir="${test.eclipse.dir}/plugins" overwrite="true">
+ <fileset dir="${published.plugins.dir}"/>
+ </copy>
+
+ <delete file="pde_test_port.properties"/> <!-- properties file generated by PDETestPortLocator class in com.symbian.pde.test.utils -->
+ <java classname="com.symbian.pde.test.utils.PDETestPortLocator" fork="yes" classpathref="pde.test.port.locator.class.path"/>
+ <waitfor maxwait="10" maxwaitunit="second" checkevery="100" checkeveryunit="millisecond">
+ <available file="pde_test_port.properties"/>
+ </waitfor>
+ <property file="pde_test_port.properties"/>
+ <echo message="Using port ${pde.test.port} for listening to PDE Test run"/>
+
+ <parallel>
+ <daemons>
+ <antcall target="run_pde_test_listener"/>
+ </daemons>
+ <sequential>
+ <sleep seconds="5"/> <!-- Give the listener a few seconds to start up -->
+ <antcall target="run_pde_tests"/>
+ </sequential>
+ </parallel>
+
+ <delete>
+ <fileset dir="${test.eclipse.dir}/plugins" includes="com.symbian.smt.gui*.jar"/>
+ <fileset dir="${test.eclipse.dir}/plugins" includes="com.symbian.pde.test.utils*.jar"/>
+ </delete>
+
+ <mkdir dir="${test.reports.dir}"/>
+ <move todir="${test.reports.dir}">
+ <fileset dir=".">
+ <include name="**/TEST-*.xml"/>
+ </fileset>
+ </move>
+ </target>
+
+ <target name="run_pde_test_listener">
+ <java classname="com.symbian.pde.test.utils.PDETestResultsCollector" fork="yes" classpathref="pde.test.listener.class.path">
+ <arg line="${plugin.name} ${pde.test.port}"/>
+ </java>
+ </target>
+
+ <target name="run_pde_tests">
+ <property name="test.classes.list" value="com.symbian.smt.gui.smtwidgets.ModelControlWidgetTest"/>
+ <property name="test.classes.list" value="com.symbian.smt.gui.wizard.NewSMTProjectWizardTest"/>
+ <property name="test.classes.list" value="com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesTest"/>
+ <property name="test.classes.list" value="com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidatorTest"/>
+ <mkdir dir="${test.reports.dir}/output/ws"/>
+ <java dir="${plugin.dir}" classname="org.eclipse.equinox.launcher.Main" fork="yes" classpathref="equinox.launcher.class.path">
+ <arg line="-application org.eclipse.pde.junit.runtime.uitestapplication -data ${test.reports.dir}/output/ws -dev bin -clean -port ${pde.test.port} -testpluginname com.symbian.smt.gui -classnames ${test.classes.list}"/>
+ </java>
+ </target>
+
+ <target name="generate_report">
+ <junitreport todir="${test.reports.dir}">
+ <fileset dir="${test.reports.dir}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report todir="${test.reports.dir}" />
+ </junitreport>
+ </target>
+
+ <target name="check_results">
+ <loadfile srcfile="${test.reports.dir}/overview-summary.html" property="full.results.summary"/> <!-- works if you load 2 times ?? -->
+ <loadfile srcfile="${test.reports.dir}/overview-summary.html" property="results.summary">
+ <filterchain>
+ <headfilter lines="30" />
+ <linecontains>
+ <contains value="%</td>" />
+ </linecontains>
+ </filterchain>
+ </loadfile>
+
+ <condition property="tests.passed">
+ <contains string="${results.summary}" substring="100.00%" />
+ </condition>
+ <fail message="FAILED - some tests failed - see ${test.reports.dir}/index.html for more details" unless="tests.passed" />
+ <echo message="SUCCESS - all tests passed - see ${test.reports.dir}/index.html for more details" />
+ </target>
+
+ <target name="clean">
+ <delete file="pde_test_port.properties"/>
+ <delete dir="${plugin.dir}/bin"/>
+ <delete dir="${plugin.target.dir}"/>
+ </target>
+
+ <target name="help">
+ <echo>
+This is the ant build file for the com.symbian.smt.gui.test PDE Tests.
+
+Usage:
+
+Target Description
+============== ==============================================
+[default] Displays this message.
+
+build Builds the source and creates the plugin jar.
+
+clean Cleans all the build and generated artefacts.
+
+test Builds and runs the PDE JUnit tests and generates a report.
+ </echo>
+ </target>
+
+</project>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/SystemDefinitionTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,97 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author jamesclark
+ *
+ */
+public class SystemDefinitionTest extends TestCase {
+
+ String validSysDef = "src/com/symbian/smt/gui/validSysDef.xml";
+ String noDTDSysDef = "src/com/symbian/smt/gui/noDTDSysDef.xml";
+ String invalidDocTypeSysDef = "src/com/symbian/smt/gui/invalidDocTypeSysDef.xml";
+ String nonExistantSysDef = "iDontExist.xml";
+ String malformedSysDef = "src/com/symbian/smt/gui/malformedSysDef.xml";
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.SystemDefinition#checkValidSystemDefinitionFile(java.lang.String)}.
+ */
+ public void testCheckValidSystemDefinitionFile_ValidSysDef() {
+ try {
+ SystemDefinition.checkValidSystemDefinitionFile(validSysDef);
+ } catch (SystemDefinitionValidationException e) {
+ e.printStackTrace();
+ fail("Valid sys def failed validation due to: "+e.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.SystemDefinition#checkValidSystemDefinitionFile(java.lang.String)}.
+ */
+ public void testCheckValidSystemDefinitionFile_noDTDSysDef() {
+ try {
+ SystemDefinition.checkValidSystemDefinitionFile(noDTDSysDef);
+ } catch (SystemDefinitionValidationException e) {
+ fail("SysDef with no DTD should pass validation");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.SystemDefinition#checkValidSystemDefinitionFile(java.lang.String)}.
+ */
+ public void testCheckValidSystemDefinitionFile_invalidDocTypeSysDef() {
+ try {
+ SystemDefinition.checkValidSystemDefinitionFile(invalidDocTypeSysDef);
+ fail("Invalid sys def passed validation: "+invalidDocTypeSysDef);
+ } catch (SystemDefinitionValidationFatalException e) {
+ //pass
+ } catch (SystemDefinitionValidationException e) {
+ e.printStackTrace();
+ fail("Incase of an invalid doc type SystemDefinitionValidationFatalException but got "+e.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.SystemDefinition#checkValidSystemDefinitionFile(java.lang.String)}.
+ */
+ public void testCheckValidSystemDefinitionFile_nonExistantSysDef() {
+ try {
+ SystemDefinition.checkValidSystemDefinitionFile(nonExistantSysDef);
+ fail("Invalid sys def passed validation: "+nonExistantSysDef);
+ } catch (SystemDefinitionValidationException e) {
+ assertTrue("Expected exception cause to be IOException but was "+e.getClass(), e.getCause() instanceof IOException);
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.SystemDefinition#checkValidSystemDefinitionFile(java.lang.String)}.
+ */
+ public void testCheckValidSystemDefinitionFile_malformedSysDef() {
+ try {
+ SystemDefinition.checkValidSystemDefinitionFile(malformedSysDef);
+ fail("Invalid sys def passed validation: "+malformedSysDef);
+ } catch (SystemDefinitionValidationException e) {
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/TestConstants.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,26 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.smt.gui;
+
+public interface TestConstants {
+
+ public static final String RESOURCE_FILES_FOLDER_PATH = "\\resources\\auxiliary\\";
+
+ // Standard resource files paths
+ public static final String COLOUR_RESOURCE_FILE_PATH = "./../SystemModelGenerator/resources/auxiliary/system_model_colors.xml";
+ public static final String LOCALISATION_RESOURCE_FILE_PATH = "./../SystemModelGenerator/resources/auxiliary/display-names.xml";
+ public static final String SHAPES_RESOURCE_FILE_PATH = "./../SystemModelGenerator/resources/auxiliary/Shapes.xml";
+ public static final String SYSTEM_INFO_RESOURCE_FILE_PATH = "./../SystemModelGenerator/resources/auxiliary/SystemInfo.xml";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/invalidDocTypeSysDef.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition1 [
+<!ELEMENT SystemDefinition ( systemModel )>
+<!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED
+>
+<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not. -->
+
+<!-- System Model Section of DTD -->
+<!ELEMENT systemModel (layer+)>
+
+<!ELEMENT layer (block* | collection*)*>
+<!-- Kernel Services, Base Services, OS Services, Etc -->
+<!ATTLIST layer
+ name CDATA #REQUIRED
+ levels NMTOKENS #IMPLIED
+ span CDATA #IMPLIED
+>
+
+<!ELEMENT block (subblock* | collection*)*>
+ <!-- Generic OS services, Comms Services, etc -->
+<!ATTLIST block
+ levels NMTOKENS #IMPLIED
+ span CDATA #IMPLIED
+ level NMTOKEN #IMPLIED
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT subblock (collection)*>
+<!-- Cellular Baseband Services, Networking Services, etc -->
+<!ATTLIST subblock
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT collection (component)*>
+<!-- Screen Driver, Content Handling, etc -->
+<!ATTLIST collection
+ name CDATA #REQUIRED
+ level NMTOKEN #IMPLIED
+>
+
+<!ELEMENT component (unit)*>
+<!-- contains units or is a package or prebuilt -->
+<!ATTLIST component
+ name CDATA #REQUIRED
+ deprecated CDATA #IMPLIED
+ introduced CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ plugin (Y|N) "N"
+ filter CDATA #IMPLIED
+ class NMTOKENS #IMPLIED
+ supports CDATA #IMPLIED
+>
+
+<!ELEMENT unit EMPTY >
+<!-- must be buildable (bld.inf) -->
+<!-- bldFile may someday be removed in favour of mrp -->
+<!ATTLIST unit
+ mrp CDATA #IMPLIED
+ filter CDATA #IMPLIED
+ bldFile CDATA #IMPLIED
+ root CDATA #IMPLIED
+ version NMTOKEN #IMPLIED
+ prebuilt NMTOKEN #IMPLIED
+ late (Y|N) #IMPLIED
+ priority CDATA #IMPLIED
+>
+
+]>
+<SystemDefinition name="TCL" schema="2.0.0">
+ <systemModel>
+ <layer name="Unclassified">
+ <collection name="foo1">
+ <component name="foo2" filter="foo1">
+ <unit mrp="an.mrp"/>
+ </component>
+ </collection>
+ </layer>
+ <layer name="bar1">
+ <block name="bar2">
+ <collection name="bar3">
+ <component name="bar4" filter="bar1">
+ <unit mrp="another.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ <layer name="bash" levels="low">
+ <block name="bash2" level="low">
+ <collection name="bash2">
+ <component name="bash3" filter="bash4">
+ <unit mrp="yetanother.mrp"/>
+ </component>
+ </collection>
+ <collection name="bash5">
+ <component name="bash6" filter="bash4">
+ <unit bldFile="group" mrp="fudge.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ </systemModel>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/malformedSysDef.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,99 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition1 [
+<!ELEMENT SystemDefinition ( systemModel )>
+<!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED
+>
+<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not. -->
+
+<!-- System Model Section of DTD -->
+<!ELEMENT systemModel (layer+)>
+
+<!ELEMENT layer (block* | collection*)*>
+<!-- Kernel Services, Base Services, OS Services, Etc -->
+<!ATTLIST layer
+ name CDATA #REQUIRED
+ levels NMTOKENS #IMPLIED
+ span CDATA #IMPLIED
+>
+
+<!ELEMENT block (subblock* | collection*)*>
+ <!-- Generic OS services, Comms Services, etc -->
+<!ATTLIST block
+ levels NMTOKENS #IMPLIED
+ span CDATA #IMPLIED
+ level NMTOKEN #IMPLIED
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT subblock (collection)*>
+<!-- Cellular Baseband Services, Networking Services, etc -->
+<!ATTLIST subblock
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT collection (component)*>
+<!-- Screen Driver, Content Handling, etc -->
+<!ATTLIST collection
+ name CDATA #REQUIRED
+ level NMTOKEN #IMPLIED
+>
+
+<!ELEMENT component (unit)*>
+<!-- contains units or is a package or prebuilt -->
+<!ATTLIST component
+ name CDATA #REQUIRED
+ deprecated CDATA #IMPLIED
+ introduced CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ plugin (Y|N) "N"
+ filter CDATA #IMPLIED
+ class NMTOKENS #IMPLIED
+ supports CDATA #IMPLIED
+>
+
+<!ELEMENT unit EMPTY >
+<!-- must be buildable (bld.inf) -->
+<!-- bldFile may someday be removed in favour of mrp -->
+<!ATTLIST unit
+ mrp CDATA #IMPLIED
+ filter CDATA #IMPLIED
+ bldFile CDATA #IMPLIED
+ root CDATA #IMPLIED
+ version NMTOKEN #IMPLIED
+ prebuilt NMTOKEN #IMPLIED
+ late (Y|N) #IMPLIED
+ priority CDATA #IMPLIED
+>
+
+]>
+<SystemDefinition name="TCL" schema="2.0.0">
+ <systemModel>
+ <layer name="Unclassified">
+ <collection name="foo1">
+ <component name="foo2" filter="foo1">
+ <unit mrp="an.mrp"/>
+ </component>
+ </layer>
+ <layer name="bar1">
+ <block name="bar2">
+ <collection name="bar3">
+ <component name="bar4" filter="bar1">
+ <unit mrp="another.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ <layer name="bash" levels="low">
+ <block name="bash2" level="low">
+ <collection name="bash2">
+ <component name="bash3" filter="bash4">
+ <unit mrp="yetanother.mrp"/>
+ </component>
+ </collection>
+ <collection name="bash5">
+ <component name="bash6" filter="bash4">
+ <unit bldFile="group" mrp="fudge.mrp"/>
+ </component>
+ </collection>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/noDTDSysDef.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<SystemDefinition name="TCL" schema="2.0.0">
+ <systemModel>
+ <layer name="Unclassified">
+ <collection name="foo1">
+ <component name="foo2" filter="foo1">
+ <unit mrp="an.mrp"/>
+ </component>
+ </collection>
+ </layer>
+ <layer name="bar1">
+ <block name="bar2">
+ <collection name="bar3">
+ <component name="bar4" filter="bar1">
+ <unit mrp="another.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ <layer name="bash" levels="low">
+ <block name="bash2" level="low">
+ <collection name="bash2">
+ <component name="bash3" filter="bash4">
+ <unit mrp="yetanother.mrp"/>
+ </component>
+ </collection>
+ <collection name="bash5">
+ <component name="bash6" filter="bash4">
+ <unit bldFile="group" mrp="fudge.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ </systemModel>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/smtwidgets/ModelControlWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,345 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.smt.gui.smtwidgets;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.preferences.SmmPreferencesInitializer;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class ModelControlWidgetTest extends TestCase {
+
+ private Dialog dialog;
+ private PersistentDataStore instanceStore;
+ private ModelControlWidget modelControlWidget;
+ private int validModelDefinedPassNumber = 1;
+
+ protected void setUp() throws Exception {
+ // Initialise the default values
+ SmmPreferencesInitializer initialiser = new SmmPreferencesInitializer();
+
+ initialiser.initializeDefaultPreferences();
+
+
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ Shell shell = workbench.getActiveWorkbenchWindow().getShell();
+
+ dialog = new Dialog(shell) {
+ protected Control createContents(Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FillLayout());
+ modelControlWidget = new ModelControlWidget(c, SWT.NONE);
+
+ return c;
+ }
+ };
+
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ }
+
+ protected void tearDown() throws Exception {
+ dialog.close();
+ dialog = null;
+ modelControlWidget.dispose();
+ modelControlWidget = null;
+
+ validModelDefinedPassNumber = 1;
+ }
+
+ public final void testAddModelListener() {
+ List<ValidModelDefinedListener> listeners = modelControlWidget.getModelListeners();
+
+ assertTrue (listeners.size() == 0);
+
+ ValidModelDefinedListener listener = new ValidModelDefinedListener() {
+ public void validModelDefined(ValidModelEvent event) {
+ // Do nothing
+ ;
+ }
+ };
+
+ modelControlWidget.addModelListener(listener);
+
+ listeners = modelControlWidget.getModelListeners();
+
+ assertTrue (listeners.size() == 1);
+ }
+
+ public final void testCheckDpi() {
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(
+ instanceNode, defaultNode);
+
+ modelControlWidget.initialisePrintedDpi(instanceStore);
+
+ modelControlWidget.addModelListener(new ValidModelDefinedListener() {
+ public void validModelDefined(ValidModelEvent event) {
+ String message = event.getMessage();
+ Type type = event.getType();
+
+ if (validModelDefinedPassNumber == 1) {
+ assertEquals("", message);
+ assertEquals(Type.SUCCESS, type);
+ validModelDefinedPassNumber = 2;
+ }
+ else if (validModelDefinedPassNumber == 2) {
+ assertEquals("", message);
+ assertEquals(Type.SUCCESS, type);
+ validModelDefinedPassNumber = 3;
+ }
+ else {
+ assertEquals("The DPI value must be an integer value or empty (screen resolution).", message);
+ assertEquals(Type.ERROR, type);
+ }
+ }
+ });
+
+ Combo c = modelControlWidget.getPrintedDpiCombo();
+
+ c.setText("2400");
+
+ // TODO:BRS:The next test should fail. The validation code needs to cater for negative numbers
+ // (what about floats as opposed to integers?)
+ c.setText("-1200");
+
+ c.setText("test");
+ }
+
+ public final void testGetFixItemSize() {
+ Button b = modelControlWidget.getFixItemSizeButton();
+
+ b.setSelection(true);
+
+ Boolean actual = modelControlWidget.getFixItemSize();
+
+ assertTrue(actual);
+ b.setSelection(false);
+
+ actual = modelControlWidget.getFixItemSize();
+
+ assertFalse(actual);
+ }
+
+ public final void testGetPrintedDpis() {
+ Combo c = modelControlWidget.getPrintedDpiCombo();
+
+ c.setItems(new String[] {"1200", "300", "600"});
+
+ String[] actual = modelControlWidget.getPrintedDpis();
+ String[] expected = {"300", "600", "1200"};
+
+ testPrintedDpiComboValues(expected, actual);
+
+ c.setText("2400");
+
+ actual = modelControlWidget.getPrintedDpis();
+ expected = new String[] {"300", "600", "1200", "2400"};
+
+ testPrintedDpiComboValues(expected, actual);
+ }
+
+ public final void testGetSelectedPrintedDpi() {
+ Combo c = modelControlWidget.getPrintedDpiCombo();
+ String expected = "300";
+
+ c.setText(expected);
+
+ String actual = modelControlWidget.getSelectedPrintedDpi();
+
+ assertEquals(expected, actual);
+ }
+
+ public final void testGetSuppressMouseOverEffect() {
+ Button b = modelControlWidget.getSuppressMouseOverEffectButton();
+
+ b.setSelection(true);
+
+ Boolean actual = modelControlWidget.getSuppressMouseOverEffect();
+
+ assertTrue(actual);
+ b.setSelection(false);
+
+ actual = modelControlWidget.getSuppressMouseOverEffect();
+
+ assertFalse(actual);
+ }
+
+ public final void testInitialisePrintedDpi() {
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(
+ instanceNode, defaultNode);
+
+ modelControlWidget.initialisePrintedDpi(instanceStore);
+
+ Combo printedDpiCombo = modelControlWidget.getPrintedDpiCombo();
+ String[] actualItems = printedDpiCombo.getItems();
+ String[] expectedItems = {"300", "600"};
+
+ testPrintedDpiComboValues(expectedItems, actualItems);
+
+ String actualSelectedItem = printedDpiCombo.getText();
+ String expectedSelectedItem = "600";
+
+ assertEquals(expectedSelectedItem, actualSelectedItem);
+ }
+
+ public final void testModelControlWidget() {
+ Combo combo = modelControlWidget.getPrintedDpiCombo();
+
+ assertNotNull(combo);
+
+ Button button = modelControlWidget.getFixItemSizeButton();
+
+ assertNotNull(button);
+
+ Label label = modelControlWidget.getPrintedDpiLabel();
+
+ assertNotNull(label);
+ assertEquals("Printed Resolution (DPI)", label.getText());
+
+ label = modelControlWidget.getSuppressMouseOverEffectsLabel();
+
+ assertNotNull(label);
+ assertEquals("Suppress Mouseover Effects", label.getText());
+
+ label = modelControlWidget.getFixedItemSizeLabel();
+
+ assertNotNull(label);
+ assertEquals("Fix Items Size", label.getText());
+ }
+
+ private void testPrintedDpiComboValues(String[] expectedItems, String[] actualItems) {
+ assertEquals(expectedItems.length, actualItems.length);
+
+ for (int i = 0; i < expectedItems.length; i++) {
+ assertEquals(expectedItems[i], actualItems[i]);
+ }
+ }
+
+ public final void testRemoveModelListener() {
+ ValidModelDefinedListener listener = new ValidModelDefinedListener() {
+ public void validModelDefined(ValidModelEvent event) {
+ // Do nothing
+ ;
+ }
+ };
+
+ modelControlWidget.addModelListener(listener);
+
+ List<ValidModelDefinedListener> listeners = modelControlWidget.getModelListeners();
+
+ assertTrue (listeners.size() == 1);
+
+ modelControlWidget.removeModelListener(listener);
+
+ listeners = modelControlWidget.getModelListeners();
+
+ assertTrue (listeners.size() == 0);
+ }
+
+ public final void testSetFixItemSize() {
+ Button b = modelControlWidget.getFixItemSizeButton();
+
+ modelControlWidget.setFixItemSize(true);
+
+ assertTrue(b.getSelection());
+
+ modelControlWidget.setFixItemSize(false);
+
+ assertFalse(b.getSelection());
+ }
+
+ public final void testSetPrintedDpis() {
+ Combo c = modelControlWidget.getPrintedDpiCombo();
+
+ modelControlWidget.setPrintedDpis(new String[] {"1200", "300", "600"});
+
+ String[] actual = c.getItems();
+ String[] expected = {"1200", "300", "600"};
+
+ testPrintedDpiComboValues(expected, actual);
+
+ c.setText("2400");
+
+ actual = modelControlWidget.getPrintedDpis();
+ expected = new String[] {"300", "600", "1200", "2400"};
+
+ testPrintedDpiComboValues(expected, actual);
+ }
+
+ public final void testSetSelectedPrintedDpi() {
+ Combo c = modelControlWidget.getPrintedDpiCombo();
+
+ // Testing selection prior to setting items in the Combo
+ String selected = "300";
+
+ modelControlWidget.setSelectedPrintedDpi(selected);
+
+ String actual = c.getText();
+
+ assertEquals("", actual);
+
+ // Testing selection after having set items in the Combo
+ c.setItems(new String[] {"300", "600", "1200"});
+ modelControlWidget.setSelectedPrintedDpi(selected);
+
+ actual = c.getText();
+
+ assertEquals(selected, actual);
+ }
+
+ public final void testSetSuppressMouseOverEffect() {
+ Button b = modelControlWidget.getSuppressMouseOverEffectButton();
+
+ modelControlWidget.setSuppressMouseOverEffect(true);
+
+ assertTrue(b.getSelection());
+
+ modelControlWidget.setSuppressMouseOverEffect(false);
+
+ assertFalse(b.getSelection());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/smtwidgets/resources/ResourceFileSelectionValidatorTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,140 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+import com.symbian.smt.gui.ResourcesEnums;
+import com.symbian.smt.gui.preferences.SmmPreferencesInitializer;
+import com.symbian.smt.gui.smtwidgets.InvalidPathException;
+import com.symbian.smt.gui.smtwidgets.XmlFileSelectionDialog;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class ResourceFileSelectionValidatorTest extends TestCase {
+
+ private XmlFileSelectionDialog dialog;
+ private String smgFolder;
+ private ResourceFileSelectionValidator validator;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ // Initialise the default values
+ SmmPreferencesInitializer initialiser = new SmmPreferencesInitializer();
+
+ initialiser.initializeDefaultPreferences();
+
+ smgFolder = initialiser.getSmgFolder();
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ Shell shell = workbench.getActiveWorkbenchWindow().getShell();
+ String dialogTitle = "New System Definition File";
+ String dialogMessage = "Enter the path or URL to the system definition file";
+ String initialPath = "";
+ String[] filterNames = { "*.xml" };
+ List<CheckableResourceFilename> filenames = new ArrayList<CheckableResourceFilename>();
+ validator = new ResourceFileSelectionValidator(ResourcesEnums.COLOURS, filenames);
+ dialog = new XmlFileSelectionDialog(shell, dialogTitle, dialogMessage, initialPath, filterNames, validator);
+
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidator#ResourceFileSelectionValidator(com.symbian.smt.gui.ResourcesEnums, java.util.List)}.
+ */
+ public final void testResourceFileSelectionValidator() {
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidator#isFileReadable(java.lang.String)}.
+ */
+ public final void testIsFileReadable() {
+ String localPath = smgFolder + "/foobar.xml";
+
+ String actual = validator.isFileReadable(localPath);
+
+ assertEquals("Selected file cannot be read.", actual);
+
+ localPath = smgFolder + "/resources/auxiliary/system_model_colors.xml";
+
+ actual = validator.isFileReadable(localPath);
+
+ assertNull(actual);
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidator#isUrl(java.lang.String)}.
+ */
+ public final void testIsUrl() {
+ try {
+ String path = "foo.bar";
+ boolean result = validator.isUrl(path);
+
+ assertFalse(result);
+
+ path = ":foo.bar:baz";
+ result = validator.isUrl(path);
+
+ assertFalse(result);
+
+ path = "http://bar.baz";
+ result = validator.isUrl(path);
+
+ assertTrue(result);
+ } catch (InvalidPathException e) {
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidator#isUrlResourceReadable(java.lang.String)}.
+ */
+ public final void testIsUrlResourceReadable() {
+ // Not yet implemented
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidator#isValid(java.lang.String)}.
+ */
+ public final void testIsValid() {
+ // Not yet implemented
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourceFileSelectionValidator#isXmlValid(java.lang.String)}.
+ */
+ public final void testIsXmlValid() {
+ // Not yet implemented
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/validSysDef.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition [
+<!ELEMENT SystemDefinition ( systemModel )>
+<!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED
+>
+<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not. -->
+
+<!-- System Model Section of DTD -->
+<!ELEMENT systemModel (layer+)>
+
+<!ELEMENT layer (block* | collection*)*>
+<!-- Kernel Services, Base Services, OS Services, Etc -->
+<!ATTLIST layer
+ name CDATA #REQUIRED
+ levels NMTOKENS #IMPLIED
+ span CDATA #IMPLIED
+>
+
+<!ELEMENT block (subblock* | collection*)*>
+ <!-- Generic OS services, Comms Services, etc -->
+<!ATTLIST block
+ levels NMTOKENS #IMPLIED
+ span CDATA #IMPLIED
+ level NMTOKEN #IMPLIED
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT subblock (collection)*>
+<!-- Cellular Baseband Services, Networking Services, etc -->
+<!ATTLIST subblock
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT collection (component)*>
+<!-- Screen Driver, Content Handling, etc -->
+<!ATTLIST collection
+ name CDATA #REQUIRED
+ level NMTOKEN #IMPLIED
+>
+
+<!ELEMENT component (unit)*>
+<!-- contains units or is a package or prebuilt -->
+<!ATTLIST component
+ name CDATA #REQUIRED
+ deprecated CDATA #IMPLIED
+ introduced CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ plugin (Y|N) "N"
+ filter CDATA #IMPLIED
+ class NMTOKENS #IMPLIED
+ supports CDATA #IMPLIED
+>
+
+<!ELEMENT unit EMPTY >
+<!-- must be buildable (bld.inf) -->
+<!-- bldFile may someday be removed in favour of mrp -->
+<!ATTLIST unit
+ mrp CDATA #IMPLIED
+ filter CDATA #IMPLIED
+ bldFile CDATA #IMPLIED
+ root CDATA #IMPLIED
+ version NMTOKEN #IMPLIED
+ prebuilt NMTOKEN #IMPLIED
+ late (Y|N) #IMPLIED
+ priority CDATA #IMPLIED
+>
+
+]>
+<SystemDefinition name="TCL" schema="2.0.0">
+ <systemModel>
+ <layer name="Unclassified">
+ <collection name="foo1">
+ <component name="foo2" filter="foo1">
+ <unit mrp="an.mrp"/>
+ </component>
+ </collection>
+ </layer>
+ <layer name="bar1">
+ <block name="bar2">
+ <collection name="bar3">
+ <component name="bar4" filter="bar1">
+ <unit mrp="another.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ <layer name="bash" levels="low">
+ <block name="bash2" level="low">
+ <collection name="bash2">
+ <component name="bash3" filter="bash4">
+ <unit mrp="yetanother.mrp"/>
+ </component>
+ </collection>
+ <collection name="bash5">
+ <component name="bash6" filter="bash4">
+ <unit bldFile="group" mrp="fudge.mrp"/>
+ </component>
+ </collection>
+ </block>
+ </layer>
+ </systemModel>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/wizard/NewProjectWizardTabbedPropertiesPageTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,540 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.smt.gui.wizard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.TestConstants;
+import com.symbian.smt.gui.preferences.SmmPreferencesInitializer;
+import com.symbian.smt.gui.smtwidgets.AdvancedOptionsWidget;
+import com.symbian.smt.gui.smtwidgets.BuildControlWidget;
+import com.symbian.smt.gui.smtwidgets.FilterWidget;
+import com.symbian.smt.gui.smtwidgets.IgnoreWidget;
+import com.symbian.smt.gui.smtwidgets.ModelControlWidget;
+import com.symbian.smt.gui.smtwidgets.ModelLabelsWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+import com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget;
+
+public class NewProjectWizardTabbedPropertiesPageTest extends TestCase {
+
+ private static final String SEPARATOR = "|";
+
+ private IStructuredSelection selection;
+ private Shell shell;
+ private String smgFolder;
+ private NewSMTProjectWizard wizard;
+ private WizardDialog wizardDialog;
+ private IWorkbench workbench;
+
+ private String[] convertFilenamesToAbsolute(String[] relativeFilenames) {
+ String[] absoluteFilenames = new String[relativeFilenames.length];
+
+ for (int i = 0; i < relativeFilenames.length; i++) {
+ String relativeFilename = relativeFilenames[i];
+
+ if (relativeFilename.equals("Auto")) {
+ absoluteFilenames[i] = relativeFilename;
+ } else {
+ String absoluteFilename = Helper.relative2AbsolutePaths(
+ relativeFilename, smgFolder, SEPARATOR);
+ absoluteFilenames[i] = absoluteFilename;
+ }
+ }
+
+ return absoluteFilenames;
+ }
+
+ protected void setUp() throws Exception {
+ // Initialise the default values
+ SmmPreferencesInitializer initialiser = new SmmPreferencesInitializer();
+
+ initialiser.initializeDefaultPreferences();
+
+ smgFolder = initialiser.getSmgFolder();
+ wizard = new NewSMTProjectWizard();
+ selection = new StructuredSelection(StructuredSelection.EMPTY);
+ workbench = PlatformUI.getWorkbench();
+ shell = workbench.getActiveWorkbenchWindow().getShell();
+
+ wizard.init(workbench, selection);
+
+ wizardDialog = new WizardDialog(shell, wizard);
+
+ wizardDialog.setBlockOnOpen(false);
+ wizardDialog.open();
+ }
+
+ protected void tearDown() throws Exception {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+
+ ws.getRoot().delete(true, true, null);
+ wizardDialog.close();
+ wizard.dispose();
+
+ wizard = null;
+ wizardDialog = null;
+ selection = null;
+ shell = null;
+ smgFolder = null;
+ workbench = null;
+ }
+
+ private void testAdvancedOptionsWidgetInitialised(
+ AdvancedOptionsWidget widget) {
+ String message = "Error in widget's advanced options.";
+ Object[] expectedValues = new String[] {};
+ Object[] actualValues = widget.getAdvancedOptions();
+ testWidgetValues(message, expectedValues, actualValues);
+ }
+
+ private void testBuildControlWidgetInitialised(BuildControlWidget widget) {
+ String message = "Error in widget's output filename.";
+ String expectedValue = "Model.svg";
+ String actualValue = widget.getOutputFilename();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ // We do not test for the warning level here because it is not
+ // initialised in the BuildControlWidget when the container
+ // is either the wizard or the properties page (this happens
+ // only in preferences)
+ }
+
+ public void testCreateControl() {
+ IWizardPage[] pages = wizard.getPages();
+ NewProjectWizardTabbedPropertiesPage page = (NewProjectWizardTabbedPropertiesPage) pages[2];
+ TabFolder tf = page.getTabFolder();
+
+ assertNotNull(tf);
+ TabItem[] items = tf.getItems();
+
+ assertEquals(7, items.length);
+
+ TabItem item = items[0];
+ assertTrue(item.getControl() instanceof ModelLabelsWidget);
+ assertEquals("Labels", item.getText());
+
+ item = items[1];
+ assertTrue(item.getControl() instanceof ResourcesWidget);
+ assertEquals("Resources", item.getText());
+
+ item = items[2];
+ assertTrue(item.getControl() instanceof ModelControlWidget);
+ assertEquals("Model Control", item.getText());
+
+ item = items[3];
+ assertTrue(item.getControl() instanceof FilterWidget);
+ assertEquals("Filters", item.getText());
+
+ item = items[4];
+ assertTrue(item.getControl() instanceof IgnoreWidget);
+ assertEquals("Ignore List", item.getText());
+
+ item = items[5];
+ assertTrue(item.getControl() instanceof BuildControlWidget);
+ assertEquals("Build Options", item.getText());
+
+ item = items[6];
+ assertTrue(item.getControl() instanceof AdvancedOptionsWidget);
+ assertEquals("Advanced Options", item.getText());
+ }
+
+ public void testDispose() {
+ IWizardPage[] pages = wizard.getPages();
+ NewProjectWizardTabbedPropertiesPage page = (NewProjectWizardTabbedPropertiesPage) pages[2];
+ TabFolder tf = page.getTabFolder();
+ TabItem[] items = tf.getItems();
+
+ ModelControlWidget mcw = (ModelControlWidget) items[2].getControl();
+
+ page.dispose();
+ List<ValidModelDefinedListener> listeners = mcw.getModelListeners();
+ assertFalse(listeners.contains(page));
+
+ BuildControlWidget bcw = (BuildControlWidget) items[5].getControl();
+
+ page.dispose();
+ listeners = bcw.getModelListeners();
+ assertFalse(listeners.contains(page));
+ }
+
+ private void testFilterWidgetInitialised(FilterWidget widget) {
+ String message = "Error in widget's filter items.";
+ String[] expectedValues = new String[] { "*" };
+ String[] actualValues = widget.getFilterItems();
+ testWidgetValues(message, expectedValues, actualValues);
+ }
+
+ private final void testIgnoreItemsValues(String message,
+ List<String[]> expected, List<String[]> actual) {
+ assertEquals(message, expected.size(), actual.size());
+
+ Iterator<String[]> expectedIter = expected.iterator();
+ Iterator<String[]> actualIter = actual.iterator();
+
+ while (expectedIter.hasNext() && actualIter.hasNext()) {
+ String[] expectedArray = expectedIter.next();
+ String[] actualArray = actualIter.next();
+
+ for (int i = 0; i < expectedArray.length; i++) {
+ String expectedValue = expectedArray[i];
+ String actualValue = actualArray[i];
+
+ assertEquals(message, expectedValue, actualValue);
+ }
+ }
+ }
+
+ private void testIgnoreWidgetInitialised(IgnoreWidget widget) {
+ String message = "Error in widget's ignored items.";
+ List<String[]> expectedIgnoredItems = new ArrayList<String[]>();
+ expectedIgnoredItems.add(new String[] { "layer",
+ "Tools and Utils and SDKENG" });
+ expectedIgnoredItems.add(new String[] { "layer", "MISC" });
+ expectedIgnoredItems.add(new String[] { "block", "Techview" });
+
+ List<String[]> actualIgnoredItems = widget.getIgnoreItems();
+ testIgnoreItemsValues(message, expectedIgnoredItems, actualIgnoredItems);
+ }
+
+ public void testInitialize() {
+ IWizardPage[] pages = wizard.getPages();
+ NewProjectWizardTabbedPropertiesPage page = (NewProjectWizardTabbedPropertiesPage) pages[2];
+ TabFolder tf = page.getTabFolder();
+
+ assertNotNull(tf);
+ TabItem[] items = tf.getItems();
+
+ assertEquals(7, items.length);
+
+ TabItem item = items[0];
+ assertTrue(item.getControl() instanceof ModelLabelsWidget);
+ testModelLabelsWidgetInitialised((ModelLabelsWidget) item.getControl());
+
+ item = items[1];
+ assertTrue(item.getControl() instanceof ResourcesWidget);
+ testResourcesWidgetInitialised((ResourcesWidget) item.getControl());
+
+ item = items[2];
+ assertTrue(item.getControl() instanceof ModelControlWidget);
+ testModelControlWidgetInitialised((ModelControlWidget) item
+ .getControl());
+ ModelControlWidget mcw = (ModelControlWidget) item.getControl();
+ List<ValidModelDefinedListener> listeners = mcw.getModelListeners();
+ assertTrue(listeners.contains(page));
+
+ item = items[3];
+ assertTrue(item.getControl() instanceof FilterWidget);
+ testFilterWidgetInitialised((FilterWidget) item.getControl());
+
+ item = items[4];
+ assertTrue(item.getControl() instanceof IgnoreWidget);
+ testIgnoreWidgetInitialised((IgnoreWidget) item.getControl());
+
+ item = items[5];
+ assertTrue(item.getControl() instanceof BuildControlWidget);
+ testBuildControlWidgetInitialised((BuildControlWidget) item
+ .getControl());
+ BuildControlWidget bcw = (BuildControlWidget) item.getControl();
+ listeners = bcw.getModelListeners();
+ assertTrue(listeners.contains(page));
+
+ item = items[6];
+ assertTrue(item.getControl() instanceof AdvancedOptionsWidget);
+ testAdvancedOptionsWidgetInitialised((AdvancedOptionsWidget) item
+ .getControl());
+ }
+
+ private void testModelControlWidgetInitialised(ModelControlWidget widget) {
+ String message = "Error in widget's fix item size.";
+ Boolean expectedValueB = false;
+ Boolean actualValueB = widget.getFixItemSize();
+ testWidgetValue(message, expectedValueB, actualValueB);
+
+ message = "Error in widget's highlight core OS.";
+ expectedValueB = true;
+ actualValueB = widget.getHighlightCoreOS();
+ testWidgetValue(message, expectedValueB, actualValueB);
+
+ message = "Error in widget's level of detail.";
+ String expectedValue = "component";
+ String actualValue = widget.getLevelOfDetail();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's printed dpi values.";
+ String[] expectedValues = new String[] { "300", "600" };
+ String[] actualValues = widget.getPrintedDpis();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected printed dpi.";
+ expectedValue = "600";
+ actualValue = widget.getSelectedPrintedDpi();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's suppress mouse over effect.";
+ expectedValueB = true;
+ actualValueB = widget.getSuppressMouseOverEffect();
+ testWidgetValue(message, expectedValueB, actualValueB);
+ }
+
+ private void testModelLabelsWidgetInitialised(ModelLabelsWidget widget) {
+ String message = "Error in widget's copyright text.";
+ String expectedValue = "Symbian Software Ltd.";
+ String actualValue = widget.getCopyrightText();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's distribution text values.";
+ String[] expectedValues = new String[] { "secret", "confidential",
+ "internal", "unrestricted" };
+ String[] actualValues = widget.getDistributionTexts();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's model name.";
+ expectedValue = "System Model";
+ actualValue = widget.getModelName();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's model version.";
+ expectedValue = "1";
+ actualValue = widget.getModelVersion();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's model version text values.";
+ expectedValues = new String[] { "draft", "build", "issued" };
+ actualValues = widget.getModelVersionTexts();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected distribution text.";
+ expectedValue = "secret";
+ actualValue = widget.getSelectedDistributionText();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's selected model version text.";
+ expectedValue = "draft";
+ actualValue = widget.getSelectedModelVersionText();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's system name.";
+ expectedValue = "Symbian OS";
+ actualValue = widget.getSystemName();
+ testWidgetValue(message, expectedValue, actualValue);
+
+ message = "Error in widget's system version.";
+ expectedValue = "Future";
+ actualValue = widget.getSystemVersion();
+ testWidgetValue(message, expectedValue, actualValue);
+ }
+
+ private void testPageMessageAndState1(
+ NewProjectWizardTabbedPropertiesPage page) {
+ String errorMessage = page.getErrorMessage();
+ assertTrue(errorMessage == null);
+
+ String message = page.getMessage();
+ assertTrue(message == null);
+
+ int messageType = page.getMessageType();
+ assertEquals(DialogPage.NONE, messageType);
+
+ boolean isPageComplete = page.isPageComplete();
+ assertTrue(isPageComplete);
+ }
+
+ private void testPageMessageAndState2(
+ NewProjectWizardTabbedPropertiesPage page) {
+ String errorMessage = page.getErrorMessage();
+ assertEquals("Error message one.", errorMessage);
+
+ String message = page.getMessage();
+ assertTrue(message == null);
+
+ int messageType = page.getMessageType();
+ assertEquals(DialogPage.NONE, messageType);
+
+ boolean isPageComplete = page.isPageComplete();
+ assertFalse(isPageComplete);
+ }
+
+ private void testResourcesWidgetInitialised(ResourcesWidget widget) {
+ String message = "Error in widget's border shapes files.";
+ String[] expectedValues = new String[] {};
+ String[] actualValues = widget.getBorderShapesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's border styles files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getBorderStylesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's colour files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] { TestConstants.COLOUR_RESOURCE_FILE_PATH });
+ actualValues = widget.getColoursFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's dependencies files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getDependenciesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's level files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] { "Auto",
+ "./../SystemModelGenerator/resources/auxiliary/Levels.xml",
+ "./../SystemModelGenerator/resources/auxiliary/Levels91.xml" });
+ actualValues = widget.getLevelsFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's localisation files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] { TestConstants.LOCALISATION_RESOURCE_FILE_PATH });
+ actualValues = widget.getLocalisationFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's pattern files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getPatternsFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's S12 XML files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getS12XmlFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected border shapes files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedBorderShapesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected border styles files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedBorderStylesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected colour files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedColoursFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected dependencies files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedDependenciesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected levels files.";
+ expectedValues = new String[] { "Auto" };
+ actualValues = widget.getSelectedLevelsFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected localisation files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] { TestConstants.LOCALISATION_RESOURCE_FILE_PATH });
+ actualValues = widget.getSelectedLocalisationFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected pattern files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedPatternsFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected S12 XML files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedS12XmlFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected shapes files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] { TestConstants.SHAPES_RESOURCE_FILE_PATH });
+ actualValues = widget.getSelectedShapesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's selected system info files.";
+ expectedValues = new String[] {};
+ actualValues = widget.getSelectedSystemInfoFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's shapes files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] {
+ "./../SystemModelGenerator/resources/auxiliary/Shapes.xml",
+ "./../SystemModelGenerator/resources/auxiliary/Example-shapes.xml" });
+ actualValues = widget.getShapesFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+
+ message = "Error in widget's system info files.";
+ expectedValues = convertFilenamesToAbsolute(new String[] { TestConstants.SYSTEM_INFO_RESOURCE_FILE_PATH });
+ actualValues = widget.getSystemInfoFiles();
+ testWidgetValues(message, expectedValues, actualValues);
+ }
+
+ public void testValidModelDefined() {
+ IWizardPage[] pages = wizard.getPages();
+ NewProjectWizardTabbedPropertiesPage page = (NewProjectWizardTabbedPropertiesPage) pages[2];
+
+ wizardDialog.showPage(page);
+
+ Boolean isValid = true;
+ String eventMessage = "";
+ Type type = Type.SUCCESS;
+ ValidModelEvent event = new ValidModelEvent(isValid, eventMessage, type);
+
+ page.validModelDefined(event);
+ testPageMessageAndState1(page);
+
+ isValid = false;
+ eventMessage = "Error message one.";
+ type = Type.ERROR;
+ event = new ValidModelEvent(isValid, eventMessage, type);
+
+ page.validModelDefined(event);
+ testPageMessageAndState2(page);
+
+ isValid = true;
+ eventMessage = "";
+ type = Type.SUCCESS;
+ event = new ValidModelEvent(isValid, eventMessage, type);
+
+ page.validModelDefined(event);
+ testPageMessageAndState1(page);
+ }
+
+ private final void testWidgetValue(String message, Object expected,
+ Object actual) {
+ assertEquals(message, expected, actual);
+ }
+
+ private final void testWidgetValues(String message, Object[] expected,
+ Object[] actual) {
+ assertEquals(message, expected.length, actual.length);
+
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(message, expected[i], actual[i]);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.test/src/com/symbian/smt/gui/wizard/NewSMTProjectWizardTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,525 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// NewSMTProjectWizardTest
+//
+
+
+
+package com.symbian.smt.gui.wizard;
+
+import static com.symbian.smt.gui.ResourcesEnums.BORDER_SHAPES;
+import static com.symbian.smt.gui.ResourcesEnums.BORDER_STYLES;
+import static com.symbian.smt.gui.ResourcesEnums.COLOURS;
+import static com.symbian.smt.gui.ResourcesEnums.DEPENDENCIES;
+import static com.symbian.smt.gui.ResourcesEnums.LEVELS;
+import static com.symbian.smt.gui.ResourcesEnums.LOCALISATION;
+import static com.symbian.smt.gui.ResourcesEnums.PATTERNS;
+import static com.symbian.smt.gui.ResourcesEnums.S12_XML;
+import static com.symbian.smt.gui.ResourcesEnums.SHAPES;
+import static com.symbian.smt.gui.ResourcesEnums.SYSTEM_INFO;
+
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.TestConstants;
+import com.symbian.smt.gui.preferences.SmmPreferencesInitializer;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class NewSMTProjectWizardTest extends TestCase {
+
+ private static final String SEPARATOR = "|";
+
+ private static final AbstractPersistentDataStore getPersistDataStore(
+ IProject project) {
+ IScopeContext projectScope = new ProjectScope(project);
+ IEclipsePreferences node = projectScope.getNode(Activator.PLUGIN_ID);
+ PersistentDataStore dataStore = new PersistentDataStore(node);
+
+ return dataStore;
+ }
+
+ private IStructuredSelection selection;
+ private Shell shell;
+ private String smgFolder;
+ private NewSMTProjectWizard wizard;
+ private Text wizardProjectTextField;
+ private IWorkbench workbench;
+
+ // This method is dependent on the current UI composition
+ // of Eclipse's WizardNewProjectCreationPage.
+ // We cannot find the Text widget in any other way because
+ // it is hidden.
+ private final Text findText(Composite parent) {
+ Text text = null;
+ Control[] children = parent.getChildren();
+
+ for (Control control : children) {
+ if (control instanceof Text) {
+ text = (Text) control;
+ break;
+ } else if (control instanceof Composite) {
+ return findText((Composite) control);
+ }
+ }
+
+ return text;
+ }
+
+ private final String prependPathAndMakeLowerCase(String filename) {
+ assertNotNull("Location of SystemModelManager should not be null.",
+ smgFolder);
+ return new StringBuffer(smgFolder).append(TestConstants.RESOURCE_FILES_FOLDER_PATH)
+ .append(filename).toString().toLowerCase();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected final void setUp() throws Exception {
+ // Initialise the default values
+ SmmPreferencesInitializer initialiser = new SmmPreferencesInitializer();
+
+ initialiser.initializeDefaultPreferences();
+
+ smgFolder = initialiser.getSmgFolder();
+ wizard = new NewSMTProjectWizard();
+ selection = new StructuredSelection(StructuredSelection.EMPTY);
+ workbench = PlatformUI.getWorkbench();
+ shell = workbench.getActiveWorkbenchWindow().getShell();
+
+ wizard.init(workbench, selection);
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+
+ NewProjectCreationPageCaseInsensitive page = (NewProjectCreationPageCaseInsensitive) wizard
+ .getPage("page1");
+ Composite c = (Composite) page.getControl();
+ wizardProjectTextField = findText(c);
+
+ if (wizardProjectTextField == null) {
+ throw new Exception("Could not find project name Text field");
+ }
+
+ wizardProjectTextField.setText("testproject");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected final void tearDown() throws Exception {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+
+ ws.getRoot().delete(true, true, null);
+ wizard.dispose();
+
+ wizard = null;
+ }
+
+ /**
+ * Test method for
+ * {@link com.symbian.smt.gui.wizard.NewSMTProjectWizard#addPages()}.
+ */
+ public final void testAddPages() {
+ assertEquals(3, wizard.getPageCount());
+ IWizardPage[] pages = wizard.getPages();
+
+ assertTrue(pages[0] instanceof NewProjectCreationPageCaseInsensitive);
+ assertTrue(pages[1] instanceof NewProjectWizardSystemDefsPage);
+ assertTrue(pages[2] instanceof NewProjectWizardTabbedPropertiesPage);
+ }
+
+ /**
+ * Test method for
+ * {@link com.symbian.smt.gui.wizard.NewSMTProjectWizard#copyFilesIntoProject()}
+ * .
+ */
+ public final void testCopyFilesIntoProject() {
+ IWizardPage[] pages = wizard.getPages();
+ NewProjectCreationPageCaseInsensitive page1 = (NewProjectCreationPageCaseInsensitive) pages[0];
+ IProject newProject = page1.getProjectHandle();
+
+ assertEquals("\\testproject", newProject.getFullPath().toOSString());
+ testDefaultResourcesFromPage((NewProjectWizardTabbedPropertiesPage) pages[2]);
+ }
+
+ /**
+ * Test method for
+ * {@link com.symbian.smt.gui.wizard.NewSMTProjectWizard#createPageControls()}
+ * .
+ */
+ public final void testCreatePageControls() {
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ PersistentDataStore instanceStore = new PersistentDataStore(
+ instanceNode, defaultNode);
+
+ assertNotNull(instanceStore);
+ }
+
+ /**
+ * Test method for
+ * {@link com.symbian.smt.gui.wizard.NewSMTProjectWizard#createProject()}.
+ */
+ public final void testCreateProject() {
+ NewProjectCreationPageCaseInsensitive page1 = (NewProjectCreationPageCaseInsensitive) wizard
+ .getPage("page1");
+ IProject newProject = page1.getProjectHandle();
+
+ NewProjectWizardSystemDefsPage page2 = (NewProjectWizardSystemDefsPage) wizard.getPage("wizardPage");
+
+ page2.setSystemDefinitions(new String[] {smgFolder + "/../smg-sysdef/Bob_System_Definition.xml"});
+ wizard.performFinish();
+
+ try {
+ IProjectDescription desc = newProject.getDescription();
+
+ assertEquals("testproject", desc.getName());
+
+ List<String> natureIds = Helper
+ .toListOfStrings(desc.getNatureIds());
+
+ assertTrue(natureIds.contains("com.symbian.smt.gui.nature"));
+ } catch (CoreException e) {
+ throw new AssertionFailedError(
+ "Problem encountered in obtaining the project's description.");
+ }
+ }
+
+ private final void testDefaultResourcesFromPage(
+ NewProjectWizardTabbedPropertiesPage page) {
+ String[] expected = { TestConstants.SHAPES_RESOURCE_FILE_PATH };
+ String[] actual = page.getDefaultShapesFiles();
+ String message = "Error in default shapes files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] { "Auto" };
+ actual = page.getDefaultLevelsFiles();
+ message = "Error in default level files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] { TestConstants.LOCALISATION_RESOURCE_FILE_PATH };
+ actual = page.getDefaultLocalisationFiles();
+ message = "Error in default localisation files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultDependenciesFiles();
+ message = "Error in default dependencies files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultSystemInfoFiles();
+ message = "Error in default system info files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultColoursFiles();
+ message = "Error in default colours files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultBorderStylesFiles();
+ message = "Error in default border styles files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultBorderShapesFiles();
+ message = "Error in default border shapes files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultPatternsFiles();
+ message = "Error in default patters files.";
+ testResourceName(message, expected, actual);
+
+ expected = new String[] {};
+ actual = page.getDefaultS12XmlFiles();
+ message = "Error in default S12 files.";
+ testResourceName(message, expected, actual);
+ }
+
+ /**
+ * Test method for
+ * {@link com.symbian.smt.gui.wizard.NewSMTProjectWizard#performFinish()}.
+ */
+ public final void testPerformFinish() {
+ NewProjectCreationPageCaseInsensitive page = (NewProjectCreationPageCaseInsensitive) wizard
+ .getPage("page1");
+ IProject newProject = page.getProjectHandle();
+
+ wizard.performFinish();
+
+ testPersistedSelectedItems(newProject);
+ testPersistedItems(newProject);
+ testWorkspaceContents(newProject);
+ }
+
+ private final void testPersistedItems(IProject project) {
+ AbstractPersistentDataStore dataStore = getPersistDataStore(project);
+ String[] options = dataStore.getAdvancedOptions();
+ assertEquals(0, options.length);
+
+ Boolean fixsize = dataStore.getFixItemSize();
+ assertFalse(fixsize);
+
+ options = dataStore.getDistributionTexts();
+ assertEquals(4, options.length);
+ assertEquals("secret", options[0]);
+ assertEquals("confidential", options[1]);
+ assertEquals("internal", options[2]);
+ assertEquals("unrestricted", options[3]);
+
+ options = dataStore.getModelVersionTexts();
+ assertEquals(3, options.length);
+ assertEquals("draft", options[0]);
+ assertEquals("build", options[1]);
+ assertEquals("issued", options[2]);
+
+ options = dataStore.getPrintedDpis();
+ assertEquals(2, options.length);
+ assertEquals("300", options[0]);
+ assertEquals("600", options[1]);
+
+ String[] filenames = dataStore.getBorderShapesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getBorderStylesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getColoursFiles();
+ assertEquals(1, filenames.length);
+ assertEquals(prependPathAndMakeLowerCase("system_model_colors.xml"),
+ filenames[0].toLowerCase());
+
+ filenames = dataStore.getDependenciesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getLevelsFiles();
+ assertEquals(3, filenames.length);
+ assertEquals("Auto", filenames[0]);
+ assertEquals(prependPathAndMakeLowerCase("Levels.xml"), filenames[1]
+ .toLowerCase());
+ assertEquals(prependPathAndMakeLowerCase("Levels91.xml"), filenames[2]
+ .toLowerCase());
+
+ filenames = dataStore.getLocalisationFiles();
+ assertEquals(1, filenames.length);
+ assertEquals(prependPathAndMakeLowerCase("display-names.xml"),
+ filenames[0].toLowerCase());
+
+ filenames = dataStore.getPatternsFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getS12XmlFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getShapesFiles();
+ assertEquals(2, filenames.length);
+ assertEquals(prependPathAndMakeLowerCase("Shapes.xml"), filenames[0]
+ .toLowerCase());
+ assertEquals(prependPathAndMakeLowerCase("Example-shapes.xml"),
+ filenames[1].toLowerCase());
+
+ filenames = dataStore.getSystemInfoFiles();
+ assertEquals(1, filenames.length);
+ assertEquals(prependPathAndMakeLowerCase("SystemInfo.xml"),
+ filenames[0].toLowerCase());
+
+ filenames = dataStore.getBorderShapesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getBorderShapesFiles();
+ assertEquals(0, filenames.length);
+ }
+
+ private final void testPersistedSelectedItems(IProject project) {
+ AbstractPersistentDataStore dataStore = getPersistDataStore(project);
+
+ String[] filenames = dataStore.getSelectedBorderShapesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getSelectedBorderStylesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getSelectedColoursFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getSelectedDependenciesFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getSelectedLevelsFiles();
+ assertEquals(1, filenames.length);
+ assertEquals("Auto", filenames[0]);
+
+ filenames = dataStore.getSelectedLocalisationFiles();
+ assertEquals(1, filenames.length);
+ assertEquals(prependPathAndMakeLowerCase("display-names.xml"),
+ filenames[0].toLowerCase());
+
+ filenames = dataStore.getSelectedPatternsFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getSelectedS12XmlFiles();
+ assertEquals(0, filenames.length);
+
+ filenames = dataStore.getSelectedShapesFiles();
+ assertEquals(1, filenames.length);
+ assertEquals(prependPathAndMakeLowerCase("Shapes.xml"), filenames[0]
+ .toLowerCase());
+
+ filenames = dataStore.getSelectedSystemInfoFiles();
+ assertEquals(0, filenames.length);
+
+ String distributionText = dataStore.getSelectedDistributionText();
+ assertEquals("secret", distributionText);
+
+ String modelVersionText = dataStore.getSelectedModelVersionText();
+ assertEquals("draft", modelVersionText);
+
+ String dpi = dataStore.getSelectedPrintedDpi();
+ assertEquals("600", dpi);
+ }
+
+ private final void testResourceName(String message, String[] expected,
+ String[] actual) {
+ assertEquals(message, expected.length, actual.length);
+
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(message, Helper.relative2AbsolutePaths(expected[i],
+ smgFolder, SEPARATOR), actual[i]);
+ }
+ }
+
+ private final void testWorkspaceContents(IProject project) {
+ String folderName = "";
+
+ try {
+ folderName = BORDER_SHAPES.arg();
+ IFolder folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ IResource[] children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = BORDER_STYLES.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = COLOURS.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = DEPENDENCIES.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = LEVELS.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = LOCALISATION.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(1, children.length);
+ assertEquals("display-names.xml", children[0].getName());
+
+ folderName = PATTERNS.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = S12_XML.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+
+ folderName = SHAPES.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ // TODO:BRS:Check why assertions below fail.
+ // assertEquals(1, children.length);
+ // assertEquals("Shapes.xml", children[0].getName());
+
+ folderName = SYSTEM_INFO.arg();
+ folder = project.getFolder(new Path(folderName));
+ assertFalse("Folder [" + folderName
+ + "] does not exist in project.", !folder.exists());
+ children = folder.members();
+ assertEquals(0, children.length);
+ } catch (CoreException e) {
+ assertFalse("Exception while looking for the contents of folder ["
+ + folderName + "].", true);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/.classpath Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/com.symbian.smt.gui"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.smt.gui.unittest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/META-INF/MANIFEST.MF Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Unittest Plug-in
+Bundle-SymbolicName: com.symbian.smt.gui.unittest
+Bundle-Version: 1.1.1
+Bundle-Activator: com.symbian.smt.gui.unittest.Activator
+Bundle-Vendor: Nokia Corporation
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.console,
+ org.eclipse.jface.text,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.navigator
+Bundle-ActivationPolicy: lazy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/build.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/build.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="com.symbian.smt.gui.unittest" default="build.jars" basedir=".">
+
+ <property name="basews" value="${ws}"/>
+ <property name="baseos" value="${os}"/>
+ <property name="basearch" value="${arch}"/>
+ <property name="basenl" value="${nl}"/>
+
+ <!-- Compiler settings. -->
+ <property name="javacFailOnError" value="false"/>
+ <property name="javacDebugInfo" value="on"/>
+ <property name="javacVerbose" value="false"/>
+ <property name="logExtension" value=".log"/>
+ <property name="compilerArg" value=""/>
+ <property name="javacSource" value="1.5"/>
+ <property name="javacTarget" value="1.5"/>
+ <path id="path_bootclasspath">
+ <fileset dir="${java.home}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <property name="bootclasspath" refid="path_bootclasspath"/>
+ <property name="bundleJavacSource" value="${javacSource}"/>
+ <property name="bundleJavacTarget" value="${javacTarget}"/>
+ <property name="bundleBootClasspath" value="${bootclasspath}"/>
+
+ <target name="init">
+ <condition property="pluginTemp" value="${buildTempFolder}/plugins">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="pluginTemp" value="${basedir}"/>
+ <condition property="build.result.folder" value="${pluginTemp}/com.symbian.smt.gui.unittest">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="build.result.folder" value="${basedir}"/>
+ <property name="temp.folder" value="${basedir}/temp.folder"/>
+ <property name="plugin.destination" value="${basedir}"/>
+ </target>
+
+ <target name="build.update.jar" depends="init" description="Build the plug-in: com.symbian.smt.gui.unittest for an update site.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <zip destfile="${plugin.destination}/com.symbian.smt.gui.unittest_1.1.1.jar" basedir="${temp.folder}/com.symbian.smt.gui.unittest_1.1.1" filesonly="false" whenempty="skip" update="false"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="@dot" depends="init" unless="@dot" description="Create jar: com.symbian.smt.gui.unittest @dot.">
+ <delete dir="${temp.folder}/@dot.bin"/>
+ <mkdir dir="${temp.folder}/@dot.bin"/>
+
+ <path id="required.plugins">
+ <fileset dir="${basedir}/../shared/">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="@dot.classpath">
+ <pathelement path="../lib/junit-4.1.jar" />
+ <pathelement path="../com.symbian.smt.gui/@dot" />
+ <pathelement path="../com.symbian.smt.gui/bin" />
+ </path>
+
+ <!-- compile the source code -->
+ <javac destdir="${temp.folder}/@dot.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" >
+ <compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
+ <classpath refid="@dot.classpath" />
+ <classpath refid="required.plugins" />
+ <src path="src/" />
+ </javac>
+ <!-- Copy necessary resources -->
+ <copy todir="${temp.folder}/@dot.bin" failonerror="true" overwrite="false">
+ <fileset dir="src/" excludes="**/*.java, **/package.htm*" />
+ </copy>
+ <mkdir dir="${build.result.folder}"/>
+ <copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false">
+ <fileset dir="${temp.folder}/@dot.bin" />
+ </copy>
+ <delete dir="${temp.folder}/@dot.bin"/>
+ </target>
+
+ <target name="src.zip" depends="init" unless="src.zip">
+ <mkdir dir="${build.result.folder}"/>
+ <zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false">
+ <fileset dir="src/" includes="**/*.java" />
+ </zip>
+ </target>
+
+ <target name="build.jars" depends="init" description="Build all the jars for the plug-in: com.symbian.smt.gui.unittest.">
+ <available property="@dot" file="${build.result.folder}/@dot"/>
+ <antcall target="@dot"/>
+ </target>
+
+ <target name="build.sources" depends="init">
+ <available property="src.zip" file="${build.result.folder}/src.zip"/>
+ <antcall target="src.zip"/>
+ </target>
+
+ <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1"/>
+ <copy todir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1" failonerror="true" overwrite="false">
+ <fileset dir="${build.result.folder}/@dot" includes="**" />
+ </copy>
+ <copy todir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1" failonerror="true" overwrite="false">
+ <fileset dir="${basedir}" includes="META-INF/" />
+ </copy>
+ </target>
+
+ <target name="build.zips" depends="init">
+ </target>
+
+ <target name="gather.sources" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1"/>
+ <copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1" failonerror="false" overwrite="false"/>
+ </target>
+
+ <target name="gather.logs" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1"/>
+ <copy file="${temp.folder}/@dot.bin${logExtension}" todir="${destination.temp.folder}/com.symbian.smt.gui.unittest_1.1.1" failonerror="false" overwrite="false"/>
+ </target>
+
+ <target name="clean" depends="init" description="Clean the plug-in: com.symbian.smt.gui.unittest of all the zips, jars and logs created.">
+ <delete dir="${build.result.folder}/@dot"/>
+ <delete file="${build.result.folder}/src.zip"/>
+ <delete file="${plugin.destination}/com.symbian.smt.gui.unittest_1.1.1.jar"/>
+ <delete file="${plugin.destination}/com.symbian.smt.gui.unittest_1.1.1.zip"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: com.symbian.smt.gui.unittest.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="build.sources"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <antcall target="gather.sources">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <delete>
+ <fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" />
+ </delete>
+ <zip destfile="${plugin.destination}/com.symbian.smt.gui.unittest_1.1.1.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/buildtest-local.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This build file is for the sole purpose of running the unit tests that are located in -->
+<!-- this plug-in in the local development environment. It may be disposed of if not used. -->
+
+<project name="com.symbian.smt.gui.unittest" basedir=".">
+
+ <!-- User Property -->
+ <property name="reports.dir" value="${basedir}/report" />
+ <property name="coverage.dir" value="${reports.dir}/coverage" />
+ <property name="junit.dir" value="${reports.dir}/junit" />
+ <property name="destination.results.folder" value="${basedir}/results" />
+
+ <property name="main.build" value="${basedir}/build.xml/" />
+
+ <target name="clean" description="Clean the plug-in: com.symbian.smt.gui.unittest">
+ <ant antfile="${main.build}" target="clean" inheritall="false" />
+ <delete dir="${reports.dir}" />
+ </target>
+
+ <target name="run.junit">
+ <mkdir dir="${reports.dir}" />
+ <mkdir dir="${junit.dir}" />
+ <mkdir dir="${coverage.dir}" />
+
+ <property name="instr.jar.folder" value="${basedir}/bin" />
+ <property name="jars" value="${instr.jar.folder}" />
+ <property name="current.version" value="1.1.1" />
+ <property name="version" value="${current.version}" />
+ <property name="jar" value="${jars}/com.symbian.smt.gui_${version}.jar" />
+
+ <path id="classpath.test">
+ <pathelement path="${jar}" />
+ <pathelement path="${basedir}/@dot/" />
+ <pathelement path="${basedir}/../lib/cglib-nodep-2.1_3.jar" />
+ <pathelement path="${basedir}/../lib/jmock-cglib-1.1.0.jar" />
+ <pathelement path="${basedir}/../lib/jmock-1.1.0.jar" />
+ <pathelement path="${basedir}/../lib/emma.jar" />
+ <pathelement path="${basedir}/../lib/junit-4.1.jar" />
+
+ <pathelement path="${basedir}/../com.symbian.smt.gui/@dot" />
+ <pathelement path="${basedir}/../com.symbian.smt.gui/bin" />
+
+ <pathelement path="${basedir}/@dot" />
+ <pathelement path="${basedir}/bin" />
+ </path>
+
+ <path id="required.plugins">
+ <fileset dir="${basedir}/../shared/">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+
+ <junit printsummary="withOutAndErr" fork="yes" haltonfailure="no" failureproperty="junit.failed">
+ <classpath>
+ <path refid="classpath.test" />
+ <path refid="required.plugins" />
+ </classpath>
+ <formatter type="xml" />
+ <formatter type="plain" />
+ <batchtest todir="${junit.dir}">
+ <fileset dir="${basedir}/src">
+ <include name="**/*Test.java" />
+ </fileset>
+ </batchtest>
+ <jvmarg value="-Djava.library.path=${basedir}/../shared;${java.library.path}" />
+ <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/smtgui_runtime.ec " />
+ </junit>
+
+ <!--<fail message="JUnit test failure." if="junit.failed" />-->
+ </target>
+
+ <target name="gather.results">
+ <copy todir="${destination.results.folder}" failonerror="true" overwrite="true">
+ <fileset dir="${reports.dir}" />
+ </copy>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/buildtest.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="com.symbian.smt.gui.unittest" basedir=".">
+
+ <!-- User Property -->
+ <property name="reports.dir" value="${basedir}/report" />
+ <property name="coverage.dir" value="${reports.dir}/coverage" />
+ <property name="junit.dir" value="${reports.dir}/junit" />
+
+ <property name="main.build" value="${basedir}/build.xml/" />
+
+ <target name="clean" description="Clean the plug-in: com.symbian.smt.gui.unittest">
+ <ant antfile="${main.build}" target="clean" inheritall="false" />
+ <delete dir="${reports.dir}" />
+ </target>
+
+ <target name="run.junit">
+ <mkdir dir="${reports.dir}" />
+ <mkdir dir="${junit.dir}" />
+ <mkdir dir="${coverage.dir}" />
+
+ <property name="jar" value="${jars}/com.symbian.smt.gui_${version}.jar" />
+
+ <path id="classpath.test">
+ <pathelement path="${jar}" />
+ <pathelement path="${basedir}/@dot/" />
+ <pathelement path="${basedir}/../lib/cglib-nodep-2.1_3.jar" />
+ <pathelement path="${basedir}/../lib/jmock-cglib-1.1.0.jar" />
+ <pathelement path="${basedir}/../lib/jmock-1.1.0.jar" />
+ <pathelement path="${basedir}/../lib/emma.jar" />
+ <pathelement path="${basedir}/../lib/junit-4.1.jar" />
+
+ <pathelement path="${basedir}/../com.symbian.smt.gui/@dot" />
+ <pathelement path="${basedir}/../com.symbian.smt.gui/bin" />
+ </path>
+
+ <path id="required.plugins">
+ <fileset dir="${basedir}/../shared/">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+
+ <junit printsummary="withOutAndErr" fork="yes" haltonfailure="no" failureproperty="junit.failed">
+ <classpath>
+ <path refid="classpath.test" />
+ <path refid="required.plugins" />
+ </classpath>
+ <formatter type="xml" />
+ <formatter type="plain" />
+ <batchtest todir="${junit.dir}">
+ <fileset dir="${basedir}/src">
+ <include name="**/*Test.java" />
+ </fileset>
+ </batchtest>
+ <jvmarg value="-Djava.library.path=${basedir}/../shared;${java.library.path}" />
+ <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/smtgui_runtime.ec " />
+ </junit>
+
+ <!--<fail message="JUnit test failure." if="junit.failed" />-->
+ </target>
+
+ <target name="gather.results">
+ <copy todir="${destination.results.folder}" failonerror="true" overwrite="true">
+ <fileset dir="${reports.dir}" />
+ </copy>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/builder/SystemModelGeneratorEnumsForCLITest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,175 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.builder;
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.BORDER_SHAPES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_DEFINITION_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.COPYRIGHT_TEXT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.DISTRIBUTION_TEXT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.MODEL_NAME;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.MODEL_VERSION;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.MODEL_VERSION_TEXT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_NAME;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_VERSION;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.HIGHTLIGHT_CORE_OS;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.LEVEL_OF_DETAIL;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SUPPRESS_MOUSE_OVER_EFFECT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.LEVELS_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.LOCALISATION_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SHAPES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.DEPENDENCIES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_INFO_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.COLOURS_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.BORDER_STYLES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.PATTERNS_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.FILTER_HAS_ITEMS;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.IGNORE_ITEMS;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.WARNING_LEVEL;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.TEMPDIR;
+
+public class SystemModelGeneratorEnumsForCLITest {
+ // System Definition Files
+ @Test
+ public final void testSystemDefinitionFiles() {
+ Assert.assertTrue(SYSTEM_DEFINITION_FILES.arg().equals("--sysdef"));
+ }
+
+ // Model Labels
+ @Test
+ public final void testCopyrightText() {
+ Assert.assertTrue(COPYRIGHT_TEXT.arg().equals("--copyright"));
+ }
+
+ @Test
+ public final void testDistributionText() {
+ Assert.assertTrue(DISTRIBUTION_TEXT.arg().equals("--distribution"));
+ }
+
+ @Test
+ public final void testModelName() {
+ Assert.assertTrue(MODEL_NAME.arg().equals("--model_name"));
+ }
+
+ @Test
+ public final void testModelVersion() {
+ Assert.assertTrue(MODEL_VERSION.arg().equals("--model_version"));
+ }
+
+ @Test
+ public final void testModelVersionText() {
+ Assert.assertTrue(MODEL_VERSION_TEXT.arg().equals("--model_version_type"));
+ }
+
+ @Test
+ public final void testSystemName() {
+ Assert.assertTrue(SYSTEM_NAME.arg().equals("--system_name"));
+ }
+
+ @Test
+ public final void testSystemVersion() {
+ Assert.assertTrue(SYSTEM_VERSION.arg().equals("--system_version"));
+ }
+
+ // Model Control
+ @Test
+ public final void testHighlightCoreOS() {
+ Assert.assertTrue(HIGHTLIGHT_CORE_OS.arg().equals("--coreos"));
+ }
+
+ @Test
+ public final void testLevelOfDetail() {
+ Assert.assertTrue(LEVEL_OF_DETAIL.arg().equals("--detail"));
+ }
+
+ @Test
+ public final void testMakeModelStatic() {
+ Assert.assertTrue(SUPPRESS_MOUSE_OVER_EFFECT.arg().equals("--static"));
+ }
+
+ // Resources
+ @Test
+ public final void testShapesFile() {
+ Assert.assertTrue(SHAPES_FILES.arg().equals("--shapes"));
+ }
+
+ @Test
+ public final void testLevelsFile() {
+ Assert.assertTrue(LEVELS_FILES.arg().equals("--levels"));
+ }
+
+ @Test
+ public final void testLocalisationFile() {
+ Assert.assertTrue(LOCALISATION_FILES.arg().equals("--localize"));
+ }
+
+ @Test
+ public final void testDependenciesFile() {
+ Assert.assertTrue(DEPENDENCIES_FILES.arg().equals("--deps"));
+ }
+
+ @Test
+ public final void testSystemInfoFile() {
+ Assert.assertTrue(SYSTEM_INFO_FILES.arg().equals("--sysinfo"));
+ }
+
+ @Test
+ public final void testColoursFile() {
+ Assert.assertTrue(COLOURS_FILES.arg().equals("--color"));
+ }
+
+ @Test
+ public final void testBorderStylesFile() {
+ Assert.assertTrue(BORDER_STYLES_FILES.arg().equals("--border-style"));
+ }
+
+ @Test
+ public final void testBorderShapesFile() {
+ Assert.assertTrue(BORDER_SHAPES_FILES.arg().equals("--border-shape"));
+ }
+
+ @Test
+ public final void testPatternsFile() {
+ Assert.assertTrue(PATTERNS_FILES.arg().equals("--pattern"));
+ }
+
+ // Filter has Items
+ @Test
+ public final void testFilterItems() {
+ Assert.assertTrue(FILTER_HAS_ITEMS.arg().equals("--filter-has"));
+ }
+
+ // Ignore Items
+ @Test
+ public final void testIgnoreItems() {
+ Assert.assertTrue(IGNORE_ITEMS.arg().equals("--ignore"));
+ }
+
+ // Warning Level
+ @Test
+ public final void testWarningLevel() {
+ Assert.assertTrue(WARNING_LEVEL.arg().equals("-w"));
+ }
+
+ // Temp Dir
+ @Test
+ public final void testTempDir() {
+ Assert.assertTrue(TEMPDIR.arg().equals("--tempdir"));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/FilterWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,148 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import static org.junit.Assert.*;
+import junit.framework.Assert;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import com.symbian.smt.gui.smtwidgets.FilterWidget;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.swt.SWT;
+
+public class FilterWidgetTest {
+ Display display;
+ Shell shell;
+ FilterWidget filterWidget;
+
+ @Before
+ public final void setUp() {
+ display = new Display();
+ shell = new Shell(display);
+
+ filterWidget = new FilterWidget(shell, SWT.NONE);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ display.dispose();
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.FilterWidget#FilterWidget(org.eclipse.swt.widgets.Composite, int)}.
+ */
+ @Test
+ public final void testFilterWidget() {
+ Assert.assertNotNull(filterWidget);
+ }
+
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.FilterWidget#setFilterItems(java.lang.String[])}.
+ */
+ @Test
+ public final void testSetEmpty() {
+ String[] list = new String[0];
+
+ filterWidget.setFilterItems(list);
+
+ String[] results = filterWidget.getFilterItems();
+
+ assertNotNull(results);
+
+ if (results.length > 0) {
+ fail("Should return an empty list");
+ }
+ }
+
+ @Test
+ public final void testFilterItems() {
+ String[] list = new String[] {"1", "2"};
+
+ filterWidget.setFilterItems(list);
+
+ String[] results = filterWidget.getFilterItems();
+
+ if (results.length != 2) {
+ fail("The list returned should contain 2 elements");
+ }
+ }
+
+ @Test
+ public final void testSetTwice() {
+
+ String[] list = new String[] {"1", "2"};
+
+ String[] list2 = new String[] {"1", "2", "3", "4"};
+
+ filterWidget.setFilterItems(list);
+
+ filterWidget.setFilterItems(list2);
+
+ String[] results = filterWidget.getFilterItems();
+
+ Assert.assertEquals("Expected size: " + list2.length + ", got " + results.length, list2.length, results.length);
+ }
+
+/* @Test
+ public final void testSetString() {
+
+ String filter = "java,gt,";
+
+ filterWidget.setFilterItems(filter);
+
+ String[] results = filterWidget.getFilterItems();
+
+ Assert.assertEquals("Expected size: 2, got " + results.length, 2, results.length);
+ Assert.assertEquals("Expected java as first item", "java", results[0]);
+ Assert.assertEquals("Expected gt as first item", "gt", results[1]);
+
+ }
+
+ @Test
+ public final void testSetString2() {
+
+ String filter = "java,gt";
+
+ filterWidget.setFilterItems(filter);
+
+ String[] results = filterWidget.getFilterItems();
+
+ Assert.assertEquals("Expected size: 2, got " + results.length, 2, results.length);
+ Assert.assertEquals("Expected java as first item", "java", results[0]);
+ Assert.assertEquals("Expected gt as first item", "gt", results[1]);
+
+ }
+
+ @Test
+ public final void testGetString() {
+
+ String[] list = new String[] {"1", "2"};
+
+ filterWidget.setFilterItems(list);
+
+ String result = filterWidget.getFilterItemsString();
+
+ Assert.assertEquals("1,2,", result);
+
+ }
+ */
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/IgnoreWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,161 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.symbian.smt.gui.smtwidgets.IgnoreWidget;
+
+
+public class IgnoreWidgetTest {
+ Display display;
+ Shell shell;
+ IgnoreWidget ignoreWidget;
+
+ @Before
+ public final void setUp() {
+ display = new Display();
+ shell = new Shell(display);
+
+ ignoreWidget = new IgnoreWidget(shell, SWT.NONE);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ display.dispose();
+ }
+
+ @Test
+ public final void testSetAndGetIgnoreItems() {
+
+ ArrayList<String[]> ignoreItems = new ArrayList<String[]>();
+
+ String[] itemData = {"layer", "2"} ;
+ ignoreItems.add(itemData);
+
+ ignoreWidget.setIgnoreItems(ignoreItems);
+
+ List<String[]> returned = ignoreWidget.getIgnoreItems();
+
+ Assert.assertEquals(1, returned.size());
+
+ if (returned.get(0)[0] != "layer" || returned.get(0)[1] != "2") {
+ fail("The list returned is incorrect");
+ }
+ }
+
+/* @Test
+ public final void testSetString() {
+ String ignore = "layer:Tools;layer:Utils;layer:SDKENG;layer:MISC;";
+
+ ignoreWidget.setIgnoreItems(ignore);
+
+ List<String[]> returned = ignoreWidget.getIgnoreItems();
+
+ Assert.assertEquals("The list returned is incorrect", 4, returned.size());
+
+ Assert.assertEquals("layer", returned.get(0)[0]);
+ Assert.assertEquals("layer", returned.get(1)[0]);
+ Assert.assertEquals("layer", returned.get(2)[0]);
+ Assert.assertEquals("layer", returned.get(3)[0]);
+
+ Assert.assertEquals("Tools", returned.get(0)[1]);
+ Assert.assertEquals("Utils", returned.get(1)[1]);
+ Assert.assertEquals("SDKENG", returned.get(2)[1]);
+ Assert.assertEquals("MISC", returned.get(3)[1]);
+ }
+
+ @Test
+ public final void testSetString2() {
+ String ignore = "layer:Tools;layer:Utils;layer:SDKENG;layer:MISC";
+
+ ignoreWidget.setIgnoreItems(ignore);
+
+ List<String[]> returned = ignoreWidget.getIgnoreItems();
+
+ Assert.assertEquals("The list returned is incorrect", 4, returned.size());
+
+ Assert.assertEquals("layer", returned.get(0)[0]);
+ Assert.assertEquals("layer", returned.get(1)[0]);
+ Assert.assertEquals("layer", returned.get(2)[0]);
+ Assert.assertEquals("layer", returned.get(3)[0]);
+
+ Assert.assertEquals("Tools", returned.get(0)[1]);
+ Assert.assertEquals("Utils", returned.get(1)[1]);
+ Assert.assertEquals("SDKENG", returned.get(2)[1]);
+ Assert.assertEquals("MISC", returned.get(3)[1]);
+ }
+
+ @Test
+ public final void testGetString() {
+ String ignore = "layer:1;layer:2;layer:3;";
+
+ ArrayList<String[]> ignoreItems = new ArrayList<String[]>();
+
+ String[] itemData = {"layer", "1"} ;
+ ignoreItems.add(itemData);
+
+ String[] itemData2 = {"layer", "2"} ;
+ ignoreItems.add(itemData2);
+
+ String[] itemData3 = {"layer", "3"} ;
+ ignoreItems.add(itemData3);
+
+ ignoreWidget.setIgnoreItems(ignoreItems);
+
+ String result = ignoreWidget.getIgnoreItemsString();
+
+ Assert.assertEquals("The list returned is incorrect", ignore, result);
+ }
+
+ @Test
+ public final void testAddDouble() {
+ String ignore = "layer:1;layer:2;layer:3;";
+ String ignore2 = "layer:5;layer:6;layer:7;layer:8;";
+
+ ignoreWidget.setIgnoreItems(ignore);
+ ignoreWidget.setIgnoreItems(ignore2);
+
+ List<String[]> returned = ignoreWidget.getIgnoreItems();
+
+ Assert.assertEquals("The list returned is incorrect", 4, returned.size());
+ Assert.assertEquals("5", returned.get(0)[1]);
+ Assert.assertEquals("6", returned.get(1)[1]);
+ Assert.assertEquals("7", returned.get(2)[1]);
+ Assert.assertEquals("8", returned.get(3)[1]);
+ }*/
+}
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/ModelControlWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,74 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import static org.junit.Assert.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.symbian.smt.gui.smtwidgets.ModelControlWidget;
+
+public class ModelControlWidgetTest {
+ Display display;
+ Shell shell;
+ ModelControlWidget modelControlWidget;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ display = new Display();
+ shell = new Shell(display);
+
+ modelControlWidget = new ModelControlWidget(shell, SWT.NONE);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ display.dispose();
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelControlWidgetTest#getHighlightCoreOS()}.
+ */
+ @Test
+ public final void testSetAndGetHighlightCoreOS() {
+ modelControlWidget.setHighlightCoreOS(true);
+ assertTrue("Highlight Core OS set\\get failed", modelControlWidget.getHighlightCoreOS());
+
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelControlWidgetTest#getLevelOfDetail()}.
+ */
+ @Test
+ public final void testSetAndGetLevelOfDetail() {
+ modelControlWidget.setLevelOfDetail("component");
+ String result = modelControlWidget.getLevelOfDetail();
+
+ if (!result.equals("component")) {
+ fail("Level of Detail set\\get failed");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/ModelLabelsWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,145 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import static org.junit.Assert.fail;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ModelLabelsWidgetTest {
+ Display display;
+ Shell shell;
+ ModelLabelsWidget modelLabelsWidget;
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public final void setUp() {
+ display = new Display();
+ shell = new Shell(display);
+
+ modelLabelsWidget = new ModelLabelsWidget(shell, SWT.NONE);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ display.dispose();
+ }
+
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setDistributionTexts(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetDistributionText() {
+ String[] text = {"test"};
+
+ modelLabelsWidget.setDistributionTexts(text);
+ String[] result = modelLabelsWidget.getDistributionTexts();
+
+ if (result.length != 1 || (!result[0].equals("test"))) {
+ fail("Distribution Text set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setModelVersion(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetModelVersion() {
+ modelLabelsWidget.setModelVersion("test");
+ String result = modelLabelsWidget.getModelVersion();
+
+ if (!result.equals("test")) {
+ fail("Model Version set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setSystemVersion(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetSystemVersion() {
+ modelLabelsWidget.setSystemVersion("test");
+ String result = modelLabelsWidget.getSystemVersion();
+
+ if (!result.equals("test")) {
+ fail("System Version set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setCopyrightText(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetCopyrightText() {
+ modelLabelsWidget.setCopyrightText("test");
+ String result = modelLabelsWidget.getCopyrightText();
+
+ if (!result.equals("test")) {
+ fail("Copyright Text set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setModelVersionTexts(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetModelVersionText() {
+ String[] text = {"test"};
+ modelLabelsWidget.setModelVersionTexts(text);
+ String[] result = modelLabelsWidget.getModelVersionTexts();
+
+ if (result.length != 1 || (! result[0].equals("test"))) {
+ fail("Model Version Text set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setModelName(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetModelName() {
+ modelLabelsWidget.setModelName("test");
+ String result = modelLabelsWidget.getModelName();
+
+ if (!result.equals("test")) {
+ fail("Model Name set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setSystemName(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetSystemName() {
+ modelLabelsWidget.setSystemName("test");
+ String result = modelLabelsWidget.getSystemName();
+
+ if (!result.equals("test")) {
+ fail("System Name set\\get failed");
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/ResourcesWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,319 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+
+import com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget;
+
+
+public class ResourcesWidgetTest {
+
+ Display display;
+ Shell shell;
+ ResourcesWidget resourcesWidget;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ display = new Display();
+ shell = new Shell(display);
+ resourcesWidget = new ResourcesWidget(shell, SWT.NONE);
+ }
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ resourcesWidget = null;
+ display.dispose();
+ }
+
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getShapesFile()}.
+// */
+// @Test
+// public final void testGetShapesFile() {
+// resourcesWidget.setShapesFiles(instanceStore.getShapesFiles());
+// String[] filenames = resourcesWidget.getShapesFiles();
+//
+// assertTrue("Shapes filenames should not be null", filenames != null);
+// assertTrue("Expected 2 filenames, got " + filenames.length, filenames.length == 2);
+//
+// String expected_fn = "./../SystemModelGenerator/resources/auxiliary/Shapes.xml";
+// String got_fn = filenames[0];
+//
+// assertTrue("First expected filename: [" + expected_fn + "], got: [" + got_fn + "]", got_fn.equalsIgnoreCase(expected_fn));
+//
+// expected_fn = "./../SystemModelGenerator/resources/auxiliary/Example-shapes.xml";
+// got_fn = filenames[1];
+//
+// assertTrue("First expected filename: [" + expected_fn + "], got: [" + got_fn + "]", got_fn.equalsIgnoreCase(expected_fn));
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getShapesFile()}.
+// */
+// @Test
+// public final void testGetSelectedShapesFile() {
+// resourcesWidget.setSelectedShapesFiles(instanceStore.getSelectedShapesFiles());
+//
+// if (resourcesWidget.getSelectedShapesFiles() != null) {
+// fail("Selected shapes files should be null by default");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getLevelsFile()}.
+// */
+// @Test
+// public final void testGetLevelsFile() {
+// if (!resourcesWidget.getSelectedLevelsFiles()[0].equalsIgnoreCase("Auto")) {
+// fail("Did not return default levels file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getLocalisationFile()}.
+// */
+// @Test
+// public final void testGetLocalisationFile() {
+// if (!resourcesWidget.getSelectedLocalisationFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default localisation file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getSystemInfoFile()}.
+// */
+// @Test
+// public final void testGetSystemInfoFile() {
+// if (!resourcesWidget.getSelectedSystemInfoFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default system info file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getDependenciesFile()}.
+// */
+// @Test
+// public final void testGetDependenciesFile() {
+// if (!resourcesWidget.getSelectedDependenciesFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default dependencies file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getColoursFile()}.
+// */
+// @Test
+// public final void testGetColoursFile() {
+// if (!resourcesWidget.getSelectedColoursFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default colours file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getBorderStylesFile()}.
+// */
+// @Test
+// public final void testGetBorderStylesFile() {
+// if (!resourcesWidget.getSelectedBorderStylesFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default border styles file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getBorderShapesFile()}.
+// */
+// @Test
+// public final void testGetDefaultBorderShapesFile() {
+// if (!resourcesWidget.getSelectedBorderShapesFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default border shapes file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getPatternsFile()}.
+// */
+// @Test
+// public final void testGetPatternsFile() {
+// if (!resourcesWidget.getSelectedPatternsFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default patterns file");
+// }
+// }
+//
+// @Test
+// public void testSetBorderShapesFile() {
+// resourcesWidget.setSelectedBorderShapesFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedBorderShapesFiles());
+// }
+//
+// @Test
+// public void testSetBorderStylesFile() {
+// resourcesWidget.setSelectedBorderStylesFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedBorderStylesFiles());
+// }
+//
+// @Test
+// public void testSetColoursFile() {
+// resourcesWidget.setSelectedColoursFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedColoursFiles());
+// }
+//
+// @Test
+// public void testSetDependenciesFile() {
+// resourcesWidget.setSelectedDependenciesFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedDependenciesFiles());
+// }
+//
+// @Test
+// public void testSetLevelsFile() {
+// resourcesWidget.setSelectedLevelsFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedLevelsFiles());
+// }
+//
+// @Test
+// public void testSetLocalisationFile() {
+// resourcesWidget.setSelectedLocalisationFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedLocalisationFiles());
+// }
+// @Test
+// public void testSetPatternsFile() {
+// resourcesWidget.setSelectedPatternsFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedPatternsFiles());
+// }
+//
+// @Test
+// public void testSetShapesFile() {
+// resourcesWidget.setSelectedShapesFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedShapesFiles());
+// }
+//
+// @Test
+// public void testSetSystemInfoFile() {
+// resourcesWidget.setSelectedSystemInfoFiles(new String[] {""});
+// Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedSystemInfoFiles());
+// }
+//
+// @Test
+// public void setAndGetBorderShapesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setBorderShapesFiles(items);
+//
+// String returned[] = resourcesWidget.getBorderShapesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetBorderStylesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setBorderStylesFiles(items);
+//
+// String returned[] = resourcesWidget.getBorderStylesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetColoursFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setColoursFiles(items);
+//
+// String returned[] = resourcesWidget.getColoursFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetPatternsFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setPatternsFiles(items);
+//
+// String returned[] = resourcesWidget.getPatternsFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetSystemInfoFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setSystemInfoFiles(items);
+//
+// String returned[] = resourcesWidget.getSystemInfoFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetLevelsFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setLevelsFiles(items);
+//
+// String returned[] = resourcesWidget.getLevelsFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetLocalisationFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setLocalisationFiles(items);
+//
+// String returned[] = resourcesWidget.getLocalisationFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+//
+// @Test
+// public void setAndGetDependenciesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setDependenciesFiles(items);
+//
+// String returned[] = resourcesWidget.getDependenciesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetShapesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// resourcesWidget.setShapesFiles(items);
+//
+// String returned[] = resourcesWidget.getShapesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/SystemDefinitionFilesWidgetTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,66 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import static org.junit.Assert.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.symbian.smt.gui.smtwidgets.SystemDefinitionFilesWidget;
+
+public class SystemDefinitionFilesWidgetTest {
+ Display display;
+ Shell shell;
+ SystemDefinitionFilesWidget systemDefinitionFilesWidget;
+
+// /**
+// * @throws java.lang.Exception
+// */
+// @Before
+// public void setUp() throws Exception {
+// display = new Display();
+// shell = new Shell(display);
+// systemDefinitionFilesWidget = new SystemDefinitionFilesWidget(shell, SWT.NONE);
+// }
+//
+// /**
+// * @throws java.lang.Exception
+// */
+// @After
+// public void tearDown() throws Exception {
+// display.dispose();
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.smtwidgets.SystemDefinitionFilesWidget#setSystemDefinitions(java.lang.String[])}.
+// */
+// @Test
+// public final void testSetAndGetSystemDefinitions() {
+// String[] list = new String[] {"1", "2"};
+//
+// systemDefinitionFilesWidget.setSystemDefinitions(list);
+//
+// String[] results = systemDefinitionFilesWidget.getSystemDefinitions();
+//
+// if (results.length != 2) {
+// fail("The list returned should contain 2 elements");
+// }
+// }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/unittest/Activator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,65 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.unittest;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.symbian.smt.gui.unittest";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/unittest/DummyTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,55 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.unittest;
+
+import org.eclipse.core.runtime.Plugin;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DummyTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testActivator() {
+ Plugin plugin = com.symbian.smt.gui.Activator.getDefault();
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testStartBundleContext() {
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testStopBundleContext() {
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testGetDefault() {
+ Assert.assertTrue(true);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/unittest/PDS_test_helper.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,40 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.unittest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.PersistentSettingsEnums;
+
+
+public class PDS_test_helper extends AbstractPersistentDataStore {
+
+ Map<String, String> data = new HashMap<String, String>();
+
+ @Override
+ public String read(PersistentSettingsEnums key) {
+ String name = key.name();
+
+ return data.get(name).toString();
+ }
+
+ @Override
+ public void write(PersistentSettingsEnums key, String value) {
+ data.put(key.toString(), value);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/unittest/PersistentDataStoreTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,394 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.unittest;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class PersistentDataStoreTest {
+
+ PDS_test_helper dataStore;
+
+ @Before
+ public final void setUp() {
+ dataStore = new PDS_test_helper();
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getCopyrightText()}.
+ */
+ @Test
+ public final void testSetAndGetCopyrightText() {
+ dataStore.setCopyrightText("CopyrightText");
+
+ assertTrue(dataStore.getCopyrightText().equals("CopyrightText"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getDependenciesFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultDependenciesFile() {
+ dataStore.setSelectedDependenciesFiles(new String[]{"DependenciesFile"});
+
+ assertTrue(dataStore.getSelectedDependenciesFiles()[0].equals("DependenciesFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getDistributionTexts()}.
+ */
+ @Test
+ public final void testSetAndGetDistributionText() {
+ String[] text = {"DistributionText"};
+ dataStore.setDistributionTexts(text);
+
+ String[] result = dataStore.getDistributionTexts();
+
+ assertTrue(result.length == 1);
+ assertTrue(result[0].equals("DistributionText"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getFilterItems()}.
+ */
+ @Test
+ public final void testSetAndGetFilterItems() {
+ String items[] = {"number1", "number2"};
+
+ dataStore.setFilterHasItems(items);
+
+ String returned[] = dataStore.getFilterHasItems();
+
+ assertTrue(returned.length == 2 && returned[0].equals("number1") && returned[1].equals("number2"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getHighlightCoreOS()}.
+ */
+ @Test
+ public final void testSetAndGetHighlightCoreOS() {
+ dataStore.setHighlightCoreOS(true);
+
+ assertTrue(dataStore.getHighlightCoreOS());
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getIgnoreItems()}.
+ */
+ @Test
+ public final void testSetAndGetIgnoreItems() {
+ List<String[]> ignoreItems = new ArrayList<String[]>();
+
+ String items[] = {"number1", "number2"};
+
+ ignoreItems.add(items);
+ ignoreItems.add(items);
+
+ dataStore.setIgnoreItems(ignoreItems);
+
+ List<String[]> returnedItems = dataStore.getIgnoreItems();
+
+ for (String[] item : returnedItems) {
+ if(!item[0].equals("number1") && !item[0].equals("number1")) {
+ fail();
+ }
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getLevelOfDetail()}.
+ */
+ @Test
+ public final void testSetAndGetLevelOfDetail() {
+ dataStore.setLevelOfDetail("LevelOfDetail");
+
+ assertTrue(dataStore.getLevelOfDetail().equals("LevelOfDetail"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getLevelsFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultLevelsFile() {
+ dataStore.setSelectedLevelsFiles(new String[]{"LevelsFile"});
+
+ assertTrue(dataStore.getSelectedLevelsFiles()[0].equals("LevelsFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getLocalisationFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultLocalisationFile() {
+ dataStore.setSelectedLocalisationFiles(new String[]{"LocalisationFile"});
+
+ assertTrue(dataStore.getSelectedLocalisationFiles()[0].equals("LocalisationFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getModelName()}.
+ */
+ @Test
+ public final void testSetAndGetModelName() {
+ dataStore.setModelName("ModelName");
+
+ assertTrue(dataStore.getModelName().equals("ModelName"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getModelVersion()}.
+ */
+ @Test
+ public final void testSetAndGetModelVersion() {
+ dataStore.setModelVersion("ModelVersion");
+
+ assertTrue(dataStore.getModelVersion().equals("ModelVersion"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getModelVersionTexts()}.
+ */
+ @Test
+ public final void testSetAndGetModelVersionText() {
+ String[] text = {"ModelVersionText"};
+
+ dataStore.setModelVersionTexts(text);
+
+ assertTrue(dataStore.getModelVersionTexts().length == 1);
+ assertTrue(dataStore.getModelVersionTexts()[0].equals("ModelVersionText"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getShapesFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultShapesFile() {
+ dataStore.setSelectedShapesFiles(new String[]{"ShapesFile"});
+
+ assertTrue(dataStore.getSelectedShapesFiles()[0].equals("ShapesFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getSystemDefinitionFiles()}.
+ */
+ @Test
+ public final void testSetAndGetSystemDefinitionFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setSystemDefinitionFiles(items);
+
+ String returned[] = dataStore.getSystemDefinitionFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getSystemInfoFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultSystemInfoFile() {
+ dataStore.setSelectedSystemInfoFiles(new String[]{"SystemInfoFile"});
+
+ assertTrue(dataStore.getSelectedSystemInfoFiles()[0].equals("SystemInfoFile"));
+ }
+
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#setSystemName(java.lang.String)}.
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getSystemName()}.
+ */
+ @Test
+ public final void testSetAndGetSystemName() {
+ dataStore.setSystemName("sysname");
+
+ assertTrue(dataStore.getSystemName().equals("sysname"));
+ }
+
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getSystemVersion()}.
+ */
+ @Test
+ public final void testSetAndGetSystemVersion() {
+ dataStore.setSystemVersion("SystemVersion");
+
+ assertTrue(dataStore.getSystemVersion().equals("SystemVersion"));
+ }
+
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getBorderShapesFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultBorderShapesFile() {
+ dataStore.setSelectedBorderShapesFiles(new String[]{"BorderShapesFile"});
+
+ assertTrue(dataStore.getSelectedBorderShapesFiles()[0].equals("BorderShapesFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getBorderStylesFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultBorderStylesFile() {
+ dataStore.setSelectedBorderStylesFiles(new String[]{"BorderStylesFile"});
+
+ assertTrue(dataStore.getSelectedBorderStylesFiles()[0].equals("BorderStylesFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getColoursFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultColoursFile() {
+ dataStore.setSelectedColoursFiles(new String[]{"ColoursFile"});
+
+ assertTrue(dataStore.getSelectedColoursFiles()[0].equals("ColoursFile"));
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.AbstractPersistentDataStore#getPatternsFile()}.
+ */
+ @Test
+ public final void testSetAndGetDefaultPatternsFile() {
+ dataStore.setSelectedPatternsFiles(new String[]{"PatternsFile"});
+
+ assertTrue(dataStore.getSelectedPatternsFiles()[0].equals("PatternsFile"));
+ }
+
+
+ @Test
+ public final void setWarningLevel() {
+ dataStore.setWarningLevel("1");
+
+ assertTrue(dataStore.getWarningLevel().equals("1"));
+ }
+
+ @Test
+ public final void setMakeModelStatic() {
+ dataStore.setSuppressMouseOverEffect(true);
+
+ assertTrue(dataStore.getSuppressMouseOverEffect());
+ }
+
+
+
+ @Test
+ public void setAndGetBorderShapesFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setBorderShapesFiles(items);
+
+ String returned[] = dataStore.getBorderShapesFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetBorderStylesFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setBorderStylesFiles(items);
+
+ String returned[] = dataStore.getBorderStylesFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetColoursFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setColoursFiles(items);
+
+ String returned[] = dataStore.getColoursFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetPatternsFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setPatternsFiles(items);
+
+ String returned[] = dataStore.getPatternsFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetSystemInfoFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setSystemInfoFiles(items);
+
+ String returned[] = dataStore.getSystemInfoFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetLevelsFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setLevelsFiles(items);
+
+ String returned[] = dataStore.getLevelsFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetLocalisationFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setLocalisationFiles(items);
+
+ String returned[] = dataStore.getLocalisationFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+
+ @Test
+ public void setAndGetDependenciesFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setDependenciesFiles(items);
+
+ String returned[] = dataStore.getDependenciesFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+
+ @Test
+ public void setAndGetShapesFiles() {
+ String items[] = {"file1", "file2"};
+
+ dataStore.setShapesFiles(items);
+
+ String returned[] = dataStore.getShapesFiles();
+
+ assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/views/ConsoleOutputTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,49 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.views;
+
+import junit.framework.Assert;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.Test;
+
+
+public class ConsoleOutputTest {
+
+ @Test
+ public final void testConsoleOutput() {
+ String textToTest = "Test text";
+
+ Display display = new Display();
+ Shell shell = new Shell(display);
+
+ ConsoleOutput consoleOutput = new ConsoleOutput();
+
+ consoleOutput.createPartControl(shell);
+
+ consoleOutput.setFocus(); // This method doesn't actually do anything but keeps code coverage happy
+
+ ConsoleOutput.addText(textToTest);
+
+ Assert.assertEquals(ConsoleOutput.getText().substring(0, textToTest.length()), textToTest);
+
+ ConsoleOutput.reset();
+
+ Assert.assertEquals(ConsoleOutput.getText(), "");
+
+ display.dispose();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/wizard/NewProjectWizardSystemDefsPageTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,79 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.wizard;
+
+import static org.junit.Assert.*;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.symbian.smt.gui.wizard.NewProjectWizardSystemDefsPage;
+
+public class NewProjectWizardSystemDefsPageTest {
+ IStructuredSelection selection;
+ NewProjectWizardSystemDefsPage newProjectWizardSystemDefsPage;
+ Display display;
+ Shell shell;
+
+// /**
+// * @throws java.lang.Exception
+// */
+// @Before
+// public void setUp() throws Exception {
+// display = new Display();
+// shell = new Shell(display);
+//
+// newProjectWizardSystemDefsPage = new NewProjectWizardSystemDefsPage(selection);
+// newProjectWizardSystemDefsPage.createControl(shell);
+// }
+//
+// /**
+// * @throws java.lang.Exception
+// */
+// @After
+// public void tearDown() throws Exception {
+// display.dispose();
+// }
+//
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardSystemDefsPage#validModelDefined(java.lang.Boolean)}.
+// */
+// @Test
+// public final void testValidModelDefined() {
+// newProjectWizardSystemDefsPage.validModelDefined(true);
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardSystemDefsPage#SetSystemDefinitions(java.lang.String[])}.
+// */
+// @Test
+// public final void testSetAndGetSystemDefinitions() {
+// String[] list = new String[] {"1", "2"};
+//
+// newProjectWizardSystemDefsPage.setSystemDefinitions(list);
+//
+// String[] results = newProjectWizardSystemDefsPage.getSystemDefinitions();
+//
+// if (results.length != 2) {
+// fail("The list returned should contain 2 elements");
+// }
+// }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/wizard/NewProjectWizardTabbedPropertiesPageTest.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,438 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.wizard;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NewProjectWizardTabbedPropertiesPageTest {
+ IStructuredSelection selection;
+ NewProjectWizardTabbedPropertiesPage newProjectWizardTabbedPropertiesPage;
+ Display display;
+ Shell shell;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ display = new Display();
+ shell = new Shell(display);
+
+ newProjectWizardTabbedPropertiesPage = new NewProjectWizardTabbedPropertiesPage(selection);
+ newProjectWizardTabbedPropertiesPage.createControl(shell);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ display.dispose();
+ }
+
+
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setDistributionText(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetDistributionText() {
+ String[] text = {"test"};
+
+ newProjectWizardTabbedPropertiesPage.setDistributionTexts(text);
+ String[] result = newProjectWizardTabbedPropertiesPage.getDistributionTexts();
+
+ if (result.length != 1 || (!result[0].equals("test"))) {
+ fail("Distribution Text set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setModelVersion(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetModelVersion() {
+ newProjectWizardTabbedPropertiesPage.setModelVersion("test");
+ String result = newProjectWizardTabbedPropertiesPage.getModelVersion();
+
+ if (!result.equals("test")) {
+ fail("Model Version set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setSystemVersion(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetSystemVersion() {
+ newProjectWizardTabbedPropertiesPage.setSystemVersion("test");
+ String result = newProjectWizardTabbedPropertiesPage.getSystemVersion();
+
+ if (!result.equals("test")) {
+ fail("System Version set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setCopyrightText(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetCopyrightText() {
+ newProjectWizardTabbedPropertiesPage.setCopyrightText("test");
+ String result = newProjectWizardTabbedPropertiesPage.getCopyrightText();
+
+ if (!result.equals("test")) {
+ fail("Copyright Text set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setModelVersionTexts(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetModelVersionText() {
+ String[] text = {"test"};
+
+ newProjectWizardTabbedPropertiesPage.setModelVersionTexts(text);
+ String[] result = newProjectWizardTabbedPropertiesPage.getModelVersionTexts();
+
+ if (result.length != 1 || (!result[0].equals("test"))) {
+ fail("Model Version Text set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setModelName(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetModelName() {
+ newProjectWizardTabbedPropertiesPage.setModelName("test");
+ String result = newProjectWizardTabbedPropertiesPage.getModelName();
+
+ if (!result.equals("test")) {
+ fail("Model Name set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setSystemName(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetSystemName() {
+ newProjectWizardTabbedPropertiesPage.setSystemName("test");
+ String result = newProjectWizardTabbedPropertiesPage.getSystemName();
+
+ if (!result.equals("test")) {
+ fail("System Name set\\get failed");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setHighlightCoreOS(java.lang.Boolean)}.
+ */
+ @Test
+ public final void testSetAndGetHighlightCoreOS() {
+ newProjectWizardTabbedPropertiesPage.setHighlightCoreOS(true);
+ assertTrue("Highlight Core OS set\\get failed", newProjectWizardTabbedPropertiesPage.getHighlightCoreOS());
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setLevelOfDetail(java.lang.String)}.
+ */
+ @Test
+ public final void testSetAndGetLevelOfDetail() {
+ newProjectWizardTabbedPropertiesPage.setLevelOfDetail("component");
+ String result = newProjectWizardTabbedPropertiesPage.getLevelOfDetail();
+
+ if (!result.equals("component")) {
+ fail("Level of Detail set\\get failed");
+ }
+ }
+
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getShapesFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultShapesFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultShapesFiles(new String[] {"./../SystemModelGenerator/resources/auxiliary/Shapes.xml"});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultShapesFiles()[0].equalsIgnoreCase("./../SystemModelGenerator/resources/auxiliary/Shapes.xml")) {
+// fail("Did not return default shapes file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getLevelsFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultLevelsFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultLevelsFiles(new String[]{"Auto"});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultLevelsFiles()[0].equalsIgnoreCase("Auto")) {
+// fail("Did not return default levels file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getLocalisationFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultLocalisationFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultLocalisationFiles(new String[] {"./../SystemModelGenerator/resources/auxiliary/display-names.xml"});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultLocalisationFiles()[0].equalsIgnoreCase("./../SystemModelGenerator/resources/auxiliary/display-names.xml")) {
+// fail("Did not return default localisation file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getSystemInfoFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultSystemInfoFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultSystemInfoFiles(new String[] {""});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultSystemInfoFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default system info file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getDependenciesFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultDependenciesFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultDependenciesFiles(new String[] {""});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultDependenciesFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default dependencies file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getColoursFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultColoursFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultColoursFiles(new String[] {""});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultColoursFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default colours file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getBorderStylesFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultBorderStylesFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultBorderStylesFiles(new String[] {""});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultBorderStylesFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default border styles file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getBorderShapesFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultBorderShapesFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultBorderShapesFiles(new String[] {""});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultBorderShapesFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default border shapes file");
+// }
+// }
+//
+// /**
+// * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#getPatternsFile()}.
+// */
+// @Test
+// public final void testSetAndGetDefaultPatternsFile() {
+// newProjectWizardTabbedPropertiesPage.setDefaultPatternsFiles(new String[] {""});
+//
+// if (!newProjectWizardTabbedPropertiesPage.getDefaultPatternsFiles()[0].equalsIgnoreCase("")) {
+// fail("Did not return default patterns file");
+// }
+// }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setFilterItems(java.lang.String[])}.
+ */
+ @Test
+ public final void testSetAndGetFilterItems() {
+ String[] list = new String[] {"1", "2"};
+
+ newProjectWizardTabbedPropertiesPage.setFilterItems(list);
+
+ String[] results = newProjectWizardTabbedPropertiesPage.getFilterItems();
+
+ if (results.length != 2) {
+ fail("The list returned should contain 2 elements");
+ }
+ }
+
+ /**
+ * Test method for {@link com.symbian.smt.gui.wizard.NewProjectWizardTabbedPropertiesPage#setIgnoreItems(java.util.List)}.
+ */
+ @Test
+ public final void testSetAndGetIgnoreItems() {
+ ArrayList<String[]> ignoreItems = new ArrayList<String[]>();
+
+ String[] itemData = {"layer", "2"} ;
+ ignoreItems.add(itemData);
+
+ newProjectWizardTabbedPropertiesPage.setIgnoreItems(ignoreItems);
+
+ List<String[]> returned = newProjectWizardTabbedPropertiesPage.getIgnoreItems();
+
+ Assert.assertEquals(1, returned.size());
+
+ if (returned.get(0)[0] != "layer" || returned.get(0)[1] != "2") {
+ fail("The list returned is incorrect");
+ }
+ }
+
+
+
+
+
+
+
+
+// @Test
+// public void setAndGetBorderShapesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setBorderShapesFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getBorderShapesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetBorderStylesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setBorderStylesFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getBorderStylesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetColoursFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setColoursFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getColoursFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetPatternsFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setPatternsFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getPatternsFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetSystemInfoFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setSystemInfoFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getSystemInfoFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetLevelsFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setLevelsFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getLevelsFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetLocalisationFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setLocalisationFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getLocalisationFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+//
+// @Test
+// public void setAndGetDependenciesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setDependenciesFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getDependenciesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+//
+// @Test
+// public void setAndGetShapesFiles() {
+// String items[] = {"file1", "file2"};
+//
+// newProjectWizardTabbedPropertiesPage.setShapesFiles(items);
+//
+// String returned[] = newProjectWizardTabbedPropertiesPage.getShapesFiles();
+//
+// assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2"));
+// }
+
+
+ @Test
+ public final void setMakeModelStatic() {
+ newProjectWizardTabbedPropertiesPage.setSuppressMouseOverEffect(true);
+
+ assertTrue(newProjectWizardTabbedPropertiesPage.getSuppressMouseOverEffect());
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/.classpath Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.smt.gui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/META-INF/MANIFEST.MF Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: System Model Manager
+Bundle-SymbolicName: com.symbian.smt.gui;singleton:=true
+Bundle-Version: 1.1.4
+Bundle-Activator: com.symbian.smt.gui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.console,
+ org.eclipse.jface.text,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.navigator,
+ org.eclipse.core.expressions
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Nokia Corporation
+Export-Package: com.symbian.smt.gui;x-friends:="com.symbian.smt.gui",
+ com.symbian.smt.gui.smtwidgets;x-friends:="com.symbian.smt.gui.unittest"
+Bundle-ClassPath: .
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/Activator.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/builder/Builder.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/editors/SVGEditor.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/nature/Nature.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/perspective/Perspective.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/preferences/Preferences.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/properties/Properties.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/views/ConsoleOutput.class has changed
Binary file sysmodelmgr/com.symbian.smt.gui/bin/com/symbian/smt/gui/wizard/NewSMTProjectWizard.class has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/bin/defaults.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,38 @@
+SYSTEM_DEFINITION_FILES
+
+COPYRIGHT_TEXT = Symbian Software Ltd.
+DISTRIBUTION_TEXT = Distribution text
+MODEL_NAME = System Model
+MODEL_VERSION = 1
+MODEL_VERSION_TEXT = draft
+SYSTEM_NAME = Symbian OS
+SYSTEM_VERSION = Future
+
+HIGHTLIGHT_CORE_OS = on
+LEVEL_OF_DETAIL = component
+
+SHAPES_FILES
+LEVELS_FILES
+LOCALISATION_FILES
+DEPENDENCIES_FILES
+SYSTEM_INFO_FILES
+COLOURS_FILES
+BORDER_STYLES_FILES
+BORDER_SHAPES_FILES
+PATTERNS_FILES
+
+SHAPES_FILE_DEFAULT =
+LEVELS_FILE_DEFAULT =
+LOCALISATION_FILE_DEFAULT =
+DEPENDENCIES_FILE_DEFAULT =
+SYSTEM_INFO_FILE_DEFAULT =
+COLOURS_FILE_DEFAULT =
+BORDER_STYLES_FILE_DEFAULT =
+BORDER_SHAPES_FILE_DEFAULT =
+PATTERNS_FILE_DEFAULT =
+
+FILTER_ITEMS = java,gt,
+
+IGNORE_ITEMS = layer:Tools and Utils and SDKENG;layer:MISC;
+
+WARNING_LEVELS = 1
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/build-for-testing.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,94 @@
+<!-- Build file for testing the com.symbian.smt.gui plugin -->
+<project name="com.symbian.smt.gui" default="help" basedir=".">
+ <property name="plugin.dir" location="${basedir}"/>
+ <property name="projects.dir" location="${basedir}/.."/>
+ <property name="location.properties.dir" location="${projects.dir}/com.symbian.smt.gui.properties"/>
+ <property file="${projects.dir}/project.properties"/>
+
+ <property name="plugin.name" value="com.symbian.smt.gui"/>
+ <property name="plugin.version" value="1.1.1"/>
+ <property name="test.eclipse.dir" location="c:/opt/eclipse-for-pde-unit-tests"/>
+ <property name="target.dir" location="${projects.dir}/target"/>
+ <property name="published.plugins.dir" location="${target.dir}/plugins"/>
+ <property name="src.dir" location="${plugin.dir}/src"/>
+ <property name="test.dir" location="${plugin.dir}/test"/>
+ <property name="plugin.target.dir" location="${plugin.dir}/target"/>
+ <property name="reports.dir" location="${plugin.target.dir}/reports"/>
+ <property name="classes.dir" location="${plugin.target.dir}/classes"/>
+
+ <path id="build.class.path">
+ <fileset dir="${test.eclipse.dir}/plugins">
+ <include name="org.eclipse.ui_3.4*.jar"/>
+ <include name="org.eclipse.ui.workbench_3.4*.jar"/>
+ <include name="org.eclipse.core.runtime_3.4*.jar"/>
+ <include name="org.eclipse.core.resources_3.4*.jar"/>
+ <include name="org.eclipse.jface_3.4*.jar"/>
+ <include name="org.eclipse.osgi_3.4*.jar"/>
+ <include name="org.eclipse.swt_3.4*.jar"/>
+ <include name="org.eclipse.swt.win32.win32.x86_3.4*.jar"/>
+ <include name="org.eclipse.equinox.preferences_3.2*.jar"/>
+ <include name="org.eclipse.equinox.common_3.4*.jar"/>
+ <include name="org.eclipse.equinox.registry_3.4*.jar"/>
+ <include name="org.eclipse.ui.ide_3.4*.jar"/>
+ <include name="org.eclipse.core.jobs_3.4*.jar"/>
+ <include name="org.eclipse.core.commands_3.4*.jar"/>
+ <include name="org.eclipse.core.expressions_3.4*.jar"/>
+ <include name="org.eclipse.jface.text_3.4*.jar"/>
+ <include name="org.eclipse.ui.navigator_3.*.jar"/>
+ <include name="org.eclipse.ui.editors_3.4*.jar"/>
+ <include name="org.eclipse.text_3.4*.jar"/>
+ <include name="org.eclipse.core.filebuffers_3.4*"/>
+ <include name="org.eclipse.ui.views_3*.jar"/>
+ <include name="org.eclipse.ui.workbench.texteditor_3.4*"/>
+ </fileset>
+ </path>
+
+ <target name="clean">
+ <delete dir="${plugin.dir}/bin"/>
+ <delete dir="${plugin.target.dir}"/>
+ </target>
+
+ <target name="build">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" classpathref="build.class.path" includeantruntime="false"/>
+ <antcall target="create_eclipse_plugin"/>
+ <copy todir="${published.plugins.dir}" file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar" overwrite="true"/>
+ </target>
+
+ <target name="create_eclipse_plugin">
+ <copy file="src/defaults.properties" todir="${basedir}" />
+ <copy file="${location.properties.dir}/location.properties" todir="${basedir}"/>
+
+ <property file="${plugin.dir}/build.properties"/>
+ <delete file="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar"/>
+ <zip destfile="${plugin.target.dir}/${plugin.name}_${plugin.version}.jar">
+ <zipfileset dir="." includes="${bin.includes}, defaults.properties, location.properties"/>
+ <zipfileset dir="${classes.dir}"/>
+ </zip>
+
+ <delete file="${basedir}/defaults.properties" />
+ <delete file="${basedir}/location.properties"/>
+ </target>
+
+ <target name="test">
+ <!-- no regular junit test -->
+ </target>
+
+ <target name="help">
+ <echo>
+This is the overall Ant build file for the com.symbian.smt.gui PDE Test projects.
+
+Usage:
+
+Target Description
+============== ==============================================
+[default] Displays this message.
+
+build Builds the source and creates the plugin jar.
+
+clean Cleans all the build and generated artefacts.
+ </echo>
+ </target>
+
+</project>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/build.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/build.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="com.symbian.smt.gui" default="build.jars" basedir=".">
+
+ <property name="basews" value="${ws}"/>
+ <property name="baseos" value="${os}"/>
+ <property name="basearch" value="${arch}"/>
+ <property name="basenl" value="${nl}"/>
+
+ <!-- Compiler settings. -->
+ <property name="javacFailOnError" value="false"/>
+ <property name="javacDebugInfo" value="on"/>
+ <property name="javacVerbose" value="false"/>
+ <property name="logExtension" value=".log"/>
+ <property name="compilerArg" value=""/>
+ <property name="javacSource" value="1.5"/>
+ <property name="javacTarget" value="1.5"/>
+ <path id="path_bootclasspath">
+ <fileset dir="${java.home}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <property name="bootclasspath" refid="path_bootclasspath"/>
+ <property name="bundleJavacSource" value="${javacSource}"/>
+ <property name="bundleJavacTarget" value="${javacTarget}"/>
+ <property name="bundleBootClasspath" value="${bootclasspath}"/>
+
+ <property name="reports.dir" value="${basedir}/report" />
+ <property name="coverage.dir" value="${reports.dir}/coverage" />
+
+ <!-- <property name="lib.dir" value="${basedir}/../shared/lib" /> -->
+
+ <target name="init">
+ <condition property="pluginTemp" value="${buildTempFolder}/plugins">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="pluginTemp" value="${basedir}"/>
+ <condition property="build.result.folder" value="${pluginTemp}/com.symbian.smt.gui">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="build.result.folder" value="${basedir}"/>
+ <property name="temp.folder" value="${basedir}/temp.folder"/>
+ <property name="plugin.destination" value="${release.folder}"/>
+ <property name="plugin.temp.destination" value="${basedir}/plugins.folder" />
+
+ <mkdir dir="${plugin.temp.destination}"/>
+ <mkdir dir="${plugin.destination}"/>
+ </target>
+
+ <target name="instrument.jars" depends="build.update.jar">
+ <mkdir dir="${coverage.dir}" />
+ <mkdir dir="${jars.instr.dir}" />
+ <emma>
+ <instr instrpath="${plugin.temp.destination}/com.symbian.smt.gui_${version}.jar" mode="overwrite" metadatafile="${coverage.dir}/smtgui_metadata.em"/>
+ </emma>
+ <copy file="${plugin.temp.destination}/com.symbian.smt.gui_${version}.jar" tofile="${jars.instr.dir}/com.symbian.smt.gui_${version}.jar"/>
+ </target>
+
+
+ <target name="build.update.jar" depends="init" description="Build the plug-in: com.symbian.smt.gui for an update site.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+
+ <zip destfile="${plugin.temp.destination}/com.symbian.smt.gui_${version}.jar" basedir="${temp.folder}/com.symbian.smt.gui" filesonly="false" whenempty="skip" update="false"/>
+
+ <copy file="${plugin.temp.destination}/com.symbian.smt.gui_${version}.jar" tofile="${plugin.destination}/com.symbian.smt.gui_${version}.jar"/>
+
+ <!-- <copy todir="${plugin.destination}/lib">
+ <fileset dir="${basedir}/../shared/lib"/>
+ </copy> -->
+
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="@dot" depends="init" unless="@dot" description="Create jar: com.symbian.smt.gui @dot.">
+ <delete dir="${temp.folder}/@dot.bin"/>
+ <mkdir dir="${temp.folder}/@dot.bin"/>
+ <path id="@dot.classpath">
+ <pathelement path="../shared/org.eclipse.ui_3.2.1.M20061108.jar"/>
+ <pathelement path="../shared/org.eclipse.core.runtime_3.2.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.osgi_3.2.2.R32x_v20070118.jar"/>
+ <pathelement path="../shared/org.eclipse.equinox.common_3.2.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.core.jobs_3.2.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.core.runtime.compatibility.registry_3.2.1.R32x_v20060907/runtime_registry_compatibility.jar"/>
+ <pathelement path="../shared/org.eclipse.core.runtime.compatibility.registry_3.2.1.R32x_v20060907"/>
+ <pathelement path="../shared/org.eclipse.equinox.registry_3.2.1.R32x_v20060814.jar"/>
+ <pathelement path="../shared/org.apache.xerces_2.8.0.v200606131651/resolver.jar"/>
+ <pathelement path="../shared/org.apache.xerces_2.8.0.v200606131651/xercesImpl.jar"/>
+ <pathelement path="../shared/org.apache.xerces_2.8.0.v200606131651/xml-apis.jar"/>
+ <pathelement path="../shared/org.eclipse.equinox.preferences_3.2.1.R32x_v20060717.jar"/>
+ <pathelement path="../shared/org.eclipse.core.runtime.compatibility.registry_3.2.1.R32x_v20060907/@dot"/>
+ <pathelement path="../shared/org.eclipse.core.contenttype_3.2.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/>
+ <pathelement path="../shared/org.eclipse.swt_3.2.2.v3236b.jar"/>
+ <pathelement path="../shared/org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar"/>
+ <pathelement path="../shared/org.eclipse.jface_3.2.2.M20061214-1200.jar"/>
+ <pathelement path="../shared/org.eclipse.core.commands_3.2.0.I20060605-1400.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.workbench_3.2.2.M20070119-0800.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.workbench.compatibility_3.2.0.I20060605-1400/@dot"/>
+ <pathelement path="../shared/org.eclipse.ui.workbench.compatibility_3.2.0.I20060605-1400/compatibility.jar"/>
+ <pathelement path="../shared/com.ibm.icu_3.4.5.20061213.jar"/>
+ <pathelement path="../shared/org.eclipse.help_3.2.2.R322_v20061213.jar"/>
+ <pathelement path="../shared/org.eclipse.core.expressions_3.2.2.r322_v20070109a.jar"/>
+ <pathelement path="../shared/org.eclipse.core.resources_3.2.2.R32x_v20061218.jar"/>
+ <pathelement path="../shared/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.core.resources.win32_3.2.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.update.configurator_3.2.2.R32x_v20070111.jar"/>
+ <pathelement path="../shared/org.eclipse.ant.core_3.1.100.v20060531.jar"/>
+ <pathelement path="../shared/org.eclipse.core.variables_3.1.100.v20060605.jar"/>
+ <pathelement path="../shared/org.eclipse.core.filesystem_1.0.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.console_3.1.100.v20060605.jar"/>
+ <pathelement path="../shared/org.eclipse.jface.text_3.2.2.r322_v20070104.jar"/>
+ <pathelement path="../shared/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.workbench.texteditor_3.2.0.v20060605-1400.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.editors_3.2.1.r321_v20060721.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.ide_3.2.1.M20060915-1030.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.win32_3.2.0.I20060605-1400.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.views_3.2.1.M20060906-0800.jar"/>
+ <pathelement path="../shared/org.eclipse.update.core_3.2.3.R32x_v20070118.jar"/>
+ <pathelement path="../shared/org.eclipse.update.core.win32_3.2.2.R32x_v20061214.jar"/>
+ <pathelement path="../shared/org.eclipse.update.ui_3.2.2.R32x_v20070111.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.forms_3.2.0.v20060602.jar"/>
+ <pathelement path="../shared/org.eclipse.core.filebuffers_3.2.1.r321_v20060721.jar"/>
+ <pathelement path="../shared/org.eclipse.ui.navigator_3.3.2.M20080207-0800.jar"/>
+ <!-- <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset> -->
+ </path>
+ <!-- compile the source code -->
+ <javac destdir="${temp.folder}/@dot.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" >
+ <compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
+ <classpath refid="@dot.classpath" />
+ <src path="src/" />
+ </javac>
+ <!-- Copy necessary resources -->
+ <copy todir="${temp.folder}/@dot.bin" failonerror="true" overwrite="false">
+ <fileset dir="src/" excludes="**/*.java, **/package.htm*" />
+ </copy>
+ <mkdir dir="${build.result.folder}"/>
+ <copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false">
+ <fileset dir="${temp.folder}/@dot.bin" />
+ </copy>
+ <delete dir="${temp.folder}/@dot.bin"/>
+ </target>
+
+ <target name="src.zip" depends="init" unless="src.zip">
+ <mkdir dir="${build.result.folder}"/>
+ <zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false">
+ <fileset dir="src/" includes="**/*.java" />
+ </zip>
+ </target>
+
+ <target name="build.jars" depends="init" description="Build all the jars for the plug-in: com.symbian.smt.gui.">
+ <available property="@dot" file="${build.result.folder}/@dot"/>
+ <antcall target="@dot"/>
+ </target>
+
+ <target name="build.sources" depends="init">
+ <available property="src.zip" file="${build.result.folder}/src.zip"/>
+ <antcall target="src.zip"/>
+ </target>
+
+ <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui"/>
+ <copy todir="${destination.temp.folder}/com.symbian.smt.gui" failonerror="true" overwrite="false">
+ <fileset dir="${build.result.folder}/@dot" includes="**" />
+ </copy>
+ <copy todir="${destination.temp.folder}/com.symbian.smt.gui" failonerror="true" overwrite="false">
+ <fileset dir="${basedir}" includes="META-INF/,plugin.xml,icons/" />
+ </copy>
+ </target>
+
+ <target name="build.zips" depends="init">
+ </target>
+
+ <target name="gather.sources" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui"/>
+ <copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/com.symbian.smt.gui" failonerror="false" overwrite="false"/>
+ </target>
+
+ <target name="gather.logs" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/com.symbian.smt.gui_0.0.1"/>
+ <copy file="${temp.folder}/@dot.bin${logExtension}" todir="${destination.temp.folder}/com.symbian.smt.gui" failonerror="false" overwrite="false"/>
+ </target>
+
+ <target name="clean" depends="init" description="Clean the plug-in: com.symbian.smt.gui of all the zips, jars and logs created.">
+ <delete dir="${build.result.folder}/@dot"/>
+ <delete file="${build.result.folder}/src.zip"/>
+ <delete file="${plugin.destination}/com.symbian.smt.gui_${version}.jar"/>
+ <delete file="${plugin.destination}/com.symbian.smt.gui_${version}.jar"/>
+ <delete file="${plugin.temp.destination}/com.symbian.smt.gui_${version}.zip"/>
+ <delete dir="${plugin.temp.destination}" />
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: com.symbian.smt.gui.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="build.sources"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <antcall target="gather.sources">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <delete>
+ <fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" />
+ </delete>
+ <zip destfile="${plugin.destination}/com.symbian.smt.gui_${version}.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="gather.results">
+ <copy file="${coverage.dir}\smtgui_metadata.em" tofile="${destination.results.folder}\coverage\smtgui_metadata.em"/>
+ </target>
+
+</project>
Binary file sysmodelmgr/com.symbian.smt.gui/icons/Arrow_Up_icons_24px.png has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/Arrow_down_icons_24px.png has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/SITK_Decorator_error.gif has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/SMM_16px_Icons.png has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/SMM_48px_icon.png has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/SMTIcon.gif has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/System_model_16px_Icon.png has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/XMLFile.gif has changed
Binary file sysmodelmgr/com.symbian.smt.gui/icons/sample.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/plugin.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,3 @@
+#Properties file for System Model Toolkit GUI
+plugin.name.0 = System Model Toolkit GUI
+plugin.provider-name.0 = Symbian Software Ltd
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/plugin.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ name="System Model Manager"
+ class="com.symbian.smt.gui.perspective.Perspective"
+ id="com.symbian.smt.gui.perspective"
+ icon="icons/SMM_16px_Icons.png">
+ </perspective>
+ </extension>
+ <extension
+ point="org.eclipse.ui.ide.projectNatureImages">
+ <image
+ id="com.symbian.smt.gui.natureimage"
+ icon="icons/SMM_16px_Icons.png"
+ natureId="com.symbian.smt.gui.nature">
+ </image>
+ </extension>
+ <extension
+ id="nature"
+ name="System Model Manager Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="com.symbian.smt.gui.nature.Nature">
+ </run>
+ </runtime>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ name="System Model Manager"
+ id="com.symbian.smt.gui">
+ </category>
+ <wizard
+ name="System Model Diagram"
+ class="com.symbian.smt.gui.wizard.NewSMTProjectWizard"
+ id="com.symbian.smt.gui.wizard.NewSMTProjectWizard"
+ project="true"
+ icon="icons/System_model_16px_Icon.png"
+ category="com.symbian.smt.gui"
+ finalPerspective="com.symbian.smt.gui.perspective">
+ </wizard>
+ </extension>
+ <extension
+ name="System Model Manager Builder"
+ id="builder"
+ point="org.eclipse.core.resources.builders">
+ <builder hasNature="false">
+ <run
+ class="com.symbian.smt.gui.builder.Builder">
+ </run>
+ </builder>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ name="System Model Manager"
+ class="com.symbian.smt.gui.preferences.SmmPreferences"
+ id="com.symbian.smt.gui.preferences">
+ </page>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.BuildPreferences"
+ id="com.symbian.smt.gui.buildpreferences"
+ name="Build Options"/>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.LabelPreferences"
+ id="com.symbian.smt.gui.labelspreferences"
+ name="Labels"/>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.ResourcesPreferences"
+ id="com.symbian.smt.gui.resourcespreferences"
+ name="Resources"/>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.ModelControlPreferences"
+ id="com.symbian.smt.gui.modelcontrolpreferences"
+ name="Model Control"/>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.IgnorePreferences"
+ id="com.symbian.smt.gui.ignorepreferences"
+ name="Ignore List"/>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.FilterPreferences"
+ id="com.symbian.smt.gui.filterpreferences"
+ name="Filters"/>
+ <page
+ category="com.symbian.smt.gui.preferences"
+ class="com.symbian.smt.gui.preferences.AdvancedOptionsPreferences"
+ id="com.symbian.smt.gui.advancedoptionspreferences"
+ name="Advanced Options"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="System Model Manager"
+ class="com.symbian.smt.gui.properties.SystemDefinitionFilesProperties"
+ id="com.symbian.smt.gui.properties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ name="Labels"
+ class="com.symbian.smt.gui.properties.ModelLabelProperties"
+ category="com.symbian.smt.gui.properties"
+ id="com.symbian.smt.gui.properties.ModelLabelProperties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ name="Resources"
+ class="com.symbian.smt.gui.properties.ResourceProperties"
+ category="com.symbian.smt.gui.properties"
+ id="com.symbian.smt.gui.properties.ResourceProperties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ name="Model Control"
+ class="com.symbian.smt.gui.properties.ModelControlProperties"
+ category="com.symbian.smt.gui.properties"
+ id="com.symbian.smt.gui.properties.ModelControlProperties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ name="Filters"
+ class="com.symbian.smt.gui.properties.FilterProperties"
+ category="com.symbian.smt.gui.properties"
+ id="com.symbian.smt.gui.properties.FilterProperties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ name="Ignore List"
+ class="com.symbian.smt.gui.properties.IgnoreProperties"
+ category="com.symbian.smt.gui.properties"
+ id="com.symbian.smt.gui.properties.IgnoreProperties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ adaptable="true"
+ category="com.symbian.smt.gui.properties"
+ class="com.symbian.smt.gui.properties.BuildControlProperties"
+ id="com.symbian.smt.gui.properties.BuildProperties"
+ name="Build Options"
+ objectClass="org.eclipse.core.resources.IProject">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ <page
+ name="Advanced Options"
+ class="com.symbian.smt.gui.properties.AdvancedOptionsProperties"
+ category="com.symbian.smt.gui.properties"
+ id="com.symbian.smt.gui.properties.AdvancedOptionsProperties"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <filter
+ name="nature"
+ value="com.symbian.smt.gui.nature"/>
+ </page>
+ </extension>
+ <extension
+ name="preferences"
+ id="preferences"
+ point="org.eclipse.core.runtime.preferences">
+ <scope
+ name="project"
+ class="org.eclipse.core.internal.resources.ProjectPreferences"/>
+ <initializer class="com.symbian.smt.gui.preferences.SmmPreferencesInitializer"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="System Model Manager Console Output"
+ class="com.symbian.smt.gui.views.ConsoleOutput"
+ id="com.symbian.smt.gui.views.consoleoutput"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="System Model Manager"
+ class="com.symbian.smt.gui.editors.svgeditor.SVGEditor"
+ id="com.symbian.smt.gui.editors.svgeditor"
+ contributorClass="com.symbian.smt.gui.editors.svgeditor.SVGEditorContributor"
+ extensions="svg"
+ icon="icons/System_model_16px_Icon.png"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.exportWizards">
+ <category
+ name="System Model Manager"
+ id="com.symbian.smt.gui"/>
+ <wizard
+ class="com.symbian.smt.gui.exportwizards.ExportSystemModelDiagram"
+ id="com.symbian.smt.gui.exportwizards.exportsystemmodeldiagram"
+ category="com.symbian.smt.gui"
+ icon="icons/System_model_16px_Icon.png"
+ name="System Model Diagram"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.decorators">
+ <decorator
+ lightweight="true"
+ location="TOP_LEFT"
+ adaptable="true"
+ label="SMM Decorator"
+ icon="icons/System_model_16px_Icon.png"
+ state="false"
+ id="com.symbian.smt.gui.outofsyncdecorator"
+ class="com.symbian.smt.gui.OutOfSyncDecorator">
+ </decorator>
+ </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup class="com.symbian.smt.gui.StartupClass"/>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="com.symbian.smt.gui.IFileTester"
+ type="org.eclipse.core.resources.IFile"
+ namespace="com.symbian.smt.gui"
+ properties="belongsToSMMProject"
+ class="com.symbian.smt.gui.FileTester">
+ </propertyTester>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="SMM XML Editor"
+ extensions="xml"
+ icon="icons/XMLFile.gif"
+ contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
+ class="com.symbian.smt.gui.editors.xmleditor.XMLEditor"
+ id="com.symbian.smt.gui.editors.xmleditor.XMLEditor"
+ default="true">
+ </editor>
+ </extension>
+</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/AbstractPersistentDataStore.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,976 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractPersistentDataStore implements PersistentSettings {
+
+ final static String SEPARATOR = "|";
+
+ private void concatenateAndWriteString(PersistentSettingsEnums theEnum,
+ String separator, String[] items) {
+ write(theEnum, Helper.concatenateString(separator, items));
+ }
+
+ /**
+ * Gets the list of advanced options from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getAdvancedOptions() {
+ return readAndSplitString(PersistentSettingsEnums.ADVANCED_OPTIONS,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the border shapes file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getBorderShapesFiles() {
+ return readAndSplitString(PersistentSettingsEnums.BORDER_SHAPES_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the border styles file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getBorderStylesFiles() {
+ return readAndSplitString(PersistentSettingsEnums.BORDER_STYLES_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the colours file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getColoursFiles() {
+ return readAndSplitString(PersistentSettingsEnums.COLOURS_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the copyright text from the persistent data store
+ *
+ * @return String
+ */
+ public String getCopyrightText() {
+ return read(PersistentSettingsEnums.COPYRIGHT_TEXT);
+ }
+
+ /**
+ * Gets the System Model Managers default border shapes files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultBorderShapesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.BORDER_SHAPES_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default border styles files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultBorderStylesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.BORDER_STYLES_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default colours files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultColoursFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.COLOURS_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default dependencies files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultDependenciesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.DEPENDENCIES_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default distribution text from the plug-in
+ * default persistent data store
+ *
+ * @return String
+ */
+ public String getDefaultDistributionText() {
+ return read(PersistentSettingsEnums.DISTRIBUTION_TEXT_DEFAULT);
+ }
+
+ /**
+ * Gets the System Model Managers default levels files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultLevelsFiles() {
+ return readAndSplitString(PersistentSettingsEnums.LEVELS_FILES_DEFAULT,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default localisation files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultLocalisationFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.LOCALISATION_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the default model version text from the persistent data store
+ *
+ * @return String
+ */
+ public String getDefaultModelVersionText() {
+ return read(PersistentSettingsEnums.MODEL_VERSION_TEXT_DEFAULT);
+ }
+
+ /**
+ * Gets the System Model Managers default patterns files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultPatternsFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.PATTERNS_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default printed DPI from the plug-in
+ * default persistent data store
+ *
+ * @return String
+ */
+ public String getDefaultPrintedDpi() {
+ return read(PersistentSettingsEnums.PRINTED_DPI_DEFAULT);
+ }
+
+ /**
+ * Gets the System Model Managers default S12 XML files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultS12XmlFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.S12_XML_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default shapes files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultShapesFiles() {
+ return readAndSplitString(PersistentSettingsEnums.SHAPES_FILES_DEFAULT,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the System Model Managers default system info files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultSystemInfoFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.SYSTEM_INFO_FILES_DEFAULT, SEPARATOR);
+ }
+
+ /**
+ * Gets the dependencies files location from the persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDependenciesFiles() {
+ return readAndSplitString(PersistentSettingsEnums.DEPENDENCIES_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the distribution text values from the persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDistributionTexts() {
+ return readAndSplitString(PersistentSettingsEnums.DISTRIBUTION_TEXTS,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the list of filter has items from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getFilterHasItems() {
+ return readAndSplitString(PersistentSettingsEnums.FILTER_HAS_ITEMS,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the list of filter items from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getFilterItems() {
+ return readAndSplitString(PersistentSettingsEnums.FILTER_ITEMS,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the fix item size option from the persistent data store
+ *
+ * @return a Boolean value indicating whether or not the fix item size
+ * option is checked
+ */
+ public Boolean getFixItemSize() {
+ String fixItemSize = read(PersistentSettingsEnums.FIX_ITEM_SIZE);
+
+ if (fixItemSize.equalsIgnoreCase("true")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Gets the highlight core OS option from the persistent data store
+ *
+ * @return String
+ */
+ public Boolean getHighlightCoreOS() {
+ String highlightCoreOS = read(PersistentSettingsEnums.HIGHTLIGHT_CORE_OS);
+
+ if (highlightCoreOS.equalsIgnoreCase("true")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Gets the list of ignore items from the persistent data store
+ *
+ * @return List<String[]>
+ */
+ public List<String[]> getIgnoreItems() {
+ ArrayList<String[]> ignoreItems = new ArrayList<String[]>();
+
+ String result = read(PersistentSettingsEnums.IGNORE_ITEMS);
+
+ if (result != null && result.length() > 0) {
+ // Split on ;'s
+ for (String ignoreItem : result.split(";")) {
+ if (ignoreItem != null && ignoreItem.length() > 0) {
+ // Then split on !'s
+ String[] itemData = ignoreItem.split(":");
+ // and add to the list
+ ignoreItems.add(itemData);
+ }
+ }
+ }
+ return ignoreItems;
+ }
+
+ /**
+ * Gets the level of detail from the persistent data store
+ *
+ * @return String
+ */
+ public String getLevelOfDetail() {
+ return read(PersistentSettingsEnums.LEVEL_OF_DETAIL);
+ }
+
+ /**
+ * Gets the levels file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getLevelsFiles() {
+ return readAndSplitString(PersistentSettingsEnums.LEVELS_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the localisation file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getLocalisationFiles() {
+ return readAndSplitString(PersistentSettingsEnums.LOCALISATION_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the model name from the persistent data store
+ *
+ * @return String
+ */
+ public String getModelName() {
+ return read(PersistentSettingsEnums.MODEL_NAME);
+ }
+
+ /**
+ * Gets the model version from the persistent data store
+ *
+ * @return String
+ */
+ public String getModelVersion() {
+ return read(PersistentSettingsEnums.MODEL_VERSION);
+ }
+
+ /**
+ * Gets the model version texts from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getModelVersionTexts() {
+ return readAndSplitString(PersistentSettingsEnums.MODEL_VERSION_TEXTS,
+ SEPARATOR);
+ }
+
+ public String getOutputFilename() {
+ return read(PersistentSettingsEnums.OUTPUT_NAME);
+ }
+
+ /**
+ * Gets the patterns file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getPatternsFiles() {
+ return readAndSplitString(PersistentSettingsEnums.PATTERNS_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the selected printed DPI value from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getPrintedDpis() {
+ return readAndSplitString(PersistentSettingsEnums.PRINTED_DPIS,
+ SEPARATOR);
+ }
+
+ public String[] getS12XmlFiles() {
+ return readAndSplitString(PersistentSettingsEnums.S12_XML_FILES,
+ SEPARATOR);
+ }
+
+ public String[] getSelectedBorderShapesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.BORDER_SHAPES_FILES_SELECTED, SEPARATOR);
+ }
+
+ public String[] getSelectedBorderStylesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.BORDER_STYLES_FILES_SELECTED, SEPARATOR);
+ }
+
+ public String[] getSelectedColoursFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.COLOURS_FILES_SELECTED, SEPARATOR);
+ }
+
+ public String[] getSelectedDependenciesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.DEPENDENCIES_FILES_SELECTED, SEPARATOR);
+ }
+
+ /**
+ * Gets the selected distribution text value from the persistent data store
+ *
+ * @return String
+ */
+ public String getSelectedDistributionText() {
+ return read(PersistentSettingsEnums.DISTRIBUTION_TEXT_SELECTED);
+ }
+
+ public String[] getSelectedLevelsFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.LEVELS_FILES_SELECTED, SEPARATOR);
+ }
+
+ public String[] getSelectedLocalisationFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.LOCALISATION_FILES_SELECTED, SEPARATOR);
+ }
+
+ /**
+ * Gets the selected model version text value from the persistent data store
+ *
+ * @return String
+ */
+ public String getSelectedModelVersionText() {
+ return read(PersistentSettingsEnums.MODEL_VERSION_TEXT_SELECTED);
+ }
+
+ public String[] getSelectedPatternsFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.PATTERNS_FILES_SELECTED, SEPARATOR);
+ }
+
+ /**
+ * Gets the selected printed DPI value from the persistent data store
+ *
+ * @return String
+ */
+ public String getSelectedPrintedDpi() {
+ return read(PersistentSettingsEnums.PRINTED_DPI_SELECTED);
+ }
+
+ public String[] getSelectedS12XmlFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.S12_XML_FILES_SELECTED, SEPARATOR);
+ }
+
+ public String[] getSelectedShapesFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.SHAPES_FILES_SELECTED, SEPARATOR);
+ }
+
+ public String[] getSelectedSystemInfoFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.SYSTEM_INFO_FILES_SELECTED, SEPARATOR);
+ }
+
+ /**
+ * Gets the shapes file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getShapesFiles() {
+ return readAndSplitString(PersistentSettingsEnums.SHAPES_FILES,
+ SEPARATOR);
+ }
+
+ public Boolean getSuppressMouseOverEffect() {
+ String makeModelStatic = read(PersistentSettingsEnums.SUPPRESS_MOUSE_OVER_EFFECT);
+
+ if (makeModelStatic.equalsIgnoreCase("true")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Gets the list of system definition files from the persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getSystemDefinitionFiles() {
+ return readAndSplitString(
+ PersistentSettingsEnums.SYSTEM_DEFINITION_FILES, SEPARATOR);
+ }
+
+ /**
+ * Gets the system info file location from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getSystemInfoFiles() {
+ return readAndSplitString(PersistentSettingsEnums.SYSTEM_INFO_FILES,
+ SEPARATOR);
+ }
+
+ /**
+ * Gets the system name from the persistent data store
+ *
+ * @return String
+ */
+ public String getSystemName() {
+ return read(PersistentSettingsEnums.SYSTEM_NAME);
+ }
+
+ /**
+ * Gets the system version from the persistent data store
+ *
+ * @return String
+ */
+ public String getSystemVersion() {
+ return read(PersistentSettingsEnums.SYSTEM_VERSION);
+ }
+
+ /**
+ * Gets the warning level to use from the persistent data store
+ *
+ * @return String
+ */
+ public String getWarningLevel() {
+ return read(PersistentSettingsEnums.WARNING_LEVELS);
+ }
+
+ public abstract String read(PersistentSettingsEnums key);
+
+ private String[] readAndSplitString(PersistentSettingsEnums theEnum,
+ String separator) {
+ String result = read(theEnum);
+
+ return Helper.splitString(result, separator);
+ }
+
+ /**
+ * Writes the list of advanced options to the persistent data store
+ *
+ * @param advancedOptionsList
+ * List of advanced options
+ * @return void
+ */
+ public void setAdvancedOptions(String[] advancedOptionsList) {
+ concatenateAndWriteString(PersistentSettingsEnums.ADVANCED_OPTIONS,
+ SEPARATOR, advancedOptionsList);
+ }
+
+ /**
+ * Writes the border shapes file location to the persistent data store
+ *
+ * @param borderShapesFile
+ * Location of the border shapes file
+ * @return void
+ */
+ public void setBorderShapesFiles(String[] borderShapesFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.BORDER_SHAPES_FILES,
+ SEPARATOR, borderShapesFile);
+ }
+
+ /**
+ * Writes the border styles file location to the persistent data store
+ *
+ * @param borderStylesFile
+ * Location of the border styles file
+ * @return void
+ */
+ public void setBorderStylesFiles(String[] borderStylesFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.BORDER_STYLES_FILES,
+ SEPARATOR, borderStylesFile);
+ }
+
+ /**
+ * Writes the colours file location to the persistent data store
+ *
+ * @param coloursFile
+ * Location of the colours file
+ * @return void
+ */
+ public void setColoursFiles(String[] coloursFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.COLOURS_FILES,
+ SEPARATOR, coloursFile);
+ }
+
+ /**
+ * Writes the copyright text to the persistent data store
+ *
+ * @param copyrightText
+ * String to be used for the copyright text
+ * @return void
+ */
+ public void setCopyrightText(String copyrightText) {
+ write(PersistentSettingsEnums.COPYRIGHT_TEXT, copyrightText);
+ }
+
+ /**
+ * Writes the dependencies file location to the persistent data store
+ *
+ * @param dependenciesFile
+ * Location of the dependencies file
+ * @return void
+ */
+ public void setDependenciesFiles(String[] dependenciesFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.DEPENDENCIES_FILES,
+ SEPARATOR, dependenciesFile);
+ }
+
+ /**
+ * Writes the distribution text values to the persistent data store
+ *
+ * @param distributionTexts
+ * String[] to be used for the distribution text values
+ * @return void
+ */
+ public void setDistributionTexts(String[] distributionTexts) {
+ concatenateAndWriteString(PersistentSettingsEnums.DISTRIBUTION_TEXTS,
+ SEPARATOR, distributionTexts);
+ }
+
+ /**
+ * Writes the list of filter has items to the persistent data store
+ *
+ * @param filterHasItemsList
+ * List of filter has names
+ * @return void
+ */
+ public void setFilterHasItems(String[] filterHasItemsList) {
+ concatenateAndWriteString(PersistentSettingsEnums.FILTER_HAS_ITEMS,
+ SEPARATOR, filterHasItemsList);
+ }
+
+ /**
+ * Writes the list of filter items to the persistent data store
+ *
+ * @param filterItemsList
+ * List of filter names
+ * @return void
+ */
+ public void setFilterItems(String[] filterItemsList) {
+ concatenateAndWriteString(PersistentSettingsEnums.FILTER_ITEMS,
+ SEPARATOR, filterItemsList);
+ }
+
+ /**
+ * Writes the fix item size option to the persistent data store
+ *
+ * @param fixItemSize
+ * Boolean to represent the fix item size option
+ * @return void
+ */
+ public void setFixItemSize(Boolean fixItemSize) {
+ write(PersistentSettingsEnums.FIX_ITEM_SIZE, fixItemSize.toString());
+ }
+
+ /**
+ * Writes the highlight core OS option to the persistent data store
+ *
+ * @param highlightCoreOS
+ * Boolean to represent the highlight core OS option
+ * @return void
+ */
+ public void setHighlightCoreOS(Boolean highlightCoreOS) {
+ write(PersistentSettingsEnums.HIGHTLIGHT_CORE_OS, highlightCoreOS
+ .toString());
+ }
+
+ /**
+ * Writes the list of ignore items to the persistent data store
+ *
+ * @param ignoreItems
+ * List of ignore items
+ * @return void
+ */
+ public void setIgnoreItems(List<String[]> ignoreItemsList) {
+ StringBuilder ignoreItems = new StringBuilder();
+
+ for (String[] ignoreItem : ignoreItemsList) {
+ ignoreItems.append(ignoreItem[0]);
+ ignoreItems.append(":");
+ ignoreItems.append(ignoreItem[1]);
+ ignoreItems.append(";");
+ }
+
+ write(PersistentSettingsEnums.IGNORE_ITEMS, ignoreItems.toString());
+ }
+
+ /**
+ * Writes the level of detail to the persistent data store
+ *
+ * @param levelOfDetail
+ * String to be used for the level of detail
+ * @return void
+ */
+ public void setLevelOfDetail(String levelOfDetail) {
+ write(PersistentSettingsEnums.LEVEL_OF_DETAIL, levelOfDetail);
+ }
+
+ /**
+ * Writes the levels file location to the persistent data store
+ *
+ * @param levelsFile
+ * Location of the levels file
+ * @return void
+ */
+ public void setLevelsFiles(String[] levelsFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.LEVELS_FILES,
+ SEPARATOR, levelsFile);
+ }
+
+ /**
+ * Writes the localisation file location to the persistent data store
+ *
+ * @param localisationFile
+ * Location of the localisation file
+ * @return void
+ */
+ public void setLocalisationFiles(String[] localisationFiles) {
+ concatenateAndWriteString(PersistentSettingsEnums.LOCALISATION_FILES,
+ SEPARATOR, localisationFiles);
+ }
+
+ /**
+ * Writes the model name to the persistent data store
+ *
+ * @param modelName
+ * String to be used for the model name
+ * @return void
+ */
+ public void setModelName(String modelName) {
+ write(PersistentSettingsEnums.MODEL_NAME, modelName);
+ }
+
+ /**
+ * Writes the model version to the persistent data store
+ *
+ * @param modelVersion
+ * String to be used for the model version
+ * @return void
+ */
+ public void setModelVersion(String modelVersion) {
+ write(PersistentSettingsEnums.MODEL_VERSION, modelVersion);
+ }
+
+ /**
+ * Writes the model version text values to the persistent data store
+ *
+ * @param modelVersionTexts
+ * String[] to be used for the model version text values
+ * @return void
+ */
+ public void setModelVersionTexts(String[] modelVersionTexts) {
+ concatenateAndWriteString(PersistentSettingsEnums.MODEL_VERSION_TEXTS,
+ SEPARATOR, modelVersionTexts);
+ }
+
+ public void setOutputFilename(String filename) {
+ write(PersistentSettingsEnums.OUTPUT_NAME, filename);
+ }
+
+ /**
+ * Writes the patterns file location to the persistent data store
+ *
+ * @param patternsFile
+ * Location of the patterns file
+ * @return void
+ */
+ public void setPatternsFiles(String[] patternsFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.PATTERNS_FILES,
+ SEPARATOR, patternsFile);
+ }
+
+ /**
+ * Writes the printed DPI values to the persistent data store
+ *
+ * @param dpi
+ * String array to be used for the printed DPI values
+ * @return void
+ */
+ public void setPrintedDpis(String[] dpis) {
+ concatenateAndWriteString(PersistentSettingsEnums.PRINTED_DPIS,
+ SEPARATOR, dpis);
+ }
+
+ public void setS12XmlFiles(String[] s12XmlFiles) {
+ concatenateAndWriteString(PersistentSettingsEnums.S12_XML_FILES,
+ SEPARATOR, s12XmlFiles);
+ }
+
+ public void setSelectedBorderShapesFiles(String[] borderShapesFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.BORDER_SHAPES_FILES_SELECTED,
+ SEPARATOR, borderShapesFiles);
+ }
+
+ public void setSelectedBorderStylesFiles(String[] borderStylesFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.BORDER_STYLES_FILES_SELECTED,
+ SEPARATOR, borderStylesFiles);
+ }
+
+ public void setSelectedColoursFiles(String[] coloursFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.COLOURS_FILES_SELECTED, SEPARATOR,
+ coloursFiles);
+ }
+
+ public void setSelectedDependenciesFiles(String[] dependenciesFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.DEPENDENCIES_FILES_SELECTED, SEPARATOR,
+ dependenciesFiles);
+ }
+
+ /**
+ * Writes the selected distribution text value to the persistent data store
+ *
+ * @param distributionText
+ * String to be used for the selected distribution text value
+ * @return void
+ */
+ public void setSelectedDistributionText(String distributionText) {
+ write(PersistentSettingsEnums.DISTRIBUTION_TEXT_SELECTED,
+ distributionText);
+ }
+
+ public void setSelectedLevelsFiles(String[] levelsFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.LEVELS_FILES_SELECTED, SEPARATOR,
+ levelsFiles);
+ }
+
+ public void setSelectedLocalisationFiles(String[] localisationFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.LOCALISATION_FILES_SELECTED, SEPARATOR,
+ localisationFiles);
+ }
+
+ /**
+ * Writes the selected model version text value to the persistent data store
+ *
+ * @param dpi
+ * String to be used for the selected model version text value
+ * @return void
+ */
+ public void setSelectedModelVersionText(String modelVersionText) {
+ write(PersistentSettingsEnums.MODEL_VERSION_TEXT_SELECTED,
+ modelVersionText);
+ }
+
+ public void setSelectedPatternsFiles(String[] patternsFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.PATTERNS_FILES_SELECTED, SEPARATOR,
+ patternsFiles);
+ }
+
+ /**
+ * Writes the selected printed DPI value to the persistent data store
+ *
+ * @param dpi
+ * String to be used for the selected printed DPI value
+ * @return void
+ */
+ public void setSelectedPrintedDpi(String dpi) {
+ write(PersistentSettingsEnums.PRINTED_DPI_SELECTED, dpi);
+ }
+
+ public void setSelectedS12XmlFiles(String[] s12XmlFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.S12_XML_FILES_SELECTED, SEPARATOR,
+ s12XmlFiles);
+ }
+
+ public void setSelectedShapesFiles(String[] shapesFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.SHAPES_FILES_SELECTED, SEPARATOR,
+ shapesFiles);
+ }
+
+ public void setSelectedSystemInfoFiles(String[] systemInfoFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.SYSTEM_INFO_FILES_SELECTED, SEPARATOR,
+ systemInfoFiles);
+ }
+
+ /**
+ * Writes the shapes file location to the persistent data store
+ *
+ * @param shapesFile
+ * Location of the shapes file
+ * @return void
+ */
+ public void setShapesFiles(String[] shapesFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.SHAPES_FILES,
+ SEPARATOR, shapesFile);
+ }
+
+ public void setSuppressMouseOverEffect(Boolean makeModelStatic) {
+ write(PersistentSettingsEnums.SUPPRESS_MOUSE_OVER_EFFECT,
+ makeModelStatic.toString());
+ }
+
+ /**
+ * Writes the list of system definition files to the persistent data store
+ *
+ * @param sysDefFiles
+ * List of the system definition file locations
+ * @return void
+ */
+ public void setSystemDefinitionFiles(String[] sysDefFiles) {
+ concatenateAndWriteString(
+ PersistentSettingsEnums.SYSTEM_DEFINITION_FILES, SEPARATOR,
+ sysDefFiles);
+ }
+
+ /**
+ * Writes the system info location to the persistent data store
+ *
+ * @param systemInfoFile
+ * Location of the system information file
+ * @return void
+ */
+ public void setSystemInfoFiles(String[] systemInfoFile) {
+ concatenateAndWriteString(PersistentSettingsEnums.SYSTEM_INFO_FILES,
+ SEPARATOR, systemInfoFile);
+ }
+
+ /**
+ * Writes the system name to the persistent data store
+ *
+ * @param systemName
+ * String to be used for the system name
+ * @return void
+ */
+ public void setSystemName(String systemName) {
+ write(PersistentSettingsEnums.SYSTEM_NAME, systemName);
+ }
+
+ /**
+ * Writes the system version to the persistent data store
+ *
+ * @param systemVersion
+ * String to be used for the system version
+ * @return void
+ */
+ public void setSystemVersion(String systemVersion) {
+ write(PersistentSettingsEnums.SYSTEM_VERSION, systemVersion);
+ }
+
+ /**
+ * Writes the warning level to the persistent data store
+ *
+ * @param warningLevel
+ * An int between 1 and 3 indicating the level of warnings to be
+ * produces
+ * @return void
+ */
+ public void setWarningLevel(String warningLevel) {
+ write(PersistentSettingsEnums.WARNING_LEVELS, warningLevel);
+ }
+
+ public abstract void write(PersistentSettingsEnums key, String value);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/Activator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,153 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.ui.IPageListener;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.symbian.smt.gui";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+ private SmmResourceChangeListener resourceListener;
+
+ private SmmPartListener partListener;
+ private IWindowListener windowListener;
+
+ private IPageListener pageListener;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ PlatformUI.getWorkbench().getDecoratorManager().setEnabled(
+ "com.symbian.smt.gui.outofsyncdecorator", true);
+
+ resourceListener = new SmmResourceChangeListener();
+ partListener = new SmmPartListener();
+
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ resourceListener,
+ IResourceChangeEvent.POST_CHANGE
+ | IResourceChangeEvent.PRE_DELETE
+ | IResourceChangeEvent.PRE_BUILD);
+
+ pageListener = new IPageListener() {
+
+ public void pageActivated(IWorkbenchPage page) {
+ page.addPartListener(partListener);
+ }
+
+ public void pageClosed(IWorkbenchPage page) {
+ page.removePartListener(partListener);
+ }
+
+ public void pageOpened(IWorkbenchPage page) {
+ page.addPartListener(partListener);
+ }
+ };
+
+ windowListener = new IWindowListener() {
+ public void windowActivated(IWorkbenchWindow window) {
+ window.addPageListener(pageListener);
+ if (window.getActivePage() != null) {
+ window.getActivePage().addPartListener(partListener);
+ }
+ }
+
+ public void windowClosed(IWorkbenchWindow window) {
+ window.removePageListener(pageListener);
+ if (window.getActivePage() != null) {
+ window.getActivePage().removePartListener(partListener);
+ }
+ }
+
+ public void windowDeactivated(IWorkbenchWindow window) {
+ window.removePageListener(pageListener);
+ if (window.getActivePage() != null) {
+ window.getActivePage().removePartListener(partListener);
+ }
+ }
+
+ public void windowOpened(IWorkbenchWindow window) {
+ window.addPageListener(pageListener);
+ if (window.getActivePage() != null) {
+ window.getActivePage().addPartListener(partListener);
+ }
+ }
+ };
+
+
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+
+ workbench.addWindowListener(windowListener);
+
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ workbenchWindow.addPageListener(pageListener);
+ if (workbenchWindow.getActivePage() != null) {
+ workbenchWindow.getActivePage().addPartListener(
+ partListener);
+ }
+ }
+
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/ChangeManager.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,353 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.io.File;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+import com.symbian.smt.gui.editors.svgeditor.SVGEditor;
+
+public class ChangeManager {
+ static HashMap<String, Boolean> dirtyProjects = new HashMap<String, Boolean>();
+
+ private String checkModelNameExtension(final IProject project,
+ final IResource addedFile, String newOutputName) {
+ if (!newOutputName.endsWith(".svg")) {
+ final StringBuilder fullName = new StringBuilder();
+ fullName.append(newOutputName);
+ fullName.append(".svg");
+
+ newOutputName = fullName.toString();
+ final String outputName = fullName.toString();
+
+ // The file has the extension added and is moved to the new filename
+ WorkspaceJob wj = new WorkspaceJob("auto-rename") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ IPath newLocation = addedFile.getFullPath()
+ .addFileExtension("svg");
+ addedFile
+ .move(newLocation, true, new NullProgressMonitor());
+
+ project.getFile(outputName).setDerived(true);
+
+ return new Status(IStatus.OK, Activator.PLUGIN_ID,
+ IStatus.OK, "auto-rename succeeded", null);
+ }
+ };
+ wj.schedule();
+ }
+
+ return newOutputName;
+ }
+
+ private void checkPropertyChangeMarkers(final IProject project) {
+ try {
+ IMarker[] mMarkers = project.findMarkers(IMarker.MESSAGE, false, 0);
+
+ for (final IMarker aMarker : mMarkers) {
+ if (aMarker.getAttribute(IMarker.MESSAGE) != null) {
+ if (aMarker.getAttribute(IMarker.MESSAGE).equals(
+ "properties changed")) {
+ dirtyProjects.put(project.getName(), true);
+
+ try {
+ aMarker.delete();
+ } catch (CoreException e) {
+ // Do nothing, the markers are a bit unstable, an
+ // exception will only occur if the marker has
+ // already been deleted.
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ public void closeEditor(final IFile oldProjectFile) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ IEditorPart oldEditor = page.findEditor(new FileEditorInput(
+ oldProjectFile));
+ page.closeEditor(oldEditor, false);
+ }
+ });
+ }
+
+ private IResourceDelta[] getAddedItems(IResourceDelta delta,
+ IProject project) {
+ IResourceDelta[] added = null;
+
+ if (delta.getFullPath().equals(Path.ROOT)) {
+ IResourceDelta[] children = delta
+ .getAffectedChildren(IResourceDelta.CHANGED);
+ for (IResourceDelta child : children) {
+ added = child.getAffectedChildren(IResourceDelta.ADDED);
+ break;
+ }
+ } else if (project.getFullPath().equals(delta.getFullPath())) {
+ added = delta.getAffectedChildren(IResourceDelta.ADDED);
+ }
+
+ return added;
+ }
+
+ private IResourceDelta[] getDeletedItems(IResourceDelta delta,
+ IProject project) {
+ IResourceDelta[] deleted = null;
+
+ if (delta.getFullPath().equals(Path.ROOT)) {
+ IResourceDelta[] children = delta
+ .getAffectedChildren(IResourceDelta.CHANGED);
+ for (IResourceDelta child : children) {
+ deleted = child.getAffectedChildren(IResourceDelta.REMOVED);
+ break;
+ }
+ } else if (project.getFullPath().equals(delta.getFullPath())) {
+ deleted = delta.getAffectedChildren(IResourceDelta.REMOVED);
+ }
+
+ return deleted;
+ }
+
+ private IPath getDeltaPath(IResourceDelta delta, IProject project) {
+ IPath deltaPath = null;
+
+ if (delta.getFullPath().equals(Path.ROOT)) {
+ IResourceDelta[] children = delta
+ .getAffectedChildren(IResourceDelta.CHANGED);
+ for (IResourceDelta child : children) {
+ deltaPath = child.getFullPath();
+ break;
+ }
+ } else if (project.getFullPath().equals(delta.getFullPath())) {
+ deltaPath = delta.getFullPath();
+ }
+
+ return deltaPath;
+ }
+
+ public void handleDelta(IResourceDelta delta, final IProject project) {
+ checkPropertyChangeMarkers(project);
+
+ if (delta != null) {
+ IScopeContext projectScope = new ProjectScope(project);
+ PersistentDataStore store = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Check to see if the System Model diagram name has changed
+ checkPropertyChangeMarkers(project); // True means that name has
+ // changed
+
+ // Get the added and deleted items, we use these to work out what
+ // has happened
+ IResourceDelta[] deletedItems = getDeletedItems(delta, project);
+ IResourceDelta[] addedItems = getAddedItems(delta, project);
+
+ // If the diagram has been deleted but a new one hasn't been added
+ // then close the editor
+ if (addedItems != null & deletedItems != null
+ && deletedItems.length == 1 && addedItems.length == 0) {
+ final String deletedfile = deletedItems[0].getFullPath()
+ .toString();
+ String outputName = store.getOutputFilename();
+ String resourceName = getDeltaPath(delta, project).append(
+ outputName).toString();
+
+ // Check that it was the system model diagram what was deleted,
+ // we are not interested in any other files
+ if (deletedfile.equals(resourceName)) {
+ IFile oldProjectFile = project.getFile(store
+ .getOutputFilename());
+ closeEditor(oldProjectFile);
+ dirtyProjects.put(project.getName(), true);
+ }
+ }
+
+ // Otherwise if the diagram has been deleted and a new one added
+ // then the diagram has been renamed
+ else if (addedItems != null & deletedItems != null
+ && deletedItems.length == 1 && addedItems.length == 1) {
+ String outputName = store.getOutputFilename();
+
+ if (outputName == null) {
+ return;
+ }
+
+ final String deletedfile = deletedItems[0].getFullPath()
+ .toString();
+ final String addedfile = addedItems[0].getFullPath().toString();
+
+ String resourceName = getDeltaPath(delta, project).append(
+ outputName).toString();
+
+ if (addedfile.equals(resourceName)
+ || deletedfile.equals(resourceName)) {
+ final String oldOutputName = new File(deletedfile)
+ .getName();
+
+ // Will add the .svg extension if required and also rename
+ // the file
+ final String newOutputName = checkModelNameExtension(
+ project, addedItems[0].getResource(), new File(
+ addedfile).getName());
+
+ // Update the project properties with the new model name
+ updatePropertiesWithModelName(store, resourceName,
+ deletedfile, newOutputName);
+
+ final IFile newProjectFile = project.getFile(newOutputName);
+
+ Boolean isDirty = false;
+
+ if (dirtyProjects.containsKey(project.getName())) {
+ isDirty = dirtyProjects.get(project.getName());
+ }
+
+ if (delta.getAffectedChildren(IResourceDelta.CHANGED).length <= 1
+ && !isDirty) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ if (newProjectFile.exists()
+ && !newProjectFile.isPhantom()) {
+ try {
+ IWorkbenchPage page = PlatformUI
+ .getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getActivePage();
+ FileEditorInput editorInput = new FileEditorInput(
+ newProjectFile);
+
+ IEditorPart oldEditor = page
+ .findEditor(new FileEditorInput(
+ project
+ .getFile(oldOutputName)));
+ page.closeEditor(oldEditor, false);
+
+ page.openEditor(editorInput,
+ SVGEditor.ID);
+
+ } catch (PartInitException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ }
+ });
+ }
+ }
+ } else { // Nothing has been deleted and nothing has been added - A
+ // file has been amended.
+ IResourceDelta[] children = delta
+ .getAffectedChildren(IResourceDelta.CHANGED);
+
+ for (IResourceDelta child : children) {
+ if (child.getResource() instanceof IFile) {
+ if (child.getResource().getFileExtension()
+ .equalsIgnoreCase("xml")) {
+ dirtyProjects.put(project.getName(), true);
+ }
+ } else if (child.getResource() instanceof IProject) {
+ if (child.getFlags() == IResourceDelta.OPEN) {
+ dirtyProjects.put(child.getResource().getName(),
+ true);
+ }
+ } else if (child.getResource() instanceof IFolder) {
+ IResourceDelta[] moreChildren = child
+ .getAffectedChildren(IResourceDelta.CHANGED);
+ for (IResourceDelta littlerChild : moreChildren) {
+ if (littlerChild.getResource().getFileExtension()
+ .equalsIgnoreCase("xml")) {
+ dirtyProjects.put(project.getName(), true);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void remove(IProject project) {
+ if (dirtyProjects.containsKey(project.getName())) {
+ dirtyProjects.remove(project.getName());
+ }
+ }
+
+ public boolean needsBuilding(IProject project) {
+ if (dirtyProjects.containsKey(project.getName())) {
+ return dirtyProjects.get(project.getName());
+ }
+
+ IScopeContext projectScope = new ProjectScope(project);
+ PersistentDataStore store = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ if (!project.getFile(store.getOutputFilename()).exists()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public void reset(IProject project) {
+ dirtyProjects.put(project.getName(), false);
+ }
+
+ private void updatePropertiesWithModelName(final PersistentDataStore store,
+ final String resourceName, final String deletedfile,
+ final String outName) {
+ WorkspaceJob wj = new WorkspaceJob("updating properties") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ if (deletedfile.equals(resourceName)) {
+ store.setOutputFilename(outName);
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, IStatus.OK,
+ "updating properties succeeded", null);
+ }
+ };
+ wj.schedule();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/FileTester.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,59 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+
+import com.symbian.smt.gui.nature.Nature;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class FileTester extends PropertyTester {
+
+ /**
+ *
+ */
+ public FileTester() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object element, String property, Object[] args, Object expectedValue) {
+ IFile file = (IFile) element;
+
+ if (property.equals("belongsToSMMProject")) {
+ try {
+ boolean belongsToSMMProject = file.getProject().hasNature(Nature.ID);
+ return expectedValue == null ? belongsToSMMProject : (belongsToSMMProject == ((Boolean) expectedValue).booleanValue());
+ }
+ catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ return false;
+ }
+
+ }
+
+ return false;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/FileValidationHelper.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,169 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class FileValidationHelper {
+
+ private static void createErrorMarker(IResource resource,
+ String errorMessage) {
+ IMarker marker;
+ try {
+ marker = resource.createMarker(IMarker.PROBLEM);
+
+ if (marker.exists()) {
+ marker.setAttribute(IMarker.MESSAGE, errorMessage);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
+ }
+ } catch (CoreException e) {
+ Logger.log("Cannot create error marker for resource ["
+ + resource.getName() + "].", e);
+ }
+ }
+
+ private static void deleteErrorMarkers(IResource resource) {
+ try {
+ resource
+ .deleteMarkers(IMarker.PROBLEM, false, IResource.DEPTH_ZERO);
+ } catch (CoreException e) {
+ Logger.log("Cannot delete error marker for resource ["
+ + resource.getName() + "].", e);
+ }
+ }
+
+ private static void showProblemsView() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+
+ if (window == null) {
+ return;
+ }
+
+ IWorkbenchPage page = window.getActivePage();
+
+ if (page == null) {
+ return;
+ }
+
+ try {
+ page.showView("org.eclipse.ui.views.ProblemView");
+ } catch (PartInitException e) {
+ String message = "Could not open the Problems View. Reason: "
+ + e.getMessage();
+ String title = "Error";
+
+ MessageDialog.openError(window.getShell(), title, message);
+ }
+ }
+
+ private static void communicateCoreException(CoreException e) {
+ Logger.log(e.getMessage(), e);
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+
+ if (window == null) {
+ return;
+ }
+
+ String message = "Problem encountered in locating errors in the workspace. Reason: "
+ + e.getMessage();
+ String title = "Error";
+
+ MessageDialog.openError(window.getShell(), title, message);
+ }
+
+ public static void validateResourceFile(IFile file) {
+ ResourcesEnums resourceType = ManageResources.getResourceType(file);
+
+ if (resourceType != null) {
+ ResourceFileValidator validator = new ResourceFileValidator(
+ resourceType);
+ String errorMessage;
+
+ try {
+ String url = ManageResources.getResourceUrl(file);
+
+ if (url == null) {
+ errorMessage = validator.validateXml(file.getLocation()
+ .toOSString());
+ }
+ else {
+ errorMessage = validator.validateXml(url);
+ }
+
+ deleteErrorMarkers(file);
+
+ if (errorMessage != null) {
+ createErrorMarker(file, errorMessage);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ showProblemsView();
+ }
+ });
+
+ }
+ } catch (CoreException e) {
+ communicateCoreException(e);
+ }
+ }
+ }
+
+ public static void validateSysDefFile(IFile file) {
+ XmlFileValidator validator = new XmlFileValidator();
+ String errorMessage;
+
+ try {
+ String url = ManageResources.getResourceUrl(file);
+
+ if (url == null) {
+ errorMessage = validator.validateXml(file.getLocation()
+ .toOSString());
+ }
+ else {
+ errorMessage = validator.validateXml(url);
+ }
+
+ deleteErrorMarkers(file);
+
+ if (errorMessage != null) {
+ createErrorMarker(file, errorMessage);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ showProblemsView();
+ }
+ });
+ }
+ } catch (CoreException e) {
+ communicateCoreException(e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/Helper.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,198 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.smt.gui;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A helper class for general usage.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public final class Helper {
+
+ /**
+ * Concatenates the strings in the provided array using the provided
+ * separator and returns the concatenated string.
+ *
+ * @param separator
+ * the separator to be used for the concatenation
+ * @param items
+ * the array of strings to be concatenated
+ * @return the concatenated String or an empty String if the provided array
+ * is null or empty.
+ */
+ public static String concatenateString(String separator, String[] items) {
+ StringBuilder joinedString = new StringBuilder();
+
+ if (items != null) {
+ for (String item : items) {
+ joinedString.append(item);
+ joinedString.append(separator);
+ }
+
+ if (joinedString.length() > 0) {
+ joinedString.deleteCharAt(joinedString.length() - 1);
+ }
+ }
+
+ return joinedString.toString();
+ }
+
+ /**
+ * Adds the absolute location represented by the provided rootLocation to
+ * the filenames
+ *
+ * @param filenames
+ * the String representing the relative filenames, separated by
+ * the provided separator
+ * @param rootLocation
+ * the String representing the location of the root of the
+ * filesystem that will turn the relative paths into absolute
+ * ones
+ * @param separator
+ * the String representing the separator that separates the file
+ * names
+ * @return the String representing the separator separated absolute
+ * filenames
+ */
+ public static String relative2AbsolutePaths(String filenames,
+ String rootLocation, String separator) {
+ String[] relativeNames = Helper.splitString(filenames, separator);
+ String[] absoluteNames = new String[relativeNames.length];
+ int i = 0;
+
+ for (String name : relativeNames) {
+ if (name.startsWith(".")) {
+ try {
+ name = new File(rootLocation + name).getCanonicalPath();
+ } catch (IOException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ absoluteNames[i] = name;
+ i++;
+ }
+
+ return concatenateString(separator, absoluteNames);
+ }
+
+ /**
+ * Splits the provided concatenated string into its constituent parts based
+ * upon the provided separator and returns an array of the constituents. If
+ * the provided input is null or empty, returns an empty array.
+ *
+ * @param concatenatedString
+ * a String containing components separated by the given
+ * separator
+ * @param separator
+ * the separator used
+ * @return an array of String with the separate components or an empty array
+ * if <code>concatenatedString</code> is null or empty
+ */
+ public static String[] splitString(String concatenatedString,
+ String separator) {
+ if (separator.equals("|")) {
+ separator = "\\|";
+ }
+
+ if (concatenatedString != null && concatenatedString.length() > 0) {
+ return concatenatedString.split(separator);
+ } else {
+ String[] empty = {};
+ return empty;
+ }
+ }
+
+ /**
+ * Converts the List of String objects into a String array. The opposite
+ * conversion is also provided by this class with method
+ * toListofStrings(String []).
+ *
+ * @param list
+ * the java.util.List of String objects to be converted (may be
+ * empty but cannot be null)
+ * @return the corresponding String array or an empty array if list is
+ * empty.
+ * @see #toListofStrings(String [])
+ */
+ public static final String[] toArrayOfStrings(List<String> list) {
+ if (list == null) {
+ throw new IllegalArgumentException("Parameter list cannot be null.");
+ }
+
+ String[] array = new String[list.size()];
+
+ return list.toArray(array);
+ }
+
+ /**
+ * Converts the provided ResourcesEnums array into a java.util.List
+ * containing the args of the provided ResourceEnums.
+ *
+ * @param array
+ * the array of ResourcesEnums objects to be converted (may be
+ * empty but cannot be null)
+ * @return the corresponding List of String args or an empty List if array
+ * is empty
+ */
+ public static final List<String> toListOfStrings(ResourcesEnums[] array) {
+ if (array == null) {
+ throw new IllegalArgumentException(
+ "Parameter array cannot be null.");
+ }
+
+ ArrayList<String> arrayList = new ArrayList<String>();
+
+ for (ResourcesEnums re : array) {
+ arrayList.add(re.arg());
+ }
+
+ return arrayList;
+ }
+
+ /**
+ * Converts the provided String array into a java.util.List. The opposite
+ * conversion is also provided by this class with method
+ * toArrayOfStrings(List).
+ *
+ * @param array
+ * the array of String objects to be converted (may be empty but
+ * cannot be null)
+ * @return the corresponding List of String objects or an empty List if
+ * array is empty
+ * @see #toArrayOfStrings(List<String>)
+ */
+ public static final List<String> toListOfStrings(String[] array) {
+ if (array == null) {
+ throw new IllegalArgumentException(
+ "Parameter array cannot be null.");
+ }
+
+ ArrayList<String> arrayList = new ArrayList<String>();
+
+ for (String s : array) {
+ arrayList.add(s);
+ }
+
+ return arrayList;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/Logger.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,52 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.runtime.Status;
+
+public class Logger {
+ static Activator theActivator = new Activator();
+
+ /**
+ * Logs an entry in the Eclipse error log
+ *
+ * @param String
+ * Text to appear in the Message field of the Error Log
+ * @return void
+ */
+ public static void log(String msg) {
+ log(msg, null);
+ }
+
+ /**
+ * Logs an entry in the Eclipse error log
+ *
+ * @param String
+ * Text to appear in the Message field of the Error Log
+ * @param Exception
+ * The exception to log
+ * @return void
+ */
+ public static void log(String msg, Exception e) {
+ theActivator.getLog()
+ .log(
+ new Status(Status.ERROR, Activator.PLUGIN_ID,
+ Status.OK, msg, e));
+ }
+
+ private Logger() {
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/ManageResources.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,642 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import static com.symbian.smt.gui.ResourcesEnums.BORDER_SHAPES;
+import static com.symbian.smt.gui.ResourcesEnums.BORDER_STYLES;
+import static com.symbian.smt.gui.ResourcesEnums.COLOURS;
+import static com.symbian.smt.gui.ResourcesEnums.DEPENDENCIES;
+import static com.symbian.smt.gui.ResourcesEnums.LEVELS;
+import static com.symbian.smt.gui.ResourcesEnums.LOCALISATION;
+import static com.symbian.smt.gui.ResourcesEnums.PATTERNS;
+import static com.symbian.smt.gui.ResourcesEnums.S12_XML;
+import static com.symbian.smt.gui.ResourcesEnums.SHAPES;
+import static com.symbian.smt.gui.ResourcesEnums.SYSTEM_INFO;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+
+public class ManageResources {
+
+ private static final List<String> RESOURCE_FOLDER_NAMES = Helper
+ .toListOfStrings(ResourcesEnums.values());
+
+ public static final String IS_URL = "isUrl";
+ public static final String URL_STRING = "urlString";
+
+ /**
+ * Deletes a resource, if it exists within a specified folder within the
+ * project.
+ *
+ * @param project
+ * The project to amend
+ * @param folderName
+ * The folder in which the resource is to be updated
+ * @return void
+ */
+ private static void deleteResources(IProject project, String folderName) {
+ // Create/Get the folder in the project
+ IFolder folder = getFolderInProject(project, folderName);
+
+ try {
+ for (IResource res : folder.members()) {
+ res.delete(true, null);
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Returns an IFolder object for the specified folder and project. Creates
+ * the folder if it does not already exist.
+ *
+ * @param project
+ * The project to amend
+ * @param folderName
+ * The folder name required
+ * @return IFolder
+ */
+ private static IFolder getFolderInProject(IProject project,
+ String folderName) {
+ // Makes a folder in the project
+ final IFolder folder = project.getFolder(new Path(folderName));
+
+ // Check to see if the folder already exists before creating it
+ if (!folder.exists()) {
+ try {
+ folder.create(true, true, null);
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ return folder;
+ }
+
+ /**
+ * Creates and returns an AbstractPersistentDataStore object, used for
+ * persising data.
+ *
+ * @param project
+ * The project to amend
+ * @return AbstractPersistentDataStore
+ */
+ private static AbstractPersistentDataStore getPersistDataStore(
+ IProject project) {
+ IScopeContext projectScope = new ProjectScope(project);
+ IEclipsePreferences node = projectScope.getNode(Activator.PLUGIN_ID);
+ AbstractPersistentDataStore dataStore = new PersistentDataStore(node);
+
+ return dataStore;
+ }
+
+ public static ResourcesEnums getResourceType(IFile file) {
+ if (isResourceFile(file)) {
+ String folderName = ((IFolder) file.getParent()).getName();
+
+ return ResourcesEnums.getResourcesEnums(folderName);
+ }
+
+ return null;
+ }
+
+ public static String getResourceUrl(IFile file) throws CoreException {
+ String urlString = null;
+ IMarker[] messageMarkers = file.findMarkers(IMarker.TASK, false,
+ IResource.DEPTH_ZERO);
+
+ for (int i = 0; i < messageMarkers.length; i++) {
+ IMarker marker = messageMarkers[i];
+
+ if (marker.getAttribute(ManageResources.IS_URL, false)) {
+ urlString = (String) marker.getAttribute(URL_STRING);
+ }
+ }
+
+ return urlString;
+ }
+
+ public static boolean isLocalPath(String path) {
+ int index = path.indexOf(':');
+
+ if (index == -1 || index == 1) {
+ return true;
+ } else if (index > 1) {
+ return false;
+ } else {
+ throw new RuntimeException("Unexpected file path format.");
+ }
+ }
+
+ public static boolean isResourceFile(IFile file) {
+ IContainer container = file.getParent();
+
+ if (container instanceof IFolder) {
+ IFolder folder = (IFolder) container;
+ String folderName = folder.getName();
+
+ if (RESOURCE_FOLDER_NAMES.contains(folderName)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static boolean isSystemDefinitionFile(IFile file) {
+ IContainer container = file.getParent();
+
+ if (container instanceof IProject) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Adds a file shortcut to the specified project
+ *
+ * @param project
+ * The project to amend
+ * @param folder
+ * The folder to create the shortcut in
+ * @param filenameInOS
+ * The file in the OS to create the shortcut to
+ * @param filenameInProject
+ * The name to use for the shortcut
+ * @return void
+ */
+ private static void makeFileShortcut(IProject project, String folder,
+ String filenameInOS, String fileNameInProject) {
+ IFile file;
+
+ // Check to see if the file needs to go into a folder and create the
+ // IFile object
+ if (folder == null || folder.length() == 0) {
+ file = project.getFile(fileNameInProject);
+ } else {
+ IFolder folder2 = project.getFolder(folder);
+ file = folder2.getFile(fileNameInProject);
+ }
+
+ // If the file is not being linked to a file in the OS then create a new
+ // empty file
+ if (filenameInOS == null || filenameInOS.length() == 0) {
+ filenameInOS = file.getRawLocation().toString();
+
+ File newEmptyFile = new File(filenameInOS);
+
+ try {
+ newEmptyFile.createNewFile();
+ } catch (IOException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ // Create a link to the file
+ try {
+ if (isLocalPath(filenameInOS)) {
+ IPath path = new Path(filenameInOS);
+ file.createLink(path, IResource.ALLOW_MISSING_LOCAL, null);
+ } else {
+ file.create(null, false, null);
+ IMarker marker = file.createMarker(IMarker.TASK);
+ marker.setAttribute(IS_URL, true);
+ marker.setAttribute(URL_STRING, filenameInOS);
+ }
+
+ FileValidationHelper.validateSysDefFile(file);
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Updates the border shapes file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateBorderShapesFiles(IProject project,
+ String[] options) {
+ updateResources(project, options, BORDER_SHAPES);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedBorderShapesFiles(options);
+ }
+
+ /**
+ * Updates the border styles file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateBorderStylesFiles(IProject project,
+ String[] options) {
+ updateResources(project, options, BORDER_STYLES);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedBorderStylesFiles(options);
+ }
+
+ /**
+ * Updates the colours file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateColoursFiles(IProject project, String[] options) {
+ updateResources(project, options, COLOURS);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedColoursFiles(options);
+ }
+
+ /**
+ * Updates the dependencies file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateDependenciesFiles(IProject project,
+ String[] options) {
+ updateResources(project, options, DEPENDENCIES);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedDependenciesFiles(options);
+ }
+
+ /**
+ * Updates the levels file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateLevelsFiles(IProject project, String[] options) {
+ updateResources(project, options, LEVELS);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedLevelsFiles(options);
+ }
+
+ /**
+ * Updates the localisation file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateLocalisationFiles(IProject project,
+ String[] options) {
+ updateResources(project, options, LOCALISATION);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedLocalisationFiles(options);
+ }
+
+ /**
+ * Updates the patterns file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updatePatternsFiles(IProject project, String[] options) {
+ updateResources(project, options, PATTERNS);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedPatternsFiles(options);
+ }
+
+ /**
+ * Updates a resource within a specified folder within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param folderName
+ * The folder in which the resource is to be updated
+ * @param option
+ * Either a filename or AUTO_LEVEL
+ * @return void
+ */
+ private static void updateResource(IProject project, String folderName,
+ String option) {
+ // The other arguments are checked by the callers
+ if (folderName == null) {
+ throw new IllegalArgumentException("Arguments cannot be null.");
+ }
+
+ // Create/Get the folder in the project
+ IFolder folder = getFolderInProject(project, folderName);
+
+ // If we were passed the empty string as the file name, just return,
+ // otherwise
+ // create the file
+ if (option.length() > 0) {
+ String newName;
+
+ if (isLocalPath(option)) {
+ String[] filenameParts = option.split("[\\\\/]");
+ newName = filenameParts[filenameParts.length - 1];
+ } else { // If option is a URL
+ int beginIndex = option.lastIndexOf("/");
+ newName = option.substring(beginIndex + 1, option.length());
+ }
+
+ if (!option.equals("Auto")) {
+ // Create a link to the file
+ try {
+ IFile file = folder.getFile(newName);
+
+ if (isLocalPath(option)) {
+ IPath path = new Path(option);
+ file.createLink(path, IResource.ALLOW_MISSING_LOCAL, null);
+ }
+ else {
+ file.create(null, false, null);
+ IMarker marker = file.createMarker(IMarker.TASK);
+ marker.setAttribute(IS_URL, true);
+ marker.setAttribute(URL_STRING, option);
+ }
+
+ // TODO:BRS:Remove if test when Shapes.xsd is available
+ if (!folderName.equals("Shapes")) {
+ FileValidationHelper.validateResourceFile(file);
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ private static void updateResources(IProject project, String[] options,
+ ResourcesEnums type) {
+ if (project == null || options == null) {
+ throw new IllegalArgumentException("Arguments cannot be null.");
+ }
+
+ String folderName = type.arg();
+
+ // First delete any existing resources from their folder
+ deleteResources(project, folderName);
+
+ // If options is empty, we simply need to invoke updateResource() with
+ // the empty
+ // String to ensure that the corresponding folder is created and then
+ // return.
+ if (options.length == 0) {
+ updateResource(project, folderName, "");
+ return;
+ }
+
+ for (String option : options) {
+ updateResource(project, folderName, option);
+ }
+ }
+
+ /**
+ * Updates the S12 XML file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateS12XmlFiles(IProject project, String[] options) {
+ updateResources(project, options, S12_XML);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedS12XmlFiles(options);
+ }
+
+ /**
+ * Updates the shapes file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateShapesFiles(IProject project, String[] options) {
+ updateResources(project, options, SHAPES);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedShapesFiles(options);
+
+ }
+
+ /**
+ * Updates the system definition files within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param systemDefinitionFiles
+ * The system definition files to be used by the project
+ * @param force
+ * Forces new shortcuts to be created in the project for the
+ * system definition files
+ * @return void
+ */
+ public static void updateSystemDefinitionFiles(IProject project,
+ String[] sysdefFiles, Boolean force) {
+ HashMap<String, Integer> systemDefinitionFiles = new HashMap<String, Integer>();
+
+ // Work out if we need to add any numbers to filenames to keep them
+ // unique
+ // It is not possible to have multiple files with the same name, so if
+ // this does happen a
+ // number is added to further instances, e.g afile, afile(2), afile(3)
+ // etc.
+ HashMap<String, Integer> systemDefinitionFilesCounts = new HashMap<String, Integer>();
+
+ java.util.regex.Pattern p = Pattern.compile("\\((\\d+)\\)\\.xml",
+ Pattern.CASE_INSENSITIVE);
+
+ try {
+ IResource[] members;
+ members = project.members();
+ for (IResource res : members) {
+
+ java.util.regex.Matcher m = p.matcher(res.getName());
+
+ if (m.find()) {
+ int num = Integer.valueOf(m.group(1));
+ String simpleName = m.replaceAll(".xml");
+ if (!systemDefinitionFilesCounts.containsKey(simpleName
+ .toLowerCase())
+ || systemDefinitionFilesCounts.get(simpleName
+ .toLowerCase()) < ++num) {
+ systemDefinitionFilesCounts.put(simpleName
+ .toLowerCase(), ++num);
+ }
+ } else {
+ if (!systemDefinitionFilesCounts.containsKey(res.getName()
+ .toLowerCase())) {
+ systemDefinitionFilesCounts.put(res.getName()
+ .toLowerCase(), 2);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ // Get the existing system definition files and put them into a hashmap
+ IScopeContext projectScope = new ProjectScope(project);
+ PersistentDataStore projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ for (String sysdefFile : projectStore.getSystemDefinitionFiles()) {
+ systemDefinitionFiles.put(sysdefFile.toLowerCase(), 0);
+ }
+
+ for (String sysdefFile : sysdefFiles) {
+ // If the sysdef file has not been added or removed set to 1
+ if (systemDefinitionFiles.containsKey(sysdefFile.toLowerCase())
+ && force != true) {
+ systemDefinitionFiles.put(sysdefFile.toLowerCase(), 1);
+ }
+ // Otherwise the file must be a new file
+ else {
+ systemDefinitionFiles.put(sysdefFile.toLowerCase(), 2);
+ }
+ }
+
+ for (String sysdefFile : systemDefinitionFiles.keySet()) {
+ // All files with a value of 0 must be deleted
+ if (systemDefinitionFiles.get(sysdefFile) == 0) {
+ IResource[] members;
+
+ try {
+ members = project.members();
+
+ for (IResource res : members) {
+ if (isLocalPath(sysdefFile)) {
+ if (res.isLinked()) {
+ if (sysdefFile.equalsIgnoreCase(res
+ .getRawLocation().toOSString())) {
+ res.delete(true, null);
+ }
+ }
+ } else { // If it is a URL
+ if (res instanceof IFile) {
+ String urlString = getResourceUrl((IFile) res);
+
+ if (urlString != null
+ && sysdefFile
+ .equalsIgnoreCase(urlString)) {
+ res.delete(true, null);
+ }
+ }
+ }
+ }
+
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ } else if (systemDefinitionFiles.get(sysdefFile.toLowerCase()) == 2) {
+ // All files with a value if 2 must be added
+ String newName;
+
+ if (isLocalPath(sysdefFile)) {
+ String[] filenameParts = sysdefFile.split("[\\\\/]");
+ newName = filenameParts[filenameParts.length - 1];
+ } else { // If option is a URL
+ int beginIndex = sysdefFile.lastIndexOf("/");
+ newName = sysdefFile.substring(beginIndex + 1, sysdefFile
+ .length());
+ }
+
+ int i = 1;
+
+ if (systemDefinitionFilesCounts.containsKey(newName
+ .toLowerCase())) {
+ i = systemDefinitionFilesCounts.get(newName.toLowerCase());
+
+ newName = newName.substring(0, newName.length() - 4)
+ + "("
+ + i
+ + ")"
+ + newName.substring(newName.length() - 4, newName
+ .length());
+ }
+
+ systemDefinitionFilesCounts.put(newName.toLowerCase(), ++i);
+
+ makeFileShortcut(project, null, sysdefFile, newName);
+ }
+ // Files with a value of 1 are unchanged so are ignored
+ }
+
+ // Persist the system definition files
+ projectStore.setSystemDefinitionFiles(sysdefFiles);
+ }
+
+ /**
+ * Updates the system info file resources within the project.
+ *
+ * @param project
+ * The project to amend
+ * @param options
+ * An array of filenames or the empty array if there are no files
+ * @return void
+ */
+ public static void updateSystemInfoFiles(IProject project, String[] options) {
+ updateResources(project, options, SYSTEM_INFO);
+
+ // persist the data
+ getPersistDataStore(project).setSelectedSystemInfoFiles(options);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/NodeListener.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,102 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+
+public class NodeListener {
+
+ public NodeListener(final IProject project) {
+ IScopeContext projectScope = new ProjectScope(project);
+
+ // if name changed in properties
+ projectScope.getNode(Activator.PLUGIN_ID).addPreferenceChangeListener(
+ new IPreferenceChangeListener() {
+
+ public void preferenceChange(PreferenceChangeEvent event) {
+ String key = event.getKey();
+ try {
+ if (key.equals(PersistentSettingsEnums.OUTPUT_NAME
+ .toString())
+ && event.getNewValue() != null) {
+ final IFile oldfile = project
+ .getFile((String) event.getOldValue());
+ final IFile newfile = project
+ .getFile((String) event.getNewValue());
+
+ project.getWorkspace().run(
+ new IWorkspaceRunnable() {
+ public void run(
+ IProgressMonitor monitor) {
+ if (oldfile.exists()) {
+ try {
+ newfile
+ .create(
+ oldfile
+ .getContents(true),
+ false,
+ null);
+ newfile
+ .setDerived(true);
+ oldfile.delete(true,
+ null);
+ } catch (CoreException e) {
+ Logger.log(e
+ .getMessage(),
+ e);
+ }
+ }
+ }
+ }, null);
+
+ } else {
+ Boolean alreadyHasMarker = false;
+ IMarker[] mMarkers = project.findMarkers(
+ IMarker.MESSAGE, false, 0);
+
+ for (IMarker aMarker : mMarkers) {
+ if (aMarker.getAttribute(IMarker.MESSAGE) != null) {
+ if (aMarker.getAttribute(
+ IMarker.MESSAGE).equals(
+ "properties changed")) {
+ alreadyHasMarker = true;
+ }
+ }
+ }
+
+ if (!alreadyHasMarker) {
+ IMarker marker = project
+ .createMarker(IMarker.MESSAGE);
+ marker.setAttribute(IMarker.MESSAGE,
+ "properties changed");
+ }
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/OpenFileAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,113 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class OpenFileAction extends Action {
+
+ IWorkbenchPage page;
+ ISelectionProvider selectionProvider;
+
+ public OpenFileAction(IWorkbenchPage page,
+ ISelectionProvider selectionProvider) {
+ this.page = page;
+ this.selectionProvider = selectionProvider;
+
+ setText("Open");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ ISelection selection = selectionProvider.getSelection();
+
+ if (!selection.isEmpty()) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+
+ if (ssel.size() > 1) {
+ return false;
+ }
+
+ IResource resource = (IResource) ssel.getFirstElement();
+
+ if (resource instanceof IFile) {
+ try {
+ return !isResourceMarkedAsUrl((IFile) resource);
+ } catch (CoreException e) {
+ return false;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isResourceMarkedAsUrl(IFile file) throws CoreException {
+ IMarker[] messageMarkers = file.findMarkers(IMarker.TASK, false,
+ IResource.DEPTH_ZERO);
+
+ for (int i = 0; i < messageMarkers.length; i++) {
+ IMarker marker = messageMarkers[i];
+
+ if (marker.getAttribute(ManageResources.IS_URL, false)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ IStructuredSelection ssel = (IStructuredSelection) selectionProvider
+ .getSelection();
+ IFile file = (IFile) ssel.getFirstElement();
+
+ try {
+ page.openEditor(new FileEditorInput(file),
+ "com.symbian.smt.gui.editors.xmleditor.XMLEditor", true);
+ } catch (PartInitException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/OpenFileActionProvider.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,117 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonMenuConstants;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class OpenFileActionProvider extends CommonActionProvider {
+
+ private OpenFileAction openFileAction;
+ private IActionBars actionBars;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.ActionGroup#dispose()
+ */
+ @Override
+ public void dispose() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+ if ((shell != null) && (! shell.isDisposed())) {
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, null);
+ }
+
+ super.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars
+ * )
+ */
+ @Override
+ public void fillActionBars(IActionBars actionBars) {
+ this.actionBars = actionBars;
+
+ try {
+ if (openFileAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
+ openFileAction);
+ }
+ } catch (Exception ignore) {
+ // Consuming CoreException that is thrown because the URI is missing
+ // for resources that are URLs
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.
+ * action.IMenuManager)
+ */
+ @Override
+ public void fillContextMenu(IMenuManager menu) {
+ try {
+ if (openFileAction.isEnabled()) {
+ menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN,
+ openFileAction);
+ }
+ } catch (Exception ignore) {
+ // Consuming CoreException that is thrown because the URI is missing
+ // for resources that are URLs
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator
+ * .ICommonActionExtensionSite)
+ */
+ @Override
+ public void init(ICommonActionExtensionSite site) {
+ ICommonViewerSite viewSite = site.getViewSite();
+
+ if (viewSite instanceof ICommonViewerWorkbenchSite) {
+ ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite) viewSite;
+
+ openFileAction = new OpenFileAction(workbenchSite.getPage(),
+ workbenchSite.getSelectionProvider());
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/OutOfSyncDecorator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,104 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.osgi.framework.Bundle;
+
+public class OutOfSyncDecorator implements ILightweightLabelDecorator {
+ private static final Bundle bundle = Platform
+ .getBundle("com.symbian.smt.gui");
+ private static final Path path = new Path("icons/SITK_Decorator_error.gif");
+ private SmmPartListener temp = new SmmPartListener();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.
+ * jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang
+ * .Object, org.eclipse.jface.viewers.IDecoration)
+ */
+ public void decorate(Object element, IDecoration decoration) {
+
+ String projectName = null;
+
+ if (element instanceof IFile || element instanceof IProject) {
+ IResource aResource = (IResource) element;
+ projectName = aResource.getProject().getName();
+
+ if (aResource.isDerived() || aResource instanceof IProject) {
+ decorateProject(projectName, decoration);
+ }
+ }
+ }
+
+ public void decorateProject(String projectName, IDecoration decoration) {
+ if (!temp.isInSync(projectName)) {
+ decoration.addOverlay(ImageDescriptor.createFromURL(FileLocator
+ .find(bundle, path, null)));
+ } else {
+ decoration.addOverlay(null);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang
+ * .Object, java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse
+ * .jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/PersistentDataStore.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,62 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class PersistentDataStore extends AbstractPersistentDataStore {
+
+ private IEclipsePreferences node;
+ private IEclipsePreferences defaultNode;
+
+ public PersistentDataStore(IEclipsePreferences instanceNode) {
+ this.node = instanceNode;
+ this.defaultNode = null;
+ }
+
+ /**
+ * Creates the PersistentDataStore object, which is used for reading and
+ * writing to a IEclipsePreferences node
+ *
+ * @param IEclipsePreferences
+ * A node
+ */
+ public PersistentDataStore(IEclipsePreferences instanceNode,
+ IEclipsePreferences defaultNode) {
+ this.node = instanceNode;
+ this.defaultNode = defaultNode;
+ }
+
+ public String read(PersistentSettingsEnums key) {
+ String result = node.get(key.toString(), null);
+
+ if (result == null && defaultNode != null) {
+ result = defaultNode.get(key.toString(), null);
+ }
+
+ return result;
+ }
+
+ public void write(PersistentSettingsEnums key, String value) {
+ node.put(key.toString(), value);
+ try {
+ node.flush();
+ } catch (BackingStoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/PersistentSettings.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,769 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.util.List;
+
+/**
+ * PersistentSettings interface class. This is used to define the setters and
+ * getters for the persistent plug-in and project level data stores
+ *
+ * @return void
+ */
+public interface PersistentSettings {
+
+ /**
+ * Gets the list of advanced options from the persistent data store
+ *
+ * @return String
+ */
+ public String[] getAdvancedOptions();
+
+ /**
+ * Gets the border shapes file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getBorderShapesFiles();
+
+ /**
+ * Gets the border styles file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getBorderStylesFiles();
+
+ /**
+ * Gets the colours file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getColoursFiles();
+
+ /**
+ * Gets the copyright text from the persistent data store
+ *
+ * @return String
+ */
+ String getCopyrightText();
+
+ /**
+ * Gets the System Model Managers default border shapes files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultBorderShapesFiles();
+
+ /**
+ * Gets the System Model Managers default border styles files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultBorderStylesFiles();
+
+ /**
+ * Gets the System Model Managers default colours files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultColoursFiles();
+
+ /**
+ * Gets the System Model Managers default dependencies files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultDependenciesFiles();
+
+ /**
+ * Gets the System Model Managers default distribution text from the plug-in
+ * default persistent data store
+ *
+ * @return String
+ */
+ public String getDefaultDistributionText();
+
+ /**
+ * Gets the System Model Managers default levels files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultLevelsFiles();
+
+ /**
+ * Gets the System Model Managers default localisation files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultLocalisationFiles();
+
+ /**
+ * Gets the System Model Managers default model version text from the
+ * plug-in default persistent data store
+ *
+ * @return String
+ */
+ public String getDefaultModelVersionText();
+
+ /**
+ * Gets the System Model Managers default patterns files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultPatternsFiles();
+
+ /**
+ * Gets the System Model Managers default printed DPI from the plug-in
+ * default persistent data store
+ *
+ * @return String
+ */
+ public String getDefaultPrintedDpi();
+
+ /**
+ * Gets the System Model Managers default S12 XML files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultS12XmlFiles();
+
+ /**
+ * Gets the System Model Managers default shapes files location from the
+ * plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultShapesFiles();
+
+ /**
+ * Gets the System Model Managers default system info files location from
+ * the plug-in default persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getDefaultSystemInfoFiles();
+
+ /**
+ * Gets the dependencies file location from the persistent data store
+ *
+ * @return String[]
+ */
+ String[] getDependenciesFiles();
+
+ /**
+ * Gets the distribution text values from the persistent data store
+ *
+ * @return String[]
+ */
+ String[] getDistributionTexts();
+
+ /**
+ * Gets the list of filter items from the persistent data store
+ *
+ * @return String
+ */
+ String[] getFilterItems();
+
+ /**
+ * Gets the fix item size option from the persistent data store
+ *
+ * @return a Boolean value indicating whether or not the fix item size
+ * option is checked
+ */
+ public Boolean getFixItemSize();
+
+ /**
+ * Gets the highlight core OS option from the persistent data store
+ *
+ * @return String
+ */
+ Boolean getHighlightCoreOS();
+
+ /**
+ * Gets the list of ignore items from the persistent data store
+ *
+ * @return String
+ */
+ List<String[]> getIgnoreItems();
+
+ /**
+ * Gets the level of detail from the persistent data store
+ *
+ * @return String
+ */
+ String getLevelOfDetail();
+
+ /**
+ * Gets the levels file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getLevelsFiles();
+
+ /**
+ * Gets the localisation file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getLocalisationFiles();
+
+ /**
+ * Gets the model name from the persistent data store
+ *
+ * @return String
+ */
+ String getModelName();
+
+ /**
+ * Gets the model version from the persistent data store
+ *
+ * @return String
+ */
+ String getModelVersion();
+
+ /**
+ * Gets the model version text values from the persistent data store
+ *
+ * @return String[]
+ */
+ String[] getModelVersionTexts();
+
+ /**
+ * Gets the patterns file locations from the persistent data store
+ *
+ * @return String[]
+ */
+ String[] getPatternsFiles();
+
+ /**
+ * Gets the printed DPI values from the persistent data store
+ *
+ * @return String[]
+ */
+ public String[] getPrintedDpis();
+
+ public String[] getS12XmlFiles();
+
+ /**
+ * Gets the user selected border shapes file location from the persistent
+ * data store
+ *
+ * @return String
+ */
+ String[] getSelectedBorderShapesFiles();
+
+ /**
+ * Gets the user selected border styles file location from the persistent
+ * data store
+ *
+ * @return String
+ */
+ String[] getSelectedBorderStylesFiles();
+
+ /**
+ * Gets the user selected colours file location from the persistent data
+ * store
+ *
+ * @return String
+ */
+ String[] getSelectedColoursFiles();
+
+ /**
+ * Gets the user selected dependencies file location from the persistent
+ * data store
+ *
+ * @return String
+ */
+ String[] getSelectedDependenciesFiles();
+
+ /**
+ * Gets the selected distribution text value from the persistent data store
+ *
+ * @return String
+ */
+ public String getSelectedDistributionText();
+
+ /**
+ * Gets the user selected levels file location from the persistent data
+ * store
+ *
+ * @return String
+ */
+ String[] getSelectedLevelsFiles();
+
+ /**
+ * Gets the user selected localisation file location from the persistent
+ * data store
+ *
+ * @return String
+ */
+ String[] getSelectedLocalisationFiles();
+
+ /**
+ * Gets the selected model version text value from the persistent data store
+ *
+ * @return String
+ */
+ public String getSelectedModelVersionText();
+
+ /**
+ * Gets the user selected patterns file location from the persistent data
+ * store
+ *
+ * @return String
+ */
+ String[] getSelectedPatternsFiles();
+
+ /**
+ * Gets the selected printed DPI value from the persistent data store
+ *
+ * @return String
+ */
+ public String getSelectedPrintedDpi();
+
+ public String[] getSelectedS12XmlFiles();
+
+ /**
+ * Gets the user selected shapes file location from the persistent data
+ * store
+ *
+ * @return String
+ */
+ String[] getSelectedShapesFiles();
+
+ /**
+ * Gets the user selected system info file location from the persistent data
+ * store
+ *
+ * @return String
+ */
+ String[] getSelectedSystemInfoFiles();
+
+ /**
+ * Gets the shapes file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getShapesFiles();
+
+ /**
+ * Gets a boolean value indicating if the Suppress Mouseover Effect button
+ * has been selected from the persistent data store
+ *
+ * @return Boolean
+ */
+ Boolean getSuppressMouseOverEffect();
+
+ /**
+ * Gets the list of system definition files from the persistent data store
+ *
+ * @return String[]
+ */
+ String[] getSystemDefinitionFiles();
+
+ /**
+ * Gets the system info file location from the persistent data store
+ *
+ * @return String
+ */
+ String[] getSystemInfoFiles();
+
+ /**
+ * Gets the system name from the persistent data store
+ *
+ * @return String
+ */
+ String getSystemName();
+
+ /**
+ * Gets the system version from the persistent data store
+ *
+ * @return String
+ */
+ String getSystemVersion();
+
+ /**
+ * Gets the warning level to use from the persistent data store
+ *
+ * @return String
+ */
+ String getWarningLevel();
+
+ /**
+ * Writes the list of advanced options to the persistent data store
+ *
+ * @param advancedOptionsList
+ * List of advanced options
+ * @return void
+ */
+ public void setAdvancedOptions(String[] options);
+
+ /**
+ * Writes the border shapes file location to the persistent data store
+ *
+ * @param borderShapesFile
+ * Location of the border shapes file
+ * @return void
+ */
+ void setBorderShapesFiles(String[] borderShapesFiles);
+
+ /**
+ * Writes the border styles file location to the persistent data store
+ *
+ * @param borderStylesFile
+ * Location of the border styles file
+ * @return void
+ */
+ void setBorderStylesFiles(String[] borderStylesFiles);
+
+ /**
+ * Writes the colours file location to the persistent data store
+ *
+ * @param coloursFile
+ * Location of the colours file
+ * @return void
+ */
+ void setColoursFiles(String[] coloursFiles);
+
+ /**
+ * Writes the copyright text to the persistent data store
+ *
+ * @param copyrightText
+ * String to be used for the copyright text
+ * @return void
+ */
+ void setCopyrightText(String copyrightText);
+
+ /**
+ * Writes the dependencies file location to the persistent data store
+ *
+ * @param dependenciesFile
+ * Location of the dependencies file
+ * @return void
+ */
+ void setDependenciesFiles(String[] dependenciesFiles);
+
+ /**
+ * Writes the distribution text values to the persistent data store
+ *
+ * @param distributionTexts
+ * String array to be used for the distribution text values
+ * @return void
+ */
+ void setDistributionTexts(String[] distributionTexts);
+
+ /**
+ * Writes the list of filter items to the persistent data store
+ *
+ * @param filterItemsList
+ * List of filter names
+ * @return void
+ */
+ void setFilterItems(String[] filterItemsList);
+
+ /**
+ * Writes the fix item size option to the persistent data store
+ *
+ * @param fixItemSize
+ * Boolean to represent the fix item size option
+ * @return void
+ */
+ public void setFixItemSize(Boolean fixItemSize);
+
+ /**
+ * Writes the highlight core OS option to the persistent data store
+ *
+ * @param highlightCoreOS
+ * Boolean to represent the highlight core OS option
+ * @return void
+ */
+ void setHighlightCoreOS(Boolean highlightCoreOS);
+
+ /**
+ * Writes the list of ignore items to the persistent data store
+ *
+ * @param ignoreItemsList
+ * List of ignore items
+ * @return void
+ */
+ void setIgnoreItems(List<String[]> ignoreItemsList);
+
+ /**
+ * Writes the level of detail to the persistent data store
+ *
+ * @param levelOfDetail
+ * String to be used for the level of detail
+ * @return void
+ */
+ void setLevelOfDetail(String levelOfDetail);
+
+ /**
+ * Writes the levels file location to the persistent data store
+ *
+ * @param levelsFile
+ * Location of the levels file
+ * @return void
+ */
+ void setLevelsFiles(String[] levelsFiles);
+
+ /**
+ * Writes the localisation file location to the persistent data store
+ *
+ * @param localisationFile
+ * Location of the localisation file
+ * @return void
+ */
+ void setLocalisationFiles(String[] localisationFiles);
+
+ /**
+ * Writes the model name to the persistent data store
+ *
+ * @param modelName
+ * String to be used for the model name
+ * @return void
+ */
+ void setModelName(String modelName);
+
+ /**
+ * Writes the model version to the persistent data store
+ *
+ * @param modelVersion
+ * String to be used for the model version
+ * @return void
+ */
+ void setModelVersion(String modelVersion);
+
+ /**
+ * Writes the model version text values to the persistent data store
+ *
+ * @param modelVersionTexts
+ * String array to be used for the model version text values
+ * @return void
+ */
+ void setModelVersionTexts(String[] modelVersionTexts);
+
+ /**
+ * Writes the patterns file location to the persistent data store
+ *
+ * @param patternsFile
+ * Location of the patterns file
+ * @return void
+ */
+ void setPatternsFiles(String[] patternsFiles);
+
+ /**
+ * Writes the printed DPI values to the persistent data store
+ *
+ * @param dpi
+ * String array to be used for the printed DPI values
+ * @return void
+ */
+ public void setPrintedDpis(String[] dpis);
+
+ public void setS12XmlFiles(String[] s12XmlFiles);
+
+ /**
+ * Writes the user selected border shapes file location to the persistent
+ * data store
+ *
+ * @param borderShapesFile
+ * Location of the default border shapes file
+ * @return void
+ */
+ void setSelectedBorderShapesFiles(String[] borderShapesFiles);
+
+ /**
+ * Writes the user selected border styles file location to the persistent
+ * data store
+ *
+ * @param borderStylesFile
+ * Location of the default border styles file
+ * @return void
+ */
+ void setSelectedBorderStylesFiles(String[] borderStylesFile);
+
+ /**
+ * Writes the user selected colours file location to the persistent data
+ * store
+ *
+ * @param coloursFile
+ * Location of the default colours file
+ * @return void
+ */
+ void setSelectedColoursFiles(String[] coloursFile);
+
+ /**
+ * Writes the user selected dependencies file location to the persistent
+ * data store
+ *
+ * @param dependenciesFile
+ * Location of the default dependencies file
+ * @return void
+ */
+ void setSelectedDependenciesFiles(String[] dependenciesFile);
+
+ /**
+ * Writes the selected distribution text value to the persistent data store
+ *
+ * @param distributionText
+ * String to be used for the selected distribution text value
+ * @return void
+ */
+ public void setSelectedDistributionText(String distributionText);
+
+ /**
+ * Writes the user selected levels file location to the persistent data
+ * store
+ *
+ * @param levelsFile
+ * Location of the default levels file
+ * @return void
+ */
+ void setSelectedLevelsFiles(String[] levelsFile);
+
+ /**
+ * Writes the user selected localisation file location to the persistent
+ * data store
+ *
+ * @param localisationFile
+ * Location of the default localisation file
+ * @return void
+ */
+ void setSelectedLocalisationFiles(String[] localisationFile);
+
+ /**
+ * Writes the selected model version text value to the persistent data store
+ *
+ * @param modelVersionText
+ * String to be used for the selected model version text value
+ * @return void
+ */
+ public void setSelectedModelVersionText(String modelVersionText);
+
+ /**
+ * Writes the user selected patterns file location to the persistent data
+ * store
+ *
+ * @param patternsFile
+ * Location of the default patterns file
+ * @return void
+ */
+ void setSelectedPatternsFiles(String[] patternsFiles);
+
+ /**
+ * Writes the selected printed DPI value to the persistent data store
+ *
+ * @param dpi
+ * String to be used for the selected printed DPI value
+ * @return void
+ */
+ public void setSelectedPrintedDpi(String dpi);
+
+ public void setSelectedS12XmlFiles(String[] s12XmlFiles);
+
+ /**
+ * Writes the user selected shapes file location to the persistent data
+ * store
+ *
+ * @param shapesFile
+ * Location of the default shapes file
+ * @return void
+ */
+ void setSelectedShapesFiles(String[] shapesFile);
+
+ /**
+ * Writes the user selected system info location to the persistent data
+ * store
+ *
+ * @param systemInfoFile
+ * Location of the default system information file
+ * @return void
+ */
+ void setSelectedSystemInfoFiles(String[] systemInfoFile);
+
+ /**
+ * Writes the shapes file location to the persistent data store
+ *
+ * @param shapesFile
+ * Location of the shapes file
+ * @return void
+ */
+ void setShapesFiles(String[] shapesFiles);
+
+ /**
+ * Writes the value for the Suppress Mouseover Effect option
+ *
+ * @param suppressMouseOverEffect
+ * Boolean value indicating if the Suppress Mouseover Effect is
+ * it be used when generating the diagram
+ * @return void
+ */
+ public void setSuppressMouseOverEffect(Boolean suppressMouseOverEffect);
+
+ /**
+ * Writes the list of system definition files to the persistent data store
+ *
+ * @param sysDefFiles
+ * List of the system definition file locations
+ * @return void
+ */
+ void setSystemDefinitionFiles(String[] sysDefFiles);
+
+ /**
+ * Writes the system info location to the persistent data store
+ *
+ * @param systemInfoFile
+ * Location of the system information file
+ * @return void
+ */
+ void setSystemInfoFiles(String[] systemInfoFiles);
+
+ /**
+ * Writes the system name to the persistent data store
+ *
+ * @param systemName
+ * String to be used for the system name
+ * @return void
+ */
+ void setSystemName(String systemName);
+
+ /**
+ * Writes the system version to the persistent data store
+ *
+ * @param systemVersion
+ * String to be used for the system version
+ * @return void
+ */
+ void setSystemVersion(String systemVersion);
+
+ /**
+ * Writes the warning level to the persistent data store
+ *
+ * @param warningLevel
+ * An int between 1 and 3 indicating the level of warnings to be
+ * produces
+ * @return void
+ */
+ void setWarningLevel(String warningLevel);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/PersistentSettingsEnums.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,74 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public enum PersistentSettingsEnums {
+ // A class containing Enums to be used as the keys for the plug-in and
+ // project persistent data store
+
+ // System Definition Files
+ SYSTEM_DEFINITION_FILES,
+
+ // Model Labels
+ COPYRIGHT_TEXT, DISTRIBUTION_TEXTS, DISTRIBUTION_TEXT_DEFAULT, DISTRIBUTION_TEXT_SELECTED, MODEL_NAME, MODEL_VERSION, MODEL_VERSION_TEXTS, MODEL_VERSION_TEXT_DEFAULT, MODEL_VERSION_TEXT_SELECTED, SYSTEM_NAME, SYSTEM_VERSION,
+
+ // Model Control
+ HIGHTLIGHT_CORE_OS, LEVEL_OF_DETAIL, PRINTED_DPIS, PRINTED_DPI_DEFAULT, PRINTED_DPI_SELECTED, SUPPRESS_MOUSE_OVER_EFFECT, FIX_ITEM_SIZE,
+
+ // Resources
+ // Lists of resource files
+ SHAPES_FILES, LEVELS_FILES, LOCALISATION_FILES, DEPENDENCIES_FILES, SYSTEM_INFO_FILES, COLOURS_FILES, BORDER_STYLES_FILES, BORDER_SHAPES_FILES, PATTERNS_FILES, S12_XML_FILES,
+
+ // The resource file selected by the user
+ SHAPES_FILES_SELECTED, LEVELS_FILES_SELECTED, LOCALISATION_FILES_SELECTED, DEPENDENCIES_FILES_SELECTED, SYSTEM_INFO_FILES_SELECTED, COLOURS_FILES_SELECTED, BORDER_STYLES_FILES_SELECTED, BORDER_SHAPES_FILES_SELECTED, PATTERNS_FILES_SELECTED, S12_XML_FILES_SELECTED,
+
+ // The hard coded default files for the resources
+ SHAPES_FILES_DEFAULT, LEVELS_FILES_DEFAULT, LOCALISATION_FILES_DEFAULT, DEPENDENCIES_FILES_DEFAULT, SYSTEM_INFO_FILES_DEFAULT, COLOURS_FILES_DEFAULT, BORDER_STYLES_FILES_DEFAULT, BORDER_SHAPES_FILES_DEFAULT, PATTERNS_FILES_DEFAULT, S12_XML_FILES_DEFAULT,
+
+ // Filter and Filter has Items
+ FILTER_ITEMS, FILTER_HAS_ITEMS,
+
+ // Ignore Items
+ IGNORE_ITEMS,
+
+ // Warning Level
+ WARNING_LEVELS,
+
+ // Advanced Options
+ ADVANCED_OPTIONS,
+
+ OUTPUT_NAME;
+
+ private ResourceBundle resourceBundle = ResourceBundle.getBundle(
+ "defaults", Locale.getDefault(), getClass().getClassLoader());
+
+ public String getDefault() {
+ try {
+ String value = resourceBundle.getString(this.name());
+ return value.replaceAll("'", "\\\\\'");
+ } catch (MissingResourceException e) {
+ Logger.log(e.getMessage(), e);
+ return this.name();
+ } catch (NullPointerException e) {
+ Logger.log(e.getMessage(), e);
+ return this.name();
+ }
+ };
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/ResourceFileValidator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,152 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui;
+
+import java.io.File;
+import java.util.HashMap;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class ResourceFileValidator extends XmlFileValidator {
+ /**
+ * The Map that caches all defined resource schema files, keyed by the
+ * ResourcesEnums enums.
+ */
+ private static final HashMap<ResourcesEnums, String> resourceSchemaFilesMap = new HashMap<ResourcesEnums, String>();
+
+ static {
+ for (ResourcesEnums type : ResourcesEnums.values()) {
+ switch (type) {
+ case BORDER_SHAPES:
+ resourceSchemaFilesMap
+ .put(type,
+ "./resources/xsd/Border-shapes.xsd");
+ break;
+
+ case BORDER_STYLES:
+ resourceSchemaFilesMap
+ .put(type,
+ "./resources/xsd/Border-styles.xsd");
+ break;
+
+ case COLOURS:
+ resourceSchemaFilesMap
+ .put(type,
+ "./resources/xsd/Colours.xsd");
+ break;
+
+ case DEPENDENCIES:
+ // No need for schema validation
+ break;
+
+ case LEVELS:
+ resourceSchemaFilesMap
+ .put(type,
+ "./resources/xsd/Levels.xsd");
+ break;
+
+ case LOCALISATION:
+ resourceSchemaFilesMap
+ .put(type,
+ "./resources/xsd/Localisation.xsd");
+ break;
+
+ case PATTERNS:
+ resourceSchemaFilesMap
+ .put(type,
+ "./resources/xsd/Patterns.xsd");
+ break;
+
+ case SHAPES:
+ // TODO:BRS: Need to get the Shapes schema right before
+ // validating with it.
+ // resourceSchemaFilesMap.put(type,
+ // "./../SystemModelGenerator/resources/xsd/Shapes.xsd");
+ break;
+
+ case SYSTEM_INFO:
+ // No need for schema validation
+ break;
+
+ case S12_XML:
+ // No need for schema validation
+ break;
+
+ default:
+ throw new RuntimeException("Unknown resource type ["
+ + type.arg() + "]");
+ }
+ }
+ }
+
+ private ResourcesEnums selectedResourceType;
+
+ /**
+ *
+ */
+ public ResourceFileValidator(ResourcesEnums selectedResourceType) {
+ super();
+
+ this.selectedResourceType = selectedResourceType;
+ }
+
+ // TODO:BRS:This method is incomplete and currently unused. It is related to
+ // comparing 2 different border shapes and making sure elements are not repeated
+ // between files (the same should apply to patterns).
+ // The return type in the signature should also be changed to a list of border
+ // shape item objects.
+// private void getBorderShapesItems(String filePath) {
+// try {
+// JAXBContext context = JAXBContext.newInstance(Values.class);
+// Unmarshaller unmarshaller = context.createUnmarshaller();
+// // Values values = unmarshaller.unmarshal(File or URL);
+// } catch (JAXBException e) {
+// e.printStackTrace();
+// }
+//
+// }
+
+ protected File getSchemaFile() {
+ String schemaFilePath = resourceSchemaFilesMap
+ .get(selectedResourceType);
+ File schemaFile = new File(Helper.relative2AbsolutePaths(
+ schemaFilePath, smgFolder, "|"));
+
+ return schemaFile;
+ }
+
+ public String validateXml(String filePath) {
+ String errorMessage = super.validateXml(filePath);
+
+ if (errorMessage == null) {
+ if (selectedResourceType.equals(ResourcesEnums.BORDER_SHAPES)
+ || selectedResourceType.equals(ResourcesEnums.PATTERNS)) {
+ // Finally, if we have multiple files for this resource, check
+ // about duplicates
+ // TODO:BRS:This piece of code is unfinished. If it is required to check
+ // that there are no duplicate items across multiple files, use method
+ // getBorderShapesItems() above and create similar getPatternsItem() method
+ // errorMessage = do special validation
+ }
+ }
+
+ return errorMessage;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/ResourcesEnums.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+public enum ResourcesEnums {
+ BORDER_SHAPES("Border Shapes"), BORDER_STYLES("Border Styles"), COLOURS(
+ "Colours"), DEPENDENCIES("Dependencies"), LEVELS("Levels"), LOCALISATION(
+ "Localisation"), PATTERNS("Patterns"), SHAPES("Shapes"), SYSTEM_INFO(
+ "System Info"), S12_XML("S12 XML");
+
+ public static ResourcesEnums getResourcesEnums(String arg) {
+ ResourcesEnums[] enums = values();
+
+ for (int i = 0; i < enums.length; i++) {
+ if (enums[i].arg().equals(arg)) {
+ return enums[i];
+ }
+ }
+
+ throw new IllegalArgumentException("Unknown ResourcesEnum with arg = ["
+ + arg + "]");
+ }
+
+ private final String value;
+
+ ResourcesEnums(String value) {
+ this.value = value;
+ }
+
+ public String arg() {
+ return value;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/SmmPartListener.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,198 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+import com.symbian.smt.gui.nature.Nature;
+
+final class SmmPartListener implements IPartListener {
+
+ private final class PropertyChangeListener implements IPropertyListener {
+
+ public void propertyChanged(Object source, int propId) {
+ if (propId == IEditorPart.PROP_DIRTY) {
+ if (source instanceof IEditorPart) {
+ IEditorPart editorPart = (IEditorPart) source;
+ IEditorInput input = editorPart.getEditorInput();
+
+ if (input instanceof IFileEditorInput) {
+ boolean isEditorDirty = editorPart.isDirty();
+ String dirty = String.valueOf(isEditorDirty);
+ IFile file = ((IFileEditorInput) input).getFile();
+
+ // If user has saved and if it is a resource file or a
+ // sys def file,
+ // need to validate the file and mark it in error
+ // if it is invalid.
+ if (!isEditorDirty) {
+ // save but do not build if validation fails.
+ if (ManageResources.isResourceFile(file)) {
+ // TODO:BRS:Remove the if test below when
+ // Shapes.xsd is available.
+ if (!file.getParent().getName()
+ .equals("Shapes")) {
+ FileValidationHelper
+ .validateResourceFile(file);
+ }
+ } else if (ManageResources
+ .isSystemDefinitionFile(file)) {
+ FileValidationHelper.validateSysDefFile(file);
+ }
+ }
+
+ if (!items.containsKey(file.getProject().getName())) {
+ String entry[] = { file.getName(), dirty };
+ ArrayList<String[]> entries = new ArrayList<String[]>();
+ entries.add(entry);
+ items.put(file.getProject().getName(), entries);
+ } else {
+ ArrayList<String[]> projectFiles = items.get(file
+ .getProject().getName());
+
+ Boolean alreadyExists = false;
+
+ for (String[] anEntry : projectFiles) {
+ if (anEntry[0].equalsIgnoreCase(file.getName())) {
+ anEntry[1] = dirty;
+ alreadyExists = true;
+ }
+ }
+
+ if (!alreadyExists) {
+ String entry[] = { file.getName(), dirty };
+ items.get(file.getProject().getName()).add(
+ entry);
+ }
+ }
+ }
+ }
+
+ // Tell it to do any decorating
+ PlatformUI.getWorkbench().getDecoratorManager().update(
+ "com.symbian.smt.gui.outofsyncdecorator");
+ }
+ }
+ }
+
+ private PropertyChangeListener listener;
+
+ private static HashMap<String, ArrayList<String[]>> items = new HashMap<String, ArrayList<String[]>>();
+
+ public SmmPartListener() {
+ listener = new PropertyChangeListener();
+ }
+
+ private void addListener(IWorkbenchPart part) {
+ if (part instanceof IEditorPart) {
+ try {
+ IEditorInput input = ((IEditorPart) part).getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) input).getFile();
+
+ if (file.getProject().isOpen()) {
+ boolean ourProject = file.getProject().hasNature(
+ Nature.ID);
+ if (ourProject && !file.isDerived()) {
+ part.addPropertyListener(listener);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ }
+
+ public boolean isInSync(String project) {
+ // Get the files for this project
+ ArrayList<String[]> projectFiles = items.get(project);
+
+ // Iterate over the resources
+ if (projectFiles != null) {
+ for (String[] anEntry : projectFiles) {
+ if (Boolean.valueOf(anEntry[1])) {
+ // A file is out of sync, so the project it dirty
+ return false;
+ }
+ }
+ }
+
+ // No sync information exists for the project or all are in sync -
+ // return true
+ return true;
+ }
+
+ public void partActivated(IWorkbenchPart part) {
+ addListener(part);
+
+ // if (part instanceof IViewPart) {
+ // String partId = ((IViewPart) part).getViewSite().getId();
+ //
+ // if (partId.equals("org.eclipse.ui.navigator.ProjectExplorer")) {
+ // FileValidationHelper.showProblemsViewIfNeeded();
+ // }
+ // }
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ addListener(part);
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ part.removePropertyListener(listener);
+
+ if (part instanceof IEditorPart) {
+ IEditorInput input = ((IEditorPart) part).getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) input).getFile();
+
+ if (items.containsKey(file.getProject().getName())) {
+ ArrayList<String[]> projectFiles = items.get(file
+ .getProject().getName());
+
+ for (String[] anEntry : projectFiles) {
+ if (anEntry[0].equalsIgnoreCase(file.getName())) {
+ projectFiles.remove(anEntry);
+ break;
+ }
+ }
+ }
+ }
+
+ PlatformUI.getWorkbench().getDecoratorManager().update(
+ "com.symbian.smt.gui.outofsyncdecorator");
+ }
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+ addListener(part);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/SmmResourceChangeListener.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,220 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// SmmResourceChaneListener.java
+//
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+import com.symbian.smt.gui.nature.Nature;
+
+public class SmmResourceChangeListener implements IResourceChangeListener {
+
+ public void resourceChanged(final IResourceChangeEvent event) {
+ if (event.getType() == IResourceChangeEvent.PRE_BUILD) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription description = workspace.getDescription();
+
+ IWorkspaceRoot workspaceRoot = workspace.getRoot();
+ IResourceDelta delta = event.getDelta();
+
+ if (delta.getFullPath().equals(Path.ROOT)) {
+ IResourceDelta[] children = delta
+ .getAffectedChildren(IResourceDelta.CHANGED);
+
+ if (children.length == 0) {
+ return;
+ }
+
+ for (IResourceDelta child : children) {
+ if (child.getKind() == IResourceDelta.CHANGED) {
+ for (IProject aProject : workspaceRoot.getProjects()) {
+ try {
+ if (aProject.isOpen()
+ && aProject.hasNature(Nature.ID)
+ && aProject.getFullPath().equals(
+ child.getFullPath())) {
+
+ if (child.getFlags() == IResourceDelta.OPEN) {
+ final IProject theProject = aProject;
+
+ try {
+ theProject.refreshLocal(
+ IResource.DEPTH_INFINITE,
+ null);
+
+ IScopeContext projectScope = new ProjectScope(
+ theProject);
+ PersistentDataStore store = new PersistentDataStore(
+ projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ Boolean needsShortcutsRefreshing = true;
+
+ for (IResource resource : theProject
+ .members()) {
+ if (resource.isLinked()) {
+ needsShortcutsRefreshing = false;
+ break;
+ }
+ }
+
+ if (needsShortcutsRefreshing == true) {
+ // We also need to get the
+ // shortcut to appear, as it
+ // does not always happen
+ // automatically
+ ManageResources
+ .updateSystemDefinitionFiles(
+ theProject,
+ store
+ .getSystemDefinitionFiles(),
+ true);
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ if (!description.isAutoBuilding()) {
+ final IProject theProject = aProject;
+ Job j = new Job("Building workspace") {
+ @Override
+ protected IStatus run(
+ IProgressMonitor monitor) {
+ try {
+ if (event.getBuildKind() == IncrementalProjectBuilder.AUTO_BUILD) { // 9
+ theProject
+ .build(
+ IncrementalProjectBuilder.INCREMENTAL_BUILD,
+ monitor);
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(),
+ e);
+ }
+ return new Status(
+ IStatus.OK,
+ Activator.PLUGIN_ID,
+ IStatus.OK,
+ "updating properties succeeded",
+ null);
+ }
+ };
+ j.schedule();
+ }
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ }
+ }
+ }
+ } else if (event.getType() == IResourceChangeEvent.PRE_DELETE) {
+ // If it is a delete event then the resource is an IProject
+ IProject project = (IProject) event.getResource();
+
+ IScopeContext projectScope = new ProjectScope(project);
+ PersistentDataStore store = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ final IFile oldProjectFile = project.getFile(store
+ .getOutputFilename());
+
+ ChangeManager manager = new ChangeManager();
+ manager.remove(project);
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ IEditorPart oldEditor = page
+ .findEditor(new FileEditorInput(oldProjectFile));
+ page.closeEditor(oldEditor, false);
+ }
+ });
+ } else {
+ IResourceDelta delta = event.getDelta();
+
+ if (event.getType() == IResourceChangeEvent.POST_CHANGE
+ && delta.getKind() == IResourceDelta.CHANGED) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot workspaceRoot = workspace.getRoot();
+ IProject project = null;
+
+ IPath fullPath = delta.getFullPath();
+
+ if (delta.getFullPath().equals(Path.ROOT)) {
+ IResourceDelta[] children = delta
+ .getAffectedChildren(IResourceDelta.CHANGED);
+
+ if (children.length == 0) {
+ return;
+ }
+
+ for (IResourceDelta child : children) {
+ if (child.getKind() == IResourceDelta.CHANGED) {
+ fullPath = child.getFullPath();
+ }
+ }
+ }
+ for (IProject aProject : workspaceRoot.getProjects()) {
+ try {
+ if (aProject.isOpen() && aProject.hasNature(Nature.ID)
+ && aProject.getFullPath().equals(fullPath)) {
+ project = aProject;
+ break;
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ if (project == null) {
+ return;
+ }
+
+ ChangeManager manager = new ChangeManager();
+ manager.handleDelta(delta, project);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/StartupClass.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,29 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import org.eclipse.ui.IStartup;
+
+public class StartupClass implements IStartup {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ */
+ public void earlyStartup() {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/SystemDefinition.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,119 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class SystemDefinition {
+
+ /**
+ * Determines whether the System Definition file is likely to be valid for the System Model Generator
+ * Even if this function fails the SMG may still accept the file.
+ * @param filename - the path to the System Definition file
+ * @throws SystemDefinitionValidationException - Thrown if the parsing of the document fails. If the document parses
+ * correctly but does not appear to be a System Definition file a {@link SystemDefinitionValidationFatalException} is thrown.
+ */
+ public static void checkValidSystemDefinitionFile(String filename) throws SystemDefinitionValidationException {
+ Document doc;
+ try {
+ doc = createDocument(filename);
+ } catch (ParserConfigurationException e) {
+ throw new SystemDefinitionValidationException("Problem found when parsing "+filename+".", e);
+ } catch (SAXException e) {
+ throw new SystemDefinitionValidationException("Problem found when parsing "+filename+".", e);
+ } catch (IOException e) {
+ throw new SystemDefinitionValidationException("Problem found when reading "+filename+".", e);
+ }
+
+ // Check that the file is a system definition file
+ if (doc.getDoctype() != null && !doc.getDoctype().getName().equals("SystemDefinition")) {
+ throw new SystemDefinitionValidationFatalException(filename + " has the doctype "+doc.getDoctype()+". Where specified, the doctype should be \"SystemDefinition\".");
+ }
+ }
+
+ public static int coreOSType(String filename)
+ throws ParserConfigurationException, SAXException, IOException,
+ XPathExpressionException {
+ Document doc = createDocument(filename);
+
+ int type = 0;
+
+ XPathFactory factory = XPathFactory.newInstance();
+ XPath xpath = factory.newXPath();
+
+ XPathExpression expr = xpath
+ .compile("count(//layer[@name='Hardware']) > 0");
+ Object result = expr.evaluate(doc, XPathConstants.BOOLEAN);
+
+ if ((Boolean) result) {
+ type = 1;
+ }
+
+ expr = xpath.compile("count(//layer[@name='HAL']) > 0");
+ Object result2 = expr.evaluate(doc, XPathConstants.BOOLEAN);
+
+ if ((Boolean) result2) {
+ type = 2;
+ }
+
+ return type;
+ }
+
+ private static Document createDocument(final String filename)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory
+ .newInstance();
+ domFactory.setNamespaceAware(true);
+ domFactory.setValidating(false);
+
+ DocumentBuilder builder = domFactory.newDocumentBuilder();
+ ErrorHandler errorHandler = new ErrorHandler() {
+ public void error(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+
+ public void fatalError(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+
+ public void warning(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+ };
+ builder.setErrorHandler(errorHandler);
+ Document doc = builder.parse(filename);
+
+ return doc;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/SystemDefinitionValidationException.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,47 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+
+@SuppressWarnings("serial")
+public class SystemDefinitionValidationException extends Exception {
+
+ /**
+ * Constructs a new exception that indicates that System Definition validation has failed but a build may still be attempted.
+ * @param message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
+ */
+ public SystemDefinitionValidationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception that indicates that System Definition validation has failed but a build may still be attempted.
+ * @param cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public SystemDefinitionValidationException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new exception that indicates that System Definition validation has failed but a build may still be attempted.
+ * @param message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
+ * @param cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public SystemDefinitionValidationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/SystemDefinitionValidationFatalException.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui;
+
+
+@SuppressWarnings("serial")
+public class SystemDefinitionValidationFatalException extends SystemDefinitionValidationException{
+
+ /**
+ * Constructs a new exception that indicates that System Definition validation has failed and a build should not be attempted.
+ * @param message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
+ */
+ public SystemDefinitionValidationFatalException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception that indicates that System Definition validation has failed and a build should not be attempted.
+ * @param cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public SystemDefinitionValidationFatalException(Throwable cause) {
+ super(cause);
+ }
+ /**
+ * Constructs a new exception that indicates that System Definition validation has failed and a build should not be attempted.
+ * @param message - the detail message. The detail message is saved for later retrieval by the Throwable.getMessage() method.
+ * @param cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
+ */
+ public SystemDefinitionValidationFatalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/XmlFileValidator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,124 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.validation.SchemaFactory;
+
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XmlFileValidator {
+
+ protected static String smgFolder = ""; // The location of the System Model
+ // Generator
+
+ public XmlFileValidator() {
+ final ResourceBundle resourceBundle = ResourceBundle.getBundle(
+ "location", Locale.getDefault(), this.getClass()
+ .getClassLoader());
+
+ smgFolder = resourceBundle.getString("location");
+ }
+
+ protected Document createDocument(final String filePath)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory
+ .newInstance();
+ domFactory.setNamespaceAware(true);
+ domFactory.setValidating(false);
+
+ SchemaFactory schemaFactory = SchemaFactory
+ .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ File schemaFile = getSchemaFile();
+
+ // schemaFile could be null if there is no schema for a specific file
+ // (as is the case for the System Definition xml file)
+ if (schemaFile != null && schemaFile.exists()) {
+ domFactory.setSchema(schemaFactory.newSchema(getSchemaFile()));
+ }
+
+ DocumentBuilder builder = domFactory.newDocumentBuilder();
+
+ ErrorHandler errorHandler = new ErrorHandler() {
+ public void error(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+
+ public void fatalError(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+
+ public void warning(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+ };
+
+ builder.setErrorHandler(errorHandler);
+
+ Document doc = builder.parse(filePath);
+
+ return doc;
+ }
+
+ /**
+ * The default implementation of this method
+ * returns null, meaning that this Validator
+ * is not aware of any schema definition for the
+ * associated resource.
+ *
+ * @return the appropriate schema definition file
+ * or null if there is no schema.
+ */
+ protected File getSchemaFile() {
+ return null;
+ }
+
+ public String validateXml(String filePath) {
+ String errorMessage = null;
+
+ try {
+ createDocument(filePath);
+ } catch (ParserConfigurationException e) {
+ errorMessage = e.getMessage();
+ } catch (SAXException e) {
+ errorMessage = e.getMessage();
+ } catch (IOException e) {
+ errorMessage = e.getMessage();
+ }
+
+ return errorMessage;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/builder/Builder.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,282 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.builder;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.ChangeManager;
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.ManageResources;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.editors.svgeditor.SVGEditor;
+import com.symbian.smt.gui.views.ConsoleOutput;
+
+public class Builder extends IncrementalProjectBuilder {
+ final static String TEMP_FOLDER = ".svg_temp"; // Folder names stating with
+ // a . will not be displayed
+ // in the project navigator
+
+ private IFolder svgTempFolder;
+ private IFile projectFile;
+
+ private List<IResource> markedResources;
+
+ private void addFileToProject() {
+ // Adds the file to the root of the project folder
+ try {
+ // Refresh the project so that it picks up the generated SVG file
+ getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ // Set the file as a derived resource (indicates was built from
+ // source and not an original file)
+ projectFile.setDerived(true);
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
+ throws CoreException {
+
+ IProject project = getProject();
+
+ if (!checkSMGinstalled()) {
+ writeToConsoleOutput("ERROR: Unable to locate the System Model Generator");
+ return null;
+ }
+
+ project.touch(null);
+
+ // First we check that project is in sync with the file system
+ findResourcesMarkedAsUrl(project);
+
+ if (markedResources.size() == 0) {
+ if (!project.isSynchronized(IResource.DEPTH_INFINITE)) {
+ writeToConsoleOutput("ERROR: The project is out of sync with the file system");
+ return null;
+ }
+ } else {
+ boolean isSynchronised = checkSyncrhonised(project);
+
+ if (!isSynchronised) {
+ writeToConsoleOutput("ERROR: The project is out of sync with the file system");
+ return null;
+ }
+ }
+
+ IResourceDelta delta = getDelta(project);
+ ChangeManager manager = new ChangeManager();
+
+ manager.handleDelta(delta, project);
+
+ if (!manager.needsBuilding(project)) {
+ return null;
+ }
+
+ manager.reset(project);
+
+ // We are not interested in different build types are we are only able
+ // to perform one type of build using the Perl SMG
+
+ svgTempFolder = project.getFolder(TEMP_FOLDER);
+
+ // Delete generated temp files
+ if (svgTempFolder.exists()) {
+ svgTempFolder.delete(true, null);
+ }
+
+ // Build
+ performBuild();
+
+ return null;
+ }
+
+ private boolean checkSyncrhonised(IResource resource) {
+ boolean result = true;
+
+ if (resource instanceof IFile) {
+ if (markedResources.contains(resource)) {
+ result = true;
+ } else {
+ result = resource.isSynchronized(IResource.DEPTH_ZERO);
+ }
+ } else if (resource instanceof IContainer) { // It is either IProject or
+ // IFolder
+ IContainer container = (IContainer) resource;
+
+ try {
+ IResource[] children = container.members();
+
+ for (IResource child : children) {
+ result = checkSyncrhonised(child);
+
+ if (!result) {
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ private void findResourcesMarkedAsUrl(IProject project)
+ throws CoreException {
+ IMarker[] messageMarkers = project.findMarkers(IMarker.TASK, false,
+ IResource.DEPTH_INFINITE);
+ markedResources = new ArrayList<IResource>();
+
+ for (int i = 0; i < messageMarkers.length; i++) {
+ IMarker marker = messageMarkers[i];
+
+ if (marker.getAttribute(ManageResources.IS_URL, false)) {
+ markedResources.add(marker.getResource());
+ }
+ }
+ }
+
+ private void performBuild() {
+ // Reset the command output window
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ConsoleOutput.reset();
+ }
+ });
+
+ // Create a processBuilder. This will run the SMT in another thread.
+ SMTCommand command = new SMTCommand(getProject());
+ List<String> generatedCommand = command.generateCommand();
+
+ if (generatedCommand == null) {
+ return;
+ }
+
+ SMTProcess process = new SMTProcess();
+
+ // Run the process
+ int exitCode = process.run(generatedCommand);
+
+ if (exitCode == 0) {
+ IScopeContext projectScope = new ProjectScope(getProject());
+ IEclipsePreferences projectNode = projectScope
+ .getNode(Activator.PLUGIN_ID);
+ PersistentDataStore projectStore = new PersistentDataStore(
+ projectNode);
+
+ projectFile = getProject()
+ .getFile(projectStore.getOutputFilename());
+
+ // Add the SVG file to the project
+ addFileToProject();
+
+ // Inform the user that the model has been created
+ writeToConsoleOutput("Finished");
+
+ // Open the file in the editor
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+
+ IEditorPart part = page.findEditor(new FileEditorInput(
+ projectFile));
+ if (part != null && part instanceof SVGEditor) {
+ page.openEditor(new FileEditorInput(projectFile),
+ SVGEditor.ID);
+ ((SVGEditor) part).refresh();
+ } else {
+ page.openEditor(new FileEditorInput(projectFile),
+ SVGEditor.ID);
+ }
+ } catch (PartInitException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+ });
+ } else {
+ writeToConsoleOutput("Exit Code: " + exitCode);
+
+ // Add the output to the Eclipse log
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Exception e = new Exception(ConsoleOutput.getText());
+ Logger
+ .log(
+ "Failed to successfully generate System Model diagram",
+ e);
+ }
+ });
+
+ writeToConsoleOutput("ERROR: Failed to successfully generate System Model diagram");
+ }
+ }
+
+ private boolean checkSMGinstalled() {
+
+ final ResourceBundle resourceBundle = ResourceBundle.getBundle(
+ "location", Locale.getDefault(), this.getClass()
+ .getClassLoader());
+
+ String smgFolder = resourceBundle.getString("location");
+
+ File smgCommand = new File(smgFolder + File.separator + "SysModGen.pl");
+
+ return smgCommand.exists();
+ }
+
+ private void writeToConsoleOutput(final String string) {
+ // Writes a string to the console output view
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ConsoleOutput.addText(string);
+ }
+ });
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/builder/SMTCommand.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,465 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.builder;
+
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.BORDER_SHAPES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.BORDER_STYLES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.COLOURS_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.COPYRIGHT_TEXT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.DEPENDENCIES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.DISTRIBUTION_TEXT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.FILTER_HAS_ITEMS;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.FIX_ITEM_SIZE;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.HIGHTLIGHT_CORE_OS;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.IGNORE_ITEMS;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.LEVELS_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.LEVEL_OF_DETAIL;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.LOCALISATION_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.MODEL_NAME;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.MODEL_VERSION;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.MODEL_VERSION_TEXT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.OUTPUT_FILE;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.PATTERNS_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.PRINTED_DPI;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.S12_XML_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SHAPES_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SUPPRESS_MOUSE_OVER_EFFECT;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_DEFINITION_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_INFO_FILES;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_NAME;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.SYSTEM_VERSION;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.TEMPDIR;
+import static com.symbian.smt.gui.builder.SystemModelGeneratorEnumsForCLI.WARNING_LEVEL;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.widgets.Display;
+import org.xml.sax.SAXException;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.SystemDefinition;
+import com.symbian.smt.gui.SystemDefinitionValidationException;
+import com.symbian.smt.gui.SystemDefinitionValidationFatalException;
+import com.symbian.smt.gui.views.ConsoleOutput;
+
+public class SMTCommand {
+
+ private static String SMG_FOLDER = ""; // The location of the System Model
+ // Generator
+ private static String SMT_COMMAND = ""; // The perl script to run for the
+ // System Model Generator
+ final static String TEMP_FOLDER = ".svg_temp"; // Folder names stating with
+ // a . will not be displayed
+ // in the project navigator
+ private IFolder svgTempFolder;
+ private IProject project;
+ private ArrayList<String> command = new ArrayList<String>();;
+
+ private PersistentDataStore defaultStore;
+ private PersistentDataStore instanceStore;
+ private PersistentDataStore projectStore;
+
+ private Pattern ampersandPattern = Pattern.compile("&",
+ Pattern.CASE_INSENSITIVE);
+ private Pattern lessThanPattern = Pattern.compile("<",
+ Pattern.CASE_INSENSITIVE);
+ private Pattern greaterThanPattern = Pattern.compile(">",
+ Pattern.CASE_INSENSITIVE);
+ private Pattern singleQuotePattern = Pattern.compile("'",
+ Pattern.CASE_INSENSITIVE);
+ private Pattern doubleQuotePattern = Pattern.compile("\"",
+ Pattern.CASE_INSENSITIVE);
+
+ public SMTCommand(IProject project) {
+ this.project = project;
+ svgTempFolder = project.getFolder(TEMP_FOLDER);
+
+ final ResourceBundle resourceBundle = ResourceBundle.getBundle(
+ "location", Locale.getDefault(), this.getClass()
+ .getClassLoader());
+
+ SMG_FOLDER = resourceBundle.getString("location");
+
+ try {
+ SMT_COMMAND = new File(SMG_FOLDER + File.separator + "SysModGen.pl")
+ .getCanonicalPath();
+ } catch (IOException e) {
+ Logger.log(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Generates the command line string for the System Model Toolkit
+ *
+ * @return List<String> Arguments for the CLI
+ */
+ public List<String> generateCommand() {
+ // Set up access to the persistent data stores
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ IScopeContext projectScope = new ProjectScope(project);
+ IEclipsePreferences projectNode = projectScope
+ .getNode(Activator.PLUGIN_ID);
+ projectStore = new PersistentDataStore(projectNode);
+
+ // Required to use the SMT script
+ command.add("perl");
+ command.add(SMT_COMMAND);
+
+ // Add the system definition files
+ String[] sysDefFiles = projectStore.getSystemDefinitionFiles();
+
+ // The while loop below protects against concurrency conditions which
+ // are encountered when the sys def file is a URL resource and
+ // when we are creating a new project via the NewSMTProjectWizard.
+ while (sysDefFiles.length == 0) {
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException ignore) {
+ }
+
+ sysDefFiles = projectStore.getSystemDefinitionFiles();
+ }
+
+ command.add(SYSTEM_DEFINITION_FILES.arg());
+
+ // Check that the system definition files are valid
+ // Only fatal errors cause the build attempt to be aborted.
+ //
+ for (String filename : sysDefFiles) {
+ try {
+ SystemDefinition.checkValidSystemDefinitionFile(filename);
+ } catch (SystemDefinitionValidationFatalException e1) {
+ writeToConsoleOutput("Error: " + filename
+ + " is not a valid system definition file:\n"
+ + e1.getMessage());
+ Logger.log("Validation of system definition file ("+filename+") failed.", e1);
+ return null;
+ } catch (SystemDefinitionValidationException e1) {
+ Logger.log("Validation of system definition file ("+filename+") failed.", e1);
+ }
+ }
+
+ // There may be multiple system definition files, if there are they need
+ // to be joined with a ,
+ if (sysDefFiles.length == 1) {
+ command.add(prepareArg(sysDefFiles[0]));
+ } else {
+ StringBuilder sysDefJoined = new StringBuilder();
+
+ for (String file : sysDefFiles) {
+ sysDefJoined.append(file);
+ sysDefJoined.append(",");
+ }
+
+ command.add(prepareArg(sysDefJoined.toString()));
+ }
+
+ // Add the resources
+ // Default files in this context mean file the user selected
+ handleResource(SHAPES_FILES, projectStore.getSelectedShapesFiles());
+ handleResource(LEVELS_FILES, projectStore.getSelectedLevelsFiles());
+ handleResource(SYSTEM_INFO_FILES, projectStore
+ .getSelectedSystemInfoFiles());
+ handleResource(DEPENDENCIES_FILES, projectStore
+ .getSelectedDependenciesFiles());
+ handleResource(COLOURS_FILES, projectStore.getSelectedColoursFiles());
+ handleResource(BORDER_SHAPES_FILES, projectStore
+ .getSelectedBorderShapesFiles());
+ handleResource(PATTERNS_FILES, projectStore.getSelectedPatternsFiles());
+ handleResource(LOCALISATION_FILES, projectStore
+ .getSelectedLocalisationFiles());
+ handleResource(BORDER_STYLES_FILES, projectStore
+ .getSelectedBorderStylesFiles());
+ handleResource(S12_XML_FILES, projectStore.getSelectedS12XmlFiles());
+
+ // Add the model labels
+ command.add(COPYRIGHT_TEXT.arg());
+ command.add(prepareArg(projectStore.getCopyrightText()));
+
+ command.add(SYSTEM_NAME.arg());
+ command.add(prepareArg(projectStore.getSystemName()));
+
+ command.add(DISTRIBUTION_TEXT.arg());
+ command.add(prepareArg(projectStore.getSelectedDistributionText()));
+
+ command.add(MODEL_NAME.arg());
+ command.add(prepareArg(projectStore.getModelName()));
+
+ command.add(MODEL_VERSION.arg());
+ command.add(prepareArg(projectStore.getModelVersion()));
+
+ command.add(MODEL_VERSION_TEXT.arg());
+ command.add(prepareArg(projectStore.getSelectedModelVersionText()));
+
+ command.add(SYSTEM_VERSION.arg());
+ command.add(prepareArg(projectStore.getSystemVersion()));
+
+ // Add the model control settings
+ command.add(HIGHTLIGHT_CORE_OS.arg());
+ if (projectStore.getHighlightCoreOS().toString().equalsIgnoreCase(
+ "true")) {
+ command.add("on");
+ } else {
+ command.add("false");
+ }
+
+ command.add(LEVEL_OF_DETAIL.arg());
+ command.add(prepareArg(projectStore.getLevelOfDetail()));
+
+ String dpi = projectStore.getSelectedPrintedDpi();
+
+ // The dpi option is to be added only if the user
+ // selected or typed in an option other than ""
+ if ((dpi != null) && (!dpi.equals(""))) {
+ command.add(PRINTED_DPI.arg());
+ command.add(prepareArg(dpi));
+ }
+
+ if (projectStore.getSuppressMouseOverEffect()) {
+ command.add(SUPPRESS_MOUSE_OVER_EFFECT.arg());
+ }
+
+ // The fix item size option is to be added only if the user
+ // checked the corresponding check box
+ if (projectStore.getFixItemSize()) {
+ command.add(FIX_ITEM_SIZE.arg());
+ command.add("fixed");
+ }
+
+ // Filter has Items
+ command.add(FILTER_HAS_ITEMS.arg());
+
+ String[] filterHasItems = projectStore.getFilterHasItems();
+
+ // No command line argument if there are no filter-has keywords
+ // If there are multiple filter has items, they need to be joined with a
+ // ,
+ if (filterHasItems.length > 0) {
+ if (filterHasItems.length == 1) {
+ command.add(prepareArg(filterHasItems[0]));
+ } else {
+ StringBuilder filterItemsJoined = new StringBuilder();
+
+ for (String filter : filterHasItems) {
+ filterItemsJoined.append(filter);
+ filterItemsJoined.append(",");
+ }
+
+ filterItemsJoined.deleteCharAt(filterItemsJoined.length() - 1);
+ command.add(prepareArg(filterItemsJoined.toString()));
+ }
+ }
+
+ // Ignore Items
+ List<String[]> ignoreItems = projectStore.getIgnoreItems();
+
+ StringBuilder ignoreItemsJoined = new StringBuilder();
+
+ for (String[] ignoreItem : ignoreItems) {
+ ignoreItemsJoined.append(ignoreItem[0]);
+ ignoreItemsJoined.append(":");
+ ignoreItemsJoined.append(ignoreItem[1]);
+ ignoreItemsJoined.append(";");
+ }
+
+ command.add(IGNORE_ITEMS.arg());
+ command.add(prepareArg(ignoreItemsJoined.toString()));
+
+ // Set the temp folder to use
+ command.add(TEMPDIR.arg());
+ command.add(prepareArg(svgTempFolder.getLocation().toString()));
+
+ // Set the warning level
+ command.add(WARNING_LEVEL.arg());
+ command.add(instanceStore.getWarningLevel());
+
+ // Set the output name
+ command.add(OUTPUT_FILE.arg());
+
+ File file = new File(project.getLocationURI().getPath());
+ command.add(file.getAbsolutePath() + File.separator
+ + projectStore.getOutputFilename());
+
+ // Advanced Options
+ // They are added at the very end of the command line and only if
+ // defined by the user.
+ String[] options = projectStore.getAdvancedOptions();
+
+ if ((options != null) && (options.length > 0)) {
+ for (String option : options) {
+ command.addAll(prepareAdvancedOption(option.trim()));
+ }
+ }
+
+ return command;
+ }
+
+
+ private List<String> prepareAdvancedOption(String option) {
+ List<String> options = new ArrayList<String>();
+
+ String optionValue = null;
+ String argumentValue = null;
+
+ if (option.indexOf(" ") > 0) {
+ optionValue = option.substring(0, option.indexOf(" "));
+ argumentValue = option.substring(option.indexOf(" ")).trim();
+ } else {
+ optionValue = option;
+ }
+
+ while (optionValue.startsWith("-")) {
+ optionValue = optionValue.substring(1);
+ }
+
+ options.add("--" + optionValue);
+
+ if (argumentValue != null && argumentValue.length() != 0) {
+ options.add(argumentValue);
+ }
+
+ return options;
+ }
+
+ private void handleResource(SystemModelGeneratorEnumsForCLI option,
+ String[] selectedFiles) {
+ // In the cases below where we have no selected files, we need to define
+ // a "" string for compatibility with SMG, which does not like an empty array.
+ switch (option) {
+ case BORDER_SHAPES_FILES:
+ case BORDER_STYLES_FILES:
+ case COLOURS_FILES:
+ case LOCALISATION_FILES:
+ case PATTERNS_FILES:
+ case SHAPES_FILES:
+ case SYSTEM_INFO_FILES:
+ if (selectedFiles.length == 0) {
+ selectedFiles = new String[1];
+ selectedFiles[0] = "\"\"";
+ }
+
+ break;
+
+ case LEVELS_FILES:
+ if (selectedFiles.length == 0) {
+ selectedFiles = new String[1];
+ selectedFiles[0] = "\"\"";
+ } else {
+ if (selectedFiles[0].equals("Auto")) {
+ selectedFiles = new String[] {};
+ }
+ }
+
+ break;
+
+ case DEPENDENCIES_FILES:
+ case S12_XML_FILES:
+ if (selectedFiles.length == 0) {
+ selectedFiles = new String[] {};
+ }
+
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unknown option [" + option
+ + "]");
+
+ }
+
+ for (String file : selectedFiles) {
+ command.add(option.arg());
+ command.add((file.equals("\"\"")) ? file : prepareArg(file));
+ }
+ }
+
+ private String prepareArg(String arg) {
+ // Escape any XML entities
+ arg = replace(arg, ampersandPattern.matcher(arg), "&");
+ arg = replace(arg, lessThanPattern.matcher(arg), "<");
+ arg = replace(arg, greaterThanPattern.matcher(arg), ">");
+ arg = replace(arg, singleQuotePattern.matcher(arg), "'");
+ arg = replace(arg, doubleQuotePattern.matcher(arg), """);
+ arg = arg.trim();
+
+ // Escape any unicode characters
+ StringBuffer result = new StringBuffer();
+
+ // Get chars as characters may be multibyte
+ for (char theChar : arg.toCharArray()) {
+ if ((int) theChar > 127) {
+ // Turn into XML unicode entity
+ result.append("&#x" + Integer.toHexString((int) theChar) + ";");
+ } else {
+ // Characters < 128 should be the same in all code pages, we
+ // don't escape these for aesthetic reasons
+ result.append(theChar);
+ }
+ }
+
+ return "\"" + result.toString() + "\"";
+ }
+
+ private String replace(String arg, Matcher m, String replacement) {
+ m.reset();
+
+ StringBuffer result = new StringBuffer();
+
+ while (m.find()) {
+ m.appendReplacement(result, replacement);
+ }
+
+ m.appendTail(result);
+
+ return result.toString();
+ }
+
+ private void writeToConsoleOutput(final String string) {
+ // Writes a string to the console output view
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ConsoleOutput.addText(string);
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/builder/SMTProcess.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,120 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.builder;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Display;
+
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.views.ConsoleOutput;
+
+public class SMTProcess {
+
+ /**
+ * Runs the command line base System Model Generator
+ *
+ * @param List
+ * <String> Arguments for the CLI
+ * @return int The exit code from the System Model Generator
+ */
+ public int run(List<String> command) {
+ int result = 0;
+
+ // Reset the console
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ConsoleOutput.reset();
+
+ }
+ });
+
+ // Print the command line string to the console output
+ StringBuilder commandLineString = new StringBuilder();
+
+ for (String item : command) {
+ commandLineString.append(item.concat(" "));
+ }
+
+ writeToConsoleOutput("Executing '" + commandLineString.toString() + "'");
+
+ // First we check that Perl is available
+ ProcessBuilder pbCheckPerl = new ProcessBuilder("perl", "-v");
+ pbCheckPerl.redirectErrorStream(true);
+
+ try {
+ pbCheckPerl.start();
+ } catch (IOException e) {
+ writeToConsoleOutput("Error: Perl is not installed");
+ return 9009; // Same exit code as Windows produces for a program not
+ // found
+ }
+
+ ProcessBuilder pb = new ProcessBuilder(command);
+
+ // Redirect STDERR to STDOUT
+ pb.redirectErrorStream(true);
+
+ try {
+ // Start the process
+ final Process p = pb.start();
+
+ // Get and close the process STDIN
+ OutputStream out = p.getOutputStream();
+ out.close();
+
+ // Create a reader to read from the process STDOUT
+ BufferedReader inReader = new BufferedReader(new InputStreamReader(
+ p.getInputStream()));
+
+ // Print STDOUT to the command output view
+ String line;
+ while ((line = inReader.readLine()) != null) {
+ writeToConsoleOutput(line);
+ }
+
+ // Close the process STDOUT pipe when finished
+ inReader.close();
+
+ try {
+ // Ensure the process has finished and get the exit code
+ result = p.waitFor();
+ } catch (InterruptedException e) {
+ Logger.log(e.getMessage(), e);
+ } finally {
+ // Destroy the process
+ p.destroy();
+ }
+ } catch (IOException e) {
+ Logger.log(e.getMessage(), e);
+ }
+
+ return result;
+
+ }
+
+ private void writeToConsoleOutput(final String string) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ConsoleOutput.addText(string);
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/builder/SystemModelGeneratorEnumsForCLI.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,68 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.builder;
+
+public enum SystemModelGeneratorEnumsForCLI {
+
+ // System Definition Files
+ SYSTEM_DEFINITION_FILES("--sysdef"),
+
+ // Model Labels
+ COPYRIGHT_TEXT("--copyright"), DISTRIBUTION_TEXT("--distribution"), MODEL_NAME(
+ "--model_name"), MODEL_VERSION("--model_version"), MODEL_VERSION_TEXT(
+ "--model_version_type"), SYSTEM_NAME("--system_name"), SYSTEM_VERSION(
+ "--system_version"),
+
+ // Model Control
+ HIGHTLIGHT_CORE_OS("--coreos"), LEVEL_OF_DETAIL("--detail"), PRINTED_DPI(
+ "--dpi"), SUPPRESS_MOUSE_OVER_EFFECT("--static"), FIX_ITEM_SIZE(
+ "--detail-type"),
+
+ // Resources
+ SHAPES_FILES("--shapes"), LEVELS_FILES("--levels"), LOCALISATION_FILES(
+ "--localize"), DEPENDENCIES_FILES("--deps"), SYSTEM_INFO_FILES(
+ "--sysinfo"), COLOURS_FILES("--color"), BORDER_STYLES_FILES(
+ "--border-style"), BORDER_SHAPES_FILES("--border-shape"), PATTERNS_FILES(
+ "--pattern"), S12_XML_FILES("--s12"),
+
+ // Filter Items
+ FILTER_ITEMS("--filter"),
+
+ // Filter Items
+ FILTER_HAS_ITEMS("--filter-has"),
+
+ // Ignore Items
+ IGNORE_ITEMS("--ignore"),
+
+ // Warning Level
+ WARNING_LEVEL("-w"),
+
+ // Output filename
+ OUTPUT_FILE("-output"),
+
+ // Temp Dir
+ TEMPDIR("--tempdir");
+
+ private final String commandlineArg;
+
+ SystemModelGeneratorEnumsForCLI(String commandlineArg) {
+ this.commandlineArg = commandlineArg;
+ }
+
+ public String arg() {
+ return commandlineArg;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/svgeditor/SVGEditor.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,105 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.svgeditor;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+
+public class SVGEditor extends org.eclipse.ui.part.EditorPart {
+
+ public static final String ID = "com.symbian.smt.gui.editors.svgeditor"; //$NON-NLS-1$
+
+ private String filename;
+ private Browser browser;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ browser = new Browser(parent, SWT.NONE);
+ browser.setUrl(filename);
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ // The save button is disabled
+ }
+
+ @Override
+ public void doSaveAs() {
+ // Not implementing at this stage
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ try {
+ if (input instanceof IFileEditorInput) {
+ IFileEditorInput file = (IFileEditorInput) input;
+ URI uri = file.getFile().getLocationURI();
+ filename = uri.toURL().toString();
+ }
+ } catch (MalformedURLException mue) {
+ throw new PartInitException("Bad URL", mue);
+ }
+
+ if (!input.exists()) {
+ throw new PartInitException("Input file " + input.getName()
+ + " does not exist");
+ }
+
+ setSite(site);
+ setInput(input);
+ setPartName(input.getName());
+ }
+
+ @Override
+ public boolean isDirty() {
+ // The user is not able to edit the image
+ return false;
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ public void print() {
+ browser.execute("window.print();");
+ }
+
+ public void refresh() {
+ browser.refresh();
+ }
+
+ @Override
+ public void setFocus() {
+ // Set the focus to the browser. The editor will not function properly
+ // (won't open files or change tabs) if you don't set the focus to
+ // something
+
+ browser.setFocus();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/svgeditor/SVGEditorContributor.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,60 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+package com.symbian.smt.gui.editors.svgeditor;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.LabelRetargetAction;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+import com.symbian.smt.gui.print.PrintAction;
+
+public class SVGEditorContributor extends EditorActionBarContributor {
+
+ private LabelRetargetAction printRetargetAction;
+
+ private PrintAction printAction;
+
+ public SVGEditorContributor() {
+ printAction = new PrintAction("Print SVG");
+ printRetargetAction = new LabelRetargetAction(ActionFactory.PRINT
+ .getId(), "Print SVG");
+ }
+
+ public void dispose() {
+ // Remove retarget actions as page listeners
+ getPage().removePartListener(printRetargetAction);
+ }
+
+ public void init(IActionBars bars, IWorkbenchPage page) {
+ super.init(bars, page);
+ bars.setGlobalActionHandler(ActionFactory.PRINT.getId(), printAction);
+
+ // Hook retarget actions as page listeners
+ page.addPartListener(printRetargetAction);
+ IWorkbenchPart activePart = page.getActivePart();
+ if (activePart != null) {
+ printRetargetAction.partActivated(activePart);
+
+ }
+ }
+
+ public void setActiveEditor(IEditorPart editor) {
+ printAction.setActiveEditor(editor);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/ColorManager.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,53 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class ColorManager {
+
+ protected Map<RGB, Color> fColorTable = new HashMap<RGB, Color>(10);
+
+ public void dispose() {
+ Iterator<Color> e = fColorTable.values().iterator();
+
+ while (e.hasNext())
+ ((Color) e.next()).dispose();
+ }
+
+ public Color getColor(RGB rgb) {
+ Color color = (Color) fColorTable.get(rgb);
+
+ if (color == null) {
+ color = new Color(Display.getCurrent(), rgb);
+ fColorTable.put(rgb, color);
+ }
+
+ return color;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/IXMLColorConstants.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,32 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public interface IXMLColorConstants {
+ RGB XML_COMMENT = new RGB(128, 0, 0);
+ RGB PROC_INSTR = new RGB(128, 128, 128);
+ RGB STRING = new RGB(0, 128, 0);
+ RGB DEFAULT = new RGB(0, 0, 0);
+ RGB TAG = new RGB(0, 0, 128);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/NonRuleBasedDamagerRepairer.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,153 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.presentation.IPresentationDamager;
+import org.eclipse.jface.text.presentation.IPresentationRepairer;
+import org.eclipse.swt.custom.StyleRange;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class NonRuleBasedDamagerRepairer implements IPresentationDamager,
+ IPresentationRepairer {
+
+ /** The document this object works on */
+ protected IDocument fDocument;
+ /**
+ * The default text attribute if non is returned as data by the current
+ * token
+ */
+ protected TextAttribute fDefaultTextAttribute;
+
+ /**
+ * Constructor for NonRuleBasedDamagerRepairer.
+ */
+ public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
+ Assert.isNotNull(defaultTextAttribute);
+
+ fDefaultTextAttribute = defaultTextAttribute;
+ }
+
+ /**
+ * Adds style information to the given text presentation.
+ *
+ * @param presentation
+ * the text presentation to be extended
+ * @param offset
+ * the offset of the range to be styled
+ * @param length
+ * the length of the range to be styled
+ * @param attr
+ * the attribute describing the style of the range to be styled
+ */
+ protected void addRange(TextPresentation presentation, int offset,
+ int length, TextAttribute attr) {
+ if (attr != null)
+ presentation.addStyleRange(new StyleRange(offset, length, attr
+ .getForeground(), attr.getBackground(), attr.getStyle()));
+ }
+
+ /**
+ * @see IPresentationRepairer#createPresentation(TextPresentation,
+ * ITypedRegion)
+ */
+ public void createPresentation(TextPresentation presentation,
+ ITypedRegion region) {
+ addRange(presentation, region.getOffset(), region.getLength(),
+ fDefaultTextAttribute);
+ }
+
+ /**
+ * Returns the end offset of the line that contains the specified offset or
+ * if the offset is inside a line delimiter, the end offset of the next
+ * line.
+ *
+ * @param offset
+ * the offset whose line end offset must be computed
+ * @return the line end offset for the given offset
+ * @exception BadLocationException
+ * if offset is invalid in the current document
+ */
+ protected int endOfLineOf(int offset) throws BadLocationException {
+
+ IRegion info = fDocument.getLineInformationOfOffset(offset);
+ if (offset <= info.getOffset() + info.getLength())
+ return info.getOffset() + info.getLength();
+
+ int line = fDocument.getLineOfOffset(offset);
+ try {
+ info = fDocument.getLineInformation(line + 1);
+ return info.getOffset() + info.getLength();
+ } catch (BadLocationException x) {
+ return fDocument.getLength();
+ }
+ }
+
+ /**
+ * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent,
+ * boolean)
+ */
+ public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event,
+ boolean documentPartitioningChanged) {
+ if (!documentPartitioningChanged) {
+ try {
+
+ IRegion info = fDocument.getLineInformationOfOffset(event
+ .getOffset());
+ int start = Math.max(partition.getOffset(), info.getOffset());
+
+ int end = event.getOffset()
+ + (event.getText() == null ? event.getLength() : event
+ .getText().length());
+
+ if (info.getOffset() <= end
+ && end <= info.getOffset() + info.getLength()) {
+ // optimize the case of the same line
+ end = info.getOffset() + info.getLength();
+ } else
+ end = endOfLineOf(end);
+
+ end = Math.min(partition.getOffset() + partition.getLength(),
+ end);
+ return new Region(start, end - start);
+
+ } catch (BadLocationException x) {
+ }
+ }
+
+ return partition;
+ }
+
+ /**
+ * @see IPresentationRepairer#setDocument(IDocument)
+ */
+ public void setDocument(IDocument document) {
+ fDocument = document;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/TagRule.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,53 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.rules.ICharacterScanner;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class TagRule extends MultiLineRule {
+
+ public TagRule(IToken token) {
+ super("<", ">", token);
+ }
+
+ protected boolean sequenceDetected(ICharacterScanner scanner,
+ char[] sequence, boolean eofAllowed) {
+ int c = scanner.read();
+ if (sequence[0] == '<') {
+ if (c == '?') {
+ // processing instruction - abort
+ scanner.unread();
+ return false;
+ }
+ if (c == '!') {
+ scanner.unread();
+ // comment - abort
+ return false;
+ }
+ } else if (sequence[0] == '>') {
+ scanner.unread();
+ }
+ return super.sequenceDetected(scanner, sequence, eofAllowed);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLConfiguration.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,96 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLConfiguration extends SourceViewerConfiguration {
+ private XMLDoubleClickStrategy doubleClickStrategy;
+ private XMLTagScanner tagScanner;
+ private XMLScanner scanner;
+ private ColorManager colorManager;
+
+ public XMLConfiguration(ColorManager colorManager) {
+ this.colorManager = colorManager;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
+ XMLPartitionScanner.XML_COMMENT, XMLPartitionScanner.XML_TAG };
+ }
+
+ public ITextDoubleClickStrategy getDoubleClickStrategy(
+ ISourceViewer sourceViewer, String contentType) {
+ if (doubleClickStrategy == null)
+ doubleClickStrategy = new XMLDoubleClickStrategy();
+ return doubleClickStrategy;
+ }
+
+ public IPresentationReconciler getPresentationReconciler(
+ ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(
+ getXMLTagScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
+
+ dr = new DefaultDamagerRepairer(getXMLScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(
+ new TextAttribute(colorManager
+ .getColor(IXMLColorConstants.XML_COMMENT)));
+ reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
+
+ return reconciler;
+ }
+
+ protected XMLScanner getXMLScanner() {
+ if (scanner == null) {
+ scanner = new XMLScanner(colorManager);
+ scanner.setDefaultReturnToken(new Token(new TextAttribute(
+ colorManager.getColor(IXMLColorConstants.DEFAULT))));
+ }
+ return scanner;
+ }
+
+ protected XMLTagScanner getXMLTagScanner() {
+ if (tagScanner == null) {
+ tagScanner = new XMLTagScanner(colorManager);
+ tagScanner.setDefaultReturnToken(new Token(new TextAttribute(
+ colorManager.getColor(IXMLColorConstants.TAG))));
+ }
+ return tagScanner;
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLDocumentProvider.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,44 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.ui.editors.text.FileDocumentProvider;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLDocumentProvider extends FileDocumentProvider {
+
+ protected IDocument createDocument(Object element) throws CoreException {
+ IDocument document = super.createDocument(element);
+ if (document != null) {
+ IDocumentPartitioner partitioner = new FastPartitioner(
+ new XMLPartitionScanner(), new String[] {
+ XMLPartitionScanner.XML_TAG,
+ XMLPartitionScanner.XML_COMMENT });
+ partitioner.connect(document);
+ document.setDocumentPartitioner(partitioner);
+ }
+ return document;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLDoubleClickStrategy.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,138 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.ITextViewer;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy {
+ protected ITextViewer fText;
+
+ public void doubleClicked(ITextViewer part) {
+ int pos = part.getSelectedRange().x;
+
+ if (pos < 0)
+ return;
+
+ fText = part;
+
+ if (!selectComment(pos)) {
+ selectWord(pos);
+ }
+ }
+
+ protected boolean selectComment(int caretPos) {
+ IDocument doc = fText.getDocument();
+ int startPos, endPos;
+
+ try {
+ int pos = caretPos;
+ char c = ' ';
+
+ while (pos >= 0) {
+ c = doc.getChar(pos);
+ if (c == '\\') {
+ pos -= 2;
+ continue;
+ }
+ if (c == Character.LINE_SEPARATOR || c == '\"')
+ break;
+ --pos;
+ }
+
+ if (c != '\"')
+ return false;
+
+ startPos = pos;
+
+ pos = caretPos;
+ int length = doc.getLength();
+ c = ' ';
+
+ while (pos < length) {
+ c = doc.getChar(pos);
+ if (c == Character.LINE_SEPARATOR || c == '\"')
+ break;
+ ++pos;
+ }
+ if (c != '\"')
+ return false;
+
+ endPos = pos;
+
+ int offset = startPos + 1;
+ int len = endPos - offset;
+ fText.setSelectedRange(offset, len);
+ return true;
+ } catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+
+ private void selectRange(int startPos, int stopPos) {
+ int offset = startPos + 1;
+ int length = stopPos - offset;
+ fText.setSelectedRange(offset, length);
+ }
+
+ protected boolean selectWord(int caretPos) {
+
+ IDocument doc = fText.getDocument();
+ int startPos, endPos;
+
+ try {
+
+ int pos = caretPos;
+ char c;
+
+ while (pos >= 0) {
+ c = doc.getChar(pos);
+ if (!Character.isJavaIdentifierPart(c))
+ break;
+ --pos;
+ }
+
+ startPos = pos;
+
+ pos = caretPos;
+ int length = doc.getLength();
+
+ while (pos < length) {
+ c = doc.getChar(pos);
+ if (!Character.isJavaIdentifierPart(c))
+ break;
+ ++pos;
+ }
+
+ endPos = pos;
+ selectRange(startPos, endPos);
+ return true;
+
+ } catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLEditor.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,42 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.ui.editors.text.TextEditor;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLEditor extends TextEditor {
+
+ private ColorManager colorManager;
+
+ public XMLEditor() {
+ super();
+ colorManager = new ColorManager();
+ setSourceViewerConfiguration(new XMLConfiguration(colorManager));
+ setDocumentProvider(new XMLDocumentProvider());
+ }
+
+ public void dispose() {
+ colorManager.dispose();
+ super.dispose();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLPartitionScanner.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.Token;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLPartitionScanner extends RuleBasedPartitionScanner {
+ public final static String XML_COMMENT = "__xml_comment";
+ public final static String XML_TAG = "__xml_tag";
+
+ public XMLPartitionScanner() {
+
+ IToken xmlComment = new Token(XML_COMMENT);
+ IToken tag = new Token(XML_TAG);
+
+ IPredicateRule[] rules = new IPredicateRule[2];
+
+ rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
+ rules[1] = new TagRule(tag);
+
+ setPredicateRules(rules);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLScanner.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLScanner extends RuleBasedScanner {
+
+ public XMLScanner(ColorManager manager) {
+ IToken procInstr = new Token(new TextAttribute(manager
+ .getColor(IXMLColorConstants.PROC_INSTR)));
+
+ IRule[] rules = new IRule[2];
+ // Add rule for processing instructions
+ rules[0] = new SingleLineRule("<?", "?>", procInstr);
+ // Add generic whitespace rule.
+ rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
+
+ setRules(rules);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLTagScanner.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,49 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLTagScanner extends RuleBasedScanner {
+
+ public XMLTagScanner(ColorManager manager) {
+ IToken string = new Token(new TextAttribute(manager
+ .getColor(IXMLColorConstants.STRING)));
+
+ IRule[] rules = new IRule[3];
+
+ // Add rule for double quotes
+ rules[0] = new SingleLineRule("\"", "\"", string, '\\');
+ // Add a rule for single quotes
+ rules[1] = new SingleLineRule("'", "'", string, '\\');
+ // Add generic whitespace rule.
+ rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
+
+ setRules(rules);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/XMLWhitespaceDetector.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,31 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.editors.xmleditor;
+
+import org.eclipse.jface.text.rules.IWhitespaceDetector;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class XMLWhitespaceDetector implements IWhitespaceDetector {
+
+ public boolean isWhitespace(char c) {
+ return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/exportwizards/ExportSelectionPage.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,217 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.exportwizards;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.nature.Nature;
+
+public class ExportSelectionPage extends WizardPage {
+ private Text text;
+ private List list;
+
+ /**
+ * @param pageName
+ */
+ protected ExportSelectionPage(IStructuredSelection selection) {
+ super("wizardPage");
+ setTitle("System Model Manager Export Wizard");
+ setDescription("Select the project you wish to export the diagram from, select the location to export to and then click finish");
+ setPageComplete(false);
+ }
+
+ private void canFinish() {
+ if (text.getText().trim().length() > 0
+ && list.getSelectionIndex() != -1) {
+ setPageComplete(true);
+ } else {
+ setPageComplete(false);
+ }
+ }
+
+ public boolean copyFile() {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot workspaceRoot = workspace.getRoot();
+
+ IProject project = workspaceRoot.getProject(list.getItem(list
+ .getSelectionIndex()));
+
+ IScopeContext projectScope = new ProjectScope(project);
+ PersistentDataStore store = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ IFile projectFile = project.getFile(store.getOutputFilename());
+
+ File toFile = new File(text.getText());
+
+ if (toFile.isDirectory()) {
+ MessageDialog.openError(getShell(), "Error", toFile.toString()
+ + " is a directory");
+ Logger.log(toFile.toString() + " is a directory");
+ return false;
+ }
+
+ if (!projectFile.exists()) {
+ MessageDialog.openError(getShell(), "Error", "The project "
+ + list.getItem(list.getSelectionIndex())
+ + " does not contain a System Model Diagram");
+ return false;
+ }
+
+ if (toFile.exists()) {
+ if (!MessageDialog.openConfirm(getShell(), "Overwrite?",
+ "Do you wish to overwrite the file " + toFile.toString()
+ + "?")) {
+ return false;
+ }
+ }
+
+ try {
+ FileChannel in = new FileInputStream(projectFile.getRawLocation()
+ .toOSString()).getChannel();
+ FileChannel out = new FileOutputStream(text.getText()).getChannel();
+
+ try {
+ in.transferTo(0, in.size(), out);
+ in.close();
+ out.close();
+ } catch (IOException e) {
+ MessageDialog.openError(getShell(), "Error", e.getMessage());
+ Logger.log(e.getMessage(), e);
+ return false;
+ }
+
+ } catch (FileNotFoundException e) {
+ MessageDialog.openError(getShell(), "Error", e.getMessage());
+ Logger.log(e.getMessage(), e);
+ return false;
+ }
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+ * .Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setLayout(new FillLayout(SWT.VERTICAL));
+
+ setControl(container);
+
+ final Composite composite = new Composite(container, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+
+ list = new List(composite, SWT.BORDER);
+ final GridData gd_list = new GridData(SWT.FILL, SWT.FILL, true, true,
+ 2, 1);
+ list.setLayoutData(gd_list);
+ list.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ canFinish();
+ }
+ });
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot workspaceRoot = workspace.getRoot();
+
+ for (IProject project : workspaceRoot.getProjects()) {
+ if (project.isOpen()) {
+ try {
+ if (project.hasNature(Nature.ID)) {
+ list.add(project.getName());
+ }
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ MessageDialog
+ .openError(getShell(), "Error", e.getMessage());
+ }
+ }
+ }
+
+ final Button browseButton = new Button(composite, SWT.NONE);
+ browseButton.setText("Browse");
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ // Create and open a file window
+ FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
+
+ String[] filterNames = new String[1];
+
+ filterNames[0] = "*.svg";
+
+ dialog.setFilterExtensions(filterNames);
+
+ String filename = dialog.open();
+
+ if (filename != null) {
+ text.setText(filename);
+ }
+ }
+ });
+
+ text = new Text(composite, SWT.BORDER);
+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ canFinish();
+ }
+ });
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/exportwizards/ExportSystemModelDiagram.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,41 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.exportwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+public class ExportSystemModelDiagram extends Wizard implements IExportWizard {
+
+ private ExportSelectionPage page;
+
+ public void addPages(IStructuredSelection selection) {
+ page = new ExportSelectionPage(selection);
+ addPage(page);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ setWindowTitle("System Model Manager Export Wizard");
+ addPages(selection);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return page.copyFile();
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/nature/Nature.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,59 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.nature;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+public class Nature implements IProjectNature {
+ public static final String ID = "com.symbian.smt.gui.nature";
+
+ private IProject project;
+
+ public void configure() throws CoreException {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+
+ for (int i = 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(
+ "com.symbian.smt.gui.builder")) {
+ return;
+ }
+ }
+
+ ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+ ICommand command = desc.newCommand();
+ command.setBuilderName("com.symbian.smt.gui.builder");
+ newCommands[newCommands.length - 1] = command;
+ desc.setBuildSpec(newCommands);
+ project.setDescription(desc, null);
+ }
+
+ public void deconfigure() throws CoreException {
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/perspective/Perspective.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,51 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.perspective;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class Perspective implements IPerspectiveFactory {
+
+ public static final String ID = "com.symbian.smt.gui.perspective"; //$NON-NLS-1$
+
+ // Add fast views to the perspective
+ private void addFastViews(IPageLayout layout) {
+ }
+
+ // Add perspective shortcuts to the perspective
+ private void addPerspectiveShortcuts(IPageLayout layout) {
+ }
+
+ // Add view shortcuts to the perspective
+ private void addViewShortcuts(IPageLayout layout) {
+ }
+
+ // Creates the initial layout for a page
+ public void createInitialLayout(IPageLayout layout) {
+ String editorArea = layout.getEditorArea();
+ addFastViews(layout);
+ addViewShortcuts(layout);
+ addPerspectiveShortcuts(layout);
+
+ IFolderLayout topLeft = layout.createFolder("topLeft",
+ IPageLayout.LEFT, 0.25f, editorArea); // $NON-NLS$
+ topLeft.addView("org.eclipse.ui.navigator.ProjectExplorer");
+ layout.addView(com.symbian.smt.gui.views.ConsoleOutput.ID,
+ IPageLayout.BOTTOM, 0.80f, editorArea);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/AdvancedOptionsPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,116 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.AdvancedOptionsWidget;
+
+/**
+ * This is the Preference page for the Advanced Options. It utilises the
+ * <code>AdvancedOptionsWidget</code>.
+ * <p>
+ * By default, there are no advanced options defined.
+ * </p>
+ *
+ * @author barbararosi-schwartz
+ */
+public class AdvancedOptionsPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private AdvancedOptionsWidget advancedOptionsWidget;
+ private AbstractPersistentDataStore instanceStore;
+ private AbstractPersistentDataStore defaultStore;
+
+ public AdvancedOptionsPreferences() {
+ }
+
+ public AdvancedOptionsPreferences(String title) {
+ super(title);
+ }
+
+ public AdvancedOptionsPreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ advancedOptionsWidget = new AdvancedOptionsWidget(composite, SWT.NONE);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ advancedOptionsWidget.setAdvancedOptions(instanceStore
+ .getAdvancedOptions());
+
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("System Model Diagram advanced options.\n"
+ + "These must be defined in their entirety. "
+ + "Their order is also user defined.");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void restoreDefaults() {
+ advancedOptionsWidget.setAdvancedOptions(defaultStore
+ .getAdvancedOptions());
+ }
+
+ private void storeValues() {
+ instanceStore.setAdvancedOptions(advancedOptionsWidget
+ .getAdvancedOptions());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/BuildPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,141 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.BuildControlWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+
+public class BuildPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage, ValidModelDefinedListener {
+
+ private BuildControlWidget buildWidget;
+
+ private AbstractPersistentDataStore instanceStore;
+ private AbstractPersistentDataStore defaultStore;
+
+ public BuildPreferences() {
+ }
+
+ public BuildPreferences(String title) {
+ super(title);
+ }
+
+ public BuildPreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ buildWidget = new BuildControlWidget(composite, SWT.NONE, true);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ buildWidget.setOutputFilename(instanceStore.getOutputFilename());
+ buildWidget.setWarningLevel(instanceStore.getWarningLevel());
+
+ buildWidget.addModelListener(this);
+
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (buildWidget != null) {
+ buildWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ /*
+ * Comma-separated list of filters to turn on when building the model. All
+ * filters on an item must be present in this list in order for that item to
+ * appear. Order does not matter
+ */
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("System Model Manager build options.");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void restoreDefaults() {
+ buildWidget.setOutputFilename(defaultStore.getOutputFilename());
+ buildWidget.setWarningLevel(defaultStore.getWarningLevel());
+ }
+
+ private void storeValues() {
+ instanceStore.setOutputFilename(buildWidget.getOutputFilename());
+ instanceStore.setWarningLevel(buildWidget.getWarningLevel());
+ }
+
+ /*
+ * This is called by the observed object when a change is used to ensure the
+ * information entered into the widget is acceptable, in this case at least
+ * 1 system definition xml file
+ *
+ * @return void
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(event.getMessage());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/FilterPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,108 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.FilterWidget;
+
+public class FilterPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private FilterWidget filterWidget;
+ private AbstractPersistentDataStore instanceStore;
+ private AbstractPersistentDataStore defaultStore;
+
+ public FilterPreferences() {
+ }
+
+ public FilterPreferences(String title) {
+ super(title);
+ }
+
+ public FilterPreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ filterWidget = new FilterWidget(composite, SWT.NONE);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ filterWidget.setFilterItems(instanceStore.getFilterHasItems());
+
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ /*
+ * Comma-separated list of filters to turn on when building the model. All
+ * filters on an item must be present in this list in order for that item to
+ * appear. Order does not matter
+ */
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("List of filters to turn on when building the model. \n"
+ + "All filters on an item must be present in this "
+ + "list in order for that item to appear. \n"
+ + "Order does not matter.");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void restoreDefaults() {
+ filterWidget.setFilterItems(defaultStore.getFilterHasItems());
+ }
+
+ private void storeValues() {
+ instanceStore.setFilterHasItems(filterWidget.getFilterItems());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/IgnorePreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,100 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.IgnoreWidget;
+
+public class IgnorePreferences extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private IgnoreWidget ignoreWidget;
+ private AbstractPersistentDataStore instanceStore;
+ private AbstractPersistentDataStore defaultStore;
+
+ public IgnorePreferences() {
+ }
+
+ public IgnorePreferences(String title) {
+ super(title);
+ }
+
+ public IgnorePreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ ignoreWidget = new IgnoreWidget(composite, SWT.NONE);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ ignoreWidget.setIgnoreItems(instanceStore.getIgnoreItems());
+
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("List of model entities not to draw when building System Model Diagram.");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void restoreDefaults() {
+ ignoreWidget.setIgnoreItems(defaultStore.getIgnoreItems());
+ }
+
+ private void storeValues() {
+ instanceStore.setIgnoreItems(ignoreWidget.getIgnoreItems());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/LabelPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,165 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.ModelLabelsWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class LabelPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage, ValidModelDefinedListener {
+
+ private ModelLabelsWidget labelsWidget;
+ private PersistentDataStore instanceStore;
+ private PersistentDataStore defaultStore;
+
+ public LabelPreferences() {
+ }
+
+ public LabelPreferences(String title) {
+ super(title);
+ }
+
+ public LabelPreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ labelsWidget = new ModelLabelsWidget(composite, SWT.NONE);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ labelsWidget.initialiseModelVersionText(defaultStore);
+ labelsWidget.initialiseDistributionText(defaultStore);
+ labelsWidget.addModelListener(this);
+ labelsWidget.setModelVersion(instanceStore.getModelVersion());
+ labelsWidget.setSystemVersion(instanceStore.getSystemVersion());
+ labelsWidget.setCopyrightText(instanceStore.getCopyrightText());
+ labelsWidget.setModelName(instanceStore.getModelName());
+ labelsWidget.setSystemName(instanceStore.getSystemName());
+
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (labelsWidget != null) {
+ labelsWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("System Model Diagram default labels");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void restoreDefaults() {
+ labelsWidget.setDistributionTexts(defaultStore.getDistributionTexts());
+ labelsWidget.setSelectedDistributionText(defaultStore
+ .getSelectedDistributionText());
+ labelsWidget.setModelVersion(defaultStore.getModelVersion());
+ labelsWidget.setSystemVersion(defaultStore.getSystemVersion());
+ labelsWidget.setCopyrightText(defaultStore.getCopyrightText());
+ labelsWidget.setModelVersionTexts(defaultStore.getModelVersionTexts());
+ labelsWidget.setSelectedModelVersionText(defaultStore
+ .getSelectedModelVersionText());
+ labelsWidget.setModelName(defaultStore.getModelName());
+ labelsWidget.setSystemName(defaultStore.getSystemName());
+ }
+
+ private void storeValues() {
+ instanceStore.setDistributionTexts(labelsWidget.getDistributionTexts());
+ instanceStore.setSelectedDistributionText(labelsWidget
+ .getSelectedDistributionText());
+ instanceStore.setModelVersion(labelsWidget.getModelVersion());
+ instanceStore.setSystemVersion(labelsWidget.getSystemVersion());
+ instanceStore.setCopyrightText(labelsWidget.getCopyrightText());
+ instanceStore.setModelVersionTexts(labelsWidget.getModelVersionTexts());
+ instanceStore.setSelectedModelVersionText(labelsWidget
+ .getSelectedModelVersionText());
+ instanceStore.setModelName(labelsWidget.getModelName());
+ instanceStore.setSystemName(labelsWidget.getSystemName());
+ }
+
+ /**
+ * This method is called by the observed object when a change occurs to
+ * ensure the information entered into the widget is acceptable. In this
+ * case we set the page in error mode if validation of the model version
+ * text field or of the distribution text field fails.
+ *
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener#validModelDefined(ValidModelEvent)
+ **/
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+ Type eventType = event.getType();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+
+ if (eventType == Type.WARNING) {
+ setMessage(event.getMessage(), WARNING);
+ }
+ } else {
+ setErrorMessage(event.getMessage());
+ setMessage(null);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/ModelControlPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,165 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.ModelControlWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class ModelControlPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage, ValidModelDefinedListener {
+
+ private ModelControlWidget modelControlWidget;
+ private PersistentDataStore instanceStore;
+ private PersistentDataStore defaultStore;
+
+ public ModelControlPreferences() {
+ }
+
+ public ModelControlPreferences(String title) {
+ super(title);
+ }
+
+ public ModelControlPreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ modelControlWidget = new ModelControlWidget(composite, SWT.NONE);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ modelControlWidget.initialisePrintedDpi(defaultStore);
+ modelControlWidget.addModelListener(this);
+ populate(instanceStore);
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (modelControlWidget != null) {
+ modelControlWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("System Model Diagram model control.");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ // printedDpi field has already been initialised via the call to
+ // modelControlWidget.initialisePrintedDpi()
+ modelControlWidget.setHighlightCoreOS(dataStore.getHighlightCoreOS());
+ modelControlWidget.setLevelOfDetail(dataStore.getLevelOfDetail());
+ modelControlWidget.setSuppressMouseOverEffect(dataStore
+ .getSuppressMouseOverEffect());
+ modelControlWidget.setFixItemSize(dataStore.getFixItemSize());
+ }
+
+ private void restoreDefaults() {
+ modelControlWidget.setLevelOfDetail(defaultStore.getLevelOfDetail());
+ modelControlWidget.setPrintedDpis(defaultStore.getPrintedDpis());
+ modelControlWidget.setSelectedPrintedDpi(defaultStore
+ .getSelectedPrintedDpi());
+ modelControlWidget
+ .setHighlightCoreOS(defaultStore.getHighlightCoreOS());
+ modelControlWidget.setSuppressMouseOverEffect(defaultStore
+ .getSuppressMouseOverEffect());
+ modelControlWidget.setFixItemSize(defaultStore.getFixItemSize());
+ }
+
+ private void storeValues() {
+ instanceStore.setHighlightCoreOS(modelControlWidget
+ .getHighlightCoreOS());
+ instanceStore.setLevelOfDetail(modelControlWidget.getLevelOfDetail());
+ instanceStore.setPrintedDpis(modelControlWidget.getPrintedDpis());
+ instanceStore.setSelectedPrintedDpi(modelControlWidget
+ .getSelectedPrintedDpi());
+ instanceStore.setSuppressMouseOverEffect(modelControlWidget
+ .getSuppressMouseOverEffect());
+ instanceStore.setFixItemSize(modelControlWidget.getFixItemSize());
+ }
+
+ /**
+ * This method is called by the observed object when a change occurs to
+ * ensure the information entered into the widget is acceptable. In this
+ * case we set the page in error mode if validation of the printed DPI field
+ * fails.
+ *
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener#validModelDefined(ValidModelEvent)
+ **/
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+ Type eventType = event.getType();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+
+ if (eventType == Type.WARNING) {
+ setMessage(event.getMessage(), WARNING);
+ }
+ } else {
+ setErrorMessage(event.getMessage());
+ setMessage(null);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/ResourcesPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,216 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget;
+
+public class ResourcesPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private ResourcesWidget resourcesWidget;
+ private AbstractPersistentDataStore instanceStore;
+ private AbstractPersistentDataStore defaultStore;
+
+ public ResourcesPreferences() {
+ }
+
+ public ResourcesPreferences(String title) {
+ super(title);
+ }
+
+ public ResourcesPreferences(String title, ImageDescriptor image) {
+ super(title, image);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ resourcesWidget = new ResourcesWidget(composite, SWT.NONE);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+ defaultStore = new PersistentDataStore(defaultNode);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // All files
+ resourcesWidget.setBorderShapesFiles(instanceStore
+ .getBorderShapesFiles());
+ resourcesWidget.setBorderStylesFiles(instanceStore
+ .getBorderStylesFiles());
+ resourcesWidget.setColoursFiles(instanceStore.getColoursFiles());
+ resourcesWidget.setDependenciesFiles(instanceStore
+ .getDependenciesFiles());
+ resourcesWidget.setLevelsFiles(instanceStore.getLevelsFiles());
+ resourcesWidget.setLocalisationFiles(instanceStore
+ .getLocalisationFiles());
+ resourcesWidget.setPatternsFiles(instanceStore.getPatternsFiles());
+ resourcesWidget.setShapesFiles(instanceStore.getShapesFiles());
+ resourcesWidget.setSystemInfoFiles(instanceStore.getSystemInfoFiles());
+ resourcesWidget.setS12XmlFiles(instanceStore.getS12XmlFiles());
+
+ // Default files
+ resourcesWidget.setSelectedBorderShapesFiles(instanceStore
+ .getSelectedBorderShapesFiles());
+ resourcesWidget.setSelectedBorderStylesFiles(instanceStore
+ .getSelectedBorderStylesFiles());
+ resourcesWidget.setSelectedColoursFiles(instanceStore
+ .getSelectedColoursFiles());
+ resourcesWidget.setSelectedDependenciesFiles(instanceStore
+ .getSelectedDependenciesFiles());
+ resourcesWidget.setSelectedLevelsFiles(instanceStore
+ .getSelectedLevelsFiles());
+ resourcesWidget.setSelectedLocalisationFiles(instanceStore
+ .getSelectedLocalisationFiles());
+ resourcesWidget.setSelectedPatternsFiles(instanceStore
+ .getSelectedPatternsFiles());
+ resourcesWidget.setSelectedShapesFiles(instanceStore
+ .getSelectedShapesFiles());
+ resourcesWidget.setSelectedSystemInfoFiles(instanceStore
+ .getSelectedSystemInfoFiles());
+ resourcesWidget.setSelectedS12XmlFiles(instanceStore
+ .getSelectedS12XmlFiles());
+ composite.pack();
+ parent.pack();
+
+ return composite;
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("Location of configuration files used when building System Model Diagram.");
+ }
+
+ public void performDefaults() {
+ restoreDefaults();
+ }
+
+ public boolean performOk() {
+ storeValues();
+ return super.performOk();
+ }
+
+ private void restoreDefaults() {
+
+ // All files
+ resourcesWidget.setBorderShapesFiles(defaultStore
+ .getBorderShapesFiles());
+ resourcesWidget.setBorderStylesFiles(defaultStore
+ .getBorderStylesFiles());
+ resourcesWidget.setColoursFiles(defaultStore.getColoursFiles());
+ resourcesWidget.setDependenciesFiles(defaultStore
+ .getDependenciesFiles());
+ resourcesWidget.setLevelsFiles(defaultStore.getLevelsFiles());
+ resourcesWidget.setLocalisationFiles(defaultStore
+ .getLocalisationFiles());
+ resourcesWidget.setPatternsFiles(defaultStore.getPatternsFiles());
+ resourcesWidget.setShapesFiles(defaultStore.getShapesFiles());
+ resourcesWidget.setSystemInfoFiles(defaultStore.getSystemInfoFiles());
+ resourcesWidget.setS12XmlFiles(defaultStore.getS12XmlFiles());
+
+ // Default value
+ resourcesWidget.setSelectedBorderShapesFiles(defaultStore
+ .getSelectedBorderShapesFiles());
+ resourcesWidget.setSelectedBorderStylesFiles(defaultStore
+ .getSelectedBorderStylesFiles());
+ resourcesWidget.setSelectedColoursFiles(defaultStore
+ .getSelectedColoursFiles());
+ resourcesWidget.setSelectedDependenciesFiles(defaultStore
+ .getSelectedDependenciesFiles());
+ resourcesWidget.setSelectedLevelsFiles(defaultStore
+ .getSelectedLevelsFiles());
+ resourcesWidget.setSelectedLocalisationFiles(defaultStore
+ .getSelectedLocalisationFiles());
+ resourcesWidget.setSelectedPatternsFiles(defaultStore
+ .getSelectedPatternsFiles());
+ resourcesWidget.setSelectedShapesFiles(defaultStore
+ .getSelectedShapesFiles());
+ resourcesWidget.setSelectedSystemInfoFiles(defaultStore
+ .getSelectedSystemInfoFiles());
+ resourcesWidget.setSelectedS12XmlFiles(defaultStore
+ .getSelectedS12XmlFiles());
+ }
+
+ private void storeValues() {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ // All files
+ instanceStore.setBorderShapesFiles(resourcesWidget
+ .getBorderShapesFiles());
+ instanceStore.setBorderStylesFiles(resourcesWidget
+ .getBorderStylesFiles());
+ instanceStore.setColoursFiles(resourcesWidget.getColoursFiles());
+ instanceStore.setDependenciesFiles(resourcesWidget
+ .getDependenciesFiles());
+ instanceStore.setLevelsFiles(resourcesWidget.getLevelsFiles());
+ instanceStore.setLocalisationFiles(resourcesWidget
+ .getLocalisationFiles());
+ instanceStore.setPatternsFiles(resourcesWidget.getPatternsFiles());
+ instanceStore.setShapesFiles(resourcesWidget.getShapesFiles());
+ instanceStore.setSystemInfoFiles(resourcesWidget.getSystemInfoFiles());
+ instanceStore.setS12XmlFiles(resourcesWidget.getS12XmlFiles());
+
+ // Default value
+ instanceStore.setSelectedBorderShapesFiles(resourcesWidget
+ .getSelectedBorderShapesFiles());
+ instanceStore.setSelectedBorderStylesFiles(resourcesWidget
+ .getSelectedBorderStylesFiles());
+ instanceStore.setSelectedColoursFiles(resourcesWidget
+ .getSelectedColoursFiles());
+ instanceStore.setSelectedDependenciesFiles(resourcesWidget
+ .getSelectedDependenciesFiles());
+ instanceStore.setSelectedLevelsFiles(resourcesWidget
+ .getSelectedLevelsFiles());
+ instanceStore.setSelectedLocalisationFiles(resourcesWidget
+ .getSelectedLocalisationFiles());
+ instanceStore.setSelectedPatternsFiles(resourcesWidget
+ .getSelectedPatternsFiles());
+ instanceStore.setSelectedShapesFiles(resourcesWidget
+ .getSelectedShapesFiles());
+ instanceStore.setSelectedSystemInfoFiles(resourcesWidget
+ .getSelectedSystemInfoFiles());
+ instanceStore.setSelectedS12XmlFiles(resourcesWidget
+ .getSelectedS12XmlFiles());
+ }
+ };
+
+ BusyIndicator.showWhile(getShell().getDisplay(), runnable);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/SmmPreferences.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,39 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class SmmPreferences extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public static final String ID = "com.symbian.smt.gui.preferences";
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+ return null;
+ }
+
+ public void init(IWorkbench workbench) {
+ noDefaultAndApplyButton();
+ setDescription("Expand the tree to edit specific preferences for System Model Diagram.");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/preferences/SmmPreferencesInitializer.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,302 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.preferences;
+
+import static com.symbian.smt.gui.PersistentSettingsEnums.ADVANCED_OPTIONS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.BORDER_SHAPES_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.BORDER_SHAPES_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.BORDER_SHAPES_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.BORDER_STYLES_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.BORDER_STYLES_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.BORDER_STYLES_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.COLOURS_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.COLOURS_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.COLOURS_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.COPYRIGHT_TEXT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.DEPENDENCIES_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.DEPENDENCIES_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.DEPENDENCIES_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.DISTRIBUTION_TEXTS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.DISTRIBUTION_TEXT_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.DISTRIBUTION_TEXT_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.FILTER_HAS_ITEMS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.FILTER_ITEMS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.FIX_ITEM_SIZE;
+import static com.symbian.smt.gui.PersistentSettingsEnums.HIGHTLIGHT_CORE_OS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.IGNORE_ITEMS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LEVELS_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LEVELS_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LEVELS_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LEVEL_OF_DETAIL;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LOCALISATION_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LOCALISATION_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.LOCALISATION_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.MODEL_NAME;
+import static com.symbian.smt.gui.PersistentSettingsEnums.MODEL_VERSION;
+import static com.symbian.smt.gui.PersistentSettingsEnums.MODEL_VERSION_TEXTS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.MODEL_VERSION_TEXT_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.MODEL_VERSION_TEXT_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.OUTPUT_NAME;
+import static com.symbian.smt.gui.PersistentSettingsEnums.PATTERNS_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.PATTERNS_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.PATTERNS_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.PRINTED_DPIS;
+import static com.symbian.smt.gui.PersistentSettingsEnums.PRINTED_DPI_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.PRINTED_DPI_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.S12_XML_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.S12_XML_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.S12_XML_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SHAPES_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SHAPES_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SHAPES_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SUPPRESS_MOUSE_OVER_EFFECT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SYSTEM_INFO_FILES;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SYSTEM_INFO_FILES_DEFAULT;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SYSTEM_INFO_FILES_SELECTED;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SYSTEM_NAME;
+import static com.symbian.smt.gui.PersistentSettingsEnums.SYSTEM_VERSION;
+import static com.symbian.smt.gui.PersistentSettingsEnums.WARNING_LEVELS;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.Helper;
+
+public class SmmPreferencesInitializer extends AbstractPreferenceInitializer {
+
+ private static String smgFolder = ""; // The location of the System Model
+ // Generator
+ private final static String SEPARATOR = "|";
+
+ public SmmPreferencesInitializer() {
+ super();
+
+ final ResourceBundle resourceBundle = ResourceBundle.getBundle(
+ "location", Locale.getDefault(), this.getClass()
+ .getClassLoader());
+
+ smgFolder = resourceBundle.getString("location");
+ }
+
+ /**
+ * Returns the location of the System Model Generator. This method has been
+ * introduced for the benefit of the PDE unit tests.
+ *
+ * @return location of the System Model Generator
+ */
+ public String getSmgFolder() {
+ return smgFolder;
+ }
+
+ @Override
+ public void initializeDefaultPreferences() {
+
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ store
+ .setDefault(WARNING_LEVELS.toString(), WARNING_LEVELS
+ .getDefault());
+
+ store.setDefault(OUTPUT_NAME.toString(), OUTPUT_NAME.getDefault());
+
+ store
+ .setDefault(COPYRIGHT_TEXT.toString(), COPYRIGHT_TEXT
+ .getDefault());
+
+ store.setDefault(DISTRIBUTION_TEXT_SELECTED.toString(),
+ DISTRIBUTION_TEXT_SELECTED.getDefault());
+
+ store.setDefault(DISTRIBUTION_TEXTS.toString(), DISTRIBUTION_TEXTS
+ .getDefault());
+
+ store.setDefault(DISTRIBUTION_TEXT_DEFAULT.toString(),
+ DISTRIBUTION_TEXT_DEFAULT.getDefault());
+
+ store.setDefault(MODEL_NAME.toString(), MODEL_NAME.getDefault());
+
+ store.setDefault(MODEL_VERSION.toString(), MODEL_VERSION.getDefault());
+
+ store.setDefault(MODEL_VERSION_TEXT_SELECTED.toString(),
+ MODEL_VERSION_TEXT_SELECTED.getDefault());
+
+ store.setDefault(MODEL_VERSION_TEXTS.toString(), MODEL_VERSION_TEXTS
+ .getDefault());
+
+ store.setDefault(MODEL_VERSION_TEXT_DEFAULT.toString(),
+ MODEL_VERSION_TEXT_DEFAULT.getDefault());
+
+ store.setDefault(SYSTEM_NAME.toString(), SYSTEM_NAME.getDefault());
+
+ store
+ .setDefault(SYSTEM_VERSION.toString(), SYSTEM_VERSION
+ .getDefault());
+
+ String highlight = HIGHTLIGHT_CORE_OS.getDefault();
+
+ if (highlight.equals("on")) {
+ highlight = "true";
+ }
+
+ store.setDefault(HIGHTLIGHT_CORE_OS.toString(), new Boolean(highlight));
+
+ String makeModelStatic = SUPPRESS_MOUSE_OVER_EFFECT.getDefault();
+
+ if (makeModelStatic.equals("on")) {
+ makeModelStatic = "true";
+ }
+
+ String fixItemSize = FIX_ITEM_SIZE.getDefault();
+
+ if (fixItemSize.equals("on")) {
+ fixItemSize = "true";
+ }
+
+ store.setDefault(FIX_ITEM_SIZE.toString(), new Boolean(fixItemSize));
+
+ store.setDefault(SUPPRESS_MOUSE_OVER_EFFECT.toString(), new Boolean(
+ makeModelStatic));
+
+ store.setDefault(LEVEL_OF_DETAIL.toString(), LEVEL_OF_DETAIL
+ .getDefault());
+
+ store.setDefault(PRINTED_DPI_SELECTED.toString(), PRINTED_DPI_SELECTED
+ .getDefault());
+
+ store.setDefault(PRINTED_DPIS.toString(), PRINTED_DPIS.getDefault());
+
+ store.setDefault(PRINTED_DPI_DEFAULT.toString(), PRINTED_DPI_DEFAULT
+ .getDefault());
+
+ store.setDefault(FILTER_ITEMS.toString(), FILTER_ITEMS.getDefault());
+
+ store.setDefault(FILTER_HAS_ITEMS.toString(), FILTER_HAS_ITEMS
+ .getDefault());
+
+ store.setDefault(IGNORE_ITEMS.toString(), IGNORE_ITEMS.getDefault());
+
+ store.setDefault(SHAPES_FILES.toString(), prependPath(SHAPES_FILES
+ .getDefault()));
+
+ store.setDefault(LEVELS_FILES.toString(), prependPath(LEVELS_FILES
+ .getDefault()));
+
+ store.setDefault(LOCALISATION_FILES.toString(),
+ prependPath(LOCALISATION_FILES.getDefault()));
+
+ store.setDefault(DEPENDENCIES_FILES.toString(),
+ prependPath(DEPENDENCIES_FILES.getDefault()));
+
+ store.setDefault(SYSTEM_INFO_FILES.toString(),
+ prependPath(SYSTEM_INFO_FILES.getDefault()));
+
+ store.setDefault(COLOURS_FILES.toString(), prependPath(COLOURS_FILES
+ .getDefault()));
+
+ store.setDefault(BORDER_STYLES_FILES.toString(),
+ prependPath(BORDER_STYLES_FILES.getDefault()));
+
+ store.setDefault(BORDER_SHAPES_FILES.toString(),
+ prependPath(BORDER_SHAPES_FILES.getDefault()));
+
+ store.setDefault(PATTERNS_FILES.toString(), prependPath(PATTERNS_FILES
+ .getDefault()));
+
+ store.setDefault(S12_XML_FILES.toString(), prependPath(S12_XML_FILES
+ .getDefault()));
+
+ store.setDefault(SHAPES_FILES_SELECTED.toString(),
+ prependPath(SHAPES_FILES_SELECTED.getDefault()));
+
+ store.setDefault(LEVELS_FILES_SELECTED.toString(),
+ prependPath(LEVELS_FILES_SELECTED.getDefault()));
+
+ store.setDefault(LOCALISATION_FILES_SELECTED.toString(),
+ prependPath(LOCALISATION_FILES_SELECTED.getDefault()));
+
+ store.setDefault(DEPENDENCIES_FILES_SELECTED.toString(),
+ prependPath(DEPENDENCIES_FILES_SELECTED.getDefault()));
+
+ store.setDefault(SYSTEM_INFO_FILES_SELECTED.toString(),
+ prependPath(SYSTEM_INFO_FILES_SELECTED.getDefault()));
+
+ store.setDefault(COLOURS_FILES_SELECTED.toString(),
+ prependPath(COLOURS_FILES_SELECTED.getDefault()));
+
+ store.setDefault(BORDER_STYLES_FILES_SELECTED.toString(),
+ prependPath(BORDER_STYLES_FILES_SELECTED.getDefault()));
+
+ store.setDefault(BORDER_SHAPES_FILES_SELECTED.toString(),
+ prependPath(BORDER_SHAPES_FILES_SELECTED.getDefault()));
+
+ store.setDefault(PATTERNS_FILES_SELECTED.toString(),
+ prependPath(PATTERNS_FILES_SELECTED.getDefault()));
+
+ store.setDefault(S12_XML_FILES_SELECTED.toString(),
+ prependPath(S12_XML_FILES_SELECTED.getDefault()));
+
+ store.setDefault(SHAPES_FILES_DEFAULT.toString(),
+ prependPath(SHAPES_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(SHAPES_FILES_DEFAULT.toString(),
+ prependPath(SHAPES_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(LEVELS_FILES_DEFAULT.toString(),
+ prependPath(LEVELS_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(LOCALISATION_FILES_DEFAULT.toString(),
+ prependPath(LOCALISATION_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(DEPENDENCIES_FILES_DEFAULT.toString(),
+ prependPath(DEPENDENCIES_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(SYSTEM_INFO_FILES_DEFAULT.toString(),
+ prependPath(SYSTEM_INFO_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(COLOURS_FILES_DEFAULT.toString(),
+ prependPath(COLOURS_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(BORDER_STYLES_FILES_DEFAULT.toString(),
+ prependPath(BORDER_STYLES_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(BORDER_SHAPES_FILES_DEFAULT.toString(),
+ prependPath(BORDER_SHAPES_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(PATTERNS_FILES_DEFAULT.toString(),
+ prependPath(PATTERNS_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(S12_XML_FILES_DEFAULT.toString(),
+ prependPath(S12_XML_FILES_DEFAULT.getDefault()));
+
+ store.setDefault(ADVANCED_OPTIONS.toString(), ADVANCED_OPTIONS
+ .getDefault());
+ }
+
+ /**
+ * Adds the absolute location of the System Model Generator to the filenames
+ *
+ * @param filenames
+ * the String representing the "|" separated relative filenames
+ * @return the String representing the "|" separated absolute filenames
+ */
+ private String prependPath(String filenames) {
+ return Helper.relative2AbsolutePaths(filenames, smgFolder, SEPARATOR);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/print/PrintAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,40 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.print;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IEditorPart;
+
+import com.symbian.smt.gui.editors.svgeditor.SVGEditor;
+
+public class PrintAction extends Action {
+
+ private IEditorPart editor;
+
+ public PrintAction(String title) {
+ super(title);
+ }
+
+ public void run() {
+ if (editor instanceof SVGEditor) {
+ ((SVGEditor) editor).print();
+ }
+ }
+
+ public void setActiveEditor(IEditorPart editor) {
+ this.editor = editor;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/AdvancedOptionsProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,112 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.AdvancedOptionsWidget;
+
+/**
+ * This is the PropertyPage that handles the advanced command line options. It
+ * creates and presents the AdvancedOptionsWidget.
+ *
+ * @author barbararosi-schwartz
+ */
+public class AdvancedOptionsProperties extends PropertyPage implements
+ IWorkbenchPropertyPage {
+
+ private AdvancedOptionsWidget advancedOptionsWidget;
+ private PersistentDataStore projectStore;
+ private PersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ advancedOptionsWidget = new AdvancedOptionsWidget(composite, SWT.NONE);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ advancedOptionsWidget
+ .setAdvancedOptions(dataStore.getAdvancedOptions());
+ }
+
+ private void saveChanges() {
+ projectStore.setAdvancedOptions(advancedOptionsWidget
+ .getAdvancedOptions());
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/BuildControlProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,138 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.BuildControlWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+
+public class BuildControlProperties extends PropertyPage implements
+ IWorkbenchPropertyPage, ValidModelDefinedListener {
+
+ private BuildControlWidget buildWidget;
+ private PersistentDataStore projectStore;
+ private PersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ buildWidget = new BuildControlWidget(composite, SWT.NONE, false);
+ buildWidget.addModelListener(this);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (buildWidget != null) {
+ buildWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ public boolean isValid() {
+ return super.isValid();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ buildWidget.setOutputFilename(dataStore.getOutputFilename());
+ }
+
+ private void saveChanges() {
+ projectStore.setOutputFilename(buildWidget.getOutputFilename());
+ }
+
+ /**
+ * This is called by the observed object when a change is used to ensure the
+ * information entered into the widget is acceptable, in this case a non
+ * empty output file name with no illegal characters.
+ *
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener#validModelDefined(ValidModelEvent)
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(event.getMessage());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/FilterProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,101 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.FilterWidget;
+
+public class FilterProperties extends PropertyPage implements
+ IWorkbenchPropertyPage {
+
+ private FilterWidget filterWidget;
+ private PersistentDataStore projectStore;
+ private PersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ filterWidget = new FilterWidget(composite, SWT.NONE);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ filterWidget.setFilterItems(dataStore.getFilterHasItems());
+ }
+
+ private void saveChanges() {
+ projectStore.setFilterHasItems(filterWidget.getFilterItems());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/IgnoreProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,101 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.IgnoreWidget;
+
+public class IgnoreProperties extends PropertyPage implements
+ IWorkbenchPropertyPage {
+
+ private IgnoreWidget ignoreWidget;
+ private PersistentDataStore projectStore;
+ private PersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ ignoreWidget = new IgnoreWidget(composite, SWT.NONE);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ ignoreWidget.setIgnoreItems(dataStore.getIgnoreItems());
+ }
+
+ private void saveChanges() {
+ projectStore.setIgnoreItems(ignoreWidget.getIgnoreItems());
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/ModelControlProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,157 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.ModelControlWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class ModelControlProperties extends PropertyPage implements
+ IWorkbenchPropertyPage, ValidModelDefinedListener {
+
+ private ModelControlWidget modelControlWidget;
+ private PersistentDataStore projectStore;
+ private PersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ modelControlWidget = new ModelControlWidget(composite, SWT.NONE);
+ modelControlWidget.initialisePrintedDpi(projectStore);
+
+ modelControlWidget.addModelListener(this);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (modelControlWidget != null) {
+ modelControlWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ // printedDpi field has already been initialised via the call to
+ // modelControlWidget.initialisePrintedDpi()
+ modelControlWidget.setHighlightCoreOS(dataStore.getHighlightCoreOS());
+ modelControlWidget.setLevelOfDetail(dataStore.getLevelOfDetail());
+ modelControlWidget.setSuppressMouseOverEffect(dataStore
+ .getSuppressMouseOverEffect());
+ modelControlWidget.setFixItemSize(dataStore.getFixItemSize());
+ }
+
+ private void saveChanges() {
+ projectStore.setLevelOfDetail(modelControlWidget.getLevelOfDetail());
+ projectStore
+ .setHighlightCoreOS(modelControlWidget.getHighlightCoreOS());
+ projectStore.setSuppressMouseOverEffect(modelControlWidget
+ .getSuppressMouseOverEffect());
+ projectStore.setFixItemSize(modelControlWidget.getFixItemSize());
+ projectStore.setPrintedDpis(modelControlWidget.getPrintedDpis());
+ projectStore.setSelectedPrintedDpi(modelControlWidget
+ .getSelectedPrintedDpi());
+ }
+
+ /**
+ * This method is called by the observed object when a change occurs to
+ * ensure the information entered into the widget is acceptable. In this
+ * case we set the page in error mode if validation of the printed DPI field
+ * fails.
+ *
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener#validModelDefined(ValidModelEvent)
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+ Type eventType = event.getType();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+
+ if (eventType == Type.WARNING) {
+ setMessage(event.getMessage(), WARNING);
+ }
+ } else {
+ setErrorMessage(event.getMessage());
+ setMessage(null);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/ModelLabelProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,176 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ModelLabelsProperties.java
+//
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.ModelLabelsWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class ModelLabelProperties extends PropertyPage implements
+ IWorkbenchPropertyPage, ValidModelDefinedListener {
+
+ private ModelLabelsWidget modelLabelsWidget;
+ private PersistentDataStore projectStore;
+ private PersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ modelLabelsWidget = new ModelLabelsWidget(composite, SWT.NONE);
+
+ modelLabelsWidget.initialiseModelVersionText(projectStore);
+ modelLabelsWidget.initialiseDistributionText(projectStore);
+ modelLabelsWidget.addModelListener(this);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (modelLabelsWidget != null) {
+ modelLabelsWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ // Model Version Text and Distribution Text fields have already been
+ // initialised via the calls
+ // to modelLabelsWidget.initialiseModelVersionText() and
+ // modelLabelsWidget.initialiseDistributionText() respectively
+ modelLabelsWidget.setCopyrightText(dataStore.getCopyrightText());
+
+ modelLabelsWidget.setModelName(dataStore.getModelName());
+
+ modelLabelsWidget.setModelVersion(dataStore.getModelVersion());
+
+ modelLabelsWidget.setSystemName(dataStore.getSystemName());
+
+ modelLabelsWidget.setSystemVersion(dataStore.getSystemVersion());
+ }
+
+ private void saveChanges() {
+ projectStore.setCopyrightText(modelLabelsWidget.getCopyrightText());
+
+ projectStore.setDistributionTexts(modelLabelsWidget
+ .getDistributionTexts());
+ projectStore.setSelectedDistributionText(modelLabelsWidget
+ .getSelectedDistributionText());
+
+ projectStore.setModelName(modelLabelsWidget.getModelName());
+
+ projectStore.setModelVersion(modelLabelsWidget.getModelVersion());
+
+ projectStore.setModelVersionTexts(modelLabelsWidget
+ .getModelVersionTexts());
+ projectStore.setSelectedModelVersionText(modelLabelsWidget
+ .getSelectedModelVersionText());
+
+ projectStore.setSystemName(modelLabelsWidget.getSystemName());
+
+ projectStore.setSystemVersion(modelLabelsWidget.getSystemVersion());
+ }
+
+ /**
+ * This method is called by the observed object when a change occurs to
+ * ensure the information entered into the widget is acceptable. In this
+ * case we set the page in error mode if validation of the model version
+ * text field or of the distribution text field fails.
+ *
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener#validModelDefined(ValidModelEvent)
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+ Type eventType = event.getType();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+
+ if (eventType == Type.WARNING) {
+ setMessage(event.getMessage(), WARNING);
+ }
+ } else {
+ setErrorMessage(event.getMessage());
+ setMessage(null);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/ResourceProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,184 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.ManageResources;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.preferences.SmmPreferencesInitializer;
+import com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget;
+
+public class ResourceProperties extends PropertyPage implements
+ IWorkbenchPropertyPage {
+
+ private ResourcesWidget resourcesWidget;
+ private AbstractPersistentDataStore projectStore;
+ private AbstractPersistentDataStore instanceStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Initialise the default values
+ SmmPreferencesInitializer initialiser = new SmmPreferencesInitializer();
+ initialiser.initializeDefaultPreferences();
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the default scope data store
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ instanceStore = new PersistentDataStore(instanceNode, defaultNode);
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ resourcesWidget = new ResourcesWidget(composite, SWT.NONE);
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ populate(instanceStore);
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(AbstractPersistentDataStore dataStore) {
+
+ // All files
+ resourcesWidget.setBorderShapesFiles(dataStore.getBorderShapesFiles());
+ resourcesWidget.setBorderStylesFiles(dataStore.getBorderStylesFiles());
+ resourcesWidget.setColoursFiles(dataStore.getColoursFiles());
+ resourcesWidget.setDependenciesFiles(dataStore.getDependenciesFiles());
+ resourcesWidget.setLevelsFiles(dataStore.getLevelsFiles());
+ resourcesWidget.setLocalisationFiles(dataStore.getLocalisationFiles());
+ resourcesWidget.setPatternsFiles(dataStore.getPatternsFiles());
+ resourcesWidget.setShapesFiles(dataStore.getShapesFiles());
+ resourcesWidget.setSystemInfoFiles(dataStore.getSystemInfoFiles());
+ resourcesWidget.setS12XmlFiles(dataStore.getS12XmlFiles());
+
+ // Selected files
+ resourcesWidget.setSelectedBorderShapesFiles(dataStore
+ .getSelectedBorderShapesFiles());
+ resourcesWidget.setSelectedBorderStylesFiles(dataStore
+ .getSelectedBorderStylesFiles());
+ resourcesWidget.setSelectedColoursFiles(dataStore
+ .getSelectedColoursFiles());
+ resourcesWidget.setSelectedDependenciesFiles(dataStore
+ .getSelectedDependenciesFiles());
+ resourcesWidget.setSelectedLevelsFiles(dataStore
+ .getSelectedLevelsFiles());
+ resourcesWidget.setSelectedLocalisationFiles(dataStore
+ .getSelectedLocalisationFiles());
+ resourcesWidget.setSelectedPatternsFiles(dataStore
+ .getSelectedPatternsFiles());
+ resourcesWidget.setSelectedShapesFiles(dataStore
+ .getSelectedShapesFiles());
+ resourcesWidget.setSelectedSystemInfoFiles(dataStore
+ .getSelectedSystemInfoFiles());
+ resourcesWidget.setSelectedS12XmlFiles(dataStore
+ .getSelectedS12XmlFiles());
+ }
+
+ private void saveChanges() {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ // All files
+ projectStore.setBorderShapesFiles(resourcesWidget
+ .getBorderShapesFiles());
+ projectStore.setBorderStylesFiles(resourcesWidget
+ .getBorderStylesFiles());
+ projectStore.setColoursFiles(resourcesWidget.getColoursFiles());
+ projectStore.setDependenciesFiles(resourcesWidget
+ .getDependenciesFiles());
+ projectStore.setLevelsFiles(resourcesWidget.getLevelsFiles());
+ projectStore.setLocalisationFiles(resourcesWidget
+ .getLocalisationFiles());
+ projectStore.setPatternsFiles(resourcesWidget.getPatternsFiles());
+ projectStore.setShapesFiles(resourcesWidget.getShapesFiles());
+ projectStore.setSystemInfoFiles(resourcesWidget.getSystemInfoFiles());
+ projectStore.setS12XmlFiles(resourcesWidget.getS12XmlFiles());
+
+ // Add the folders and files to the project
+ ManageResources.updateShapesFiles(getProject(), resourcesWidget
+ .getSelectedShapesFiles());
+ ManageResources.updateLevelsFiles(getProject(), resourcesWidget
+ .getSelectedLevelsFiles());
+ ManageResources.updateLocalisationFiles(getProject(), resourcesWidget
+ .getSelectedLocalisationFiles());
+ ManageResources.updateDependenciesFiles(getProject(), resourcesWidget
+ .getSelectedDependenciesFiles());
+ ManageResources.updateSystemInfoFiles(getProject(), resourcesWidget
+ .getSelectedSystemInfoFiles());
+ ManageResources.updateColoursFiles(getProject(), resourcesWidget
+ .getSelectedColoursFiles());
+ ManageResources.updateBorderStylesFiles(getProject(), resourcesWidget
+ .getSelectedBorderStylesFiles());
+ ManageResources.updateBorderShapesFiles(getProject(), resourcesWidget
+ .getSelectedBorderShapesFiles());
+ ManageResources.updatePatternsFiles(getProject(), resourcesWidget
+ .getSelectedPatternsFiles());
+ ManageResources.updateS12XmlFiles(getProject(), resourcesWidget
+ .getSelectedS12XmlFiles());
+ }
+ };
+
+ BusyIndicator.showWhile(getShell().getDisplay(), runnable);
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/properties/SystemDefinitionFilesProperties.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,151 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// SystemDefinitionFiles.java
+//
+//
+
+package com.symbian.smt.gui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.ManageResources;
+import com.symbian.smt.gui.NodeListener;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.SystemDefinitionFilesWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelObservable;
+
+public class SystemDefinitionFilesProperties extends PropertyPage implements
+ IWorkbenchPropertyPage, ValidModelDefinedListener {
+ private SystemDefinitionFilesWidget systemDefinitionFilesWidget;
+ private PersistentDataStore projectStore;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ new NodeListener(getProject());
+
+ // Disable the restore defaults button
+ noDefaultAndApplyButton();
+
+ // Create the project scope data store
+ IScopeContext projectScope = new ProjectScope(this.getProject());
+ projectStore = new PersistentDataStore(projectScope
+ .getNode(Activator.PLUGIN_ID));
+
+ // Create the widget
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ systemDefinitionFilesWidget = new SystemDefinitionFilesWidget(
+ composite, SWT.NONE);
+
+ if (systemDefinitionFilesWidget instanceof ValidModelObservable) {
+ ((ValidModelObservable) systemDefinitionFilesWidget)
+ .addModelListener(this);
+ }
+
+ // Set required values
+ populate(projectStore);
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (systemDefinitionFilesWidget != null) {
+ ((ValidModelObservable) systemDefinitionFilesWidget)
+ .removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ private IProject getProject() {
+ return (IProject) getElement();
+ }
+
+ @Override
+ public boolean isValid() {
+ // return requiredInformationPresent;
+ return super.isValid();
+ }
+
+ @Override
+ protected void performApply() {
+ saveChanges();
+ }
+
+ @Override
+ protected void performDefaults() {
+ }
+
+ @Override
+ public boolean performOk() {
+ saveChanges();
+ return super.performOk();
+ }
+
+ private void populate(PersistentDataStore dataStore) {
+ systemDefinitionFilesWidget.setSystemDefinitions(dataStore
+ .getSystemDefinitionFiles());
+ }
+
+ private void saveChanges() {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ // Update the system definition files in the project
+ ManageResources.updateSystemDefinitionFiles(getProject(),
+ systemDefinitionFilesWidget.getSystemDefinitions(), false);
+
+ // Write to the persistent data store
+ projectStore.setSystemDefinitionFiles(systemDefinitionFilesWidget
+ .getSystemDefinitions());
+ }
+ };
+
+ BusyIndicator.showWhile(getShell().getDisplay(), runnable);
+ }
+
+ /**
+ * This is called by the observed object when a change is used to ensure the
+ * information entered into the widget is acceptable, in this case at least
+ * 1 system definition xml file
+ *
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener#validModelDefined(ValidModelEvent)
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+
+ setValid(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(event.getMessage());
+ }
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/AbstractMultipleEntriesWidgetAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,107 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+/**
+ * This is the parent of all actions that act on the command line options from
+ * the list of assigned options.
+ * <p>
+ * It caches the Button that is the presentation proxy for the action and
+ * manages the enabled state of the Button to be consistent with its own
+ * enablement state.
+ * </p>
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public abstract class AbstractMultipleEntriesWidgetAction extends
+ SelectionProviderAction {
+
+ protected Button actionProxy;
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * The constructor sets the text on the Button that is the visual proxy of
+ * this action and caches the button for later usage.
+ *
+ * @param text
+ * the text that represents both the name of the action and the
+ * label on the corresponding Button
+ * @param button
+ * the Button that acts as the visual proxy of this action.
+ */
+ public AbstractMultipleEntriesWidgetAction(ISelectionProvider provider,
+ String text, Button button) {
+ super(provider, text);
+
+ if (provider == null) {
+ throw new IllegalArgumentException(
+ "ISelectionProvider cannot be null.");
+ }
+
+ if (button == null) {
+ throw new IllegalArgumentException(
+ "Button proxy object cannot be null.");
+ }
+
+ this.selectionProvider = provider;
+ this.actionProxy = button;
+ actionProxy.setText(text);
+ }
+
+ /**
+ * The default implementation of this method does nothing.
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ /**
+ * The default implementation of this method does nothing.
+ */
+ @Override
+ public void run() {
+ super.run();
+ };
+
+ /**
+ * The default implementation of this method does nothing.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ super.selectionChanged(selection);
+ }
+
+ /**
+ * Sets the enablement state of the proxy Button to be the same as the
+ * enablement state of the action, the latter being managed by a call to
+ * super.setEnabled().
+ */
+ @Override
+ public final void setEnabled(boolean enabled) {
+ actionProxy.setEnabled(enabled);
+ super.setEnabled(enabled);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/AdvancedOptionsWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,783 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+import com.symbian.smt.gui.Helper;
+
+/**
+ * This widget contains all the functionality to handle assignment of generic
+ * command line parameters.
+ * <p>
+ * It allows to add, remove and edit command line options, as well as changing
+ * their order.
+ * </p>
+ * NB: This class is in need of refactoring using the common classes that are
+ * also being utilised in the ResourcesWidget class.
+ *
+ * @author barbararosi-schwartz
+ */
+public class AdvancedOptionsWidget extends Composite {
+
+ /**
+ * This is the parent of all actions that act on the command line options
+ * from the list of assigned options.
+ * <p>
+ * It caches the Button that is the presentation proxy for the action and
+ * manages the enabled state of the Button to be consistent with its own
+ * enablement state.
+ * </p>
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+ private abstract class AbstractOptionAction extends SelectionProviderAction {
+ protected Button actionProxy;
+
+ /**
+ * The constructor sets the text on the Button that is the visual proxy
+ * of this action and caches the button for later usage.
+ *
+ * @param text
+ * the text that represents both the name of the action and
+ * the label on the corresponding Button
+ * @param button
+ * the Button that acts as the visual proxy of this action.
+ */
+ private AbstractOptionAction(String text, Button button) {
+ super(viewer, text);
+
+ this.actionProxy = button;
+ actionProxy.setText(text);
+ }
+
+ /**
+ * The default implementation of this method does nothing.
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ /**
+ * The default implementation of this method does nothing.
+ */
+ @Override
+ public void run() {
+ super.run();
+ };
+
+ /**
+ * The default implementation of this method does nothing.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ super.selectionChanged(selection);
+ }
+
+ /**
+ * Sets the enablement state of the proxy Button to be the same as the
+ * enablement state of the action, the latter being managed by a call to
+ * super.setEnabled().
+ */
+ @Override
+ public final void setEnabled(boolean enabled) {
+ actionProxy.setEnabled(enabled);
+ super.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * This is the action that adds a new command line option to the list of
+ * assigned options.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+ private class AddOptionAction extends AbstractOptionAction {
+
+ /**
+ * The option that has been entered by the user or null if the user
+ * cancelled the operation.
+ */
+ private String newOption = null;
+
+ private AddOptionAction(Button button) {
+ super("Add...", button);
+ setEnabled(true);
+ }
+
+ /**
+ * Returns the option that was entered by the user.
+ *
+ * @return the option that was entered by the user (or null if the user
+ * cancelled the operation)
+ */
+ String getNewOption() {
+ return newOption;
+ }
+
+ /**
+ * Creates and displays an InputDialogWithWarning that collects the new
+ * option entered by the user. The dialog is equipped with a
+ * DialogInputValidator object that automatically performs validation on
+ * the user's input.
+ * <p>
+ * When the dialog is dismissed, the action changes the model to reflect
+ * the new addition.
+ * </p>
+ */
+ @Override
+ public void run() {
+ InputDialogWithWarning dialog = new InputDialogWithWarning(viewer
+ .getControl().getShell(), "Add Option",
+ "Please enter the required command-line option", "",
+ new DialogInputValidator());
+
+ int result = dialog.open();
+
+ if (result == Window.CANCEL) {
+ newOption = null;
+ return;
+ } else {
+ newOption = dialog.getValue().trim();
+
+ java.util.List<String> model = Helper
+ .toListOfStrings((String[]) viewer.getInput());
+ model.add(newOption);
+ setAdvancedOptions(Helper.toArrayOfStrings(model));
+ }
+ }
+
+ /**
+ * This action is always enabled.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ }
+ }
+
+ /**
+ * This is the content provider for the list of assigned command line
+ * options.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class AdvancedOptionsContentProvider implements
+ IStructuredContentProvider {
+
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ if (! (inputElement instanceof String[])) {
+ throw new IllegalArgumentException("Argument is not of type String[].");
+ }
+
+ String[] items = (String[]) inputElement;
+
+ return items;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ /**
+ * This is the label provider for the list of assigned command line options.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class AdvancedOptionsLabelProvider implements ILabelProvider {
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return element.toString();
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ }
+
+ /**
+ * This is the validator that is utilised by the InputDialogWithWarning
+ * presented by the AddOptionAction.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+ private class DialogInputValidator implements IInputValidatorWithWarning {
+
+ private java.util.List<String> listElements = new ArrayList<String>();
+
+ private DialogInputValidator() {
+ listElements = Helper.toListOfStrings((String[]) viewer.getInput());
+ }
+
+ /**
+ * User input is invalid if:
+ * <ol>
+ * <li>input is not empty</li>
+ * <li>input is already present in the list</li>
+ * </ol>
+ *
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ */
+ public String isValid(String newText) {
+ if (newText.trim().length() == 0) {
+ return "";
+ }
+
+ if (listElements.contains(newText.trim())) {
+ return "Option [" + newText + "] is already in the list.";
+ }
+
+ return null;
+ }
+
+ /**
+ * User input generates a warning if it is one of the options contained
+ * in the dangerousOptions list.
+ *
+ * @see com.symbian.smt.gui.smtwidgets.IInputValidatorWithWarning#isWarning(java.lang.String)
+ */
+ public String isWarning(String newText) {
+ if (dangerousOptions.contains(newText)) {
+ return "Warning: option [" + newText
+ + "] may cause the model build process to fail.";
+ }
+
+ return null;
+ }
+
+ }
+
+ /**
+ * This is the action that edits a command line option that already exists
+ * in the list of assigned options.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class EditOptionAction extends AbstractOptionAction {
+
+ private EditOptionAction(Button button) {
+ super("Edit...", button);
+ setEnabled(false);
+ }
+
+ /**
+ * Creates and displays an InputDialogWithWarning, initialised with the
+ * currently selected option. The dialog is equipped with a
+ * DialogInputValidator object that automatically performs validation on
+ * the user's input.
+ * <p>
+ * When the dialog is dismissed, the action changes the model to reflect
+ * the option modification.
+ * </p>
+ */
+ @Override
+ public void run() {
+ String initialValue = (String) ((StructuredSelection) getSelection())
+ .getFirstElement();
+ InputDialogWithWarning dialog = new InputDialogWithWarning(viewer
+ .getControl().getShell(), "Add Option",
+ "Please enter the required command-line option",
+ initialValue, new DialogInputValidator());
+
+ int result = dialog.open();
+ String editedOption = null;
+
+ if (result == Window.CANCEL) {
+ return;
+ } else {
+ editedOption = dialog.getValue().trim();
+
+ java.util.List<String> model = Helper
+ .toListOfStrings((String[]) viewer.getInput());
+ int index = model.indexOf(initialValue);
+ model.set(index, editedOption);
+ setAdvancedOptions(Helper.toArrayOfStrings(model));
+ }
+ }
+
+ /**
+ * Enabled if we have exactly one selection in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.size() != 1) {
+ setEnabled(false);
+ return;
+ }
+
+ setEnabled(true);
+ }
+ }
+
+ /**
+ * This is the action that moves a command line option down by one position
+ * in the list of assigned options.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class MoveOptionDownAction extends AbstractOptionAction {
+
+ /**
+ * The option that has been moved by the user
+ */
+ private String movedOption = null;
+
+ private MoveOptionDownAction(Button button) {
+ super("Move Down", button);
+ setEnabled(false);
+ }
+
+ /**
+ * Returns the option that was moved by the user.
+ *
+ * @return the option that was moved by the user
+ */
+ String getMovedOption() {
+ return movedOption;
+ }
+
+ /**
+ * Moves the selected option down by one position in the model.
+ */
+ @Override
+ public void run() {
+ movedOption = (String) ((StructuredSelection) getSelection())
+ .getFirstElement();
+ java.util.List<String> model = Helper
+ .toListOfStrings((String[]) viewer.getInput());
+ int oldIndex = model.indexOf(movedOption);
+ model.remove(oldIndex);
+ int newIndex = oldIndex + 1;
+ model.add(newIndex, movedOption);
+ setAdvancedOptions(Helper.toArrayOfStrings(model));
+ }
+
+ /**
+ * Enabled if the list has exactly one selection and if the selection is
+ * not the last element in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.size() != 1) {
+ setEnabled(false);
+ return;
+ }
+
+ boolean enabled = true;
+ String selectedElement = (String) selection.getFirstElement();
+ String lastElement = (String) viewer.getElementAt(viewer.getList()
+ .getItemCount() - 1);
+
+ if (lastElement != null && selectedElement.equals(lastElement)) {
+ enabled = false;
+ }
+
+ setEnabled(enabled);
+ }
+ }
+
+ /**
+ * This is the action that moves a command line option up by one position in
+ * the list of assigned options.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class MoveOptionUpAction extends AbstractOptionAction {
+
+ /**
+ * The option that has been moved by the user
+ */
+ private String movedOption = null;
+
+ private MoveOptionUpAction(Button button) {
+ super("Move Up", button);
+ setEnabled(false);
+ }
+
+ /**
+ * Returns the option that was moved by the user.
+ *
+ * @return the option that was moved by the user
+ */
+ String getMovedOption() {
+ return movedOption;
+ }
+
+ /**
+ * Moves the selected option down by one position in the model.
+ */
+ @Override
+ public void run() {
+ movedOption = (String) ((StructuredSelection) getSelection())
+ .getFirstElement();
+ java.util.List<String> model = Helper
+ .toListOfStrings((String[]) viewer.getInput());
+ int oldIndex = model.indexOf(movedOption);
+ model.remove(oldIndex);
+ int newIndex = oldIndex - 1;
+ model.add(newIndex, movedOption);
+ setAdvancedOptions(Helper.toArrayOfStrings(model));
+ }
+
+ /**
+ * Enabled if the list has exactly one selection and if the selection is
+ * not the first element in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.size() != 1) {
+ setEnabled(false);
+ return;
+ }
+
+ boolean enabled = true;
+ String selectedElement = (String) selection.getFirstElement();
+ String firstElement = (String) viewer.getElementAt(0);
+
+ if (firstElement != null && selectedElement.equals(firstElement)) {
+ enabled = false;
+ }
+
+ setEnabled(enabled);
+ }
+ }
+
+ /**
+ * This is the action that removes a command line option from the list of
+ * assigned options.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class RemoveOptionAction extends AbstractOptionAction {
+
+ private RemoveOptionAction(Button button) {
+ super("Remove", button);
+ setEnabled(false);
+ }
+
+ /**
+ * Removes the selected options from the model.
+ */
+ @Override
+ public void run() {
+ StructuredSelection ssel = (StructuredSelection) getSelection();
+ java.util.List<String> model = Helper
+ .toListOfStrings((String[]) viewer.getInput());
+
+ @SuppressWarnings("unchecked")
+ Iterator<String> iter = ssel.iterator();
+
+ while (iter.hasNext()) {
+ String to_be_removed = (String) iter.next();
+ model.remove(to_be_removed);
+ }
+
+ setAdvancedOptions(Helper.toArrayOfStrings(model));
+ }
+
+ /**
+ * Enabled if we have at least one selection in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ setEnabled(false);
+ return;
+ }
+
+ setEnabled(true);
+ }
+ }
+
+ /**
+ * The List of all command line options that may override values entered
+ * elsewhere.
+ */
+ private static final ArrayList<String> dangerousOptions = new ArrayList<String>();
+
+ static {
+ dangerousOptions.add("clean");
+ dangerousOptions.add("compress");
+ dangerousOptions.add("log");
+ dangerousOptions.add("model");
+ dangerousOptions.add("output");
+ dangerousOptions.add("tempdir");
+ }
+
+ /**
+ * The viewer associated with the List widget.
+ */
+ private ListViewer viewer;
+
+ /**
+ * Creates an AdvancedOptionsWidget composite object
+ *
+ * @return void
+ */
+ public AdvancedOptionsWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ this.setLayout(new FillLayout());
+
+ // The Composite that contains all widgets
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayoutComposite.setLayout(gridLayout);
+
+ final Label label = new Label(gridLayoutComposite, SWT.NONE);
+ GridData gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false,
+ 2, 1);
+
+ label.setText("Additional Command-Line Parameters");
+ label.setLayoutData(gd);
+
+ // The List that contains all assigned command line options
+ final List list = new List(gridLayoutComposite, SWT.BORDER
+ | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ gd.widthHint = 200;
+
+ list.setLayoutData(gd);
+
+ viewer = new ListViewer(list);
+
+ viewer.setContentProvider(new AdvancedOptionsContentProvider());
+ viewer.setLabelProvider(new AdvancedOptionsLabelProvider());
+
+ // The Composite that contains all buttons in a vertical stack
+ final Composite buttonsComposite = new Composite(gridLayoutComposite,
+ SWT.NONE);
+ final RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
+ rowLayout.spacing = 5;
+ rowLayout.wrap = false;
+ rowLayout.fill = true;
+
+ buttonsComposite.setLayout(rowLayout);
+
+ gd = new GridData(SWT.RIGHT, SWT.BEGINNING, false, true, 1, 1);
+ buttonsComposite.setLayoutData(gd);
+
+ // The "Add" button
+ final Button addOptionButton = new Button(buttonsComposite, SWT.NONE);
+ RowData rd = new RowData();
+ rd.width = 75;
+
+ addOptionButton.setLayoutData(rd);
+
+ // The action that backs the "Add" button
+ final AddOptionAction addOptionAction = new AddOptionAction(
+ addOptionButton);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refresh
+ // the List of assigned options and set the selection appropriately
+ addOptionButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ addOptionAction.run();
+ StructuredSelection oldSel = (StructuredSelection) viewer
+ .getSelection();
+ viewer.refresh();
+
+ String newOption = addOptionAction.getNewOption();
+ StructuredSelection newSel = (newOption == null) ? oldSel
+ : new StructuredSelection(newOption);
+
+ viewer.setSelection(newSel);
+ }
+ });
+
+ // The "Edit" button
+ final Button editOptionButton = new Button(buttonsComposite, SWT.NONE);
+ rd = new RowData();
+ rd.width = 75;
+
+ editOptionButton.setLayoutData(rd);
+
+ // The action that backs the "Edit" button
+ final EditOptionAction editOptionAction = new EditOptionAction(
+ editOptionButton);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refresh
+ // the List of assigned options and set the selection appropriately
+ editOptionButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ editOptionAction.run();
+ StructuredSelection oldSel = (StructuredSelection) viewer
+ .getSelection();
+
+ viewer.refresh();
+ viewer.setSelection(oldSel);
+ }
+ });
+
+ // The "Remove" button
+ final Button removeOptionButton = new Button(buttonsComposite, SWT.NONE);
+ rd = new RowData();
+ rd.width = 75;
+
+ removeOptionButton.setLayoutData(rd);
+
+ // The action that backs the "Remove" button
+ final RemoveOptionAction removeOptionAction = new RemoveOptionAction(
+ removeOptionButton);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refreshes the List of assigned options and set the selection
+ // appropriately
+ removeOptionButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ removeOptionAction.run();
+ viewer.refresh();
+
+ // If the viewer has at least one element, we set the current
+ // selection to that element.
+ Object firstElement = viewer.getElementAt(0);
+ StructuredSelection ssel = (firstElement == null) ? new StructuredSelection(
+ StructuredSelection.EMPTY)
+ : new StructuredSelection(firstElement);
+
+ viewer.setSelection(ssel);
+ }
+ });
+
+ // The "Move Up" button
+ final Button moveOptionUpButton = new Button(buttonsComposite, SWT.NONE);
+ rd = new RowData();
+ rd.width = 75;
+
+ moveOptionUpButton.setLayoutData(rd);
+
+ // The action that backs the "Move Up" button
+ final MoveOptionUpAction moveOptionUpAction = new MoveOptionUpAction(
+ moveOptionUpButton);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refreshes the List of assigned options and set the selection
+ // appropriately
+ moveOptionUpButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ moveOptionUpAction.run();
+ viewer.refresh();
+
+ StructuredSelection newSel = new StructuredSelection(
+ moveOptionUpAction.getMovedOption());
+
+ viewer.setSelection(newSel);
+ }
+ });
+
+ // The "Move Down" button
+ final Button moveOptionDownButton = new Button(buttonsComposite,
+ SWT.NONE);
+ rd = new RowData();
+ rd.width = 75;
+
+ moveOptionDownButton.setLayoutData(rd);
+
+ // The action that backs the "Move Down" button
+ final MoveOptionDownAction moveOptionDownAction = new MoveOptionDownAction(
+ moveOptionDownButton);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refreshes the List of assigned options and set the selection
+ // appropriately
+ moveOptionDownButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ moveOptionDownAction.run();
+ viewer.refresh();
+
+ StructuredSelection newSel = new StructuredSelection(
+ moveOptionDownAction.getMovedOption());
+
+ viewer.setSelection(newSel);
+ }
+ });
+ }
+
+ /**
+ * Returns the advanced options
+ *
+ * @return String[]
+ */
+ public String[] getAdvancedOptions() {
+ return (String[]) viewer.getInput();
+ }
+
+ /**
+ * Sets the advanced options
+ *
+ * @param options
+ * A list containing advanced options.
+ * @return void
+ */
+ public void setAdvancedOptions(String[] options) {
+ if (options != null) {
+ viewer.setInput(options);
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/BuildControlWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,212 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class BuildControlWidget extends Composite implements
+ ValidModelObservable {
+ private Text outputFilenameText;
+ private List<ValidModelDefinedListener> listeners = new ArrayList<ValidModelDefinedListener>();
+
+ private Button warningLevel1, warningLevel2, warningLevel3, warningLevel4;
+
+ // private String message;
+
+ private static final Pattern validationPattern = Pattern
+ .compile("[^:*?<>\"/\\\\|]*");
+
+ /**
+ * Creates a BuildControlWidget composite object
+ *
+ * @return void
+ */
+ public BuildControlWidget(final Composite parent, int style,
+ boolean allOptions) {
+ super(parent, style);
+
+ setLayout(new FillLayout());
+
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ gridLayoutComposite.setLayout(new GridLayout(2, false));
+
+ final Label outputFilenameLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ outputFilenameLabel.setText("Output filename");
+
+ outputFilenameText = new Text(gridLayoutComposite, SWT.BORDER);
+ outputFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ true, false));
+
+ outputFilenameText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkIfValid();
+ }
+ });
+
+ if (allOptions) {
+ Group group = new Group(gridLayoutComposite, SWT.SHADOW_ETCHED_IN);
+ group.setText("Warning level");
+ group.setLayout(new RowLayout(SWT.VERTICAL));
+ group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false,
+ 2, 1));
+
+ warningLevel1 = new Button(group, SWT.RADIO);
+ warningLevel1.setText("Errors only");
+ warningLevel2 = new Button(group, SWT.RADIO);
+ warningLevel2.setText("Errors and warnings");
+ warningLevel3 = new Button(group, SWT.RADIO);
+ warningLevel3.setText("Verbose");
+ warningLevel4 = new Button(group, SWT.RADIO);
+ warningLevel4.setText("Debug (note: will increase build times)");
+ }
+ }
+
+ /**
+ * Registers a listener object, which will be notified if the conditions for
+ * proceeding have been met.
+ *
+ * @param listener
+ * A ValidModelDefinedListener object
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#addModelListener(ValidModelDefinedListener)
+ */
+ public void addModelListener(ValidModelDefinedListener listener) {
+ listeners.add(listener);
+ }
+
+ // Check that at least one system definition file has been specified. Any
+ // registered
+ // model listeners are notified with a ValidModelEvent.
+ private void checkIfValid() {
+ if (listeners.size() > 0) {
+ String text = outputFilenameText.getText().trim();
+ String message = "";
+ boolean valid = true;
+ Type type = Type.SUCCESS;
+
+ if (text.length() == 0) {
+ valid = false;
+ message = "Filename must be specified.";
+ type = Type.ERROR;
+ }
+
+ Matcher matcher = validationPattern.matcher(text);
+ matcher.reset();
+
+ if (!matcher.matches()) {
+ valid = false;
+ message = "Forbidden characters in output filename.";
+ type = Type.ERROR;
+ }
+
+ ValidModelEvent event = new ValidModelEvent(valid, message, type);
+
+ for (ValidModelDefinedListener listener : listeners) {
+ listener.validModelDefined(event);
+ }
+ }
+ }
+
+ /**
+ * This method is for testing purposes only.
+ *
+ * @return
+ */
+ public List<ValidModelDefinedListener> getModelListeners() {
+ List<ValidModelDefinedListener> l;
+
+ synchronized (listeners) {
+ l = new ArrayList<ValidModelDefinedListener>(listeners);
+ }
+
+ return l;
+ }
+
+ public String getOutputFilename() {
+
+ String entry = outputFilenameText.getText().trim();
+
+ if (entry.length() > 0) {
+ if (!entry.endsWith(".svg")) {
+ return entry + ".svg";
+ }
+ }
+
+ return entry;
+ }
+
+ public String getWarningLevel() {
+ if (warningLevel1.getSelection()) {
+ return "1";
+ } else if (warningLevel2.getSelection()) {
+ return "2";
+ } else if (warningLevel3.getSelection()) {
+ return "3";
+ } else if (warningLevel4.getSelection()) {
+ return "4";
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#removeModelListener(ValidModelDefinedListener)
+ */
+ public void removeModelListener(ValidModelDefinedListener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ public void setOutputFilename(String arg) {
+ outputFilenameText.setText(arg);
+ }
+
+ public void setWarningLevel(String arg) {
+ if ("1".equals(arg)) {
+ warningLevel1.setSelection(true);
+ } else if ("2".equals(arg)) {
+ warningLevel2.setSelection(true);
+ } else if ("3".equals(arg)) {
+ warningLevel3.setSelection(true);
+ } else if ("4".equals(arg)) {
+ warningLevel4.setSelection(true);
+ }
+ }
+
+ // public String getMessage() {
+ // return message;
+ // }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/FilterWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,226 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+
+public class FilterWidget extends Composite {
+ private Text text = null;
+ private List list;
+ private Button modifyButton;
+
+ /**
+ * Creates a FilterWidget composite object
+ *
+ * @return void
+ */
+ public FilterWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ this.setLayout(new FillLayout());
+
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayoutComposite.setLayout(gridLayout);
+
+ list = new List(gridLayoutComposite, SWT.BORDER);
+ final GridData gd_list = new GridData(SWT.FILL, SWT.FILL, true, true,
+ 2, 1);
+ gd_list.widthHint = 439;
+ list.setLayoutData(gd_list);
+ list.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ int index = list.getSelectionIndex();
+
+ if (index != -1) {
+ String filterSelected = list.getItem(index);
+ text.setText(filterSelected);
+ text.setFocus();
+ modifyButton.setEnabled(true);
+ }
+ }
+ });
+
+ final Label filterLabel = new Label(gridLayoutComposite, SWT.NONE);
+ filterLabel.setText("Filter");
+
+ text = new Text(gridLayoutComposite, SWT.BORDER);
+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ text.setFocus();
+ text.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (text.getText().length() == 0) {
+ modifyButton.setEnabled(false);
+ }
+ }
+ });
+
+ final Composite buttonsComposite = new Composite(gridLayoutComposite,
+ SWT.NONE);
+ final RowLayout rowLayout = new RowLayout();
+ rowLayout.spacing = 30;
+ rowLayout.justify = true;
+ buttonsComposite.setLayout(rowLayout);
+ final GridData gd_buttonsComposite = new GridData(SWT.CENTER, SWT.FILL,
+ true, false, 2, 1);
+ buttonsComposite.setLayoutData(gd_buttonsComposite);
+
+ final Button addFilterButton = new Button(buttonsComposite, SWT.NONE);
+ final RowData rd_addFilterButton = new RowData();
+ rd_addFilterButton.width = 75;
+ addFilterButton.setLayoutData(rd_addFilterButton);
+ addFilterButton.setText("Add");
+ addFilterButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // Adds the text entered in the filter text to the list of
+ // filter items
+ String filter = text.getText().trim();
+
+ if (filter.length() > 0) {
+ // Check that text has been entered and that it does not
+ // already exist in the table
+ Boolean doesExistInList = false;
+
+ for (String s : list.getItems()) {
+ if (s.equals(filter)) {
+ doesExistInList = true;
+ }
+ }
+
+ if (!doesExistInList) {
+ // If it doesn't exist in the table then add it and
+ // clear the text box
+ list.add(filter);
+ text.setText("");
+ modifyButton.setEnabled(false);
+ } else {
+ MessageDialog
+ .openError(
+ parent.getShell(),
+ "Error",
+ filter
+ + " already exists in the list of filters.");
+ }
+ }
+
+ text.setFocus();
+ }
+ });
+
+ final Button removeFilterButton = new Button(buttonsComposite, SWT.NONE);
+ final RowData rd_removeFilterButton = new RowData();
+ rd_removeFilterButton.width = 75;
+ removeFilterButton.setLayoutData(rd_removeFilterButton);
+ removeFilterButton.setText("Remove");
+ removeFilterButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ int listIndex = list.getSelectionIndex();
+
+ if (listIndex != -1) {
+ // If an item has been selected in the table then remove it
+ list.remove(listIndex);
+ text.setText("");
+ modifyButton.setEnabled(false);
+ } else {
+ MessageDialog.openInformation(parent.getShell(), "Info",
+ "You need to select an item to remove.");
+ }
+
+ text.setFocus();
+ }
+ });
+
+ modifyButton = new Button(buttonsComposite, SWT.NONE);
+ final RowData rd_modifyButton = new RowData();
+ rd_modifyButton.width = 75;
+ modifyButton.setLayoutData(rd_modifyButton);
+ modifyButton.setText("Modify");
+ modifyButton.setEnabled(false);
+ modifyButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // Modifies a table entry in place
+ int index = list.getSelectionIndex();
+
+ String filter = text.getText().trim();
+
+ if (filter.length() > 0) {
+ // Check filter text has been entered
+ Boolean doesExistInList = false;
+
+ for (String s : list.getItems()) {
+ // Check that the entry doesn't already exist in the
+ // table
+ if (s.equals(filter)) {
+ doesExistInList = true;
+ }
+ }
+
+ if (!doesExistInList) {
+ // If it doesn't already exist in the table then add it
+ list.remove(index);
+ list.add(filter, index);
+ text.setText("");
+ modifyButton.setEnabled(false);
+ }
+ }
+
+ text.setFocus();
+ }
+ });
+ }
+
+ /**
+ * Returns the filter items
+ *
+ * @return String[]
+ */
+ public String[] getFilterItems() {
+ return list.getItems();
+ }
+
+ /**
+ * Sets the filter items
+ *
+ * @param filterItems
+ * A list containing filters.
+ * @return void
+ */
+ public void setFilterItems(String[] filterItems) {
+ if (filterItems != null)
+ list.setItems(filterItems);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/IFileInputValidator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,52 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// IFileInputValidator
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+
+/**
+ * This is an extension of the IInputValidator interface which caters for
+ * validation of local files and URLs.
+ * <p>
+ * While isValid() is invoked dynamically as the user types his input (as per
+ * the standard IInputValidator interface), the methods
+ * <code>isFileReadable()</code> and <code>isUrlResourceReadable</code> defined
+ * by this interface are invoked when the user presses the dialog's OK button,
+ * as these operations may take longer to execute.
+ * <p>
+ * The third method, <code>isUrl()</code>, is a utility method that determines
+ * whether a given String is a URL or a simple file path.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public interface IFileInputValidator extends IInputValidator {
+
+ // The unconventional method signature follows the pattern of
+ // IInputValidator's isValid() method.
+ public String isFileReadable(String filePath);
+
+ // The unconventional method signature follows the pattern of
+ // IInputValidator's isValid() method.
+ public boolean isUrl(String filePath) throws InvalidPathException;
+
+ // The unconventional method signature follows the pattern of
+ // IInputValidator's isValid() method.
+ public String isUrlResourceReadable(String urlPath);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/IInputValidatorWithWarning.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,49 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+
+/**
+ * An extension of the IInputValidator interface that is equipped to also handle
+ * warnings. While the superinterface method <code>isValid()</code> determines
+ * whether user input is ok or in error, this interface's <code>isWarning</code>
+ * method determines whether the user input is produces a non disabling warning.
+ * <p>
+ * For an example of usage, see class InputDialogWithWarning.
+ * </p>
+ *
+ * @author barbararosi-schwartz
+ * @see com.symbian.smt.gui.smtwidgets.InputDialogWithWarning
+ */
+public interface IInputValidatorWithWarning extends IInputValidator {
+ /**
+ * Determines whether or not the given string should produce a non-disabling
+ * warning. Returns a warning message to display if the new text is invalid.
+ * Returns <code>null</code> if there is no warning.
+ *
+ * The unconventional method signature follows the pattern of
+ * IInputValidator's isValid() method.
+ *
+ * @param newText
+ * the text to check for validity
+ *
+ * @return a warning message or <code>null</code> if no warning
+ */
+ public String isWarning(String newText);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/IXmlFileInputValidator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,47 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// IXmlFileInputValidator
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+/**
+ * This is an extension of the IFileInputValidator interface which caters for
+ * validation of XML files
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public interface IXmlFileInputValidator extends IFileInputValidator {
+
+ /**
+ * Determines whether or not the file identified by the provided path
+ * is a valid XML resource. Returns a message to display if validation
+ * fails.
+ * <p>
+ * Returns <code>null</code> if validation succeeds.
+ * <p>
+ * The unconventional method signature follows the pattern of
+ * IInputValidator's isValid() method.
+ *
+ * @param filePath
+ * the String representing the path to the file to
+ * be validated.
+ *
+ * @return a message or <code>null</code> if no validation error
+ */
+ public String isXmlValid(String filePath);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/IgnoreWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,293 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public class IgnoreWidget extends Composite {
+ private Combo itemTypeCombo;
+ private Text itemNameText;
+ private Table ignoreItemsTable;
+ private Button modifyButton;
+
+ /**
+ * Creates an IgnoreWidget composite object
+ *
+ * @return void
+ */
+ public IgnoreWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ this.setLayout(new FillLayout());
+
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 4;
+ gridLayoutComposite.setLayout(gridLayout);
+
+ ignoreItemsTable = new Table(gridLayoutComposite, SWT.FULL_SELECTION
+ | SWT.BORDER);
+ ignoreItemsTable.setHeaderVisible(true);
+ ignoreItemsTable.setLinesVisible(true);
+ final GridData gd_ignoreItemsTable = new GridData(SWT.FILL, SWT.FILL,
+ true, true, 4, 1);
+ ignoreItemsTable.setLayoutData(gd_ignoreItemsTable);
+ ignoreItemsTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // When an item in the table is selected populate the item type
+ // combo and the
+ // item name text with the relevant information
+ TableItem itemSelected = ignoreItemsTable
+ .getItem(ignoreItemsTable.getSelectionIndex());
+
+ int index = 0;
+
+ for (String item : itemTypeCombo.getItems()) {
+ if (item.equals(itemSelected.getText(0))) {
+ itemTypeCombo.select(index);
+ }
+ index++;
+ }
+
+ itemNameText.setText(itemSelected.getText(1));
+ itemNameText.setFocus();
+ modifyButton.setEnabled(true);
+ }
+ });
+
+ final TableColumn itemTypeTableColumn = new TableColumn(
+ ignoreItemsTable, SWT.NONE);
+ itemTypeTableColumn.setWidth(100);
+ itemTypeTableColumn.setText("Item Type");
+
+ final TableColumn itemNameTableColumn = new TableColumn(
+ ignoreItemsTable, SWT.NONE);
+ itemNameTableColumn.setWidth(269);
+ itemNameTableColumn.setText("Item Name");
+
+ final Label itemTypeLabel = new Label(gridLayoutComposite, SWT.NONE);
+ itemTypeLabel.setText("Item Type");
+
+ itemTypeCombo = new Combo(gridLayoutComposite, SWT.READ_ONLY);
+ itemTypeCombo.setLayoutData(new GridData());
+ itemTypeCombo.setItems(new String[] { "layer", "block", "subblock",
+ "collection", "component" });
+ itemTypeCombo.select(0);
+
+ final Label itemNameLabel = new Label(gridLayoutComposite, SWT.NONE);
+ itemNameLabel.setLayoutData(new GridData());
+ itemNameLabel.setText("Item Name");
+
+ itemNameText = new Text(gridLayoutComposite, SWT.BORDER);
+ final GridData gd_itemNameText = new GridData(SWT.FILL, SWT.CENTER,
+ true, false);
+ itemNameText.setLayoutData(gd_itemNameText);
+ itemNameText.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (itemNameText.getText().length() == 0) {
+ modifyButton.setEnabled(false);
+ }
+ }
+ });
+
+ final Composite buttonsComposite = new Composite(gridLayoutComposite,
+ SWT.NONE);
+ final GridData gd_buttonsComposite = new GridData(SWT.CENTER,
+ SWT.CENTER, false, false, 4, 1);
+ buttonsComposite.setLayoutData(gd_buttonsComposite);
+ final RowLayout rowLayout = new RowLayout();
+ rowLayout.spacing = 30;
+ buttonsComposite.setLayout(rowLayout);
+
+ final Button addButton = new Button(buttonsComposite, SWT.NONE);
+ addButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // Check to see if an item had been selected and item text has
+ // been entered
+ if (itemTypeCombo.getText().length() > 0
+ && itemNameText.getText().trim().length() > 0) {
+
+ // Check that combination of type and text doesn't already
+ // exist in the table
+ Boolean alreadyExistsInTable = false;
+
+ for (TableItem item : ignoreItemsTable.getItems()) {
+ if (item.getText(0).equals(itemTypeCombo.getText())
+ && item.getText(1).equalsIgnoreCase(
+ itemNameText.getText().trim())) {
+ alreadyExistsInTable = true;
+ }
+ }
+
+ // Add to the table if does not already exist
+ if (!alreadyExistsInTable) {
+ final TableItem newItemTableItem = new TableItem(
+ ignoreItemsTable, SWT.BORDER);
+ newItemTableItem.setText(0, itemTypeCombo.getText());
+ newItemTableItem.setText(1, itemNameText.getText());
+
+ // Clear the text entry
+ itemNameText.setText("");
+ modifyButton.setEnabled(false);
+ } else {
+ MessageDialog
+ .openError(
+ parent.getShell(),
+ "Error",
+ itemTypeCombo.getText()
+ + " "
+ + itemNameText.getText()
+ + " already exists in the list of items to ignore.");
+ }
+ }
+
+ itemNameText.setFocus();
+ }
+ });
+
+ final RowData rd_addButton = new RowData();
+ rd_addButton.width = 75;
+ addButton.setLayoutData(rd_addButton);
+ addButton.setText("Add");
+
+ final Button removeButton = new Button(buttonsComposite, SWT.NONE);
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ if (ignoreItemsTable.getSelectionIndex() >= 0) {
+ ignoreItemsTable.remove(ignoreItemsTable
+ .getSelectionIndex());
+
+ // Clear the text entry
+ itemNameText.setText("");
+ modifyButton.setEnabled(false);
+ } else {
+ MessageDialog
+ .openInformation(parent.getShell(), "Info",
+ "You need to select an item from the list before you can remove it.");
+ }
+
+ itemNameText.setFocus();
+ }
+ });
+
+ final RowData rd_removeButton = new RowData();
+ rd_removeButton.width = 75;
+ removeButton.setLayoutData(rd_removeButton);
+ removeButton.setText("Remove");
+
+ modifyButton = new Button(buttonsComposite, SWT.NONE);
+ modifyButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // Check to see if an item had been selected and item text has
+ // been entered
+ if (itemNameText.getText().length() > 0) {
+
+ // Check that combination of type and text doesn't already
+ // exist in the table
+ Boolean alreadyExistsInTable = false;
+
+ for (TableItem item : ignoreItemsTable.getItems()) {
+ if (item.getText(0).equals(itemTypeCombo.getText())
+ && item.getText(1).equals(
+ itemNameText.getText())) {
+ alreadyExistsInTable = true;
+ }
+ }
+
+ // Add to the table if does not already exist
+ if (!alreadyExistsInTable) {
+ TableItem itemSelected = ignoreItemsTable
+ .getItem(ignoreItemsTable.getSelectionIndex());
+
+ itemSelected.setText(0, itemTypeCombo.getText());
+ itemSelected.setText(1, itemNameText.getText());
+
+ // Clear the text entry
+ itemNameText.setText("");
+ modifyButton.setEnabled(false);
+ }
+ }
+
+ itemNameText.setFocus();
+ }
+ });
+
+ final RowData rd_modifyButton = new RowData();
+ rd_modifyButton.width = 75;
+ modifyButton.setLayoutData(rd_modifyButton);
+ modifyButton.setText("Modify");
+ modifyButton.setEnabled(false);
+ }
+
+ /**
+ * Returns a list of the ignore items
+ *
+ * @return List<String>
+ */
+ public List<String[]> getIgnoreItems() {
+ ArrayList<String[]> ignoreItems = new ArrayList<String[]>();
+
+ for (TableItem item : ignoreItemsTable.getItems()) {
+ String[] itemData = { item.getText(0), item.getText(1) };
+ ignoreItems.add(itemData);
+ }
+
+ return ignoreItems;
+ }
+
+ /**
+ * Sets the ignore items
+ *
+ * @param ignoreItems
+ * An ArrayList containing 2 element lists. The first element
+ * contains the item type and the second element contains the
+ * item text.
+ * @return void
+ */
+ public void setIgnoreItems(List<String[]> ignoreItems) {
+ ignoreItemsTable.removeAll();
+ for (String[] ignoreItem : ignoreItems) {
+ final TableItem newItemTableItem = new TableItem(ignoreItemsTable,
+ SWT.BORDER);
+ newItemTableItem.setText(0, ignoreItem[0]);
+ newItemTableItem.setText(1, ignoreItem[1]);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/InputDialogWithWarning.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,111 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This specialisation of the InputDialog class is equipped to handle warnings
+ * as well as errors in user input. Warnings are messages that need to be
+ * displayed in the dialog but do not require disablement of buttons.
+ * <p>
+ * This dialog makes use of the specialised validator interface
+ * IInputValidatorWithWarning.
+ * </p>
+ *
+ * @author barbararosi-schwartz
+ * @see com.symbian.smt.gui.smtwidgets.IInputValidatorWithWarning
+ */
+public class InputDialogWithWarning extends InputDialog {
+
+ /**
+ * The object that handles validation
+ */
+ private IInputValidatorWithWarning validator;
+
+ public InputDialogWithWarning(Shell parentShell, String dialogTitle,
+ String dialogMessage, String initialValue,
+ IInputValidatorWithWarning validator) {
+ super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
+
+ this.validator = validator;
+ }
+
+ /**
+ * After invoking the superclass <code>setErrorMessage()</code> method, this
+ * method ensures that the dialog's OK button, if present, is enabled.
+ * <p>
+ * The warning message will be automatically presented by the superclass.
+ * </p>
+ *
+ * @param warningMessage
+ * the warning message, or <code>null</code> if no warning is
+ * required
+ */
+ public void setWarningMessage(String warningMessage) {
+ super.setErrorMessage(warningMessage);
+
+ Control button = getButton(IDialogConstants.OK_ID);
+
+ if (button != null) {
+ button.setEnabled(true);
+ }
+ }
+
+ /**
+ * Validates the input.
+ * <p>
+ * Delegates the request to the supplied input validator object.
+ * </p>
+ * <p>
+ * If it finds the input invalid, the error message is displayed in the
+ * dialog's message line and the dialog's OK button is disabled.
+ * </p>
+ * <p>
+ * If it finds the input valid (i.e. no error), it checks with the validator
+ * if the input requires a warning message and, if so, the warning message
+ * is displayed in the dialog's message line but no disabling of the button
+ * occurs.
+ * </p>
+ * <p>
+ * This hook method is called whenever the text changes in the input field.
+ * </p>
+ */
+ @Override
+ protected void validateInput() {
+ String errorMessage = null;
+ String warningMessage = null;
+
+ if (validator != null) {
+ String newText = getText().getText();
+ errorMessage = validator.isValid(newText);
+
+ if (errorMessage == null) {
+ warningMessage = validator.isWarning(newText);
+
+ setWarningMessage(warningMessage);
+ } else {
+ setErrorMessage(errorMessage);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/InvalidPathException.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,64 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// InvalidPathException
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class InvalidPathException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Default constructor
+ */
+ public InvalidPathException() {
+ }
+
+ /**
+ * This constructor takes a message as the exception message.
+ *
+ * @param message
+ */
+ public InvalidPathException(String message) {
+ super(message);
+ }
+
+ /**
+ * This constructor takes a message as the exception message
+ * and wraps the provided Throwable.
+ *
+ * @param message the String to be set as the exception message
+ * @param t the Throwable that is wrapped by this exception
+ */
+ public InvalidPathException(String message, Throwable t) {
+ super(message, t);
+ }
+
+ /**
+ * This constructor takes wraps the provided Throwable.
+ *
+ * @param t the Throwable that is wrapped by this exception
+ */
+ public InvalidPathException(Throwable t) {
+ super(t);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/ModelControlWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,449 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class ModelControlWidget extends Composite implements
+ ValidModelObservable {
+ private Combo levelOfDetailCombo;
+ private Combo printedDpiCombo;
+ private Button highlightCoreOsButton;
+ private Button suppressMouseOverEffectButton;
+ private Button fixItemSizeButton;
+ private Label fixedItemSizeLabel;
+ private Label suppressMouseOverEffectsLabel;
+ private Label printedDpiLabel;
+
+ private ArrayList<ValidModelDefinedListener> listeners = new ArrayList<ValidModelDefinedListener>();
+
+ /**
+ * Creates a ModelControlWidget composite object
+ *
+ * @return void
+ */
+ public ModelControlWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ this.setLayout(new FillLayout());
+
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.verticalSpacing = 10;
+ gridLayout.horizontalSpacing = 20;
+ gridLayout.numColumns = 2;
+ gridLayoutComposite.setLayout(gridLayout);
+
+ final Label levelOfDetailLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ levelOfDetailLabel.setText("Level of Detail");
+
+ levelOfDetailCombo = new Combo(gridLayoutComposite, SWT.READ_ONLY);
+ GridData data = new GridData(200, SWT.DEFAULT);
+ data.horizontalAlignment = SWT.LEFT;
+ levelOfDetailCombo.setLayoutData(data);
+ levelOfDetailCombo.setItems(new String[] { "layer", "block",
+ "subblock", "collection", "component" });
+
+ printedDpiLabel = new Label(gridLayoutComposite, SWT.NONE);
+ printedDpiLabel.setText("Printed Resolution (DPI)");
+
+ printedDpiCombo = new Combo(gridLayoutComposite, SWT.NONE);
+ data = new GridData(50, SWT.DEFAULT);
+ data.horizontalAlignment = SWT.LEFT;
+
+ printedDpiCombo.setLayoutData(data);
+
+ final Label highlightCoreOs = new Label(gridLayoutComposite, SWT.NONE);
+ highlightCoreOs.setText("Highlight Core OS");
+
+ highlightCoreOsButton = new Button(gridLayoutComposite, SWT.CHECK);
+
+ suppressMouseOverEffectsLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ suppressMouseOverEffectsLabel.setText("Suppress Mouseover Effects");
+
+ suppressMouseOverEffectButton = new Button(gridLayoutComposite,
+ SWT.CHECK);
+
+ fixedItemSizeLabel = new Label(gridLayoutComposite, SWT.NONE);
+ fixedItemSizeLabel.setText("Fix Items Size");
+
+ fixItemSizeButton = new Button(gridLayoutComposite, SWT.CHECK);
+ }
+
+ /**
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#addModelListener(ValidModelDefinedListener)
+ */
+ public void addModelListener(ValidModelDefinedListener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ private void checkDpi() {
+ if (listeners.size() > 0) {
+ Boolean modelDefined = true;
+ String message = "";
+ Type type = Type.SUCCESS;
+
+ String text = printedDpiCombo.getText().trim();
+
+ if (text.length() > 0) {
+ try {
+ Integer i = new Integer(text);
+
+ if (i < 0) {
+ throw new NumberFormatException();
+ }
+ } catch (NumberFormatException nfe) {
+ modelDefined = false;
+ message = "The DPI value must be a positive integer less than 2147483648 or empty.";
+ type = Type.ERROR;
+ }
+ }
+
+ ValidModelEvent event = new ValidModelEvent(modelDefined, message,
+ type);
+
+ for (ValidModelDefinedListener listener : listeners) {
+ listener.validModelDefined(event);
+ }
+ }
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the fixedItemSizeLabel
+ */
+ public Label getFixedItemSizeLabel() {
+ return fixedItemSizeLabel;
+ }
+
+ /**
+ * Returns a Boolean indicating if the Fix Items Size button has been
+ * selected
+ *
+ * @return Boolean
+ */
+ public Boolean getFixItemSize() {
+ return fixItemSizeButton.getSelection();
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the fixItemSizeButton
+ */
+ public Button getFixItemSizeButton() {
+ return fixItemSizeButton;
+ }
+
+ /**
+ * Returns a boolean value indicating if the Highlight Core OS button has
+ * been selected
+ *
+ * @return Boolean
+ */
+ public Boolean getHighlightCoreOS() {
+ return highlightCoreOsButton.getSelection();
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the highlightCoreOsButton
+ */
+ public Button getHighlightCoreOsButton() {
+ return highlightCoreOsButton;
+ }
+
+ /**
+ * Returns the level of detail
+ *
+ * @return String
+ */
+ public String getLevelOfDetail() {
+ return levelOfDetailCombo.getText();
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the levelOfDetailCombo
+ */
+ public Combo getLevelOfDetailCombo() {
+ return levelOfDetailCombo;
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the listeners
+ */
+ public ArrayList<ValidModelDefinedListener> getListeners() {
+ return listeners;
+ }
+
+ /**
+ * This method is for testing purposes only.
+ *
+ * @return
+ */
+ public List<ValidModelDefinedListener> getModelListeners() {
+ List<ValidModelDefinedListener> l;
+
+ synchronized (listeners) {
+ l = new ArrayList<ValidModelDefinedListener>(listeners);
+ }
+
+ return l;
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the printedDpiCombo
+ */
+ public Combo getPrintedDpiCombo() {
+ return printedDpiCombo;
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the printedDpiLabel
+ */
+ public Label getPrintedDpiLabel() {
+ return printedDpiLabel;
+ }
+
+ /**
+ * Returns the printed DPI values. We need to take into account both the
+ * list items and the item that the user may have typed in. We also need to
+ * make sure that all items in the pulldown are sorted.
+ *
+ * @return String the list of all current DPI values, including the one that
+ * the user may have typed in.
+ */
+ public String[] getPrintedDpis() {
+ Collection<Integer> c = new HashSet<Integer>();
+ List<String> items = Helper.toListOfStrings(printedDpiCombo.getItems());
+
+ for (String item : items) {
+ c.add(new Integer(item));
+ }
+
+ String text = printedDpiCombo.getText().trim();
+
+ if (text.length() > 0) {
+ if (!items.contains(text)) {
+ c.add(new Integer(text));
+ }
+ }
+
+ Integer[] allNumbers = new Integer[c.size()];
+ List<Integer> sortedNumbers = sort(c.toArray(allNumbers));
+ List<String> dpis = new ArrayList<String>();
+
+ for (Integer number : sortedNumbers) {
+ dpis.add(number.toString());
+ }
+
+ return dpis.toArray(new String[dpis.size()]);
+ }
+
+ /**
+ * Returns the selected printed DPI value
+ *
+ * @return String
+ */
+ public String getSelectedPrintedDpi() {
+ return printedDpiCombo.getText();
+ }
+
+ /**
+ * Returns a boolean value indicating if the Suppress Mouseover Effects
+ * button has been selected
+ *
+ * @return Boolean
+ */
+ public Boolean getSuppressMouseOverEffect() {
+ return suppressMouseOverEffectButton.getSelection();
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the suppressMouseOverEffectButton
+ */
+ public Button getSuppressMouseOverEffectButton() {
+ return suppressMouseOverEffectButton;
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the suppressMouseOverEffectsLabel
+ */
+ public Label getSuppressMouseOverEffectsLabel() {
+ return suppressMouseOverEffectsLabel;
+ }
+
+ public void initialisePrintedDpi(PersistentDataStore store) {
+ printedDpiCombo.setItems(store.getPrintedDpis());
+ printedDpiCombo.setText(store.getSelectedPrintedDpi());
+
+ printedDpiCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkDpi();
+ }
+ });
+ }
+
+ /**
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#removeModelListener(ValidModelDefinedListener)
+ */
+ public void removeModelListener(ValidModelDefinedListener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ /**
+ * Sets the value for the Fix Items Size button
+ *
+ * @param fixItemSize
+ * Boolean indicating if the Fix Items Size is to be used when
+ * generating the diagram
+ * @return void
+ */
+ public void setFixItemSize(Boolean fixItemSize) {
+ fixItemSizeButton.setSelection(fixItemSize);
+ }
+
+ /**
+ * Sets the value for the Highlight Core OS button
+ *
+ * @param HighlightCoreOS
+ * Boolean value indicating if the Core OS section is to be
+ * highlighted
+ * @return void
+ */
+ public void setHighlightCoreOS(Boolean HighlightCoreOS) {
+ highlightCoreOsButton.setSelection(HighlightCoreOS);
+ }
+
+ /**
+ * Sets the level of detail
+ *
+ * @param level
+ * The level of detail to set.
+ * @return void
+ */
+ public void setLevelOfDetail(String level) {
+ String[] items = levelOfDetailCombo.getItems();
+ int index = 0;
+
+ for (String item : items) {
+ if (item.equals(level)) {
+ break;
+ }
+ index++;
+ }
+
+ levelOfDetailCombo.select(index);
+ }
+
+ /**
+ * Sets the printed DPI values
+ *
+ * @param dpi
+ * The DPI values to populate the combo box with.
+ * @return void
+ */
+ public void setPrintedDpis(String[] dpis) {
+ printedDpiCombo.setItems(dpis);
+ }
+
+ /**
+ * Sets the selected printed DPI value
+ *
+ * @param dpi
+ * The DPI value to set as selected.
+ * @return void
+ */
+ public void setSelectedPrintedDpi(String dpi) {
+ String[] items = printedDpiCombo.getItems();
+ int index = 0;
+
+ for (String item : items) {
+ if (item.equals(dpi)) {
+ break;
+ }
+
+ index++;
+ }
+
+ printedDpiCombo.select(index);
+ }
+
+ /**
+ * Sets the value for the Suppress Mouseover Effects button
+ *
+ * @param suppressMouseOverEffect
+ * Boolean value indicating if the Suppress Mouseover Effects is
+ * it be used when generating the diagram
+ * @return void
+ */
+ public void setSuppressMouseOverEffect(Boolean suppressMouseOverEffect) {
+ suppressMouseOverEffectButton.setSelection(suppressMouseOverEffect);
+ }
+
+ private List<Integer> sort(Integer[] numbers) {
+ ArrayList<Integer> al = new ArrayList<Integer>();
+
+ for (int i = 0; i < numbers.length; i++) {
+ al.add(i, (numbers[i]));
+ }
+
+ List<Integer> list = Collections.synchronizedList(al);
+ Collections.sort(list);
+
+ return list;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/ModelLabelsWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,449 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class ModelLabelsWidget extends Composite implements
+ ValidModelObservable {
+ private Combo distributionTextCombo;
+ private Text modelVersionText;
+ private Text systemVersionText;
+ private Text copyrightTextText;
+ private Combo modelVersionTextCombo;
+ private Text modelNameText;
+ private Text systemNameText;
+ private ArrayList<ValidModelDefinedListener> listeners = new ArrayList<ValidModelDefinedListener>();
+
+ /**
+ * Creates a ModelLabelsWidget composite object
+ *
+ * @return void
+ */
+ public ModelLabelsWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ this.setLayout(new FillLayout());
+
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 4;
+ gridLayoutComposite.setLayout(gridLayout);
+
+ final Label systemNameLabel = new Label(gridLayoutComposite, SWT.NONE);
+ systemNameLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
+ false));
+ systemNameLabel.setText("System Name");
+
+ systemNameText = new Text(gridLayoutComposite, SWT.BORDER);
+ systemNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
+ false));
+
+ final Label systemVersionLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ systemVersionLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ false, false));
+ systemVersionLabel.setText("System Version");
+
+ systemVersionText = new Text(gridLayoutComposite, SWT.BORDER);
+ systemVersionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ true, false));
+
+ final Label modelNameLabel = new Label(gridLayoutComposite, SWT.NONE);
+ modelNameLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
+ false));
+ modelNameLabel.setText("Model Name");
+
+ modelNameText = new Text(gridLayoutComposite, SWT.BORDER);
+ modelNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
+ false));
+
+ final Label modelVersionLabel = new Label(gridLayoutComposite, SWT.NONE);
+ modelVersionLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ false, false));
+ modelVersionLabel.setText("Model Version");
+
+ modelVersionText = new Text(gridLayoutComposite, SWT.BORDER);
+ modelVersionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
+ false));
+
+ final Label modelVersionTextLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ modelVersionTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ false, false));
+ modelVersionTextLabel.setText("Model Version Text");
+
+ modelVersionTextCombo = new Combo(gridLayoutComposite, SWT.NONE);
+ modelVersionTextCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ true, false));
+
+ final Label distributionTextLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ distributionTextLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
+ false, false));
+ distributionTextLabel.setText("Distribution Text");
+
+ distributionTextCombo = new Combo(gridLayoutComposite, SWT.NONE);
+ distributionTextCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ true, false));
+
+ final Label copyrightTextLabel = new Label(gridLayoutComposite,
+ SWT.NONE);
+ copyrightTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ false, false));
+ copyrightTextLabel.setText("Copyright Text");
+
+ copyrightTextText = new Text(gridLayoutComposite, SWT.BORDER);
+ copyrightTextText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ true, false));
+ }
+
+ /**
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#addModelListener(ValidModelDefinedListener)
+ */
+ public void addModelListener(ValidModelDefinedListener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ private void checkDistributionText() {
+ if (listeners.size() > 0) {
+ Boolean modelDefined = true;
+ String message = "";
+ Type type = Type.SUCCESS;
+
+ String text = distributionTextCombo.getText().trim();
+
+ if (text.length() > 0) {
+ // TODO:BRS:Specify any validation here, such as what to do with
+ // the empty string
+ // if (xxx) {
+ // modelDefined = false;
+ // message =
+ // "";
+ // type = Type.ERROR;
+ // }
+ }
+
+ ValidModelEvent event = new ValidModelEvent(modelDefined, message,
+ type);
+
+ for (ValidModelDefinedListener listener : listeners) {
+ listener.validModelDefined(event);
+ }
+ }
+ }
+
+ private void checkModelVersionText() {
+ if (listeners.size() > 0) {
+ Boolean modelDefined = true;
+ String message = "";
+ Type type = Type.SUCCESS;
+
+ String text = modelVersionTextCombo.getText().trim();
+
+ if (text.length() > 0) {
+ // TODO:BRS:Specify any validation here, such as what to do with
+ // the empty string
+ // if (xxx) {
+ // modelDefined = false;
+ // message =
+ // "";
+ // type = Type.ERROR;
+ // }
+ }
+
+ ValidModelEvent event = new ValidModelEvent(modelDefined, message,
+ type);
+
+ for (ValidModelDefinedListener listener : listeners) {
+ listener.validModelDefined(event);
+ }
+ }
+ }
+
+ /**
+ * Returns the copyright text
+ *
+ * @return String
+ */
+ public String getCopyrightText() {
+ return copyrightTextText.getText();
+ }
+
+ /**
+ * Returns the distribution text values
+ *
+ * @return String[]
+ */
+ public String[] getDistributionTexts() {
+ List<String> items = Helper.toListOfStrings(distributionTextCombo
+ .getItems());
+ String text = distributionTextCombo.getText().trim();
+
+ if (text.length() > 0) {
+ if (!items.contains(text)) {
+ items.add(0, text);
+ }
+ }
+
+ return items.toArray(new String[items.size()]);
+ }
+
+ /**
+ * Returns the model name
+ *
+ * @return String
+ */
+ public String getModelName() {
+ return modelNameText.getText();
+ }
+
+ /**
+ * Returns the text for the model version
+ *
+ * @return String
+ */
+ public String getModelVersion() {
+ return modelVersionText.getText();
+ }
+
+ /**
+ * Returns the model version text values
+ *
+ * @return String[]
+ */
+ public String[] getModelVersionTexts() {
+ List<String> items = Helper.toListOfStrings(modelVersionTextCombo
+ .getItems());
+ String text = modelVersionTextCombo.getText().trim();
+
+ if (text.length() > 0) {
+ if (!items.contains(text)) {
+ items.add(0, text);
+ }
+ }
+
+ return items.toArray(new String[items.size()]);
+ }
+
+ /**
+ * Returns the selected distribution text value
+ *
+ * @return String
+ */
+ public String getSelectedDistributionText() {
+ return distributionTextCombo.getText();
+ }
+
+ /**
+ * Returns the selected model version text value
+ *
+ * @return String
+ */
+ public String getSelectedModelVersionText() {
+ return modelVersionTextCombo.getText();
+ }
+
+ /**
+ * Returns the system name
+ *
+ * @return String
+ */
+ public String getSystemName() {
+ return systemNameText.getText();
+ }
+
+ /**
+ * Returns the text for the system version
+ *
+ * @return String
+ */
+ public String getSystemVersion() {
+ return systemVersionText.getText();
+ }
+
+ public void initialiseDistributionText(PersistentDataStore store) {
+ distributionTextCombo.setItems(store.getDistributionTexts());
+ distributionTextCombo.setText(store.getSelectedDistributionText());
+
+ distributionTextCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkDistributionText();
+ }
+ });
+ }
+
+ public void initialiseModelVersionText(PersistentDataStore store) {
+ modelVersionTextCombo.setItems(store.getModelVersionTexts());
+ modelVersionTextCombo.setText(store.getSelectedModelVersionText());
+
+ modelVersionTextCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkModelVersionText();
+ }
+ });
+ }
+
+ /**
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#removeModelListener(ValidModelDefinedListener)
+ */
+ public void removeModelListener(ValidModelDefinedListener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ /**
+ * Sets the text for the copyright text
+ *
+ * @param copyrightText
+ * String to be used for the copyright text
+ * @return void
+ */
+ public void setCopyrightText(String copyrightText) {
+ copyrightTextText.setText(copyrightText);
+ }
+
+ /**
+ * Sets the values for the distribution text combo
+ *
+ * @param distributionText
+ * String array to be used for the distribution text values
+ * @return void
+ */
+ public void setDistributionTexts(String[] distributionTexts) {
+ distributionTextCombo.setItems(distributionTexts);
+ }
+
+ /**
+ * Sets the text for the model name
+ *
+ * @param modelName
+ * String to be used for the model name
+ * @return void
+ */
+ public void setModelName(String modelName) {
+ modelNameText.setText(modelName);
+ }
+
+ /**
+ * Sets the text for the model version
+ *
+ * @param modelVersion
+ * String to be used for the model version
+ * @return void
+ */
+ public void setModelVersion(String modelVersion) {
+ modelVersionText.setText(modelVersion);
+ }
+
+ /**
+ * Sets the items for the model version text combo
+ *
+ * @param modelVersionTexts
+ * values of the model version text
+ * @return void
+ */
+ public void setModelVersionTexts(String[] modelVersionTexts) {
+ modelVersionTextCombo.setItems(modelVersionTexts);
+ }
+
+ /**
+ * Sets the selected distribution text value
+ *
+ * @param distributionText
+ * The distribution text value to set as selected.
+ * @return void
+ */
+ public void setSelectedDistributionText(String distributionText) {
+ String[] items = distributionTextCombo.getItems();
+ int index = 0;
+
+ for (String item : items) {
+ if (item.equals(distributionText)) {
+ break;
+ }
+
+ index++;
+ }
+
+ distributionTextCombo.select(index);
+ }
+
+ /**
+ * Sets the selected model version text value
+ *
+ * @param modelVersionText
+ * The model version text value to set as selected.
+ * @return void
+ */
+ public void setSelectedModelVersionText(String modelVersionText) {
+ String[] items = modelVersionTextCombo.getItems();
+ int index = 0;
+
+ for (String item : items) {
+ if (item.equals(modelVersionText)) {
+ break;
+ }
+
+ index++;
+ }
+
+ modelVersionTextCombo.select(index);
+ }
+
+ /**
+ * Sets the text for the system name
+ *
+ * @param systemName
+ * String to be used for the system name
+ * @return void
+ */
+ public void setSystemName(String systemName) {
+ systemNameText.setText(systemName);
+ }
+
+ /**
+ * Sets the text for the system version
+ *
+ * @param systemVersion
+ * String to be used for the system version
+ * @return void
+ */
+ public void setSystemVersion(String systemVersion) {
+ systemVersionText.setText(systemVersion);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/SystemDefinitionFileSelectionValidator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,246 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.XmlFileValidator;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class SystemDefinitionFileSelectionValidator extends
+ XmlFileValidator implements IXmlFileInputValidator {
+
+ private List<String> sysdefFilenames;
+ private InputStream urlInputStream;
+
+ public SystemDefinitionFileSelectionValidator(List<String> filenames) {
+ super();
+
+ this.sysdefFilenames = filenames;
+ }
+
+ private void closeInputStream() {
+ if (urlInputStream != null) {
+ try {
+ urlInputStream.close();
+ } catch (IOException ignore) {
+ Logger.log(ignore.getMessage(), ignore);
+ }
+ urlInputStream = null;
+ }
+ }
+
+ protected Document createDocument(final String filePath)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory
+ .newInstance();
+ domFactory.setNamespaceAware(true);
+ domFactory.setValidating(false);
+
+ DocumentBuilder builder = domFactory.newDocumentBuilder();
+
+ ErrorHandler errorHandler = new ErrorHandler() {
+ public void error(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+
+ public void fatalError(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+
+ public void warning(SAXParseException exception)
+ throws SAXParseException {
+ throw exception;
+ }
+ };
+
+ builder.setErrorHandler(errorHandler);
+ Document doc = null;
+
+ try {
+ if (isUrl(filePath)) {
+ if (urlInputStream != null) {
+ doc = builder.parse(urlInputStream);
+ closeInputStream();
+ }
+ } else {
+ doc = builder.parse(filePath);
+ }
+ } catch (InvalidPathException e) {
+ // This cannot happen as it has already been checked while the user
+ // was typing in
+ }
+
+ return doc;
+ }
+
+ private String isFilePathValid(String filePath) {
+ return isFileReadable(filePath);
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IFileInputValidator#isFileReadable(java.lang.String)
+ */
+ public String isFileReadable(String filePath) {
+ String errorMessage = null;
+ File inFile = new File(filePath);
+
+ if (!inFile.canRead()) {
+ return "Selected file cannot be read.";
+ }
+
+ return errorMessage;
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IFileInputValidator#isUrl(java.lang.String)
+ */
+ public boolean isUrl(String filePath) throws InvalidPathException {
+ int index = filePath.indexOf(':');
+
+ if (index == -1 || index == 1) {
+ return false;
+ } else if (index > 1) {
+ return true;
+ } else {
+ throw new InvalidPathException("Unexpected file path format.");
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IFileInputValidator#isUrlResourceReadable(java.lang.String)
+ */
+ public String isUrlResourceReadable(String filePath) {
+ String errorMessage = null;
+
+ try {
+ URL fileURL = new URL(filePath.trim());
+ URLConnection connection = fileURL.openConnection();
+ String contentType = connection.getContentType();
+
+ if (contentType == null) {
+ return "System definition resource at specified URL cannot be read.";
+ }
+
+ if (!contentType.endsWith("xml")) {
+ return "Specified URL is not an XML document.";
+ }
+
+ urlInputStream = connection.getInputStream();
+
+ if (urlInputStream == null) {
+ errorMessage = "System definition resource at specified URL cannot be read.";
+ }
+ } catch (IllegalArgumentException e) {
+ closeInputStream();
+ errorMessage = "System definition resource at specified URL cannot be read.";
+ } catch (MalformedURLException e) {
+ closeInputStream();
+ errorMessage = "Specified URL is not a valid URL.";
+ } catch (IOException e) {
+ closeInputStream();
+ errorMessage = "System definition resource at specified URL cannot be reached.";
+ }
+
+ return errorMessage;
+ }
+
+ private String isUrlValid(String url) {
+ String errorMessage = null;
+
+ try {
+ URL inputUrl = new URL(url);
+ inputUrl.openConnection();
+ } catch (MalformedURLException e) {
+ closeInputStream();
+ errorMessage = "Specified URL is not a valid URL.";
+ } catch (IOException e) {
+ closeInputStream();
+ errorMessage = "Resource at specified URL cannot be reached.";
+ }
+
+ return errorMessage;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ */
+ public String isValid(String filePath) {
+ if (filePath == null || filePath.length() == 0) {
+ return "";
+ } else {
+ return validateResourceWhileUserTypes(filePath);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IXmlFileInputValidator#isXmlValid(java.lang.String)
+ */
+ public String isXmlValid(String filePath) {
+ return validateXml(filePath);
+ }
+
+ private String validateResourceWhileUserTypes(String filePath) {
+ String errorMessage = null;
+
+ // First check path is not UNC
+ if (filePath.startsWith(File.separator)) {
+ return "UNC paths are not compatible with the System Model Manager";
+ }
+
+ // Then check that filename (path) is not duplicate
+ // by checking name against table
+ if ((sysdefFilenames != null) && (sysdefFilenames.contains(filePath))) {
+ return "The selected file has already been assigned.";
+ }
+
+ // Then check that path is appropriate
+ try {
+ if (isUrl(filePath)) {
+ errorMessage = isUrlValid(filePath);
+ } else {
+ errorMessage = isFilePathValid(filePath);
+ }
+ } catch (InvalidPathException e) {
+ errorMessage = e.getMessage();
+ }
+
+ return errorMessage;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/SystemDefinitionFilesWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,306 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
+
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent.Type;
+
+public class SystemDefinitionFilesWidget extends Composite implements
+ ValidModelObservable {
+ private List systemDefinitionFilesList = null;
+ private ArrayList<ValidModelDefinedListener> listeners = new ArrayList<ValidModelDefinedListener>();
+
+ /**
+ * Creates a SystemDefinitionFilesWidget composite object
+ *
+ * @return void
+ */
+ public SystemDefinitionFilesWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ this.setLayout(new FillLayout());
+ this.setRedraw(true);
+
+ final Composite compositeMainGridLayout = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ compositeMainGridLayout.setLayout(gridLayout);
+
+ systemDefinitionFilesList = new List(compositeMainGridLayout,
+ SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ systemDefinitionFilesList.setBackground(Display.getCurrent()
+ .getSystemColor(SWT.COLOR_WHITE));
+ final GridData gd_list = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd_list.widthHint = 271;
+ systemDefinitionFilesList.setLayoutData(gd_list);
+
+ systemDefinitionFilesList.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ CheckRequiredInformationPresent();
+ }
+ });
+
+ final Composite compositeUpDownButtons = new Composite(
+ compositeMainGridLayout, SWT.NONE);
+ final GridData gd_compositeUpDownButtons = new GridData();
+ compositeUpDownButtons.setLayoutData(gd_compositeUpDownButtons);
+ compositeUpDownButtons.setLayout(new RowLayout(SWT.VERTICAL));
+
+ final Button upButton = new Button(compositeUpDownButtons, SWT.FLAT);
+ final RowData rd_upButton = new RowData();
+ rd_upButton.height = 26;
+ rd_upButton.width = 26;
+ upButton.setLayoutData(rd_upButton);
+ upButton.setImage(getUpArrowImage());
+ upButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // Reorder the system definition files in the list by swapping
+ // the item
+ // selected with the item above
+ int index = systemDefinitionFilesList.getSelectionIndex();
+
+ if (index != -1 && index - 1 >= 0) {
+ String item = systemDefinitionFilesList.getItem(index);
+ String itemAbove = systemDefinitionFilesList
+ .getItem(index - 1);
+
+ systemDefinitionFilesList.setItem(index - 1, item);
+ systemDefinitionFilesList.setItem(index, itemAbove);
+
+ systemDefinitionFilesList.setSelection(index - 1);
+
+ }
+ systemDefinitionFilesList.setFocus();
+ }
+ });
+
+ final Button downButton = new Button(compositeUpDownButtons, SWT.FLAT);
+ final RowData rd_downButton = new RowData();
+ rd_downButton.height = 26;
+ rd_downButton.width = 26;
+ downButton.setLayoutData(rd_downButton);
+ downButton.setImage(getDownArrowImage());
+ downButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ // Reorder the system definition files in the list by swapping
+ // the item
+ // selected with the item below
+ int index = systemDefinitionFilesList.getSelectionIndex();
+
+ if (index != -1
+ && index + 1 < systemDefinitionFilesList.getItemCount()) { // index
+ // is
+ // 0
+ // relative,
+ // getItemCount
+ // is
+ // not
+ String item = systemDefinitionFilesList.getItem(index);
+ String itemBelow = systemDefinitionFilesList
+ .getItem(index + 1);
+
+ systemDefinitionFilesList.setItem(index + 1, item);
+ systemDefinitionFilesList.setItem(index, itemBelow);
+
+ systemDefinitionFilesList.setSelection(index + 1);
+ }
+ systemDefinitionFilesList.setFocus();
+ }
+ });
+
+ final Composite compositeAddRemoveButtons = new Composite(
+ compositeMainGridLayout, SWT.NONE);
+ final GridData gd_compositeAddRemoveButtons = new GridData(SWT.CENTER,
+ SWT.CENTER, false, false, 2, 1);
+ compositeAddRemoveButtons.setLayoutData(gd_compositeAddRemoveButtons);
+ final RowLayout rowLayout = new RowLayout();
+ rowLayout.spacing = 30;
+ compositeAddRemoveButtons.setLayout(rowLayout);
+
+ final Button addSystemDefinitionButton = new Button(
+ compositeAddRemoveButtons, SWT.NONE);
+
+ addSystemDefinitionButton.setText("Add System Definition File");
+ addSystemDefinitionButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ java.util.List<String> currentItems = Helper
+ .toListOfStrings(systemDefinitionFilesList.getItems());
+ SystemDefinitionFileSelectionValidator validator = new SystemDefinitionFileSelectionValidator(
+ currentItems);
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ String dialogTitle = "New System Definition File";
+ String dialogMessage = "Enter the path or URL to the system definition file";
+ String initialPath = "";
+ String[] filterNames = { "*.xml" };
+ XmlFileSelectionDialog dialog = new XmlFileSelectionDialog(
+ shell, dialogTitle, dialogMessage, initialPath,
+ filterNames, validator);
+
+ dialog.open();
+
+ if (dialog.getReturnCode() == Dialog.CANCEL) {
+ return;
+ }
+
+ String filename = dialog.getValue();
+
+ if (filename != null && (filename.length() != 0)) {
+ systemDefinitionFilesList.add(filename);
+ }
+
+ systemDefinitionFilesList.setFocus();
+ }
+ });
+
+ final Button removeSystemDefinitionButton = new Button(
+ compositeAddRemoveButtons, SWT.NONE);
+ removeSystemDefinitionButton.setText("Remove System Definition File");
+ removeSystemDefinitionButton
+ .addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ int listIndex = systemDefinitionFilesList
+ .getSelectionIndex();
+
+ if (listIndex != -1) {
+ // Remove the system definition file from the list
+ systemDefinitionFilesList.remove(listIndex);
+ }
+ systemDefinitionFilesList.setFocus();
+ }
+ });
+ }
+
+ /**
+ * Registers a listener object, which will be notified if the conditions for
+ * proceeding have been met.
+ *
+ * @param listener
+ * A ValidModelDefinedListener object
+ * @return void
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#addModelListener(ValidModelDefinedListener)
+ */
+ public void addModelListener(ValidModelDefinedListener listener) {
+ listeners.add(listener);
+ }
+
+ // Check that at least one system definition file has been specified. Any
+ // registered
+ // model listeners are notified with a ValidModelEvent.
+ private void CheckRequiredInformationPresent() {
+ if (listeners.size() > 0) {
+ Boolean modelDefined = true;
+ String message = "";
+ Type type = Type.SUCCESS;
+
+ if (systemDefinitionFilesList.getItems().length == 0) {
+ modelDefined = false;
+ message = "You must specify at least 1 system definition xml file to proceed.";
+ type = Type.ERROR;
+ }
+
+ ValidModelEvent event = new ValidModelEvent(modelDefined, message,
+ type);
+
+ for (ValidModelDefinedListener listener : listeners) {
+ listener.validModelDefined(event);
+ }
+ }
+ }
+
+ private Image getDownArrowImage() {
+ return new Image(getDisplay(),
+ getImageAsStream("icons/Arrow_down_icons_24px.png"));
+ }
+
+ private InputStream getImageAsStream(String imageLocation) {
+ Bundle bundle = Platform.getBundle("com.symbian.smt.gui");
+ Path path = new Path(imageLocation);
+ URL imageURL = FileLocator.find(bundle, path, null);
+
+ try {
+ return imageURL.openStream();
+ } catch (IOException e) {
+ Logger.log(e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns a list of the system definition files
+ *
+ * @return String[]
+ */
+ public String[] getSystemDefinitions() {
+ String[] sysDefs = systemDefinitionFilesList.getItems();
+ return sysDefs;
+ }
+
+ private Image getUpArrowImage() {
+ return new Image(getDisplay(),
+ getImageAsStream("icons/Arrow_Up_icons_24px.png"));
+ }
+
+ /**
+ * @see com.symbian.smt.gui.smtwidgets.ValidModelObservable#removeModelListener(ValidModelDefinedListener)
+ */
+ public void removeModelListener(ValidModelDefinedListener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ /**
+ * Sets the system definition files
+ *
+ * @param sysDefs
+ * A list containing system definition files
+ * @return void
+ */
+ public void setSystemDefinitions(String[] sysDefs) {
+ systemDefinitionFilesList.setItems(sysDefs);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/ValidModelDefinedListener.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,34 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+public interface ValidModelDefinedListener {
+
+ /**
+ * This is the call back method invoked by a ValidObservable object on all
+ * ValidModelDefinedListener objects registered with it to inform the
+ * listeners of the outcome of validation of a given field in a widget. The
+ * listeners are then responsible to set their state accordingly.
+ *
+ * @param event
+ * the ValidModelEvent that has been created by the
+ * ValidObservable object and that contains all of the necessary
+ * validation related information.
+ */
+ void validModelDefined(ValidModelEvent event);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/ValidModelEvent.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,93 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets;
+
+/**
+ * This class encapsulates the outcome of the validation of a field which the
+ * user has touched.
+ * <p>
+ * It contains information on the event result (whether validation was
+ * successful or failed) and the message associated with the event.
+ * </p>
+ * <p>
+ * It is created by objects of type ValidModelObservable when validation of a
+ * field occurs and it is propagated to registered ValidModelDefinedListener
+ * objects in order to allow them to set their state accordingly.
+ * </p>
+ * <p>
+ * An example of usage of this class is provided by Properties pages which
+ * require to disable their "Ok" and "Apply" buttons and to show a relevant
+ * error message when validation of a specific field fails.
+ * </p>
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public class ValidModelEvent {
+ public enum Type {
+ ERROR, SUCCESS, WARNING;
+ }
+
+ private Boolean isValid;
+ private String message;
+ private Type type;
+
+ /**
+ * The constructor.
+ *
+ * @param result
+ * a Boolean representing whether validation was successful or
+ * not
+ * @param message
+ * the message associated with the validation. If validation
+ * succeeded, the message may be empty. If validation failed, the
+ * message cannot be empty. If it is, a default error message is
+ * enforced.
+ */
+ public ValidModelEvent(Boolean isValid, String message, Type type) {
+ if (isValid == null) {
+ throw new IllegalArgumentException("Arg result cannot be null.");
+ }
+
+ if (message == null) {
+ throw new IllegalArgumentException("Arg message cannot be null.");
+ }
+
+ // Enforcing the message not to be non empty
+ if ((!isValid) && (message.length() == 0)) {
+ message = "Error message unavailable.";
+ }
+
+ this.isValid = isValid;
+ this.message = message;
+ this.type = type;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public Boolean isValid() {
+ return isValid;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/ValidModelObservable.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,40 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+public interface ValidModelObservable {
+
+ /**
+ * Registers the provided listener as an interested party in
+ * ValidModelEvents.
+ *
+ * @param listener
+ * the ValidModelDefinedListener object to be registered with
+ * this class.
+ */
+ void addModelListener(ValidModelDefinedListener listener);
+
+ /**
+ * Removes the provided listener from the list of registered listeners of
+ * ValidModelEvents.
+ *
+ * @param listener
+ * the ValidModelDefinedListener object to be unregistered.
+ */
+ void removeModelListener(ValidModelDefinedListener listener);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/XmlFileSelectionDialog.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,456 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.StringConverter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This dialog is adapted from Eclipse's InputDialog in order to accept the name
+ * (local or URL) of an XML file. Validation of the XML also occurs.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public class XmlFileSelectionDialog extends Dialog {
+
+ private static final String BROWSE_BUTTON = "Browse..."; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ /**
+ * Browse button widget.
+ */
+ private Button browseButton;
+
+ /**
+ * Cancel button widget.
+ */
+ private Button cancelButton;
+
+ /**
+ * Error message string.
+ */
+ private String errorMessage;
+
+ /**
+ * Error message label widget.
+ */
+ private Text errorMessageText;
+
+ /**
+ * The file extensions to filter on.
+ */
+ private String[] extensionFilter;
+
+ /**
+ * The message to display, or <code>null</code> if none.
+ */
+ private String message;
+
+ /**
+ * Ok button widget.
+ */
+ private Button okButton;
+
+ /**
+ * Input text widget.
+ */
+ private Text inputText;
+
+ /**
+ * The title of the dialog.
+ */
+ private String title;
+
+ /**
+ * The input m_validator, or <code>null</code> if none.
+ */
+ private IXmlFileInputValidator validator;
+
+ /**
+ * The input value; the empty string by default.
+ */
+ private String inputValue = EMPTY_STRING;
+
+ /**
+ * Creates an input dialog with OK and Cancel buttons. Note that the dialog
+ * will have no visual representation (no widgets) until it is told to open.
+ * <p>
+ * Note that the <code>open</code> method blocks for input dialogs.
+ * </p>
+ *
+ * @param parentShell
+ * the parent shell, or <code>null</code> to create a top-level
+ * shell
+ * @param dialogTitle
+ * the dialog title, or <code>null</code> if none
+ * @param dialogMessage
+ * the dialog message, or <code>null</code> if none
+ * @param initialValue
+ * the initial input value, or <code>null</code> if none
+ * (equivalent to the empty string)
+ * @param extensionFilter
+ * the file extensions to filter on.
+ * @param validator
+ * an input validator, or <code>null</code> if none
+ */
+ public XmlFileSelectionDialog(Shell parentShell, String dialogTitle,
+ String dialogMessage, String initialValue,
+ String[] extensionFilter, IXmlFileInputValidator validator) {
+ super(parentShell);
+
+ this.title = dialogTitle;
+ message = dialogMessage;
+ this.extensionFilter = extensionFilter;
+
+ if (initialValue == null) {
+ inputValue = EMPTY_STRING;
+ } else {
+ inputValue = initialValue;
+ }
+
+ this.validator = validator;
+ }
+
+ /*
+ * Method declared on Dialog.
+ */
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ inputValue = inputText.getText();
+ } else {
+ inputValue = null;
+ }
+
+ super.buttonPressed(buttonId);
+ }
+
+ /*
+ *
+ *
+ * @see
+ * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
+ * .Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ if (title != null) {
+ shell.setText(title);
+ }
+ }
+
+ /*
+ *
+ *
+ * @see
+ * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+ * .swt.widgets.Composite)
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ okButton = createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, true);
+
+ cancelButton = createButton(parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false);
+
+ // do this here because setting the m_text will set enablement on the ok
+ // button
+ inputText.setFocus();
+ if (inputValue != null) {
+ inputText.setText(inputValue);
+ inputText.selectAll();
+ }
+ }
+
+ /*
+ * Method declared on Dialog.
+ */
+ protected Control createDialogArea(Composite parent) {
+ // create composite
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridLayout layout = (GridLayout) composite.getLayout();
+
+ layout.numColumns = 2;
+
+ // create message
+ if (message != null) {
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(message);
+
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL,
+ GridData.VERTICAL_ALIGN_CENTER, true, true, 2, 1);
+
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ }
+
+ inputText = new Text(composite, getInputTextStyle());
+
+ inputText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ inputText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateInput();
+ }
+ });
+
+ browseButton = new Button(composite, SWT.PUSH);
+
+ browseButton.setText(BROWSE_BUTTON);
+ browseButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+ FileDialog fd = new FileDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ SWT.OPEN | SWT.APPLICATION_MODAL);
+ fd.setText("Select the desired resource file name");
+
+ if (extensionFilter != null) {
+ fd.setFilterExtensions(extensionFilter);
+ }
+
+ String selected = fd.open();
+
+ if (selected != null) {
+ inputText.setText(selected);
+ }
+ }
+ });
+
+ GridData gd = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL
+ | GridData.VERTICAL_ALIGN_FILL);
+
+ gd.horizontalSpan = 2;
+ gd.minimumHeight = 40;
+ errorMessageText = new Text(composite, SWT.MULTI | SWT.READ_ONLY
+ | SWT.WRAP);
+
+ errorMessageText.setLayoutData(gd);
+ errorMessageText.setBackground(errorMessageText.getDisplay()
+ .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ // Set the error message text
+ setErrorMessage(errorMessage);
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ /**
+ * @return the cancelButton
+ */
+ public Button getCancelButton() {
+ return cancelButton;
+ }
+
+ /**
+ * Returns the style bits that should be used for the input text field.
+ * Defaults to a single line entry. Subclasses may override.
+ *
+ * @return the integer style bits that should be used when creating the
+ * input text
+ */
+ protected int getInputTextStyle() {
+ return SWT.SINGLE | SWT.BORDER;
+ }
+
+ /**
+ * Returns the ok button.
+ *
+ * @return the ok button
+ */
+ public Button getOkButton() {
+ return okButton;
+ }
+
+ /**
+ * Returns the text area.
+ *
+ * @return the text area
+ */
+ public Text getText() {
+ return inputText;
+ }
+
+ /**
+ * Returns the validator.
+ *
+ * @return the validator
+ */
+ protected IInputValidator getValidator() {
+ return validator;
+ }
+
+ /**
+ * Returns the string typed into this input dialog.
+ *
+ * @return the input string
+ */
+ public String getValue() {
+ return inputValue;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ String input = getValue();
+ String result;
+
+ // Validation of the XML content does not happen here as an invalid XML
+ // file
+ // is deemed acceptable. It occurs as part of the update that takes
+ // place
+ // in the ManageResources class, which is also responsible for arranging
+ // for error markers to be placed on any invalid resource file or sys
+ // def file.
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ monitor.beginTask("Reading " + input, 2);
+
+ try {
+ input = getValue();
+
+ if (validator.isUrl(input)) {
+ result = validator.isUrlResourceReadable(input);
+ } else { // If file path is local
+ result = validator.isFileReadable(input);
+ }
+ } catch (InvalidPathException e) {
+ result = e.getMessage();
+ }
+
+ monitor.worked(1);
+ monitor.setTaskName("Checking validation");
+ setValidationError(result);
+ monitor.worked(1);
+ monitor.done();
+ }
+ };
+
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, false, op);
+ } catch (InterruptedException e) {
+ return;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException.getMessage());
+ return;
+ }
+ finally {
+ if (validationError != null) {
+ setErrorMessage(validationError);
+ setValidationError(null);
+
+ return;
+ }
+ }
+
+ super.okPressed();
+ }
+
+ private String validationError;
+
+ private void setValidationError(String error) {
+ validationError = error;
+ }
+
+ /**
+ * Sets or clears the error message. If not <code>null</code>, the OK button
+ * is disabled.
+ *
+ * @param errorMessage
+ * the error message, or <code>null</code> to clear
+ * @since 3.0
+ */
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ if (errorMessageText != null && !errorMessageText.isDisposed()) {
+
+ errorMessageText
+ .setText(errorMessage == null ? "\n" : errorMessage); //$NON-NLS-1$
+
+ // Disable the error message text control if there is no error, or
+ // no error text (empty or whitespace only). Hide it also to avoid
+ // color change.
+ boolean hasError = errorMessage != null
+ && (StringConverter.removeWhiteSpaces(errorMessage))
+ .length() > 0;
+ errorMessageText.setEnabled(hasError);
+ errorMessageText.setVisible(hasError);
+ errorMessageText.getParent().update();
+
+ // Access the ok button by id, in case clients have overridden
+ // button creation.
+ Control button = getButton(IDialogConstants.OK_ID);
+
+ if (button != null) {
+ button.setEnabled(errorMessage == null);
+ }
+ }
+ }
+
+ /**
+ * Validates the input.
+ * <p>
+ * The default implementation of this framework method delegates the request
+ * to the supplied input validator object; if it finds the input invalid,
+ * the error message is displayed in the dialog's message line. This
+ * hook method is called whenever the text changes in the input field.
+ * </p>
+ */
+ protected void validateInput() {
+ String errorMessage = null;
+ if (validator != null) {
+ errorMessage = validator.isValid(inputText.getText());
+ }
+ // It is important not to treat "" (blank error) the same as null
+ // (no error)
+ setErrorMessage(errorMessage);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/AddResourceFileAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,139 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.symbian.smt.gui.ResourcesEnums;
+import com.symbian.smt.gui.smtwidgets.AbstractMultipleEntriesWidgetAction;
+import com.symbian.smt.gui.smtwidgets.XmlFileSelectionDialog;
+
+/**
+ * This is the action that adds a new command line option to the list of
+ * assigned options.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+class AddResourceFileAction extends AbstractMultipleEntriesWidgetAction {
+
+ private HashMap<ResourcesEnums, List<CheckableResourceFilename>> resourceFilesMap;
+
+ /**
+ * The option that has been entered by the user or null if the user
+ * cancelled the operation.
+ */
+ private String newFileLocation = null;
+
+ AddResourceFileAction(
+ Button button,
+ ISelectionProvider filesViewer,
+ HashMap<ResourcesEnums, List<CheckableResourceFilename>> resourceFilesMap,
+ ListViewer resourceTypesViewer) {
+ super(resourceTypesViewer, "Add...", button);
+
+ this.resourceFilesMap = resourceFilesMap;
+
+ setEnabled(false);
+ }
+
+ /**
+ * Returns the option that was entered by the user.
+ *
+ * @return the option that was entered by the user (or null if the user
+ * cancelled the operation)
+ */
+ String getNewFileLocation() {
+ return newFileLocation;
+ }
+
+ /**
+ * Creates and displays an InputDialogWithWarning that collects the new
+ * option entered by the user. The dialog is equipped with a
+ * DialogInputValidator object that automatically performs validation on the
+ * user's input.
+ * <p>
+ * When the dialog is dismissed, the action changes the model to reflect the
+ * new addition.
+ * </p>
+ */
+ @Override
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+ String dialogTitle = "New Resource File";
+ String dialogMessage = "Enter the path or URL to the resource file";
+ String initialPath = "";
+ String[] filterNames = { "*.xml" };
+ ResourcesEnums selectedResourceType = ResourcesWidgetHelper
+ .getSelectedResourceType((ListViewer) selectionProvider);
+ List<CheckableResourceFilename> checkableFilenames = ResourcesWidgetHelper
+ .getCheckableResourceFilenames(selectedResourceType,
+ resourceFilesMap);
+
+ ResourceFileSelectionValidator validator = new ResourceFileSelectionValidator(
+ selectedResourceType, checkableFilenames);
+ XmlFileSelectionDialog dialog = new XmlFileSelectionDialog(shell,
+ dialogTitle, dialogMessage, initialPath, filterNames, validator);
+
+ dialog.open();
+
+ if (dialog.getReturnCode() == Dialog.CANCEL) {
+ newFileLocation = null;
+ return;
+ }
+
+ newFileLocation = dialog.getValue();
+
+ // Adding the newly added file to the resource files
+ // map.
+ // Automatic checking of the related checkbox and
+ // addition
+ // to the selected resource files map is handled by the
+ // <code>handleMultipleCheckRules()</code> method in the ResourcesWidget
+ // class,
+ // which is also used for user checks/unchecks.
+ if (newFileLocation.length() != 0) {
+ checkableFilenames.add(new CheckableResourceFilename(
+ newFileLocation));
+ }
+ }
+
+ /**
+ * This action is enabled if a resource type has been selected by the user.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ ResourcesEnums selectedResourceType = ResourcesWidgetHelper
+ .getSelectedResourceType((ListViewer) selectionProvider);
+
+ if (selectedResourceType == null) {
+ setEnabled(false);
+ } else {
+ setEnabled(true);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/CheckableResourceFilename.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,60 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// CheckableResourceFilename
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+/**
+ * This is a wrapper class that represents the elements that appear in the
+ * resource files table. It encompasses the String representing each and every
+ * file path String representation and a boolean that represents its current
+ * checked state.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+public class CheckableResourceFilename {
+
+ private String filename;
+ private boolean isChecked;
+
+ CheckableResourceFilename(String filename) {
+ this(filename, false);
+ }
+
+ CheckableResourceFilename(String filename, boolean isChecked) {
+ this.filename = filename;
+ this.isChecked = isChecked;
+ }
+
+ String getFilename() {
+ return filename;
+ }
+
+ boolean isChecked() {
+ return isChecked;
+ }
+
+ void setChecked(boolean isChecked) {
+ this.isChecked = isChecked;
+ }
+
+ void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/MoveResourceFileDownAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,118 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// MoveResourceFileDownAction
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Button;
+
+import com.symbian.smt.gui.ResourcesEnums;
+import com.symbian.smt.gui.smtwidgets.AbstractMultipleEntriesWidgetAction;
+
+/**
+ * This is the action that moves a command line option down by one position in
+ * the list of assigned options.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+class MoveResourceFileDownAction extends AbstractMultipleEntriesWidgetAction {
+
+ private CheckboxTableViewer resourceFilesViewer;
+ private ListViewer resourceTypesViewer;
+ private HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap;
+
+ /**
+ * The option that has been moved by the user
+ */
+ private CheckableResourceFilename movedCheckableFilename = null;
+
+ MoveResourceFileDownAction(
+ Button button,
+ ISelectionProvider filesViewer,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap,
+ ListViewer resourceTypesViewer) {
+ super(filesViewer, "Move Down", button);
+
+ this.resourceFilesViewer = (CheckboxTableViewer) filesViewer;
+ this.resourceFilesMap = resourceFilesMap;
+ this.resourceTypesViewer = resourceTypesViewer;
+
+ setEnabled(false);
+ }
+
+ /**
+ * Returns the CheckableResourceFilename object that was moved by the user.
+ *
+ * @return the CheckableResourceFilename object that was moved by the user
+ */
+ CheckableResourceFilename getMovedCheckableFilename() {
+ return movedCheckableFilename;
+ }
+
+ /**
+ * Moves the selected CheckableResourceFilename object down by one position
+ * in the model.
+ */
+ @Override
+ public void run() {
+ movedCheckableFilename = (CheckableResourceFilename) ((StructuredSelection) getSelection())
+ .getFirstElement();
+
+ // Rearrange the order of the files in <code>resourceFilesMap</code>
+ java.util.List<CheckableResourceFilename> checkableFilenames = ResourcesWidgetHelper
+ .getCheckableResourceFilenames(ResourcesWidgetHelper
+ .getSelectedResourceType(resourceTypesViewer),
+ resourceFilesMap);
+ int oldIndex = checkableFilenames.indexOf(movedCheckableFilename);
+ checkableFilenames.remove(oldIndex);
+ int newIndex = oldIndex + 1;
+ checkableFilenames.add(newIndex, movedCheckableFilename);
+ }
+
+ /**
+ * Enabled if the list has exactly one selection and if the selection is not
+ * the last element in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.size() != 1) {
+ setEnabled(false);
+ return;
+ }
+
+ boolean enabled = true;
+ CheckableResourceFilename selectedElement = (CheckableResourceFilename) selection
+ .getFirstElement();
+ CheckableResourceFilename lastElement = (CheckableResourceFilename) resourceFilesViewer
+ .getElementAt(resourceFilesViewer.getTable().getItemCount() - 1);
+
+ if (lastElement != null && selectedElement.equals(lastElement)) {
+ enabled = false;
+ }
+
+ setEnabled(enabled);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/MoveResourceFileUpAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,116 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// MoveResourceFileDownAction
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Button;
+
+import com.symbian.smt.gui.ResourcesEnums;
+import com.symbian.smt.gui.smtwidgets.AbstractMultipleEntriesWidgetAction;
+
+/**
+ * This is the action that moves a command line option up by one position in the
+ * list of assigned options.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+class MoveResourceFileUpAction extends AbstractMultipleEntriesWidgetAction {
+
+ private CheckboxTableViewer resourceFilesViewer;
+ private ListViewer resourceTypesViewer;
+ private HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap;
+
+ /**
+ * The option that has been moved by the user
+ */
+ private CheckableResourceFilename movedCheckableFilename = null;
+
+ MoveResourceFileUpAction(
+ Button button,
+ ISelectionProvider filesViewer,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap,
+ ListViewer resourceTypesViewer) {
+ super(filesViewer, "Move Up", button);
+
+ this.resourceFilesViewer = (CheckboxTableViewer) filesViewer;
+ this.resourceFilesMap = resourceFilesMap;
+ this.resourceTypesViewer = resourceTypesViewer;
+
+ setEnabled(false);
+ }
+
+ /**
+ * Returns the CheckableResourceFilename object that was moved by the user.
+ *
+ * @return the CheckableResourceFilename object that was moved by the user
+ */
+ CheckableResourceFilename getMovedCheckableFilename() {
+ return movedCheckableFilename;
+ }
+
+ /**
+ * Moves the selected CheckableResourceFilename object down by one position
+ * in the model.
+ */
+ @Override
+ public void run() {
+ movedCheckableFilename = (CheckableResourceFilename) ((StructuredSelection) getSelection())
+ .getFirstElement();
+ java.util.List<CheckableResourceFilename> checkableFilenames = ResourcesWidgetHelper
+ .getCheckableResourceFilenames(ResourcesWidgetHelper
+ .getSelectedResourceType(resourceTypesViewer),
+ resourceFilesMap);
+ int oldIndex = checkableFilenames.indexOf(movedCheckableFilename);
+ checkableFilenames.remove(oldIndex);
+ int newIndex = oldIndex - 1;
+ checkableFilenames.add(newIndex, movedCheckableFilename);
+ }
+
+ /**
+ * Enabled if the list has exactly one selection and if the selection is not
+ * the first element in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.size() != 1) {
+ setEnabled(false);
+ return;
+ }
+
+ boolean enabled = true;
+ CheckableResourceFilename selectedElement = (CheckableResourceFilename) selection
+ .getFirstElement();
+ CheckableResourceFilename firstElement = (CheckableResourceFilename) resourceFilesViewer
+ .getElementAt(0);
+
+ if (firstElement != null && selectedElement.equals(firstElement)) {
+ enabled = false;
+ }
+
+ setEnabled(enabled);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/RemoveResourceFileAction.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,92 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// RemoveResourceFileAction
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Button;
+
+import com.symbian.smt.gui.ResourcesEnums;
+import com.symbian.smt.gui.smtwidgets.AbstractMultipleEntriesWidgetAction;
+
+/**
+ * This is the action that removes a command line option from the list of
+ * assigned options.
+ *
+ * @author barbararosi-schwartz
+ *
+ */
+class RemoveResourceFileAction extends AbstractMultipleEntriesWidgetAction {
+
+ private ListViewer resourceTypesViewer;
+ private HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap;
+
+ RemoveResourceFileAction(
+ Button button,
+ ISelectionProvider filesViewer,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap,
+ ListViewer resourceTypesViewer) {
+ super(filesViewer, "Remove", button);
+
+ this.resourceFilesMap = resourceFilesMap;
+ this.resourceTypesViewer = resourceTypesViewer;
+
+ setEnabled(false);
+ }
+
+ /**
+ * Removes the selected filename from the model.
+ */
+ @Override
+ public void run() {
+ StructuredSelection ssel = (StructuredSelection) getSelection();
+ java.util.List<CheckableResourceFilename> checkableFilenames = ResourcesWidgetHelper
+ .getCheckableResourceFilenames(ResourcesWidgetHelper
+ .getSelectedResourceType(resourceTypesViewer),
+ resourceFilesMap);
+
+ @SuppressWarnings("unchecked")
+ Iterator<CheckableResourceFilename> iter = ssel.iterator();
+
+ while (iter.hasNext()) {
+ CheckableResourceFilename to_be_removed = (CheckableResourceFilename) iter
+ .next();
+ checkableFilenames.remove(to_be_removed);
+ }
+ }
+
+ /**
+ * Enabled if we have at least one selection in the list.
+ */
+ @Override
+ public void selectionChanged(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ setEnabled(false);
+ return;
+ }
+
+ setEnabled(true);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/ResourceFileSelectionValidator.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,202 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ResourceFileSelectionValidator
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.ResourceFileValidator;
+import com.symbian.smt.gui.ResourcesEnums;
+import com.symbian.smt.gui.smtwidgets.IXmlFileInputValidator;
+import com.symbian.smt.gui.smtwidgets.InvalidPathException;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class ResourceFileSelectionValidator extends ResourceFileValidator
+ implements IXmlFileInputValidator {
+
+ private List<CheckableResourceFilename> existingFilenames;
+
+ public ResourceFileSelectionValidator(ResourcesEnums selectedResourceType,
+ List<CheckableResourceFilename> filenames) {
+ super(selectedResourceType);
+
+ this.existingFilenames = filenames;
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IFileInputValidator#isFileReadable(java.lang.String)
+ */
+ public String isFileReadable(String filePath) {
+ String errorMessage = null;
+ File inFile = new File(filePath);
+
+ if (!inFile.canRead()) {
+ return "Selected file cannot be read.";
+ }
+
+ return errorMessage;
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IFileInputValidator#isUrl(java.lang.String)
+ */
+ public boolean isUrl(String filePath) throws InvalidPathException {
+ int index = filePath.indexOf(':');
+
+ if (index == -1 || index == 1) {
+ return false;
+ } else if (index > 1) {
+ return true;
+ } else {
+ throw new InvalidPathException("Unexpected file path format.");
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IFileInputValidator#isUrlResourceReadable(java.lang.String)
+ */
+ public String isUrlResourceReadable(String filePath) {
+ String errorMessage = null;
+ InputStream urlInputStream = null;
+
+ try {
+ URL fileURL = new URL(filePath);
+ URLConnection connection = fileURL.openConnection();
+ String contentType = null;
+
+ try {
+ contentType = connection.getContentType();
+ } catch (Exception e) {
+ return "Resource at specified URL cannot be found.";
+ }
+
+ if (contentType == null) {
+ return "Resource at specified URL cannot be found.";
+ }
+
+ if (!contentType.endsWith("xml")) {
+ return "Specified URL is not an XML document.";
+ }
+
+ urlInputStream = connection.getInputStream();
+
+ if (urlInputStream == null) {
+ errorMessage = "Resource at specified URL cannot be read.";
+ }
+ /*
+ * Snippet below is just for diagnostics else { int bytes; while
+ * ((bytes = urlInputStream.available()) > 0) { byte[] b = new
+ * byte[bytes];
+ *
+ * urlInputStream.read(b); String s = new String(b);
+ *
+ * System.err.println(s); } }
+ */
+ } catch (IllegalArgumentException e) {
+ errorMessage = "Resource at specified URL cannot be read.";
+ } catch (MalformedURLException e) {
+ errorMessage = "Specified URL is not a valid URL.";
+ } catch (IOException e) {
+ errorMessage = "Resource at specified URL cannot be reached.";
+ } finally {
+ if (urlInputStream != null) {
+ try {
+ urlInputStream.close();
+ } catch (IOException ignore) {
+ Logger.log(ignore.getMessage(), ignore);
+ }
+ urlInputStream = null;
+ }
+ }
+
+ return errorMessage;
+ }
+
+ private String isUrlValid(String url) {
+ String errorMessage = null;
+
+ try {
+ URL inputUrl = new URL(url);
+ inputUrl.openConnection();
+ } catch (MalformedURLException e) {
+ errorMessage = "Specified URL is not a valid URL.";
+ } catch (IOException e) {
+ errorMessage = "Resource at specified URL cannot be reached.";
+ }
+
+ return errorMessage;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ */
+ public String isValid(String filePath) {
+ if (filePath == null || filePath.length() == 0) {
+ return "";
+ } else {
+ return validateResourceWhileUserTypes(filePath);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.symbian.smt.gui.smtwidgets.IXmlFileInputValidator#isXmlValid(java.lang.String)
+ */
+ public String isXmlValid(String filePath) {
+ return validateXml(filePath);
+ }
+
+ private String validateResourceWhileUserTypes(String filePath) {
+ String errorMessage = null;
+
+ // First check path is not UNC
+ if (filePath.startsWith(File.separator)) {
+ return "UNC paths are not compatible with the System Model Manager";
+ }
+
+ // Then check that filename (path) is not duplicate
+ // by checking name against table
+ if (existingFilenames != null) {
+ if (ResourcesWidgetHelper.contains(existingFilenames, filePath)) {
+ return "The selected file has already been assigned.";
+ }
+ }
+
+ // Then check that path is appropriate
+ try {
+ if (isUrl(filePath)) {
+ errorMessage = isUrlValid(filePath);
+ } else {
+ errorMessage = isFileReadable(filePath);
+ }
+ } catch (InvalidPathException e) {
+ errorMessage = e.getMessage();
+ }
+
+ return errorMessage;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/ResourcesWidget.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,974 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Table;
+
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.ResourcesEnums;
+
+public class ResourcesWidget extends Composite {
+
+ /**
+ * This is the content provider for the list of resource types.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class ResourceFilesContentProvider implements
+ IStructuredContentProvider {
+
+ public void dispose() {
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object inputElement) {
+ return ResourcesWidgetHelper
+ .toArrayOfCheckableResourceFilenames((java.util.List<CheckableResourceFilename>) inputElement);
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ /**
+ * This is the label provider for the list of of resource types.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class ResourceFilesLabelProvider implements ITableLabelProvider {
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ CheckableResourceFilename crf = (CheckableResourceFilename) element;
+
+ return (columnIndex == 0) ? crf.getFilename() : null;
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ }
+
+ /**
+ * This is the content provider for the list of resource types.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class ResourceTypesContentProvider implements
+ IStructuredContentProvider {
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return (ResourcesEnums[]) inputElement;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ /**
+ * This is the label provider for the list of of resource types.
+ *
+ * @author barbararosi-schwartz
+ */
+ private class ResourceTypesLabelProvider implements ILabelProvider {
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return ((ResourcesEnums) element).arg();
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ }
+
+ /**
+ * The Map that caches all defined resource files, keyed by the
+ * ResourcesEnums enums.
+ */
+ private final HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap = new HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>>();
+
+ /**
+ * The viewer associated with the Resource Files List widget.
+ */
+ private CheckboxTableViewer resourceFilesViewer;
+
+ /**
+ * The viewer associated with the Resource Types List widget.
+ */
+ private ListViewer resourceTypesViewer;
+
+ /**
+ * Creates a ResourcesWidget composite object
+ *
+ * @return void
+ */
+ public ResourcesWidget(final Composite parent, int style) {
+ super(parent, style);
+
+ initialiseMaps();
+ this.setLayout(new FillLayout());
+
+ // The Composite that contains all widgets
+ final Composite gridLayoutComposite = new Composite(this, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+
+ gridLayoutComposite.setLayout(gridLayout);
+
+ // The SashForm that contains the resource types and resource files
+ // widgets
+ // side by side
+ SashForm sash = new SashForm(gridLayoutComposite, SWT.HORIZONTAL);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+
+ sash.setLayoutData(gd);
+ createResourceTypesComposite(sash);
+ createResourceFilesComposite(sash);
+ sash.setWeights(new int[] { 30, 70 });
+ createButtonsComposite(gridLayoutComposite);
+ }
+
+ private void addAddResourceButton(Composite parent) {
+ // The "Add" button
+ final Button addResourceFileButton = new Button(parent, SWT.NONE);
+ RowData rd = new RowData();
+ rd.width = 75;
+
+ addResourceFileButton.setLayoutData(rd);
+
+ // The action that backs the "Add" button
+ final AddResourceFileAction addResourceFileAction = new AddResourceFileAction(
+ addResourceFileButton, resourceFilesViewer, resourceFilesMap,
+ resourceTypesViewer);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then ensures that the newly added file is checked, guaranteeing that
+ // all rules around multiple checked files are respected.
+ // Finally refreshes the List of assigned options and set the selection
+ // appropriately.
+ // If the newly added file failed validation during the action's run()
+ // method,
+ // none of the operations above is taken and all is left as it was prior
+ // to
+ // the request to add a new file.
+ addResourceFileButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ addResourceFileAction.run();
+ resourceFilesViewer.refresh();
+
+ String newFileLocation = addResourceFileAction
+ .getNewFileLocation();
+
+ // newFile could be null if an error was detected in the
+ // validations
+ // performed in the action's run() method.
+ if (newFileLocation != null) {
+ ResourcesEnums type = ResourcesWidgetHelper
+ .getSelectedResourceType(resourceTypesViewer);
+ CheckableResourceFilename crf = ResourcesWidgetHelper
+ .filename2checkableFilename(newFileLocation, type,
+ resourceFilesMap);
+
+ handleMultipleCheckRules(crf);
+
+ StructuredSelection oldSel = (StructuredSelection) resourceFilesViewer
+ .getSelection();
+
+ StructuredSelection newSel = (newFileLocation == null) ? oldSel
+ : new StructuredSelection(newFileLocation);
+
+ resourceFilesViewer.setSelection(newSel);
+ }
+ }
+ });
+ }
+
+ private void addMoveDownResourceButton(Composite parent) {
+ // The "Move Down" button
+ final Button moveResourceFileDownButton = new Button(parent, SWT.NONE);
+ RowData rd = new RowData();
+ rd.width = 75;
+
+ moveResourceFileDownButton.setLayoutData(rd);
+
+ // The action that backs the "Move Down" button
+ final MoveResourceFileDownAction moveResourceFileDownAction = new MoveResourceFileDownAction(
+ moveResourceFileDownButton, resourceFilesViewer,
+ resourceFilesMap, resourceTypesViewer);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refreshes the List of assigned options and set the selection
+ // appropriately
+ moveResourceFileDownButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ moveResourceFileDownAction.run();
+ resourceFilesViewer.refresh();
+
+ StructuredSelection newSel = new StructuredSelection(
+ moveResourceFileDownAction.getMovedCheckableFilename());
+
+ resourceFilesViewer.setSelection(newSel);
+ }
+ });
+ }
+
+ private void addMoveUpResourceButton(Composite parent) {
+ // The "Move Up" button
+ final Button moveResourceFileUpButton = new Button(parent, SWT.NONE);
+ RowData rd = new RowData();
+ rd.width = 75;
+
+ moveResourceFileUpButton.setLayoutData(rd);
+
+ // The action that backs the "Move Up" button
+ final MoveResourceFileUpAction moveResourceFileUpAction = new MoveResourceFileUpAction(
+ moveResourceFileUpButton, resourceFilesViewer,
+ resourceFilesMap, resourceTypesViewer);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refreshes the List of assigned options and set the selection
+ // appropriately
+ moveResourceFileUpButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent e) {
+ moveResourceFileUpAction.run();
+ resourceFilesViewer.refresh();
+
+ StructuredSelection newSel = new StructuredSelection(
+ moveResourceFileUpAction.getMovedCheckableFilename());
+
+ resourceFilesViewer.setSelection(newSel);
+ }
+ });
+
+ }
+
+ private void addRemoveResourceButton(Composite parent) {
+ // The "Remove" button
+ final Button removeResourceFileButton = new Button(parent, SWT.NONE);
+ RowData rd = new RowData();
+ rd.width = 75;
+
+ removeResourceFileButton.setLayoutData(rd);
+
+ // The action that backs the "Remove" button
+ final RemoveResourceFileAction removeResourceFileAction = new RemoveResourceFileAction(
+ removeResourceFileButton, resourceFilesViewer,
+ resourceFilesMap, resourceTypesViewer);
+
+ // When button is pressed, listener invokes the action's run() method,
+ // then refreshes the List of assigned options and set the selection
+ // appropriately
+ removeResourceFileButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ removeResourceFileAction.run();
+ resourceFilesViewer.refresh();
+
+ Object firstElement = resourceFilesViewer.getElementAt(0);
+ StructuredSelection ssel = (firstElement == null) ? new StructuredSelection(
+ StructuredSelection.EMPTY)
+ : new StructuredSelection(firstElement);
+
+ resourceFilesViewer.setSelection(ssel);
+ }
+ });
+ }
+
+ private void checkFilesInResourceFilesTable(String[] filenames,
+ ResourcesEnums resourceType) {
+ if (filenames == null) {
+ throw new IllegalArgumentException(
+ "Argument filenames cannot be null.");
+ }
+
+ java.util.List<String> listOfFilenames = Helper
+ .toListOfStrings(filenames);
+ java.util.List<CheckableResourceFilename> checkableFilenames = resourceFilesMap
+ .get(resourceType);
+
+ if (checkableFilenames == null) {
+ throw new IllegalArgumentException(
+ "Could not find any elements of type [" + resourceType
+ + "] in resourceFilesMap.");
+ }
+
+ CheckableResourceFilename[] viewerElementsToBeChecked = new CheckableResourceFilename[filenames.length];
+ int i = 0;
+
+ for (String filename : listOfFilenames) {
+
+ CheckableResourceFilename checkableFilename = ResourcesWidgetHelper
+ .filename2checkableFilename(filename, resourceType,
+ resourceFilesMap);
+
+ checkableFilename.setChecked(true);
+
+ viewerElementsToBeChecked[i] = checkableFilename;
+ i++;
+ }
+
+ IStructuredSelection ssel = (IStructuredSelection) resourceTypesViewer.getSelection();
+ if (!ssel.isEmpty()) {
+ ResourcesEnums selectedType = (ResourcesEnums) ssel.getFirstElement();
+ if (selectedType.equals(resourceType)) {
+ resourceFilesViewer.setCheckedElements(viewerElementsToBeChecked);
+ }
+ }
+
+
+ }
+
+ private void createButtonsComposite(Composite parent) {
+ // The Composite that contains all buttons in a horizontal stack
+ final Composite buttonsComposite = new Composite(parent, SWT.NONE);
+ final RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
+ rowLayout.spacing = 5;
+ rowLayout.wrap = false;
+ rowLayout.fill = true;
+
+ buttonsComposite.setLayout(rowLayout);
+
+ GridData gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false,
+ 1, 1);
+
+ buttonsComposite.setLayoutData(gd);
+ addAddResourceButton(buttonsComposite);
+ addRemoveResourceButton(buttonsComposite);
+ addMoveUpResourceButton(buttonsComposite);
+ addMoveDownResourceButton(buttonsComposite);
+ }
+
+ private void createResourceFilesComposite(SashForm sash) {
+ // The Composite that contains the resource files table, along with a
+ // label
+ Composite resourceFilesComposite = new Composite(sash, SWT.NONE);
+ GridData gd = new GridData(SWT.BEGINNING, SWT.FILL, false, true, 1, 1);
+
+ resourceFilesComposite.setLayoutData(gd);
+ resourceFilesComposite.setLayout(new GridLayout());
+
+ Label label = new Label(resourceFilesComposite, SWT.NONE);
+ gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 1, 1);
+
+ label.setLayoutData(gd);
+ label.setText("Resource Files");
+
+ // The Table that contains all assigned resource files for the selected
+ // resource type
+ final Table table = new Table(resourceFilesComposite, SWT.BORDER
+ | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.CHECK
+ | SWT.FULL_SELECTION);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+
+ table.setLayoutData(gd);
+
+ // The resource type viewer associated with the list
+ resourceFilesViewer = new CheckboxTableViewer(table);
+
+ resourceFilesViewer
+ .setContentProvider(new ResourceFilesContentProvider());
+ resourceFilesViewer.setLabelProvider(new ResourceFilesLabelProvider());
+
+ resourceFilesViewer.addCheckStateListener(new ICheckStateListener() {
+
+ // When the user changed the checked state of the checkbox in the
+ // table, set
+ // or unset the isChecked attribute in the corresponding
+ // CheckableResourceFilename object
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ CheckableResourceFilename checkableFilename = (CheckableResourceFilename) event
+ .getElement();
+ boolean isSelected = event.getChecked();
+
+ if (isSelected) {
+ handleMultipleCheckRules(checkableFilename);
+ } else {
+ handleNoCheckRules(checkableFilename);
+ }
+ }
+
+ });
+ }
+
+ private void createResourceTypesComposite(SashForm sash) {
+ // The Composite that contains the resource types list, along with a
+ // label
+ Composite resourceTypesComposite = new Composite(sash, SWT.NONE);
+ GridData gd = new GridData(SWT.BEGINNING, SWT.FILL, false, true, 1, 1);
+
+ resourceTypesComposite.setLayoutData(gd);
+ resourceTypesComposite.setLayout(new GridLayout());
+
+ Label l = new Label(resourceTypesComposite, SWT.NONE);
+ gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 1, 1);
+
+ l.setLayoutData(gd);
+ l.setText("Resource Types");
+
+ // The List that contains all possible resource types
+ final List list = new List(resourceTypesComposite, SWT.BORDER
+ | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+
+ list.setLayoutData(gd);
+
+ // The resource type viewer associated with the list
+ resourceTypesViewer = new ListViewer(list);
+
+ resourceTypesViewer
+ .setContentProvider(new ResourceTypesContentProvider());
+ resourceTypesViewer.setLabelProvider(new ResourceTypesLabelProvider());
+ resourceTypesViewer.setInput(ResourcesEnums.values());
+
+ resourceTypesViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection ssel = (IStructuredSelection) event
+ .getSelection();
+ if (ssel.isEmpty()) {
+ return;
+ }
+ ResourcesEnums selectedType = (ResourcesEnums) ssel.getFirstElement();
+
+ resourceFilesViewer.setInput(ResourcesWidgetHelper
+ .getCheckableResourceFilenames(selectedType,
+ resourceFilesMap));
+
+ resourceFilesViewer
+ .setCheckedElements(ResourcesWidgetHelper
+ .getCheckedResourceFilenames(
+ selectedType, resourceFilesMap));
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ resourceFilesMap.clear();
+ super.dispose();
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getBorderShapesFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.BORDER_SHAPES,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getBorderStylesFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.BORDER_STYLES,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getColoursFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.COLOURS,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getDependenciesFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.DEPENDENCIES,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getLevelsFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.LEVELS,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getLocalisationFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.LOCALISATION,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getPatternsFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.PATTERNS,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getS12XmlFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.S12_XML,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the border shapes file or an empty string if no border shapes
+ * file has been specified
+ *
+ * @return String
+ */
+ public String[] getSelectedBorderShapesFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.BORDER_SHAPES, resourceFilesMap);
+ }
+
+ /**
+ * Returns the border styles file or an empty string if no border styles
+ * file has been specified
+ *
+ * @return String
+ */
+ public String[] getSelectedBorderStylesFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.BORDER_STYLES, resourceFilesMap);
+ }
+
+ /**
+ * Returns the colours file or an empty string if no colours file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getSelectedColoursFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.COLOURS, resourceFilesMap);
+ }
+
+ /**
+ * Returns the dependencies file or an empty string if no dependencies file
+ * has been specified
+ *
+ * @return String
+ */
+ public String[] getSelectedDependenciesFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.DEPENDENCIES, resourceFilesMap);
+ }
+
+ /**
+ * Returns the levels file or an empty string if no levels file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getSelectedLevelsFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(ResourcesEnums.LEVELS,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the localisation file or an empty string if no localisation file
+ * has been specified
+ *
+ * @return String
+ */
+ public String[] getSelectedLocalisationFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.LOCALISATION, resourceFilesMap);
+ }
+
+ /**
+ * Returns the patterns file or an empty string if no patterns file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getSelectedPatternsFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.PATTERNS, resourceFilesMap);
+ }
+
+ /**
+ * Returns the patterns file or an empty string if no patterns file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getSelectedS12XmlFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.S12_XML, resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getSelectedShapesFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(ResourcesEnums.SHAPES,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the system info file or an empty string if no system info file
+ * has been specified
+ *
+ * @return String
+ */
+ public String[] getSelectedSystemInfoFiles() {
+ return ResourcesWidgetHelper.getCheckedFilenames(
+ ResourcesEnums.SYSTEM_INFO, resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getShapesFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.SHAPES,
+ resourceFilesMap);
+ }
+
+ /**
+ * Returns the shapes file or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getSystemInfoFiles() {
+ return ResourcesWidgetHelper.getFilenames(ResourcesEnums.SYSTEM_INFO,
+ resourceFilesMap);
+ }
+
+ /**
+ * Checks the designated resource file and sets its <code>isChecked</code>
+ * attribute to true. Handles business rules around the acceptability of
+ * having multiple checked files.
+ * <p>
+ * The rules are as follows:
+ * <ul>
+ * <li>If resource type is DEPENDENCIES or SHAPES, only allow one check at a
+ * time: uncheck all other files and remove them from
+ * <code>selectedResourceFilesMap</code></li>
+ * <li>In all other cases, allow multiple checks</li>
+ * </ul>
+ * </p>
+ *
+ * @param resourceFile
+ * the CheckableResourceFilename object that has been checked by
+ * the user
+ */
+ private void handleMultipleCheckRules(
+ CheckableResourceFilename checkedCheckableFilename) {
+ ResourcesEnums selectedResourceType = ResourcesWidgetHelper
+ .getSelectedResourceType(resourceTypesViewer);
+ java.util.List<CheckableResourceFilename> checkableFilenames = ResourcesWidgetHelper
+ .getCheckableResourceFilenames(selectedResourceType,
+ resourceFilesMap);
+
+ checkedCheckableFilename.setChecked(true);
+
+ switch (selectedResourceType) {
+ // Only one file can be checked at a time, therefore uncheck all others
+ case DEPENDENCIES:
+ case SHAPES:
+ for (CheckableResourceFilename checkableFilename : checkableFilenames) {
+ if (!checkableFilename.equals(checkedCheckableFilename)) {
+ checkableFilename.setChecked(false);
+ }
+ }
+
+ resourceFilesViewer
+ .setCheckedElements(new CheckableResourceFilename[] { checkedCheckableFilename });
+ break;
+
+ // If multiple files are checked and they contain the same elements,
+ // prevent checking from happening as it will generate an error in
+ // the build. Produce an explanatory error dialog.
+ case BORDER_SHAPES:
+ case PATTERNS:
+ // TODO:BRS:This piece of code is unfinished. If it is required to check
+ // that there are no duplicate items across
+ // the defined XML files, check similar behaviour in ResourceFileValidator.
+ // If ok
+ // resourceFilesViewer.setChecked(resourceFile, true);
+ // selectedResourceFiles.add(resourceFile);
+ // else
+ // MessageDialog.openError("Checked files contain the same element and the process will fail.\n"
+ // +
+ // "Please remove duplicate elements or uncheck one or more of the other files.");
+ // resourceFilesViewer.setChecked(resourceFile, false);
+
+ resourceFilesViewer.setChecked(checkedCheckableFilename, true);
+ break;
+
+ // If "Auto" is checked, uncheck everything else. If another option is
+ // checked, uncheck "Auto".
+ case LEVELS:
+ if (checkedCheckableFilename.getFilename().equals("Auto")) {
+ for (CheckableResourceFilename checkableFilename : checkableFilenames) {
+ if (!checkableFilename.equals(checkedCheckableFilename)) {
+ checkableFilename.setChecked(false);
+ }
+ }
+
+ resourceFilesViewer
+ .setCheckedElements(new CheckableResourceFilename[] { checkedCheckableFilename });
+ } else {
+ resourceFilesViewer.setChecked(checkedCheckableFilename, true);
+
+ CheckableResourceFilename autocfn = ResourcesWidgetHelper
+ .filename2checkableFilename("Auto",
+ ResourcesEnums.LEVELS, resourceFilesMap);
+
+ if (autocfn.isChecked()) {
+ autocfn.setChecked(false);
+ resourceFilesViewer.setChecked(autocfn, false);
+ }
+ }
+
+ break;
+
+ // No special rules, proceed with the operation.
+ case BORDER_STYLES:
+ case COLOURS:
+ case LOCALISATION:
+ case S12_XML:
+ case SYSTEM_INFO:
+ resourceFilesViewer.setChecked(checkedCheckableFilename, true);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unknown resource type ["
+ + selectedResourceType + "]");
+ }
+ }
+
+ /**
+ * Unchecks the designated CheckableResourceFilename object. Handles
+ * business rules around the acceptability of having no checked files.
+ * <p>
+ * The rules are as follows:
+ * <ul>
+ * <li></li>
+ * </ul>
+ * </p>
+ *
+ * @param selectedCheckableFilename
+ * the file that has been unchecked by the user
+ */
+ private void handleNoCheckRules(
+ CheckableResourceFilename uncheckedCheckableFilename) {
+ uncheckedCheckableFilename.setChecked(false);
+ resourceFilesViewer.setChecked(uncheckedCheckableFilename, false);
+ }
+
+ private void initialiseMaps() {
+ for (ResourcesEnums type : ResourcesEnums.values()) {
+ resourceFilesMap.put(type, null);
+ }
+ }
+
+ private void populateResourceFilesTable(String[] filenames,
+ ResourcesEnums resourceType) {
+ java.util.List<String> listOfFilenames = Helper
+ .toListOfStrings(filenames);
+ java.util.List<CheckableResourceFilename> checkableFilenames = new ArrayList<CheckableResourceFilename>();
+
+ for (String filename : listOfFilenames) {
+ CheckableResourceFilename crf = new CheckableResourceFilename(
+ filename);
+ checkableFilenames.add(crf);
+ }
+
+ IStructuredSelection ssel = (IStructuredSelection) resourceTypesViewer.getSelection();
+ if (!ssel.isEmpty()) {
+ ResourcesEnums selectedType = (ResourcesEnums) ssel.getFirstElement();
+ if (selectedType.equals(resourceType)) {
+ resourceFilesViewer.setInput(checkableFilenames);
+ }
+ }
+ resourceFilesMap.put(resourceType, checkableFilenames);
+ }
+
+ public void setBorderShapesFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.BORDER_SHAPES);
+ }
+
+ public void setBorderStylesFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.BORDER_STYLES);
+ }
+
+ public void setColoursFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.COLOURS);
+ }
+
+ public void setDependenciesFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.DEPENDENCIES);
+ }
+
+ public void setLevelsFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.LEVELS);
+ }
+
+ public void setLocalisationFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.LOCALISATION);
+ }
+
+ public void setPatternsFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.PATTERNS);
+ }
+
+ public void setS12XmlFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.S12_XML);
+ }
+
+ public void setSelectedBorderShapesFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.BORDER_SHAPES);
+ }
+
+ public void setSelectedBorderStylesFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.BORDER_STYLES);
+ }
+
+ public void setSelectedColoursFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.COLOURS);
+ }
+
+ public void setSelectedDependenciesFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.DEPENDENCIES);
+ }
+
+ public void setSelectedLevelsFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.LEVELS);
+ }
+
+ public void setSelectedLocalisationFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.LOCALISATION);
+ }
+
+ public void setSelectedPatternsFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.PATTERNS);
+ }
+
+ public void setSelectedS12XmlFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.S12_XML);
+ }
+
+ public void setSelectedShapesFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.SHAPES);
+ }
+
+ public void setSelectedSystemInfoFiles(String[] filenames) {
+ checkFilesInResourceFilesTable(filenames, ResourcesEnums.SYSTEM_INFO);
+ }
+
+ public void setShapesFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.SHAPES);
+ }
+
+ public void setSystemInfoFiles(String[] filenames) {
+ populateResourceFilesTable(filenames, ResourcesEnums.SYSTEM_INFO);
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/smtwidgets/resources/ResourcesWidgetHelper.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,174 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ResourcesWidgetHelper
+//
+
+
+
+package com.symbian.smt.gui.smtwidgets.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+import com.symbian.smt.gui.Helper;
+import com.symbian.smt.gui.ResourcesEnums;
+
+/**
+ * @author barbararosi-schwartz
+ *
+ */
+public class ResourcesWidgetHelper {
+
+ static boolean contains(
+ java.util.List<CheckableResourceFilename> checkableFilenames,
+ String filename) {
+ if (checkableFilenames == null || filename == null) {
+ throw new IllegalArgumentException("Arguments cannot be null.");
+ }
+
+ java.util.List<String> filenames = new ArrayList<String>();
+
+ for (CheckableResourceFilename checkableFilename : checkableFilenames) {
+ filenames.add(checkableFilename.getFilename());
+ }
+
+ return filenames.contains(filename);
+ }
+
+ static CheckableResourceFilename filename2checkableFilename(
+ String name,
+ ResourcesEnums resourceType,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap) {
+ java.util.List<CheckableResourceFilename> checkableFilenames = resourceFilesMap
+ .get(resourceType);
+
+ if (checkableFilenames == null) {
+ throw new IllegalArgumentException(
+ "Could not find any elements of type [" + resourceType
+ + "] in resourceFilesMap.");
+ }
+
+ CheckableResourceFilename checkableFilename = null;
+
+ Iterator<CheckableResourceFilename> iter = checkableFilenames
+ .iterator();
+
+ while (iter.hasNext()) {
+ CheckableResourceFilename crf = iter.next();
+
+ if (crf.getFilename().equals(name)) {
+ checkableFilename = crf;
+ break;
+ }
+
+ }
+
+ if (checkableFilename == null) {
+ throw new IllegalArgumentException(
+ "Could not find any file with name [" + name
+ + "] in resourceFilesMap.");
+ }
+
+ return checkableFilename;
+ }
+
+ static java.util.List<CheckableResourceFilename> getCheckableResourceFilenames(
+ ResourcesEnums resourceType,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap) {
+ return resourceFilesMap.get(resourceType);
+ }
+
+ static String[] getCheckedFilenames(
+ ResourcesEnums resourceType,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap) {
+ java.util.List<CheckableResourceFilename> checkableFilenames = getCheckableResourceFilenames(
+ resourceType, resourceFilesMap);
+ java.util.List<String> checkedNames = new ArrayList<String>();
+
+ for (CheckableResourceFilename checkableFilename : checkableFilenames) {
+ if (checkableFilename.isChecked()) {
+ checkedNames.add(checkableFilename.getFilename());
+ }
+ }
+
+ return Helper.toArrayOfStrings(checkedNames);
+ }
+
+ static CheckableResourceFilename[] getCheckedResourceFilenames(
+ ResourcesEnums resourceType,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap) {
+ java.util.List<CheckableResourceFilename> checkableFilenames = getCheckableResourceFilenames(
+ resourceType, resourceFilesMap);
+ java.util.List<CheckableResourceFilename> checkedResourceFilenames = new ArrayList<CheckableResourceFilename>();
+
+ for (CheckableResourceFilename checkableFilename : checkableFilenames) {
+ if (checkableFilename.isChecked()) {
+ checkedResourceFilenames.add(checkableFilename);
+ }
+ }
+
+ return toArrayOfCheckableResourceFilenames(checkedResourceFilenames);
+ }
+
+ static String[] getFilenames(
+ ResourcesEnums resourceType,
+ HashMap<ResourcesEnums, java.util.List<CheckableResourceFilename>> resourceFilesMap) {
+ java.util.List<CheckableResourceFilename> checkableFilenames = resourceFilesMap
+ .get(resourceType);
+ String[] filenames = new String[checkableFilenames.size()];
+ int i = 0;
+
+ for (CheckableResourceFilename checkableFilename : checkableFilenames) {
+ filenames[i] = checkableFilename.getFilename();
+ i++;
+ }
+
+ return filenames;
+ }
+
+ static ResourcesEnums getSelectedResourceType(ListViewer resourceTypesViewer) {
+ return (ResourcesEnums) ((StructuredSelection) resourceTypesViewer
+ .getSelection()).getFirstElement();
+ }
+
+ /**
+ * Converts the List of CheckableResourceFilename objects into a
+ * CheckableResourceFilename array. The opposite conversion is also provided
+ * by this class with method
+ * toListofCheckableResourceFilenames(CheckableResourceFilename []).
+ *
+ * @param list
+ * the java.util.List of CheckableResourceFilename objects to be
+ * converted (may be empty but cannot be null)
+ * @return the corresponding CheckableResourceFilename array or an empty
+ * array if list is empty.
+ * @see #toListofCheckableResourceFilenames(CheckableResourceFilename [])
+ */
+ static final CheckableResourceFilename[] toArrayOfCheckableResourceFilenames(
+ java.util.List<CheckableResourceFilename> list) {
+ if (list == null) {
+ throw new IllegalArgumentException("Parameter list cannot be null.");
+ }
+
+ CheckableResourceFilename[] array = new CheckableResourceFilename[list
+ .size()];
+
+ return list.toArray(array);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/views/ConsoleOutput.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,88 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.views;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+
+public class ConsoleOutput extends ViewPart {
+
+ public static final String ID = "com.symbian.smt.gui.views.consoleoutput"; //$NON-NLS-1$
+ private static Text text;
+ private static StringBuilder theText = new StringBuilder();
+
+ /**
+ * Adds text to the console output
+ *
+ * @param String
+ * Text to add to the console
+ * @return void
+ */
+ public static void addText(String someText) {
+
+ theText.append(someText);
+ theText.append(System.getProperty("line.separator"));
+
+ if (text != null) {
+ text.setText(theText.toString());
+ text.append("");
+ }
+ }
+
+ /**
+ * Returns the text contained in the console output
+ *
+ * @return String
+ */
+ public static String getText() {
+ if (theText.toString().length() > 0) {
+ return theText.toString();
+ }
+
+ return "";
+ }
+
+ /**
+ * Resets the console output, removes all text
+ *
+ * @return void
+ */
+ public static void reset() {
+ theText = new StringBuilder();
+
+ if (text != null) {
+ text.setText("");
+ }
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ text = new Text(parent, SWT.WRAP | SWT.V_SCROLL | SWT.MULTI
+ | SWT.BORDER);
+ text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ text.setEditable(false);
+ }
+
+ @Override
+ public void setFocus() {
+ if (theText != null) {
+ text.setText(theText.toString());
+ text.append("");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/wizard/NewProjectCreationPageCaseInsensitive.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,50 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+package com.symbian.smt.gui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+public class NewProjectCreationPageCaseInsensitive extends
+ WizardNewProjectCreationPage {
+
+ public NewProjectCreationPageCaseInsensitive(String pageName) {
+ super(pageName);
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ String projectName = getProjectName().trim();
+
+ if (projectName.length() > 0) {
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects()) {
+ if (project.getName().equalsIgnoreCase(projectName)) {
+ setErrorMessage("A project with that name already exists in the workspace.");
+ return false;
+ }
+ }
+ }
+
+ if (getLocationPath().isUNC()) {
+ setErrorMessage("UNC paths are not compatible with the System Model Manager");
+ return false;
+ }
+
+ return super.isPageComplete();
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/wizard/NewProjectWizardSystemDefsPage.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,113 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.wizard;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+import com.symbian.smt.gui.smtwidgets.SystemDefinitionFilesWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.ValidModelObservable;
+
+public class NewProjectWizardSystemDefsPage extends WizardPage implements
+ ValidModelDefinedListener {
+ private SystemDefinitionFilesWidget sysdef;
+
+ /**
+ * Creates a wizard page for entering information about System Definitions
+ *
+ * @return void
+ */
+ protected NewProjectWizardSystemDefsPage(ISelection selection) {
+ super("wizardPage");
+ setTitle("System Model Manager Wizard");
+ setDescription("Enter one or more system definition files to use for the System Model Diagram");
+ setPageComplete(false);
+ }
+
+ /**
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setLayout(new FillLayout(SWT.VERTICAL));
+ initialize();
+
+ setControl(container);
+
+ sysdef = new SystemDefinitionFilesWidget(container, SWT.NONE);
+
+ if (sysdef instanceof ValidModelObservable) {
+ ((ValidModelObservable) sysdef).addModelListener(this);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if (sysdef != null) {
+ if (sysdef instanceof ValidModelObservable) {
+ ((ValidModelObservable) sysdef).removeModelListener(this);
+ }
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns a list of the system definition files
+ *
+ * @return String[]
+ */
+ public String[] getSystemDefinitions() {
+ return sysdef.getSystemDefinitions();
+ }
+
+ private void initialize() {
+ }
+
+ /**
+ * Sets the system definition files
+ *
+ * @param sysDefs
+ * A list containing system definition files
+ * @return void
+ */
+ public void setSystemDefinitions(String[] sysDefs) {
+ sysdef.setSystemDefinitions(sysDefs);
+ }
+
+ /**
+ * This is called by the observed object when a change is made and controls
+ * wizard flow
+ *
+ * @param event
+ * the ValidModelEvent object created by the observer object and
+ * indicating if the wizard page is complete
+ * @return void
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+
+ setPageComplete(isValid);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/wizard/NewProjectWizardTabbedPropertiesPage.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,932 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.wizard;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+
+import com.symbian.smt.gui.PersistentDataStore;
+import com.symbian.smt.gui.smtwidgets.AdvancedOptionsWidget;
+import com.symbian.smt.gui.smtwidgets.BuildControlWidget;
+import com.symbian.smt.gui.smtwidgets.FilterWidget;
+import com.symbian.smt.gui.smtwidgets.IgnoreWidget;
+import com.symbian.smt.gui.smtwidgets.ModelControlWidget;
+import com.symbian.smt.gui.smtwidgets.ModelLabelsWidget;
+import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener;
+import com.symbian.smt.gui.smtwidgets.ValidModelEvent;
+import com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget;
+
+public class NewProjectWizardTabbedPropertiesPage extends WizardPage implements
+ ValidModelDefinedListener {
+
+ // Custom composite SWT widgets
+ private ModelLabelsWidget modelLabelsWidget;
+ private ResourcesWidget resourcesWidget;
+ private ModelControlWidget modelControlWidget;
+ private FilterWidget filterWidget;
+ private IgnoreWidget ignoreWidget;
+ private BuildControlWidget buildWidget;
+ private AdvancedOptionsWidget advancedOptionsWidget;
+ private TabFolder tabFolder;
+
+ /**
+ * Creates a wizard page for entering optional System Model information
+ *
+ * @return void
+ */
+ protected NewProjectWizardTabbedPropertiesPage(ISelection selection) {
+ super("wizardPage");
+ setTitle("System Model Manager Wizard");
+ setDescription("Enter any optional configuration information for the System Model Diagram");
+ }
+
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+
+ container.setLayout(new FillLayout(SWT.VERTICAL));
+
+ setControl(container);
+
+ tabFolder = new TabFolder(container, SWT.NONE);
+
+ final TabItem labelsTabItem = new TabItem(tabFolder, SWT.NONE);
+ labelsTabItem.setText("Labels");
+ modelLabelsWidget = new ModelLabelsWidget(tabFolder, SWT.NONE);
+ labelsTabItem.setControl(modelLabelsWidget);
+
+ final TabItem resourcesTabItem = new TabItem(tabFolder, SWT.NONE);
+ resourcesTabItem.setText("Resources");
+ resourcesWidget = new ResourcesWidget(tabFolder, SWT.NONE);
+ resourcesTabItem.setControl(resourcesWidget);
+
+ final TabItem modelControlTabItem = new TabItem(tabFolder, SWT.NONE);
+ modelControlTabItem.setText("Model Control");
+ modelControlWidget = new ModelControlWidget(tabFolder, SWT.NONE);
+ modelControlTabItem.setControl(modelControlWidget);
+
+ final TabItem filtersTabItem = new TabItem(tabFolder, SWT.NONE);
+ filtersTabItem.setText("Filters");
+ filterWidget = new FilterWidget(tabFolder, SWT.NONE);
+ filtersTabItem.setControl(filterWidget);
+
+ final TabItem ignoreListTabItem = new TabItem(tabFolder, SWT.NONE);
+ ignoreListTabItem.setText("Ignore List");
+ ignoreWidget = new IgnoreWidget(tabFolder, SWT.NONE);
+ ignoreListTabItem.setControl(ignoreWidget);
+
+ final TabItem buildControlTabItem = new TabItem(tabFolder, SWT.NONE);
+ buildControlTabItem.setText("Build Options");
+ buildWidget = new BuildControlWidget(tabFolder, SWT.NONE, false);
+ buildControlTabItem.setControl(buildWidget);
+
+ final TabItem advancedOptionsTabItem = new TabItem(tabFolder, SWT.NONE);
+ advancedOptionsTabItem.setText("Advanced Options");
+ advancedOptionsWidget = new AdvancedOptionsWidget(tabFolder, SWT.NONE);
+ advancedOptionsTabItem.setControl(advancedOptionsWidget);
+ }
+
+ @Override
+ public void dispose() {
+ if (buildWidget != null) {
+ buildWidget.removeModelListener(this);
+ }
+
+ if (modelControlWidget != null) {
+ modelControlWidget.removeModelListener(this);
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns the advanced options or an empty string array if no advanced
+ * options have been specified
+ *
+ * @return String the advanced options
+ */
+ public String[] getAdvancedOptions() {
+ return advancedOptionsWidget.getAdvancedOptions();
+ }
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getBorderShapesFiles() {
+ return resourcesWidget.getBorderShapesFiles();
+ }
+
+ // Build Options
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getBorderStylesFiles() {
+ return resourcesWidget.getBorderStylesFiles();
+ }
+
+ // Model Labels Setters & Getters
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getColoursFiles() {
+ return resourcesWidget.getColoursFiles();
+ }
+
+ /**
+ * Returns the copyright text from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getCopyrightText() {
+ return modelLabelsWidget.getCopyrightText();
+ }
+
+ /**
+ * Returns the border shapes files or an empty string if no border shapes
+ * file has been specified
+ *
+ * @return String
+ */
+ public String[] getDefaultBorderShapesFiles() {
+ return resourcesWidget.getSelectedBorderShapesFiles();
+ }
+
+ /**
+ * Returns the border styles files or an empty string if no border styles
+ * file has been specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultBorderStylesFiles() {
+ return resourcesWidget.getSelectedBorderStylesFiles();
+ }
+
+ /**
+ * Returns the colours files or an empty string if no colours file has been
+ * specified
+ *
+ * @return String
+ */
+ public String[] getDefaultColoursFiles() {
+ return resourcesWidget.getSelectedColoursFiles();
+ }
+
+ /**
+ * Returns the dependencies files or an empty string if no dependencies file
+ * has been specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultDependenciesFiles() {
+ return resourcesWidget.getSelectedDependenciesFiles();
+ }
+
+ /**
+ * Returns the default distribution text value from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getDefaultDistributionText() {
+ return modelLabelsWidget.getSelectedDistributionText();
+ }
+
+ /**
+ * Returns the levels files or an empty string if no levels file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultLevelsFiles() {
+ return resourcesWidget.getSelectedLevelsFiles();
+ }
+
+ /**
+ * Returns the localisation files or an empty string if no localisation file
+ * has been specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultLocalisationFiles() {
+ return resourcesWidget.getSelectedLocalisationFiles();
+ }
+
+ /**
+ * Returns the default model version text value from the Model Label widget
+ *
+ * @return String
+ */
+ public String getDefaultModelVersionText() {
+ return modelLabelsWidget.getSelectedModelVersionText();
+ }
+
+ /**
+ * Returns the patterns files or an empty string if no patterns file has
+ * been specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultPatternsFiles() {
+ return resourcesWidget.getSelectedPatternsFiles();
+ }
+
+ /**
+ * Returns the default printed DPI value from the Model Control widget
+ *
+ * @return String
+ */
+ public String getDefaultPrintedDpi() {
+ return modelControlWidget.getSelectedPrintedDpi();
+ }
+
+ /**
+ * Returns the S12 XML files or an empty string if no system info file has
+ * been specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultS12XmlFiles() {
+ return resourcesWidget.getSelectedS12XmlFiles();
+ }
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultShapesFiles() {
+ return resourcesWidget.getSelectedShapesFiles();
+ }
+
+ /**
+ * Returns the system info files or an empty string if no system info file
+ * has been specified
+ *
+ * @return String[]
+ */
+ public String[] getDefaultSystemInfoFiles() {
+ return resourcesWidget.getSelectedSystemInfoFiles();
+ }
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getDependenciesFiles() {
+ return resourcesWidget.getDependenciesFiles();
+ }
+
+ // Model Control Setters & Getters
+
+ /**
+ * Returns the distribution text values from the Model Labels widget
+ *
+ * @return String[]
+ */
+ public String[] getDistributionTexts() {
+ return modelLabelsWidget.getDistributionTexts();
+ }
+
+ /**
+ * Returns the filter items from the Filter Widget
+ *
+ * @return String[]
+ */
+ public String[] getFilterItems() {
+ return filterWidget.getFilterItems();
+ }
+
+ /**
+ * Returns a boolean value from the Model Control widget indicating if the
+ * Fix Item Size button has been selected
+ *
+ * @return a Boolean value specifying whether or not the item size is fixed.
+ */
+ public Boolean getFixItemSize() {
+ return modelControlWidget.getFixItemSize();
+ }
+
+ /**
+ * Returns a boolean value from the Model Control widget indicating if the
+ * Highlight Core OS button has been selected
+ *
+ * @return Boolean
+ */
+ public Boolean getHighlightCoreOS() {
+ return modelControlWidget.getHighlightCoreOS();
+ }
+
+ /**
+ * Returns a list of the ignore items from the Ignore Items Widget
+ *
+ * @return List<String>
+ */
+ public List<String[]> getIgnoreItems() {
+ return ignoreWidget.getIgnoreItems();
+ }
+
+ /**
+ * Returns the level of detail from the Model Control widget
+ *
+ * @return String
+ */
+ public String getLevelOfDetail() {
+ return modelControlWidget.getLevelOfDetail();
+ }
+
+ /**
+ * Returns the levels files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getLevelsFiles() {
+ return resourcesWidget.getLevelsFiles();
+ }
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getLocalisationFiles() {
+ return resourcesWidget.getLocalisationFiles();
+ }
+
+ /**
+ * Returns the model name from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getModelName() {
+ return modelLabelsWidget.getModelName();
+ }
+
+ /**
+ * Returns the text for the model version from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getModelVersion() {
+ return modelLabelsWidget.getModelVersion();
+ }
+
+ /**
+ * Returns the model version text values from the Model Labels widget
+ *
+ * @return String[]
+ */
+ public String[] getModelVersionTexts() {
+ return modelLabelsWidget.getModelVersionTexts();
+ }
+
+ public String getOutputFilename() {
+ return buildWidget.getOutputFilename();
+ }
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getPatternsFiles() {
+ return resourcesWidget.getPatternsFiles();
+ }
+
+ /**
+ * Returns the printed DPI values from the Model Control widget
+ *
+ * @return String
+ */
+ public String[] getPrintedDpis() {
+ return modelControlWidget.getPrintedDpis();
+ }
+
+ /**
+ * Returns the S12 XML files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getS12XmlFiles() {
+ return resourcesWidget.getS12XmlFiles();
+ }
+
+ /**
+ * Returns the selected distribution text value from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getSelectedDistributionText() {
+ return modelLabelsWidget.getSelectedDistributionText();
+ }
+
+ /**
+ * Returns the selected model version text value from the Model Label widget
+ *
+ * @return String
+ */
+ public String getSelectedModelVersionText() {
+ return modelLabelsWidget.getSelectedModelVersionText();
+ }
+
+ /**
+ * Returns the selected printed DPI value from the Model Control widget
+ *
+ * @return String
+ */
+ public String getSelectedPrintedDpi() {
+ return modelControlWidget.getSelectedPrintedDpi();
+ }
+
+ // Resources Setters & Getters
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getShapesFiles() {
+ return resourcesWidget.getShapesFiles();
+ }
+
+ /**
+ * Returns a boolean value indicating if the Suppress Mouseover Effects
+ * button has been selected
+ *
+ * @return Boolean
+ */
+ public Boolean getSuppressMouseOverEffect() {
+ return modelControlWidget.getSuppressMouseOverEffect();
+ }
+
+ /**
+ * Returns the shapes files or an empty string if no shapes file has been
+ * specified
+ *
+ * @return String[]
+ */
+ public String[] getSystemInfoFiles() {
+ return resourcesWidget.getSystemInfoFiles();
+ }
+
+ /**
+ * Returns the system name from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getSystemName() {
+ return modelLabelsWidget.getSystemName();
+ }
+
+ /**
+ * Returns the text for the system version from the Model Labels widget
+ *
+ * @return String
+ */
+ public String getSystemVersion() {
+ return modelLabelsWidget.getSystemVersion();
+ }
+
+ /**
+ * This method is for PDE JUnit testing purposes.
+ *
+ * @return the tabFolder
+ */
+ public TabFolder getTabFolder() {
+ return tabFolder;
+ }
+
+ public void initialize(PersistentDataStore store) {
+ filterWidget.setFilterItems(store.getFilterHasItems());
+
+ ignoreWidget.setIgnoreItems(store.getIgnoreItems());
+
+ // Model Control
+ modelControlWidget.initialisePrintedDpi(store);
+ modelControlWidget.setLevelOfDetail(store.getLevelOfDetail());
+ modelControlWidget.setHighlightCoreOS(store.getHighlightCoreOS());
+ modelControlWidget.setSuppressMouseOverEffect(store
+ .getSuppressMouseOverEffect());
+ modelControlWidget.setFixItemSize(store.getFixItemSize());
+
+ // Model Labels
+ modelLabelsWidget.initialiseModelVersionText(store);
+ modelLabelsWidget.initialiseDistributionText(store);
+ modelLabelsWidget.setModelVersion(store.getModelVersion());
+ modelLabelsWidget.setSystemVersion(store.getSystemVersion());
+ modelLabelsWidget.setCopyrightText(store.getCopyrightText());
+ modelLabelsWidget.setModelName(store.getModelName());
+ modelLabelsWidget.setSystemName(store.getSystemName());
+
+ // All files
+ resourcesWidget.setBorderShapesFiles(store.getBorderShapesFiles());
+ resourcesWidget.setBorderStylesFiles(store.getBorderStylesFiles());
+ resourcesWidget.setColoursFiles(store.getColoursFiles());
+ resourcesWidget.setDependenciesFiles(store.getDependenciesFiles());
+ resourcesWidget.setLevelsFiles(store.getLevelsFiles());
+ resourcesWidget.setLocalisationFiles(store.getLocalisationFiles());
+ resourcesWidget.setPatternsFiles(store.getPatternsFiles());
+ resourcesWidget.setShapesFiles(store.getShapesFiles());
+ resourcesWidget.setSystemInfoFiles(store.getSystemInfoFiles());
+ resourcesWidget.setS12XmlFiles(store.getS12XmlFiles());
+
+ // Default files
+ resourcesWidget.setSelectedBorderShapesFiles(store
+ .getSelectedBorderShapesFiles());
+ resourcesWidget.setSelectedBorderStylesFiles(store
+ .getSelectedBorderStylesFiles());
+ resourcesWidget
+ .setSelectedColoursFiles(store.getSelectedColoursFiles());
+ resourcesWidget.setSelectedDependenciesFiles(store
+ .getSelectedDependenciesFiles());
+ resourcesWidget.setSelectedLevelsFiles(store.getSelectedLevelsFiles());
+ resourcesWidget.setSelectedLocalisationFiles(store
+ .getSelectedLocalisationFiles());
+ resourcesWidget.setSelectedPatternsFiles(store
+ .getSelectedPatternsFiles());
+ resourcesWidget.setSelectedShapesFiles(store.getSelectedShapesFiles());
+ resourcesWidget.setSelectedSystemInfoFiles(store
+ .getSelectedSystemInfoFiles());
+ resourcesWidget.setSelectedS12XmlFiles(store.getSelectedS12XmlFiles());
+
+ // Advanced Options
+ advancedOptionsWidget.setAdvancedOptions(store.getAdvancedOptions());
+
+ buildWidget.setOutputFilename(store.getOutputFilename());
+
+ // Adding this class as listener of model valid events
+ buildWidget.addModelListener(this);
+ modelControlWidget.addModelListener(this);
+ }
+
+ public void setAdvancedOptions(String[] options) {
+ advancedOptionsWidget.setAdvancedOptions(options);
+ }
+
+ public void setBorderShapesFiles(String[] filenames) {
+ resourcesWidget.setBorderShapesFiles(filenames);
+ }
+
+ public void setBorderStylesFiles(String[] filenames) {
+ resourcesWidget.setBorderStylesFiles(filenames);
+ }
+
+ public void setColoursFiles(String[] filenames) {
+ resourcesWidget.setColoursFiles(filenames);
+ }
+
+ /**
+ * Sets the text for the copyright text in the Model Labels widget
+ *
+ * @param copyrightText
+ * String to be used for the copyright text
+ * @return void
+ */
+ public void setCopyrightText(String copyrightText) {
+ modelLabelsWidget.setCopyrightText(copyrightText);
+ }
+
+ public void setDefaultBorderShapesFiles(String[] filenames) {
+ resourcesWidget.setSelectedBorderShapesFiles(filenames);
+ }
+
+ public void setDefaultBorderStylesFiles(String[] filenames) {
+ resourcesWidget.setSelectedBorderStylesFiles(filenames);
+ }
+
+ public void setDefaultColoursFiles(String[] filenames) {
+ resourcesWidget.setSelectedColoursFiles(filenames);
+ }
+
+ public void setDefaultDependenciesFiles(String[] filenames) {
+ resourcesWidget.setSelectedDependenciesFiles(filenames);
+ }
+
+ /**
+ * Sets the default distribution text value in the Model Labels widget
+ *
+ * @param distributionText
+ * The default distribution text value to set.
+ * @return void
+ */
+ public void setDefaultDistributionText(String distributionText) {
+ modelLabelsWidget.setSelectedDistributionText(distributionText);
+ }
+
+ public void setDefaultLevelsFiles(String[] filenames) {
+ resourcesWidget.setSelectedLevelsFiles(filenames);
+ }
+
+ public void setDefaultLocalisationFiles(String[] filenames) {
+ resourcesWidget.setSelectedLocalisationFiles(filenames);
+ }
+
+ /**
+ * Sets the default model version text value in the Model Label widget
+ *
+ * @param modelVersionText
+ * The default model version text value to set.
+ * @return void
+ */
+ public void setDefaultModelVersionText(String modelVersionText) {
+ modelLabelsWidget.setSelectedModelVersionText(modelVersionText);
+ }
+
+ public void setDefaultPatternsFiles(String[] filenames) {
+ resourcesWidget.setSelectedPatternsFiles(filenames);
+ }
+
+ /**
+ * Sets the default printed DPI value in the Model Control widget
+ *
+ * @param dpi
+ * The default printed DPI value to set.
+ * @return void
+ */
+ public void setDefaultPrintedDpi(String dpi) {
+ modelControlWidget.setSelectedPrintedDpi(dpi);
+ }
+
+ public void setDefaultS12XmlFiles(String[] filenames) {
+ resourcesWidget.setSelectedS12XmlFiles(filenames);
+ }
+
+ public void setDefaultShapesFiles(String[] filenames) {
+ resourcesWidget.setSelectedShapesFiles(filenames);
+ }
+
+ public void setDefaultSystemInfoFiles(String[] filenames) {
+ resourcesWidget.setSelectedSystemInfoFiles(filenames);
+ }
+
+ public void setDependenciesFiles(String[] filenames) {
+ resourcesWidget.setDependenciesFiles(filenames);
+ }
+
+ /**
+ * Sets the distribution text values in the Model Labels widget
+ *
+ * @param distributionTexts
+ * The distribution text values to set.
+ * @return void
+ */
+ public void setDistributionTexts(String[] distributionTexts) {
+ modelLabelsWidget.setDistributionTexts(distributionTexts);
+ }
+
+ /**
+ * Sets the filter items in the the Filter Widget
+ *
+ * @param filterItems
+ * A list containing filters.
+ * @return void
+ */
+ public void setFilterItems(String[] filterItems) {
+ filterWidget.setFilterItems(filterItems);
+ }
+
+ /**
+ * Sets the value for the Fix Item Size button in the Model Control widget
+ *
+ * @param value
+ * Boolean value indicating if the item size is fixed or not
+ * @return void
+ */
+ public void setFixItemSize(Boolean value) {
+ modelControlWidget.setFixItemSize(value);
+ }
+
+ /**
+ * Sets the value for the Highlight Core OS button in the Model Control
+ * widget
+ *
+ * @param HighlightCoreOS
+ * Boolean value indicating if the Core OS section is to be
+ * highlighted
+ * @return void
+ */
+ public void setHighlightCoreOS(Boolean value) {
+ modelControlWidget.setHighlightCoreOS(value);
+ }
+
+ /**
+ * Sets the ignore items in the Ignore Items Widget
+ *
+ * @param ignoreItems
+ * an List containing 2 element lists. The first element contains
+ * the item type and the second element contains the item text.
+ * @return void
+ */
+ public void setIgnoreItems(List<String[]> ignoreItems) {
+ ignoreWidget.setIgnoreItems(ignoreItems);
+ }
+
+ /**
+ * Sets the level of detail in the Model Control widget
+ *
+ * @param level
+ * The level of detail to set.
+ * @return void
+ */
+ public void setLevelOfDetail(String level) {
+ modelControlWidget.setLevelOfDetail(level);
+ }
+
+ public void setLevelsFiles(String[] filenames) {
+ resourcesWidget.setLevelsFiles(filenames);
+ }
+
+ public void setLocalisationFiles(String[] filenames) {
+ resourcesWidget.setLocalisationFiles(filenames);
+ }
+
+ /**
+ * Sets the text for the model name in the Model Labels widget
+ *
+ * @param modelName
+ * String to be used for the model name
+ * @return void
+ */
+ public void setModelName(String modelName) {
+ modelLabelsWidget.setModelName(modelName);
+ }
+
+ /**
+ * Sets the text for the model version in the Model Labels widget
+ *
+ * @param modelVersion
+ * String to be used for the model version
+ * @return void
+ */
+ public void setModelVersion(String modelVersion) {
+ modelLabelsWidget.setModelVersion(modelVersion);
+ }
+
+ /**
+ * Sets the values for the model version text in the Model Labels widget
+ *
+ * @param modelVersionTexts
+ * String array to be used for the model version text values
+ * @return void
+ */
+ public void setModelVersionTexts(String[] modelVersionTexts) {
+ modelLabelsWidget.setModelVersionTexts(modelVersionTexts);
+ }
+
+ public void setPatternsFiles(String[] filenames) {
+ resourcesWidget.setPatternsFiles(filenames);
+ }
+
+ /**
+ * Sets the printed DPI values in the Model Control widget
+ *
+ * @param dpi
+ * The printed DPI values to set.
+ * @return void
+ */
+ public void setPrintedDpis(String[] dpis) {
+ modelControlWidget.setPrintedDpis(dpis);
+ }
+
+ public void setS12XmlFiles(String[] filenames) {
+ resourcesWidget.setS12XmlFiles(filenames);
+ }
+
+ /**
+ * Sets the selected distribution text value in the Model Labels widget
+ *
+ * @param distributionText
+ * The selected distribution text value to set.
+ * @return void
+ */
+ public void setSelectedDistributionText(String distributionText) {
+ modelLabelsWidget.setSelectedDistributionText(distributionText);
+ }
+
+ /**
+ * Sets the selected model version text value in the Model Label widget
+ *
+ * @param modelVersionText
+ * The selected model version text value to set.
+ * @return void
+ */
+ public void setSelectedModelVersionText(String modelVersionText) {
+ modelLabelsWidget.setSelectedModelVersionText(modelVersionText);
+ }
+
+ // Filter Items Getters & Setters
+
+ /**
+ * Sets the selected printed DPI value in the Model Control widget
+ *
+ * @param dpi
+ * The selected printed DPI value to set.
+ * @return void
+ */
+ public void setSelectedPrintedDpi(String dpi) {
+ modelControlWidget.setSelectedPrintedDpi(dpi);
+ }
+
+ public void setShapesFiles(String[] filenames) {
+ resourcesWidget.setShapesFiles(filenames);
+ }
+
+ // Ignore Items Getters & Setters
+
+ /**
+ * Sets the value for the Suppress Mouseover Effects button
+ *
+ * @param suppressMouseOverEffect
+ * Boolean value indicating if the Suppress Mouseover Effects is
+ * it be used when generating the diagram
+ * @return void
+ */
+ public void setSuppressMouseOverEffect(Boolean suppressMouseOverEffect) {
+ modelControlWidget.setSuppressMouseOverEffect(suppressMouseOverEffect);
+ }
+
+ public void setSystemInfoFiles(String[] filenames) {
+ resourcesWidget.setSystemInfoFiles(filenames);
+ }
+
+ /**
+ * Sets the text for the system name in the Model Labels widget
+ *
+ * @param systemName
+ * String to be used for the system name
+ * @return void
+ */
+ public void setSystemName(String systemName) {
+ modelLabelsWidget.setSystemName(systemName);
+ }
+
+ /**
+ * Sets the text for the system version in the Model Labels widget
+ *
+ * @param systemVersion
+ * String to be used for the system version
+ * @return void
+ */
+ public void setSystemVersion(String systemVersion) {
+ modelLabelsWidget.setSystemVersion(systemVersion);
+ }
+
+ /**
+ * This is called by the observed object when a change is made and controls
+ * wizard flow
+ *
+ * @param event
+ * the ValidModelEvent object created by the observer object and
+ * indicating if the wizard page is complete
+ * @return void
+ */
+ public void validModelDefined(ValidModelEvent event) {
+ Boolean isValid = event.isValid();
+
+ setPageComplete(isValid);
+
+ if (isValid) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(event.getMessage());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/wizard/NewSMTProjectWizard.java Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,373 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ${file_name}
+//
+//
+
+package com.symbian.smt.gui.wizard;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+
+import com.symbian.smt.gui.AbstractPersistentDataStore;
+import com.symbian.smt.gui.Activator;
+import com.symbian.smt.gui.Logger;
+import com.symbian.smt.gui.ManageResources;
+import com.symbian.smt.gui.PersistentDataStore;
+
+public class NewSMTProjectWizard extends Wizard implements INewWizard,
+ IExecutableExtension {
+ private NewProjectCreationPageCaseInsensitive projectCreationWizardPage;
+
+ private NewProjectWizardSystemDefsPage systemDefsWizardPage;
+ private NewProjectWizardTabbedPropertiesPage tabbedPropertiesWizardPage;
+
+ private ISelection selection;
+ private IWorkbench workbench;
+ private IConfigurationElement config;
+ private IProject projectHandle;
+
+ /**
+ * This is the entry point for creating and managing the wizard
+ *
+ * @return void
+ */
+ public NewSMTProjectWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * Adds pages to the wizard
+ *
+ * @return void
+ */
+ public void addPages() {
+ projectCreationWizardPage = new NewProjectCreationPageCaseInsensitive(
+ "page1");
+
+ projectCreationWizardPage.setTitle("System Model Manager Wizard");
+ projectCreationWizardPage
+ .setDescription("Enter a name for the new project...");
+ addPage(projectCreationWizardPage);
+
+ systemDefsWizardPage = new NewProjectWizardSystemDefsPage(selection);
+ addPage(systemDefsWizardPage);
+
+ tabbedPropertiesWizardPage = new NewProjectWizardTabbedPropertiesPage(
+ selection);
+ addPage(tabbedPropertiesWizardPage);
+ }
+
+ private void copyFilesIntoProject() {
+ // Add the folders and files to the project
+ ManageResources.updateShapesFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultShapesFiles());
+ ManageResources.updateLevelsFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultLevelsFiles());
+ ManageResources.updateLocalisationFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultLocalisationFiles());
+ ManageResources.updateDependenciesFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultDependenciesFiles());
+ ManageResources.updateSystemInfoFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultSystemInfoFiles());
+ ManageResources.updateColoursFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultColoursFiles());
+ ManageResources.updateBorderStylesFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultBorderStylesFiles());
+ ManageResources.updateBorderShapesFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultBorderShapesFiles());
+ ManageResources.updatePatternsFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultPatternsFiles());
+ ManageResources.updateS12XmlFiles(projectHandle,
+ tabbedPropertiesWizardPage.getDefaultS12XmlFiles());
+
+ // Add the system definition files to the project
+ ManageResources.updateSystemDefinitionFiles(projectHandle,
+ systemDefsWizardPage.getSystemDefinitions(), false);
+ }
+
+ public void createPageControls(Composite pageContainer) {
+ super.createPageControls(pageContainer);
+
+ IScopeContext defaultScope = new DefaultScope();
+ IEclipsePreferences defaultNode = defaultScope
+ .getNode(Activator.PLUGIN_ID);
+
+ IScopeContext instanceScope = new InstanceScope();
+ IEclipsePreferences instanceNode = instanceScope
+ .getNode(Activator.PLUGIN_ID);
+ PersistentDataStore instanceStore = new PersistentDataStore(
+ instanceNode, defaultNode);
+
+ tabbedPropertiesWizardPage.initialize(instanceStore);
+ }
+
+ /**
+ * Sets up the project - project folder, nature, files, folders etc
+ *
+ * @return void
+ */
+ void createProject(IProjectDescription description, IProject proj,
+ IProgressMonitor monitor) throws CoreException,
+ OperationCanceledException {
+ try {
+
+ monitor.beginTask("", 2000);
+
+ proj.create(description, new SubProgressMonitor(monitor, 1000));
+
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ proj.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(
+ monitor, 1000));
+
+ try {
+ String[] natures = description.getNatureIds();
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = "com.symbian.smt.gui.nature";
+ description.setNatureIds(newNatures);
+ proj.setDescription(description, null);
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if we can initialise
+ * from it.
+ *
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ this.workbench = workbench;
+ }
+
+ /**
+ * This method is called when the finish button is pressed in the wizard
+ *
+ * @return boolean
+ */
+ public boolean performFinish() {
+ projectHandle = projectCreationWizardPage.getProjectHandle();
+
+ if (projectHandle == null) {
+ return false;
+ }
+
+ URI projectURI = (!projectCreationWizardPage.useDefaults()) ? projectCreationWizardPage
+ .getLocationURI()
+ : null;
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ final IProjectDescription desc = workspace
+ .newProjectDescription(projectHandle.getName());
+
+ desc.setLocationURI(projectURI);
+
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException {
+ createProject(desc, projectHandle, monitor);
+ }
+ };
+
+ try {
+ getContainer().run(false, false, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException
+ .getMessage());
+ return false;
+ }
+
+ completePerformFinish();
+
+ // If auto building has been disabled then we force the build
+
+ IWorkspaceDescription description = workspace.getDescription();
+ // If auto building has been disabled then we force the build
+ if (!description.isAutoBuilding()) {
+ Job j= new Job("Building workspace") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ projectHandle.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
+ } catch (CoreException e) {
+ Logger.log(e.getMessage(), e);
+ }
+
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, IStatus.OK, "updating properties succeeded", null);
+ }
+ };
+ j.schedule();
+ }
+
+ return true;
+ }
+
+ private void completePerformFinish() {
+ IWorkspaceRunnable op = new IWorkspaceRunnable () {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Creating project", 0);
+
+ // Persist the project information
+ // This needs to be done first as the builder will try to read from the
+ // persistent store
+ persistInformation();
+
+ // Copy the files into the project / Create file shortcut icons
+ copyFilesIntoProject();
+
+ BasicNewProjectResourceWizard.updatePerspective(config);
+ BasicNewProjectResourceWizard.selectAndReveal(projectHandle, workbench
+ .getActiveWorkbenchWindow());
+
+ monitor.worked(1);
+ monitor.done();
+ }
+ };
+
+ try {
+ ResourcesPlugin.getWorkspace().run(op, projectHandle, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ MessageDialog.openError(getShell(), "Error", e.getMessage());
+ return;
+ }
+ }
+
+ private void persistInformation() {
+ IScopeContext projectScope = new ProjectScope(projectHandle);
+ IEclipsePreferences node = projectScope.getNode(Activator.PLUGIN_ID);
+
+ AbstractPersistentDataStore dataStore = new PersistentDataStore(node);
+
+ // Persist the Output Filename
+ dataStore.setOutputFilename(tabbedPropertiesWizardPage
+ .getOutputFilename());
+
+ // Persist the Model Labels
+ dataStore.setCopyrightText(tabbedPropertiesWizardPage
+ .getCopyrightText());
+ dataStore.setDistributionTexts(tabbedPropertiesWizardPage
+ .getDistributionTexts());
+ dataStore.setSelectedDistributionText(tabbedPropertiesWizardPage
+ .getSelectedDistributionText());
+ dataStore.setModelName(tabbedPropertiesWizardPage.getModelName());
+ dataStore.setModelVersion(tabbedPropertiesWizardPage.getModelVersion());
+ dataStore.setModelVersionTexts(tabbedPropertiesWizardPage
+ .getModelVersionTexts());
+ dataStore.setSelectedModelVersionText(tabbedPropertiesWizardPage
+ .getSelectedModelVersionText());
+ dataStore.setSystemName(tabbedPropertiesWizardPage.getSystemName());
+ dataStore.setSystemVersion(tabbedPropertiesWizardPage
+ .getSystemVersion());
+
+ // Persist the Model Control
+ dataStore.setHighlightCoreOS(tabbedPropertiesWizardPage
+ .getHighlightCoreOS());
+ dataStore.setLevelOfDetail(tabbedPropertiesWizardPage
+ .getLevelOfDetail());
+ dataStore.setPrintedDpis(tabbedPropertiesWizardPage.getPrintedDpis());
+ dataStore.setSelectedPrintedDpi(tabbedPropertiesWizardPage
+ .getSelectedPrintedDpi());
+ dataStore.setSuppressMouseOverEffect(tabbedPropertiesWizardPage
+ .getSuppressMouseOverEffect());
+ dataStore.setFixItemSize(tabbedPropertiesWizardPage.getFixItemSize());
+
+ // Persist the Resources, the selected file is persisted by the
+ // ManageResources widget
+ // All files (Selection is persisted as part of method
+ // copyFilesIntoProject())
+ dataStore.setBorderShapesFiles(tabbedPropertiesWizardPage
+ .getBorderShapesFiles());
+ dataStore.setBorderStylesFiles(tabbedPropertiesWizardPage
+ .getBorderStylesFiles());
+ dataStore.setColoursFiles(tabbedPropertiesWizardPage.getColoursFiles());
+ dataStore.setDependenciesFiles(tabbedPropertiesWizardPage
+ .getDependenciesFiles());
+ dataStore.setLevelsFiles(tabbedPropertiesWizardPage.getLevelsFiles());
+ dataStore.setLocalisationFiles(tabbedPropertiesWizardPage
+ .getLocalisationFiles());
+ dataStore.setPatternsFiles(tabbedPropertiesWizardPage
+ .getPatternsFiles());
+ dataStore.setShapesFiles(tabbedPropertiesWizardPage.getShapesFiles());
+ dataStore.setSystemInfoFiles(tabbedPropertiesWizardPage
+ .getSystemInfoFiles());
+ dataStore.setS12XmlFiles(tabbedPropertiesWizardPage.getS12XmlFiles());
+
+ // Persist the Ignore Items
+ dataStore.setIgnoreItems(tabbedPropertiesWizardPage.getIgnoreItems());
+
+ // Persist the Filter Items
+ dataStore
+ .setFilterHasItems(tabbedPropertiesWizardPage.getFilterItems());
+
+ // Persist the Advanced Options
+ dataStore.setAdvancedOptions(tabbedPropertiesWizardPage
+ .getAdvancedOptions());
+
+
+ }
+
+ public void setInitializationData(IConfigurationElement config,
+ String propertyName, Object data) throws CoreException {
+ this.config = config;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.gui/src/defaults.properties Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,67 @@
+SYSTEM_DEFINITION_FILES
+
+COPYRIGHT_TEXT = Nokia Corporation
+DISTRIBUTION_TEXT_DEFAULT = secret
+DISTRIBUTION_TEXT_SELECTED = secret
+DISTRIBUTION_TEXTS = secret|confidential|internal|unrestricted
+MODEL_NAME = System Model
+MODEL_VERSION = 1
+MODEL_VERSION_TEXT_DEFAULT = draft
+MODEL_VERSION_TEXT_SELECTED = draft
+MODEL_VERSION_TEXTS = draft|build|issued
+SYSTEM_NAME = Symbian OS
+SYSTEM_VERSION = Future
+
+HIGHTLIGHT_CORE_OS = on
+LEVEL_OF_DETAIL = component
+PRINTED_DPI_DEFAULT = 600
+PRINTED_DPI_SELECTED = 600
+PRINTED_DPIS = 300|600
+SUPPRESS_MOUSE_OVER_EFFECT = on
+FIX_ITEM_SIZE = off
+
+SHAPES_FILES = ./resources/auxiliary/Shapes.xml|./resources/auxiliary/Example-shapes.xml
+LEVELS_FILES = Auto|./resources/auxiliary/Levels.xml|./resources/auxiliary/Levels91.xml
+LOCALISATION_FILES = ./resources/auxiliary/display-names.xml
+DEPENDENCIES_FILES =
+SYSTEM_INFO_FILES = ./resources/auxiliary/SystemInfo.xml
+COLOURS_FILES = ./resources/auxiliary/system_model_colors.xml
+BORDER_STYLES_FILES =
+BORDER_SHAPES_FILES =
+PATTERNS_FILES =
+S12_XML_FILES =
+
+SHAPES_FILES_DEFAULT = ./resources/auxiliary/Shapes.xml|./resources/auxiliary/Example-shapes.xml
+LEVELS_FILES_DEFAULT = Auto|./resources/auxiliary/Levels.xml|./resources/auxiliary/Levels91.xml
+LOCALISATION_FILES_DEFAULT = ./resources/auxiliary/display-names.xml
+DEPENDENCIES_FILES_DEFAULT =
+SYSTEM_INFO_FILES_DEFAULT = ./resources/auxiliary/SystemInfo.xml
+COLOURS_FILES_DEFAULT = ./resources/auxiliary/system_model_colors.xml
+BORDER_STYLES_FILES_DEFAULT =
+BORDER_SHAPES_FILES_DEFAULT =
+PATTERNS_FILES_DEFAULT =
+S12_XML_FILES_DEFAULT =
+
+SHAPES_FILES_SELECTED = ./resources/auxiliary/Shapes.xml
+LEVELS_FILES_SELECTED = Auto
+LOCALISATION_FILES_SELECTED = ./resources/auxiliary/display-names.xml
+DEPENDENCIES_FILES_SELECTED =
+SYSTEM_INFO_FILES_SELECTED =
+COLOURS_FILES_SELECTED =
+BORDER_STYLES_FILES_SELECTED =
+BORDER_SHAPES_FILES_SELECTED =
+PATTERNS_FILES_SELECTED =
+S12_XML_FILES_SELECTED =
+
+# Deprecated argument. FILTER_HAS used instead
+FILTER_ITEMS = java|gt
+
+FILTER_HAS_ITEMS = *
+
+IGNORE_ITEMS = layer:Tools and Utils and SDKENG;layer:MISC;block:Techview
+
+WARNING_LEVELS = 1
+
+ADVANCED_OPTIONS
+
+OUTPUT_NAME = Model.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.updatesite/.project Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.symbian.smt.updatesite</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.UpdateSiteBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.UpdateSiteNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.updatesite/index.html Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>com.symbian.smt.updatesite</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<style>@import url("web/site.css");</style>
+<script type="text/javascript">
+ var returnval = 0;
+ var stylesheet, xmlFile, cache, doc;
+ function init(){
+ // NSCP 7.1+ / Mozilla 1.4.1+ / Safari
+ // Use the standard DOM Level 2 technique, if it is supported
+ if (document.implementation && document.implementation.createDocument) {
+ xmlFile = document.implementation.createDocument("", "", null);
+ stylesheet = document.implementation.createDocument("", "", null);
+ if (xmlFile.load){
+ xmlFile.load("site.xml");
+ stylesheet.load("web/site.xsl");
+ } else {
+ alert("Document could not be loaded by browser.");
+ }
+ xmlFile.addEventListener("load", transform, false);
+ stylesheet.addEventListener("load", transform, false);
+ }
+ //IE 6.0+ solution
+ else if (window.ActiveXObject) {
+ xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0");
+ xmlFile.async = false;
+ xmlFile.load("site.xml");
+ stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0");
+ stylesheet.async = false;
+ stylesheet.load("web/site.xsl");
+ cache = new ActiveXObject("msxml2.XSLTemplate.3.0");
+ cache.stylesheet = stylesheet;
+ transformData();
+ }
+ }
+ // separate transformation function for IE 6.0+
+ function transformData(){
+ var processor = cache.createProcessor();
+ processor.input = xmlFile;
+ processor.transform();
+ data.innerHTML = processor.output;
+ }
+ // separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+
+ function transform(){
+ returnval+=1;
+ if (returnval==2){
+ var processor = new XSLTProcessor();
+ processor.importStylesheet(stylesheet);
+ doc = processor.transformToDocument(xmlFile);
+ document.getElementById("data").innerHTML = doc.documentElement.innerHTML;
+ }
+ }
+</script>
+</head>
+<body onload="init();">
+<!--[insert static HTML here]-->
+<div id="data"><!-- this is where the transformed data goes --></div>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.updatesite/site.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/com.symbian.smt.gui.feature_1.0.0.jar" id="com.symbian.smt.gui.feature" version="1.0.0"/>
+</site>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.updatesite/web/site.css Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,12 @@
+<STYLE type="text/css">
+td.spacer {padding-bottom: 10px; padding-top: 10px;}
+.title { font-family: sans-serif; color: #99AACC;}
+.bodyText { font-family: sans-serif; font-size: 9pt; color:#000000; }
+.sub-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white;}
+.log-text {font-family: sans-serif; font-style: normal; font-weight: lighter; font-size: 8pt; color:black;}
+.big-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white; border-top:10px solid white;}
+.light-row {background:#FFFFFF}
+.dark-row {background:#EEEEFF}
+.header {background:#99AADD}
+#indent {word-wrap : break-word;width :300px;text-indent:10px;}
+</STYLE>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/com.symbian.smt.updatesite/web/site.xsl Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,214 @@
+<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl="urn:schemas-microsoft-com:xslt">
+<xsl:output method="html" encoding="UTF-8"/>
+<xsl:key name="cat" match="category" use="@name"/>
+<xsl:template match="/">
+<xsl:for-each select="site">
+ <html>
+ <head>
+ <title>com.symbian.smt.updatesite</title>
+ <style>@import url("web/site.css");</style>
+ </head>
+ <body>
+ <h1 class="title">com.symbian.smt.updatesite</h1>
+ <p class="bodyText"><xsl:value-of select="description"/></p>
+ <table width="100%" border="0" cellspacing="1" cellpadding="2">
+ <xsl:for-each select="category-def">
+ <xsl:sort select="@label" order="ascending" case-order="upper-first"/>
+ <xsl:sort select="@name" order="ascending" case-order="upper-first"/>
+ <xsl:if test="count(key('cat',@name)) != 0">
+ <tr class="header">
+ <td class="sub-header" width="30%">
+ <xsl:value-of select="@name"/>
+ </td>
+ <td class="sub-header" width="70%">
+ <xsl:value-of select="@label"/>
+ </td>
+ </tr>
+ <xsl:for-each select="key('cat',@name)">
+ <xsl:sort select="ancestor::feature//@version" order="ascending"/>
+ <xsl:sort select="ancestor::feature//@id" order="ascending" case-order="upper-first"/>
+ <tr>
+ <xsl:choose>
+ <xsl:when test="(position() mod 2 = 1)">
+ <xsl:attribute name="class">dark-row</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">light-row</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td class="log-text" id="indent">
+ <xsl:choose>
+ <xsl:when test="ancestor::feature//@label">
+ <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@label"/></a>
+ <br/>
+ <div id="indent">
+ (<xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/>)
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br />
+ </td>
+ <td>
+ <table>
+ <xsl:if test="ancestor::feature//@os">
+ <tr><td class="log-text" id="indent">Operating Systems:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@os"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="ancestor::feature//@ws">
+ <tr><td class="log-text" id="indent">Windows Systems:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@ws"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="ancestor::feature//@nl">
+ <tr><td class="log-text" id="indent">Languages:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@nl"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="ancestor::feature//@arch">
+ <tr><td class="log-text" id="indent">Architecture:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@arch"/></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </td>
+ </tr>
+ </xsl:for-each>
+ <tr><td class="spacer"><br/></td><td class="spacer"><br/></td></tr>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="count(feature) > count(feature/category)">
+ <tr class="header">
+ <td class="sub-header" colspan="2">
+ Uncategorized
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="function-available('msxsl:node-set')">
+ <xsl:variable name="rtf-nodes">
+ <xsl:for-each select="feature[not(category)]">
+ <xsl:sort select="@id" order="ascending" case-order="upper-first"/>
+ <xsl:sort select="@version" order="ascending" />
+ <xsl:value-of select="."/>
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="myNodeSet" select="msxsl:node-set($rtf-nodes)/*"/>
+ <xsl:for-each select="$myNodeSet">
+ <tr>
+ <xsl:choose>
+ <xsl:when test="position() mod 2 = 1">
+ <xsl:attribute name="class">dark-row</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">light-row</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td class="log-text" id="indent">
+ <xsl:choose>
+ <xsl:when test="@label">
+ <a href="{@url}"><xsl:value-of select="@label"/></a>
+ <br />
+ <div id="indent">
+ (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>)
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br /><br />
+ </td>
+ <td>
+ <table>
+ <xsl:if test="@os">
+ <tr><td class="log-text" id="indent">Operating Systems:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@os"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@ws">
+ <tr><td class="log-text" id="indent">Windows Systems:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@nl">
+ <tr><td class="log-text" id="indent">Languages:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@arch">
+ <tr><td class="log-text" id="indent">Architecture:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="feature[not(category)]">
+ <xsl:sort select="@id" order="ascending" case-order="upper-first"/>
+ <xsl:sort select="@version" order="ascending" />
+ <tr>
+ <xsl:choose>
+ <xsl:when test="count(preceding-sibling::feature[not(category)]) mod 2 = 1">
+ <xsl:attribute name="class">dark-row</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">light-row</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td class="log-text" id="indent">
+ <xsl:choose>
+ <xsl:when test="@label">
+ <a href="{@url}"><xsl:value-of select="@label"/></a>
+ <br />
+ <div id="indent">
+ (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>)
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br /><br />
+ </td>
+ <td>
+ <table>
+ <xsl:if test="@os">
+ <tr><td class="log-text" id="indent">Operating Systems:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@os"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@ws">
+ <tr><td class="log-text" id="indent">Windows Systems:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@nl">
+ <tr><td class="log-text" id="indent">Languages:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@arch">
+ <tr><td class="log-text" id="indent">Architecture:</td>
+ <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </table>
+ </body>
+ </html>
+</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/group/bld.inf Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,32 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+// Bld.Inf for all Java Programs.
+//
+prj_platforms
+tools2
+
+// Project Extensions
+prj_extensions
+
+start extension tools/ant_launch
+
+option build_xml build.xml
+
+option target build.jar
+
+// option args -Da=b
+
+end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/group/build.xml Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="com.symbian.smt.gui" default="build.jar" basedir="../.">
+
+ <!-- The epoc.build property specifies the temp location for build files
+ In the TCL build this will have been specified as a unique location
+ and so this value will be ignored.
+ NOTE: Do not use this directly - use build.dir instead -->
+ <property name="epoc.build" value="${basedir}"/>
+
+ <!-- The tools.rel property specifies the releease location for binaries
+ In the TCL build this will have been specified as a unique location
+ and so this value will be ignored -->
+ <property name="tools.rel" value="${basedir}"/>
+
+ <property name="release.folder" value="${tools.rel}\dist\smtgui" />
+ <property name="current.version" value="1.1.6" />
+
+ <property name="jar.folder" value="${epoc.build}/jars/" />
+ <property name="instr.jar.folder" value="${jar.folder}/instr/" />
+
+ <property name="test.folder" value="${epoc.build}/testreports" />
+
+ <property name="zip.folder" value="${epoc.build}/zips/" />
+ <property name="eclipse.folder" value="${epoc.build}/eclipse/" />
+ <property name="rel.jar.folder" value="${jar.folder}/rel/" />
+
+ <property name="reportutil.folder" value="${epoc.build}/reportutil" />
+
+ <property name="shared.lib.dir" location="${tools.rel}/java/lib"/>
+
+ <target name="clean">
+
+ <delete dir="${release.folder}"/>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui/build.xml" target="clean" inheritall="false" >
+
+ <property name="release.folder" value="${release.folder}" />
+
+ </ant>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui.properties/build.xml" target="clean" inheritall="false" >
+
+ <property name="release.folder" value="${release.folder}" />
+
+ </ant>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui.unittest/build.xml" target="clean" inheritall="false" />
+
+ </target>
+
+ <target name="build.release">
+
+ <mkdir dir="${release.folder}"/>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui/build.xml" target="build.update.jar" inheritall="false">
+
+ <property name="version" value="${current.version}" />
+
+ <property name="release.folder" value="${release.folder}" />
+
+ </ant>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui.properties/build.xml" target="zip.plugin" inheritall="false">
+
+ <property name="release.folder" value="${release.folder}" />
+
+ </ant>
+
+ </target>
+
+ <target name="build.all">
+
+ <mkdir dir="${release.folder}"/>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui/build.xml" target="instrument.jars" inheritall="false">
+
+ <property name="version" value="${current.version}" />
+
+ <property name="jars.instr.dir" value="${instr.jar.folder}" />
+
+ <property name="release.folder" value="${release.folder}" />
+
+ </ant>
+
+ </target>
+
+ <target name="build.tests">
+
+ <ant antfile="${basedir}/com.symbian.smt.gui.unittest/build.xml" target="@dot" inheritall="false" />
+
+ </target>
+
+
+ <target name="run.junit">
+
+ <ant antfile="${basedir}/com.symbian.smt.gui.unittest/buildtest.xml" target="run.junit" inheritall="false">
+
+ <property name="jars" value="${instr.jar.folder}" />
+
+ <property name="version" value="${current.version}" />
+
+ </ant>
+
+ </target>
+
+ <target name="build.jar">
+
+ <antcall target="clean" />
+
+ <antcall target="build.release" />
+
+ </target>
+
+ <target name="all">
+
+ <antcall target="clean" />
+
+ <antcall target="build.all" />
+
+ <antcall target="build.tests" />
+
+ <antcall target="run.junit" />
+
+ <antcall target="collect.results" />
+
+ <antcall target="generate.reports" />
+
+ </target>
+
+ <path id="emma.lib">
+ <pathelement location="${shared.lib.dir}/emma.jar" />
+ <pathelement location="${shared.lib.dir}/emma_ant.jar" />
+ </path>
+ <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
+
+ <target name="collect.results">
+ <delete dir="${test.folder}" />
+ <mkdir dir="${test.folder}" />
+
+ <ant antfile="${basedir}/com.symbian.smt.gui/build.xml" target="gather.results" inheritall="false">
+ <property name="destination.results.folder" value="${test.folder}/smt/results" />
+ </ant>
+
+ <ant antfile="${basedir}/com.symbian.smt.gui.unittest/buildtest.xml" target="gather.results" inheritall="false">
+ <property name="destination.results.folder" value="${test.folder}/smt/results" />
+ </ant>
+
+ </target>
+
+ <target name="generate.reports">
+ <mkdir dir="${test.folder}\complete" />
+ <mkdir dir="${test.folder}\complete\Junit" />
+ <mkdir dir="${test.folder}\complete\coverage" />
+ <mkdir dir="${test.folder}\complete\coverage\util" />
+
+ <junitreport todir="${test.folder}\complete\Junit">
+ <fileset dir="${test.folder}">
+ <include name="**\*TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${test.folder}\complete\Junit" />
+ </junitreport>
+ <copy file="${test.folder}\complete\Junit\index.html" tofile="${test.folder}\complete\Junit\JunitTestReport.html" />
+ <path id="emma.src">
+ <pathelement location="${basedir}/com.symbian.smt.gui/src" />
+ <pathelement location="${basedir}/com.symbian.smt.gui.unittest/src" />
+ </path>
+ <emma>
+ <report sourcepathref="emma.src" depth="method">
+ <infileset dir="${test.folder}">
+ <include name="**\*.em*" />
+ <include name="**\*.ec" />
+ </infileset>
+ <html outfile="${test.folder}\complete\coverage\EmmaCoverageReport.html" />
+ </report>
+ </emma>
+ </target>
+
+ <target name="what" description="Prints out all releasables">
+
+ <echo message="${release.folder}\com.symbian.smt.gui_${current.version}.jar" />
+
+ <echo message="${release.folder}\com.symbian.smt.gui.properties\META-INF\MANIFEST.MF" />
+
+ </target>
+
+
+</project>
Binary file sysmodelmgr/group/how_to_build_SMM.doc has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/group/release.txt Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,5 @@
+NOTESRC_RELEASER
+Nokia Corporation
+
+NOTESRC_RELEASE_REASON
+System Model Manager release.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/group/smm.configure.nsh Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,11 @@
+push $R0
+push $R1
+
+${REReplace} $R1 "\\" "$INSTDIR" "/" 1
+
+FileOpen $R0 "$ECLIPSEHOME\plugins\com.symbian.smt.gui.properties\location.properties" w
+FileWrite $R0 "location = $R1\\SystemModelGenerator"
+FileClose $R0
+
+pop $R1
+pop $R0
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/group/smm.unconfigure.nsh Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,3 @@
+
+
+Delete "$ECLIPSEHOME\plugins\com.symbian.smt.gui.properties\location.properties"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodelmgr/group/sysmodelmgr.mrp Thu Mar 11 19:08:43 2010 +0200
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+component depl_swconfigapps_sysmodeltools_sysmodelmgr
+
+source /src/tools/depl/swconfigapps/sysmodeltools/sysmodelmgr
+binary /src/tools/depl/swconfigapps/sysmodeltools/sysmodelmgr/group all
+
+notes_source /src/tools/depl/swconfigapps/sysmodeltools/sysmodelmgr/group/release.txt
+
+ipr T
Binary file sysmodelmgr/lib/cglib-nodep-2.1_3.jar has changed
Binary file sysmodelmgr/lib/emma.jar has changed
Binary file sysmodelmgr/lib/emma_ant.jar has changed
Binary file sysmodelmgr/lib/jmock-1.1.0.jar has changed
Binary file sysmodelmgr/lib/jmock-cglib-1.1.0.jar has changed
Binary file sysmodelmgr/lib/junit-4.1.jar has changed
Binary file sysmodelmgr/lib/junit.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.commands_3.2.0.I20060605-1400.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.contenttype_3.2.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.expressions_3.2.2.r322_v20070109a.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.filebuffers_3.2.1.r321_v20060721.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.filesystem_1.0.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.jobs_3.2.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.resources.win32_3.2.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.resources_3.2.2.R32x_v20061218.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.runtime_3.2.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.core.variables_3.1.100.v20060605.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.equinox.common_3.2.0.v20060603.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.equinox.preferences_3.2.1.R32x_v20060717.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.equinox.registry_3.2.1.R32x_v20060814.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.jface.text_3.2.2.r322_v20070104.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.jface_3.2.2.M20061214-1200.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.osgi_3.2.2.R32x_v20070118.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.swt_3.2.2.v3236b.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.text_3.2.0.v20060605-1400.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.console_3.1.100.v20060605.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.editors_3.2.1.r321_v20060721.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.forms_3.2.0.v20060602.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.ide_3.2.1.M20060915-1030.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.navigator_3.3.2.M20080207-0800.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.views_3.2.1.M20060906-0800.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.win32_3.2.0.I20060605-1400.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.workbench.texteditor_3.2.0.v20060605-1400.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui.workbench_3.2.2.M20070119-0800.jar has changed
Binary file sysmodelmgr/shared/org.eclipse.ui_3.2.1.M20061108.jar has changed
Binary file sysmodelmgr/shared/swt-win32-3236.dll has changed