This commit was manufactured by cvs2svn to create tag 'v200707232234'.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/.classpath b/plugins/org.eclipse.wst.common.project.facet.ui/.classpath
deleted file mode 100644
index 304e861..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <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="output" path="bin"/>
-</classpath>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/.cvsignore b/plugins/org.eclipse.wst.common.project.facet.ui/.cvsignore
deleted file mode 100644
index 0d662e0..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-bin
-build.xml
-facet-ui.jar
-temp.folder
-@dot
-src.zip
-javaCompiler...args
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/.project b/plugins/org.eclipse.wst.common.project.facet.ui/.project
deleted file mode 100644
index df18711..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.common.project.facet.ui</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>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 7777a26..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,57 +0,0 @@
-#Fri Feb 02 09:02:36 PST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=error
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 6925dfc..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Vendor: %providerName
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.wst.common.project.facet.ui; singleton:=true
-Bundle-Version: 1.2.0.qualifier
-Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.wst.common.project.facet.ui.internal.FacetUiPlugin
-Bundle-Localization: plugin
-Export-Package: org.eclipse.wst.common.project.facet.ui,
- org.eclipse.wst.common.project.facet.ui.internal;x-internal:=true
-Require-Bundle: org.eclipse.ui;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.ui.forms;bundle-version="[3.2.0,4.0)",
- org.eclipse.ui.ide;bundle-version="[3.2.0,4.0)",
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
- org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.common.project.facet.core;bundle-version="[1.2.0,1.3.0)";visibility:=reexport,
- org.eclipse.draw2d;bundle-version="[3.2.0,4.0)"
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/about.html b/plugins/org.eclipse.wst.common.project.facet.ui/about.html
deleted file mode 100644
index 73db36e..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>June 06, 2007</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributors license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/build.properties b/plugins/org.eclipse.wst.common.project.facet.ui/build.properties
deleted file mode 100644
index b5e9e08..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- plugin.xml,\
- plugin.properties,\
- images/,\
- schemas/,\
- META-INF/,\
- about.html
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/down-arrow.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/down-arrow.gif
deleted file mode 100644
index 8f6c34d..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/down-arrow.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/error.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/error.gif
deleted file mode 100644
index 0bc6068..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/error.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/facets-page-wizban.png b/plugins/org.eclipse.wst.common.project.facet.ui/images/facets-page-wizban.png
deleted file mode 100644
index b91c116..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/facets-page-wizban.png
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/lock.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/lock.gif
deleted file mode 100644
index be6a9ad..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/lock.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/primary-runtime-overlay.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/primary-runtime-overlay.gif
deleted file mode 100644
index 7ec574b..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/primary-runtime-overlay.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/unknown.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/unknown.gif
deleted file mode 100644
index 7ccc6a7..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/unknown.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gif
deleted file mode 100644
index 2b2e50f..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/plugin.properties b/plugins/org.eclipse.wst.common.project.facet.ui/plugin.properties
deleted file mode 100644
index 3a1ca55..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/plugin.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-pluginName = Project Facet UI
-providerName = Eclipse.org
-project.facets = Project Facets
-runtimesPropertyPageLabel = Targeted Runtimes
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/plugin.xml b/plugins/org.eclipse.wst.common.project.facet.ui/plugin.xml
deleted file mode 100644
index cb898b8..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/plugin.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-
-<plugin>
-
- <extension-point
- id="wizard"
- name="Project Facet Wizard Pages Extension Point (Deprecated)"
- schema="schemas/wizard-pages-old.exsd"/>
-
- <extension-point
- id="wizardPages"
- name="Project Facet Wizard Pages Extension Point"
- schema="schemas/wizard-pages.exsd"/>
-
- <extension-point
- id="images"
- name="Project Facet Images Extension Point"
- schema="schemas/images.exsd"/>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.wst.common.project.facet.ui.internal.DecorationsProvider$Factory"
- adaptableType="org.eclipse.wst.common.project.facet.core.IProjectFacet">
- <adapter type="org.eclipse.wst.common.project.facet.ui.IDecorationsProvider"/>
- </factory>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.wst.common.project.facet.ui.internal.DecorationsProvider$Factory"
- adaptableType="org.eclipse.wst.common.project.facet.core.ICategory">
- <adapter type="org.eclipse.wst.common.project.facet.ui.IDecorationsProvider"/>
- </factory>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.wst.common.project.facet.ui.internal.DecorationsProvider$Factory"
- adaptableType="org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentType">
- <adapter type="org.eclipse.wst.common.project.facet.ui.IDecorationsProvider"/>
- </factory>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.wst.common.project.facet.ui.internal.FacetedProjectActionFilter$Factory"
- adaptableType="org.eclipse.wst.common.project.facet.core.IFacetedProject">
- <adapter type="org.eclipse.ui.IActionFilter"/>
- </factory>
- </extension>
-
- <extension point="org.eclipse.ui.propertyPages">
- <page
- adaptable="true"
- class="org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage"
- id="org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage"
- name="%project.facets"
- objectClass="org.eclipse.core.resources.IProject">
- <filter
- name="nature"
- value="org.eclipse.wst.common.project.facet.core.nature">
- </filter>
- </page>
- <page
- adaptable="true"
- class="org.eclipse.wst.common.project.facet.ui.internal.RuntimesPropertyPage"
- id="org.eclipse.wst.common.project.facet.ui.internal.RuntimesPropertyPage"
- name="%runtimesPropertyPageLabel"
- objectClass="org.eclipse.core.resources.IProject">
- <filter
- name="nature"
- value="org.eclipse.wst.common.project.facet.core.nature">
- </filter>
- </page>
- </extension>
-
-</plugin>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/images.exsd b/plugins/org.eclipse.wst.common.project.facet.ui/schemas/images.exsd
deleted file mode 100644
index 448e880..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/images.exsd
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.project.facet.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.project.facet.ui" id="images" name="Project Facet Images Extension Point"/>
- </appInfo>
- <documentation>
- Used for specifying the image that should be used with a facet, a category, or a runtime component type.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="image" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- A fully qualified identifier of the target extension point.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- An optional identifier of the extension instance.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- An optional name of the extension instance.
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="image">
- <annotation>
- <documentation>
- Specifies the image that should be used with the specified facet, category, or runtime component type. Only one of the <i>facet</i>, <i>category</i>, and <i>runtime-component-type</i> attributes should be used.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="facet" type="string">
- <annotation>
- <documentation>
- The project facet id.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- The category id.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="runtime-component-type" type="string">
- <annotation>
- <documentation>
- The runtime component type.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="path" type="string" use="required">
- <annotation>
- <documentation>
- The relative path to the image within this plugin.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- <p>The following example associates images with two facets and a category.</p>
-
-<pre>
-<extension point="org.eclipse.wst.common.project.facet.ui.images">
- <image facet="facet1" path="icons/facet1.gif"/>
- <image facet="facet2" path="icons/facet2.gif"/>
- <image category="category1" path="icons/category1.gif"/>
-</extension>
-</pre>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 BEA Systems, Inc. and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages-old.exsd b/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages-old.exsd
deleted file mode 100644
index ed88971..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages-old.exsd
+++ /dev/null
@@ -1,200 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.project.facet.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.project.facet.ui" id="wizard" name="Project Facet Wizard Pages Extension Point"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element deprecated="true"/>
- </appInfo>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="wizard-pages" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- <appInfo>
- <meta.attribute deprecated="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute deprecated="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute translatable="true" deprecated="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="wizard-pages">
- <annotation>
- <appInfo>
- <meta.element deprecated="true"/>
- </appInfo>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="install" minOccurs="0" maxOccurs="1"/>
- <element ref="uninstall" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="facet" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute deprecated="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="version" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute deprecated="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="install">
- <annotation>
- <appInfo>
- <meta.element deprecated="true"/>
- </appInfo>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="page" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="uninstall">
- <annotation>
- <appInfo>
- <meta.element deprecated="true"/>
- </appInfo>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="page" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="page">
- <annotation>
- <appInfo>
- <meta.element deprecated="true"/>
- </appInfo>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.wst.common.project.facet.ui.IFacetWizardPage"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 BEA Systems, Inc. and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages.exsd b/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages.exsd
deleted file mode 100644
index 7527de1..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages.exsd
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.common.project.facet.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.common.project.facet.ui" id="wizardPages" name="Project Facet Wizard Pages Extension Point"/>
- </appInfo>
- <documentation>
- Used for associating wizard pages with a project facet action. For instance, wizard pages can be associated with the action of installing facet Abc or uninstalling facet FooBar.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <documentation>
- (no description available)
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="wizard-pages" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- A fully qualified identifier of the target extension point.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- An optional identifier of the extension instance.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- An optional name of the extension instance.
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="wizard-pages">
- <annotation>
- <documentation>
- Used for associating wizard pages with a project facet action. For instance, wizard pages can be associated with the action of installing facet Abc or uninstalling facet FooBar.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="page" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="action" type="string" use="required">
- <annotation>
- <documentation>
- The action id. If the action does not specify an explicit id, the default id is created using the following format: "[facet-id]#[version-expression]#[action-type]".
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="page">
- <annotation>
- <documentation>
- Specifies one page in a sequence of wizard pages being associated with a project facet action.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The wizard page class name. Has to implement org.eclipse.wst.common.project.facet.ui.IFacetWizardPage interface.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.wst.common.project.facet.ui.IFacetWizardPage"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- <p>The following example associates wizard pages with install and uninstall actions of facet1.</p>
-
-<pre>
-<extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
- <wizard-pages action="facet1.install">
- <page class="com.mycorp.Facet1InstallPage1"/>
- <page class="com.mycorp.Facet1InstallPage2"/>
- </wizard-pages>
- <wizard-pages action="facet1.uninstall">
- <page class="com.mycorp.Facet1UninstallPage"/>
- </wizard-pages>
-</extension>
-</pre>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 BEA Systems, Inc. and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at <a
-href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AbstractFacetWizardPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AbstractFacetWizardPage.java
deleted file mode 100644
index 9ed4712..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AbstractFacetWizardPage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.wizard.WizardPage;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class AbstractFacetWizardPage
-
- extends WizardPage
- implements IFacetWizardPage
-
-{
- protected IWizardContext context;
-
- public AbstractFacetWizardPage( final String name )
- {
- super( name );
- }
-
- public final void setWizardContext( final IWizardContext context )
- {
- this.context = context;
- }
-
- public void transferStateToConfig()
- {
-
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.java
deleted file mode 100644
index d2c463e..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- * @deprecated use ModifyFacetedProjectWizard class instead
- */
-
-public class AddRemoveFacetsWizard
-
- extends ModifyFacetedProjectWizard
-
-{
- public AddRemoveFacetsWizard( final IFacetedProject fproj )
- {
- super( fproj );
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetUiHelpContextIds.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetUiHelpContextIds.java
deleted file mode 100644
index e33c536..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetUiHelpContextIds.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.wst.common.project.facet.ui.internal.FacetUiPlugin;
-
-/**
- * Contains the help context ids defined in the facet UI plugin.
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class FacetUiHelpContextIds
-{
- /**
- * The help context id for the overall facets selection page:
- * "org.eclipse.wst.common.project.facet.ui.facetsSelectionPage".
- */
-
- public static final String FACETS_SELECTION_PAGE
- = FacetUiPlugin.PLUGIN_ID + ".facetsSelectionPage"; //$NON-NLS-1$
-
- private FacetUiHelpContextIds() {}
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.java
deleted file mode 100644
index 0127609..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class FacetedProjectWizard
-
- extends ModifyFacetedProjectWizard
- implements INewWizard
-
-{
- private final IFacetedProjectTemplate template;
- private WizardNewProjectCreationPage firstPage;
- private String projectName;
- private IPath customPath;
-
- public FacetedProjectWizard()
- {
- super( null );
-
- this.template = getTemplate();
-
- this.setWindowTitle( Resources.newPrefix + this.template.getLabel() );
-
- final ImageDescriptor defImageDescriptor = getDefaultPageImageDescriptor();
-
- if( defImageDescriptor != null )
- {
- this.setDefaultPageImageDescriptor( defImageDescriptor );
- }
- }
-
- public void init( final IWorkbench workbench,
- final IStructuredSelection selection )
- {
-
- }
-
- public void addPages()
- {
- this.firstPage = new WizardNewProjectCreationPage( "first.page" ); //$NON-NLS-1$
- this.firstPage.setTitle( this.template.getLabel() );
- this.firstPage.setDescription( getPageDescription() );
-
- addPage( this.firstPage );
-
- super.addPages();
-
- this.facetsSelectionPage.setInitialPreset( this.template.getInitialPreset() );
-
- final Set<IProjectFacet> fixed = this.template.getFixedProjectFacets();
- this.facetsSelectionPage.setFixedProjectFacets( fixed );
- }
-
- public boolean canFinish()
- {
- return this.firstPage.isPageComplete() && super.canFinish();
- }
-
- public IWizardPage[] getPages()
- {
- final IWizardPage[] base = super.getPages();
- final IWizardPage[] pages = new IWizardPage[ base.length + 1 ];
-
- pages[ 0 ] = this.firstPage;
- System.arraycopy( base, 0, pages, 1, base.length );
-
- return pages;
- }
-
- public synchronized boolean performFinish()
- {
- this.projectName = this.firstPage.getProjectName();
-
- this.customPath
- = this.firstPage.useDefaults()
- ? null : this.firstPage.getLocationPath();
-
- return super.performFinish();
- }
-
- protected void performFinish( final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- this.fproj
- = ProjectFacetsManager.create( this.projectName,
- this.customPath, monitor );
-
- super.performFinish( monitor );
-
- final Set<IProjectFacet> fixed = this.template.getFixedProjectFacets();
- this.fproj.setFixedProjectFacets( fixed );
- }
-
- public synchronized String getProjectName()
- {
- if( this.fproj == null )
- {
- return this.firstPage.getProjectName();
- }
- else
- {
- return this.fproj.getProject().getName();
- }
- }
-
- protected abstract IFacetedProjectTemplate getTemplate();
- protected abstract String getPageDescription();
- protected abstract ImageDescriptor getDefaultPageImageDescriptor();
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String newPrefix;
-
- static
- {
- initializeMessages( FacetedProjectWizard.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.properties
deleted file mode 100644
index 260c699..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.properties
+++ /dev/null
@@ -1 +0,0 @@
-newPrefix = New\
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IDecorationsProvider.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IDecorationsProvider.java
deleted file mode 100644
index 09191f7..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IDecorationsProvider.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IDecorationsProvider
-{
- ImageDescriptor getIcon();
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IFacetWizardPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IFacetWizardPage.java
deleted file mode 100644
index f49d781..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IFacetWizardPage.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.wizard.IWizardPage;
-
-/**
- * This interface is implemented by the wizard pages associated with project
- * facet actions.
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IFacetWizardPage
-
- extends IWizardPage
-
-{
- /**
- * The framework will call this method in order to provide the wizard
- * context to the wizard page. The wizard context can be used to find out
- * about other actions being configured by the wizard.
- *
- * @param context the wizard context
- */
-
- void setWizardContext( IWizardContext context );
-
- /**
- * The framework will call this method in order to provide the action config
- * object that the wizard page should save user selection into. The
- * populated config object will then be passed to the action delegate.
- *
- * @param config the action config object
- */
-
- void setConfig( Object config );
-
- /**
- * This method is called after the user has pressed the <code>Finish</code>
- * button. It allows the wizard page to transfer user selection into the
- * config object. Alternative, instead of using this method, the wizard
- * page could update the model on the fly as the user is making changes.
- */
-
- void transferStateToConfig();
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IRuntimeComponentLabelProvider.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IRuntimeComponentLabelProvider.java
deleted file mode 100644
index 4c7269c..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IRuntimeComponentLabelProvider.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IRuntimeComponentLabelProvider
-{
- String getLabel();
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IWizardContext.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IWizardContext.java
deleted file mode 100644
index bb1d37f..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IWizardContext.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type;
-
-/**
- * The interface exposed to the facet action wizard pages that allows them
- * to gather information about the wizard state.
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IWizardContext
-{
- /**
- * Returns the name of the project that the wizard is operating on. If the
- * wizard is in the project creation mode, the project will not yet exist
- * in the workspace.
- *
- * @return the name of the project that the wizard is operating on
- */
-
- String getProjectName();
-
- /**
- * Returns the set of facets currently selected in the wizard. If the wizard
- * is in the add/remove facets mode (vs. project creation), this method will
- * return the set of facets currently installed in a project after being
- * modified by the current set of actions.
- *
- * @return the set of facets currently selected in the wizard (element type:
- * {@see IProjectFacetVersion})
- */
-
- Set getSelectedProjectFacets();
-
- /**
- * Determines whether the specified facet is currently selected in the
- * wizard. See {@see getSelectedProjectFacets()} for more information.
- *
- * @param fv the project facet version object
- * @return <code>true</code> if an only if the provided project facet is
- * currently selected in the wizard
- */
-
- boolean isProjectFacetSelected( IProjectFacetVersion fv );
-
- /**
- * Returns the set of actions currently specified by the user.
- *
- * @return the set of actions currently specified by the user
- */
-
- Set getActions();
-
- /**
- * Finds the action of specified type that applies to the specified facet,
- * if such action exists. If the wizard is in the add/remove facets mode
- * (vs. project creation), you cannot depend on finding the install action
- * for a required facet as that facet may have already been installed.
- *
- * @param type the action type
- * @param fv the project facet version object
- * @return the action object or <code>null</code>
- */
-
- Action getAction( Action.Type type,
- IProjectFacetVersion fv );
-
- /**
- * Do not use! This method is internal and will be removed.
- */
-
- Object getConfig(IProjectFacetVersion fv, Type type, String pjname) throws CoreException;
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ModifyFacetedProjectWizard.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ModifyFacetedProjectWizard.java
deleted file mode 100644
index 4374a5f..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ModifyFacetedProjectWizard.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import static org.eclipse.wst.common.project.facet.core.internal.util.ProgressMonitorUtil.beginTask;
-import static org.eclipse.wst.common.project.facet.core.internal.util.ProgressMonitorUtil.done;
-import static org.eclipse.wst.common.project.facet.core.internal.util.ProgressMonitorUtil.subTask;
-import static org.eclipse.wst.common.project.facet.core.internal.util.ProgressMonitorUtil.submon;
-import static org.eclipse.wst.common.project.facet.core.internal.util.ProgressMonitorUtil.worked;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.wst.common.project.facet.core.IActionDefinition;
-import org.eclipse.wst.common.project.facet.core.ICategory;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.ui.internal.ChangeTargetedRuntimesDataModel;
-import org.eclipse.wst.common.project.facet.ui.internal.FacetUiPlugin;
-import org.eclipse.wst.common.project.facet.ui.internal.FacetsSelectionPage;
-import org.eclipse.wst.common.project.facet.ui.internal.ModifyFacetedProjectDataModel;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class ModifyFacetedProjectWizard
-
- extends Wizard
-
-{
- protected IFacetedProject fproj;
-
- private final WizardContext context = new WizardContext();
- protected final FacetsSelectionPage facetsSelectionPage;
- private FacetPages[] facetPages = new FacetPages[ 0 ];
- private Composite pageContainer;
- private final List<IWizardPage> pagesToDispose = new ArrayList<IWizardPage>();
- private final ModifyFacetedProjectDataModel model;
- private final List<Runnable> delayedActions;
-
- public ModifyFacetedProjectWizard( final IFacetedProject fproj )
- {
- this.model = new ModifyFacetedProjectDataModel( fproj );
- this.delayedActions = new ArrayList<Runnable>();;
- this.fproj = fproj;
-
- Set<IProjectFacetVersion> base = null;
-
- if( this.fproj != null )
- {
- base = this.fproj.getProjectFacets();
-
- final ChangeTargetedRuntimesDataModel rdm
- = this.model.getTargetedRuntimesDataModel();
-
- rdm.setTargetedRuntimes( this.fproj.getTargetedRuntimes() );
- rdm.setPrimaryRuntime( this.fproj.getPrimaryRuntime() );
- }
-
- this.facetsSelectionPage
- = new FacetsSelectionPage( this.context, base, this.model );
-
- setNeedsProgressMonitor( true );
- setForcePreviousAndNextButtons( true );
- setWindowTitle( Resources.wizardTitle );
- }
-
- public final ModifyFacetedProjectDataModel getModel()
- {
- return this.model;
- }
-
- public void addPages()
- {
- if( this.fproj != null )
- {
- this.facetsSelectionPage.setInitialSelection( this.fproj.getProjectFacets() );
- this.facetsSelectionPage.setFixedProjectFacets( this.fproj.getFixedProjectFacets());
- }
-
- this.facetsSelectionPage.addSelectedFacetsChangedListener
- (
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handleSelectedFacetsChangedEvent();
- }
- }
- );
-
- addPage( this.facetsSelectionPage );
- }
-
- public int getPageCount()
- {
- return getPages().length;
- }
-
- public IWizardPage[] getPages()
- {
- final List<IWizardPage> list = new ArrayList<IWizardPage>();
-
- list.add( this.facetsSelectionPage );
-
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- list.addAll( this.facetPages[ i ].pages );
- }
-
- return list.toArray( new IWizardPage[ list.size() ] );
- }
-
- public IWizardPage getPage( final String pageName )
- {
- final IWizardPage[] pages = getPages();
-
- for( int i = 0; i < pages.length; i++ )
- {
- final IWizardPage page = pages[ i ];
-
- if( page.getName().equals( pageName ) )
- {
- return page;
- }
- }
-
- return null;
- }
-
- public IWizardPage getStartingPage()
- {
- return getPages()[ 0 ];
- }
-
- public IWizardPage getNextPage( final IWizardPage page )
- {
- final IWizardPage[] pages = getPages();
-
- int pos = -1;
-
- for( int i = 0; i < pages.length; i++ )
- {
- if( pages[ i ] == page )
- {
- pos = i;
- }
- }
-
- if( pos == pages.length - 1 )
- {
- return null;
- }
- else
- {
- return pages[ pos + 1 ];
- }
- }
-
- public IWizardPage getPreviousPage( final IWizardPage page )
- {
- final IWizardPage[] pages = getPages();
-
- int pos = -1;
-
- for( int i = 0; i < pages.length; i++ )
- {
- if( pages[ i ] == page )
- {
- pos = i;
- }
- }
-
- if( pos == 0 )
- {
- return null;
- }
- else
- {
- return pages[ pos - 1 ];
- }
- }
-
- public boolean canFinish()
- {
- if( ! this.facetsSelectionPage.isPageComplete() )
- {
- return false;
- }
-
- final IWizardPage[] pages = getPages();
-
- for( int i = 0; i < pages.length; i++ )
- {
- if( ! pages[ i ].isPageComplete() )
- {
- return false;
- }
- }
-
- return true;
- }
-
- public void createPageControls( final Composite container )
- {
- super.createPageControls( container );
- this.pageContainer = container;
- handleSelectedFacetsChangedEvent();
- executeDelayedActions();
- }
-
- public boolean performFinish()
- {
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- for( IFacetWizardPage fp : this.facetPages[ i ].pages )
- {
- fp.transferStateToConfig();
- }
- }
-
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
- {
- public void run( final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- performFinish( monitor );
- }
- };
-
- final IRunnableWithProgress op = new IRunnableWithProgress()
- {
- public void run( final IProgressMonitor monitor )
-
- throws InvocationTargetException, InterruptedException
-
- {
- try
- {
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor );
- }
- catch( CoreException e )
- {
- throw new InvocationTargetException( e );
- }
- }
- };
-
- try
- {
- getContainer().run( true, false, op );
- }
- catch( InterruptedException e )
- {
- return false;
- }
- catch( InvocationTargetException e )
- {
- final Throwable te = e.getTargetException();
-
- if( te instanceof CoreException )
- {
- final IStatus st = ( (CoreException) te ).getStatus();
-
- ErrorDialog.openError( getShell(), Resources.errDlgTitle,
- st.getMessage(), st );
-
- FacetUiPlugin.log( st );
- }
- else
- {
- throw new RuntimeException( e.getTargetException() );
- }
- }
-
- return true;
- }
-
- protected void performFinish( final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- beginTask( monitor, "", 20 ); //$NON-NLS-1$
-
- try
- {
- // Figure out whether we can set runtimes before applying facet actions. This is better
- // for performance reasons, but may not work if the project contains facets that are
- // not supported by the new runtime. You can get into this situation if the user tries
- // to simultaneously uninstall a facet and select a different runtime. The fallback
- // solution for this situation is to set the targeted runtimes to an empty list first,
- // then apply the facet actions, and then set the targeted runtimes to the new list.
- // This is more drastic than necessary in all situations, but it is not clear that
- // implementing additional optimizations is necessary either.
-
- final ChangeTargetedRuntimesDataModel rdm = this.model.getTargetedRuntimesDataModel();
- boolean canSetRuntimesFirst = true;
-
- for( IProjectFacetVersion fv : this.fproj.getProjectFacets() )
- {
- for( IRuntime r : rdm.getTargetedRuntimes() )
- {
- if( ! r.supports( fv ) )
- {
- canSetRuntimesFirst = false;
- break;
- }
- }
-
- if( ! canSetRuntimesFirst )
- {
- break;
- }
- }
-
- subTask( monitor, Resources.taskConfiguringRuntimes );
-
- if( canSetRuntimesFirst )
- {
- this.fproj.setTargetedRuntimes( rdm.getTargetedRuntimes(), submon( monitor, 2 ) );
-
- if( rdm.getPrimaryRuntime() != null )
- {
- this.fproj.setPrimaryRuntime( rdm.getPrimaryRuntime(), submon( monitor, 2 ) );
- }
- else
- {
- worked( monitor, 2 );
- }
- }
- else
- {
- final Set<IRuntime> emptySet = Collections.emptySet();
- this.fproj.setTargetedRuntimes( emptySet, submon( monitor, 2 ) );
- }
-
- this.fproj.modify( this.facetsSelectionPage.getActions(), submon( monitor, 16 ) );
-
- if( ! canSetRuntimesFirst )
- {
- subTask( monitor, Resources.taskConfiguringRuntimes );
-
- this.fproj.setTargetedRuntimes( rdm.getTargetedRuntimes(), submon( monitor, 1 ) );
-
- if( rdm.getPrimaryRuntime() != null )
- {
- this.fproj.setPrimaryRuntime( rdm.getPrimaryRuntime(), submon( monitor, 1 ) );
- }
- else
- {
- worked( monitor, 1 );
- }
- }
- }
- finally
- {
- done( monitor );
- }
- }
-
- public String getProjectName()
- {
- return this.fproj.getProject().getName();
- }
-
- public Object getConfig(IProjectFacetVersion fv, Type type, String pjname) throws CoreException{
- return null;
- }
-
- public void syncWithPresetsModel( final Combo combo )
- {
- this.facetsSelectionPage.syncWithPresetsModel( combo );
- }
-
- public void setCategoryExpandedState( final ICategory category,
- final boolean expanded )
- {
- if( this.facetsSelectionPage != null && this.facetsSelectionPage.panel != null )
- {
- this.facetsSelectionPage.panel.setCategoryExpandedState( category, true );
- }
- else
- {
- final Runnable action = new Runnable()
- {
- public void run()
- {
- setCategoryExpandedState( category, expanded );
- }
- };
-
- this.delayedActions.add( action );
- }
- }
-
- public void dispose()
- {
- super.dispose();
-
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- this.pagesToDispose.addAll( this.facetPages[ i ].pages );
- }
-
- for( IWizardPage page : this.pagesToDispose )
- {
- page.dispose();
- }
-
- this.model.dispose();
- }
-
- private static final class FacetPages
- {
- public Action action;
- public List<IFacetWizardPage> pages;
- }
-
- private void handleSelectedFacetsChangedEvent()
- {
- // Don't do anything until the facet selection page does not have any
- // errors.
-
- if( ! this.facetsSelectionPage.isPageComplete() )
- {
- return;
- }
-
- // Get the set of actions and sort them.
-
- final Set<IProjectFacetVersion> base = getBaseFacets();
- final Set<Action> actions = this.facetsSelectionPage.getActions();
- final List<Action> sortedActions = new ArrayList<Action>( actions );
- ProjectFacetsManager.sort( base, sortedActions );
-
- // Recalculate the sequence of wizard pages.
-
- final List<FacetPages> newFacetPages = new ArrayList<FacetPages>();
- final boolean[] markers = new boolean[ this.facetPages.length ];
- boolean changed = false;
-
- for( Action action : sortedActions )
- {
- final IProjectFacetVersion fv = action.getProjectFacetVersion();
- FacetPages fp = findFacetPages( action, markers );
-
- if( fp == null )
- {
- final IActionDefinition actiondef;
-
- try
- {
- actiondef = fv.getActionDefinition( base, action.getType() );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- continue;
- }
-
- final List<IFacetWizardPage> pages
- = ProjectFacetsUiManager.getWizardPages( actiondef.getId() );
-
- if( ! pages.isEmpty() )
- {
- fp = new FacetPages();
- fp.action = action;
- fp.pages = pages;
-
- for( IFacetWizardPage page : fp.pages )
- {
- page.setWizard( this );
- page.setWizardContext( this.context );
- page.setConfig( action.getConfig() );
-
- if( page.getControl() == null )
- {
- page.createControl( this.pageContainer );
- page.getControl().setVisible( false );
- }
- }
-
- changed = true;
- }
- }
-
- if( fp != null )
- {
- newFacetPages.add( fp );
- }
- }
-
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- if( ! markers[ i ] )
- {
- for( IFacetWizardPage page : this.facetPages[ i ].pages )
- {
- page.setWizard( null );
- this.pagesToDispose.add( page );
- }
-
- changed = true;
- }
- }
-
- if( changed )
- {
- this.facetPages = new FacetPages[ newFacetPages.size() ];
- newFacetPages.toArray( this.facetPages );
-
- this.pageContainer.layout( true, true );
- }
- }
-
- private FacetPages findFacetPages( final Action action,
- final boolean[] markers )
- {
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- final FacetPages fp = this.facetPages[ i ];
-
- if( fp.action == action )
- {
- markers[ i ] = true;
- return fp;
- }
- }
-
- return null;
- }
-
- private Set<IProjectFacetVersion> getBaseFacets()
- {
- if( this.fproj == null )
- {
- return Collections.emptySet();
- }
- else
- {
- return this.fproj.getProjectFacets();
- }
- }
-
- private void executeDelayedActions()
- {
- for( Runnable r : this.delayedActions )
- {
- try
- {
- r.run();
- }
- catch( Exception e )
- {
- FacetUiPlugin.log( e );
- }
- }
- }
-
- /**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
- private final class WizardContext
-
- implements IWizardContext
-
- {
- public String getProjectName()
- {
- return ModifyFacetedProjectWizard.this.getProjectName();
- }
-
- public Set<IProjectFacetVersion> getSelectedProjectFacets()
- {
- return ModifyFacetedProjectWizard.this.facetsSelectionPage.getSelectedProjectFacets();
- }
-
- public boolean isProjectFacetSelected( final IProjectFacetVersion fv )
- {
- return getSelectedProjectFacets().contains( fv );
- }
-
- public Set<Action> getActions()
- {
- final FacetsSelectionPage page
- = ModifyFacetedProjectWizard.this.facetsSelectionPage;
-
- return page.getActions();
- }
-
- public Action getAction( final Action.Type type,
- final IProjectFacetVersion f )
- {
- for( Action action : getActions() )
- {
- if( action.getType() == type && action.getProjectFacetVersion() == f )
- {
- return action;
- }
- }
-
- return null;
- }
-
- public Object getConfig(IProjectFacetVersion fv, Type type, String pjname) throws CoreException {
- Object config = ModifyFacetedProjectWizard.this.getConfig(fv, type, pjname);
- if (null == config) {
- final Set<IProjectFacetVersion> base = getBaseFacets();
- final IActionDefinition def = fv.getActionDefinition( base, type );
- config = def.createConfigObject( fv, pjname );
- }
- return config;
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String wizardTitle;
- public static String errDlgTitle;
- public static String taskConfiguringRuntimes;
-
- static
- {
- initializeMessages( ModifyFacetedProjectWizard.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ModifyFacetedProjectWizard.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ModifyFacetedProjectWizard.properties
deleted file mode 100644
index c359be3..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ModifyFacetedProjectWizard.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-wizardTitle = Modify Faceted Project
-errDlgTitle = Error
-taskConfiguringRuntimes = Configuring targetted runtimes...
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/PresetSelectionPanel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/PresetSelectionPanel.java
deleted file mode 100644
index da0f5f8..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/PresetSelectionPanel.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial implementation and ongoing maintenance
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-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.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.ui.internal.ModifyFacetedProjectDataModel;
-import org.eclipse.wst.common.project.facet.ui.internal.AbstractDataModel.IDataModelListener;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class PresetSelectionPanel
-
- extends Composite
-
-{
- private final Group group;
- private final Combo presetsCombo;
- private final Label descLabel;
- private final ModifyFacetedProjectDataModel model;
-
- public PresetSelectionPanel( final Composite parent,
- final int style,
- final ModifyFacetedProjectDataModel model )
- {
- super( parent, style );
-
- this.model = model;
-
- GridLayout layout = new GridLayout( 1, false );
- layout.marginHeight = 0;
- layout.marginWidth = 0;
-
- setLayout( layout );
-
- this.group = new Group( this, SWT.NONE );
- this.group.setLayout( new GridLayout( 1, false ) );
- this.group.setLayoutData( gdhfill() );
- this.group.setText( Resources.groupTitle );
-
- this.presetsCombo = new Combo( this.group, SWT.BORDER | SWT.READ_ONLY );
- this.presetsCombo.setLayoutData( gdhfill() );
-
- this.descLabel = new Label( this.group, SWT.WRAP );
-
- final GridData gd = gdhfill();
- gd.widthHint = 400;
- gd.minimumHeight = 30;
- gd.grabExcessVerticalSpace = true;
-
- this.descLabel.setLayoutData( gd );
-
- refreshDescription();
-
- this.model.addListener
- (
- ModifyFacetedProjectDataModel.EVENT_SELECTED_PRESET_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- refreshDescription();
- }
- }
- );
-
- Dialog.applyDialogFont( parent );
- }
-
- public Combo getPresetsCombo()
- {
- return this.presetsCombo;
- }
-
- private void refreshDescription()
- {
- final IPreset preset = this.model.getSelectedPreset();
-
- final String desc;
-
- if( preset == null )
- {
- desc = Resources.hint;
- }
- else
- {
- desc = preset.getDescription();
- }
-
- this.descLabel.setText( desc );
- }
-
- private static GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String groupTitle;
- public static String hint;
-
- static
- {
- initializeMessages( PresetSelectionPanel.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/PresetSelectionPanel.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/PresetSelectionPanel.properties
deleted file mode 100644
index 79edf51..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/PresetSelectionPanel.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-groupTitle = Configurations
-hint = Hint: Get started quickly by selecting one of the pre-defined project configurations.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ProjectFacetsUiManager.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ProjectFacetsUiManager.java
deleted file mode 100644
index c8adeae..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/ProjectFacetsUiManager.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import java.util.List;
-
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.ui.internal.ProjectFacetsUiManagerImpl;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ProjectFacetsUiManager
-{
- private ProjectFacetsUiManager() {}
-
- public static List<IFacetWizardPage> getWizardPages( final String actionId )
- {
- return ProjectFacetsUiManagerImpl.getWizardPages( actionId );
- }
-
- /**
- * @return (element type: {@see IFacetWizardPage})
- * @deprecated
- */
-
- public static List getWizardPages( final Action.Type actionType,
- final IProjectFacetVersion f )
- {
- return ProjectFacetsUiManagerImpl.getWizardPages( actionType, f );
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/AbstractDataModel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/AbstractDataModel.java
deleted file mode 100644
index 2c2e4b1..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/AbstractDataModel.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class AbstractDataModel
-{
- private final Map<String,List<IDataModelListener>> listeners
- = new HashMap<String,List<IDataModelListener>>();
-
- public synchronized void addListener( final String event,
- final IDataModelListener listener )
- {
- List<IDataModelListener> list = this.listeners.get( event );
-
- if( list == null )
- {
- list = new ArrayList<IDataModelListener>();
- this.listeners.put( event, list );
- }
-
- list.add( listener );
- }
-
- public synchronized void removeListener( final String event,
- final IDataModelListener listener )
- {
- final List<IDataModelListener> list = this.listeners.get( event );
-
- if( list != null )
- {
- list.remove( listener );
- }
- }
-
- public synchronized void removeListener( final IDataModelListener listener )
- {
- for( String property : this.listeners.keySet() )
- {
- removeListener( property, listener );
- }
- }
-
- protected void notifyListeners( final String event )
- {
- final List<IDataModelListener> listeners = this.listeners.get( event );
-
- if( listeners != null )
- {
- for( IDataModelListener listener : listeners )
- {
- listener.handleEvent();
- }
- }
- }
-
- public static interface IDataModelListener
- {
- void handleEvent();
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ChangeTargetedRuntimesDataModel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ChangeTargetedRuntimesDataModel.java
deleted file mode 100644
index 4c4b7a2..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ChangeTargetedRuntimesDataModel.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-import org.eclipse.wst.common.project.facet.core.IListener;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ChangeTargetedRuntimesDataModel
-
- extends AbstractDataModel
-
-{
- public static final String EVENT_AVAILABLE_RUNTIMES_CHANGED
- = "availableRuntimesChanged"; //$NON-NLS-1$
-
- public static final String EVENT_TARGETABLE_RUNTIMES_CHANGED
- = "targetableRuntimesChanged"; //$NON-NLS-1$
-
- public static final String EVENT_TARGETED_RUNTIMES_CHANGED
- = "targetedRuntimesChanged"; //$NON-NLS-1$
-
- public static final String EVENT_PRIMARY_RUNTIME_CHANGED
- = "primaryRuntimeChanged"; //$NON-NLS-1$
-
- public interface IRuntimeFilter
- {
- boolean check( IRuntime runtime );
- }
-
- private final List<IRuntimeFilter> filters;
- private final Set<IRuntime> targetableRuntimes;
- private final Set<IRuntime> targetedRuntimes;
- private IRuntime primaryRuntime;
- private IListener runtimeManagerListener;
-
- public ChangeTargetedRuntimesDataModel()
- {
- this.filters = new ArrayList<IRuntimeFilter>();
-
- this.targetableRuntimes = new CopyOnWriteArraySet<IRuntime>();
- this.targetableRuntimes.addAll( getAllRuntimes() );
-
- this.targetedRuntimes = new CopyOnWriteArraySet<IRuntime>();
-
- this.primaryRuntime = null;
-
- this.runtimeManagerListener = new IListener()
- {
- public void handle()
- {
- notifyListeners( EVENT_AVAILABLE_RUNTIMES_CHANGED );
- refreshTargetableRuntimes();
- }
- };
-
- RuntimeManager.addRuntimeListener( this.runtimeManagerListener );
- }
-
- public synchronized void addRuntimeFilter( final IRuntimeFilter filter )
- {
- this.filters.add( filter );
- refreshTargetableRuntimes();
- }
-
- public synchronized void removeRuntimeFilter( final IRuntimeFilter filter )
- {
- this.filters.remove( filter );
- refreshTargetableRuntimes();
- }
-
- public synchronized Set<IRuntime> getAllRuntimes()
- {
- return RuntimeManager.getRuntimes();
- }
-
- public synchronized Set<IRuntime> getTargetableRuntimes()
- {
- return this.targetableRuntimes;
- }
-
- public synchronized void refreshTargetableRuntimes()
- {
- final Set<IRuntime> result = new HashSet<IRuntime>();
-
- for( IRuntime r : getAllRuntimes() )
- {
- boolean ok = true;
-
- for( IRuntimeFilter filter : this.filters )
- {
- if( ! filter.check( r ) )
- {
- ok = false;
- break;
- }
- }
-
- if( ok )
- {
- result.add( r );
- }
- }
-
- if( ! this.targetableRuntimes.equals( result ) )
- {
- this.targetableRuntimes.clear();
- this.targetableRuntimes.addAll( result );
- notifyListeners( EVENT_TARGETABLE_RUNTIMES_CHANGED );
-
- final List<IRuntime> toRemove = new ArrayList<IRuntime>();
-
- for( IRuntime r : this.targetedRuntimes )
- {
- if( ! this.targetableRuntimes.contains( r ) )
- {
- toRemove.add( r );
- }
- }
-
- this.targetedRuntimes.removeAll( toRemove );
-
- if( ! toRemove.isEmpty() )
- {
- notifyListeners( EVENT_TARGETED_RUNTIMES_CHANGED );
-
- if( this.primaryRuntime != null &&
- ! this.targetableRuntimes.contains( this.primaryRuntime ) )
- {
- autoAssignPrimaryRuntime();
- }
- }
- }
- }
-
- public synchronized Set<IRuntime> getTargetedRuntimes()
- {
- return this.targetedRuntimes;
- }
-
- public synchronized void setTargetedRuntimes( final Set<IRuntime> runtimes )
- {
- if( ! this.targetedRuntimes.equals( runtimes ) )
- {
- this.targetedRuntimes.clear();
-
- for( IRuntime r : runtimes )
- {
- if( this.targetableRuntimes.contains( r ) )
- {
- this.targetedRuntimes.add( r );
- }
- }
-
- notifyListeners( EVENT_TARGETED_RUNTIMES_CHANGED );
-
- if( this.primaryRuntime == null ||
- ! this.targetedRuntimes.contains( this.primaryRuntime ) )
- {
- autoAssignPrimaryRuntime();
- }
- }
- }
-
- public synchronized void addTargetedRuntime( final IRuntime runtime )
- {
- if( runtime == null )
- {
- throw new NullPointerException();
- }
- else
- {
- this.targetedRuntimes.add( runtime );
- notifyListeners( EVENT_TARGETED_RUNTIMES_CHANGED );
-
- if( this.primaryRuntime == null )
- {
- this.primaryRuntime = runtime;
- notifyListeners( EVENT_PRIMARY_RUNTIME_CHANGED );
- }
- }
- }
-
- public synchronized void removeTargetedRuntime( final IRuntime runtime )
- {
- if( runtime == null )
- {
- throw new NullPointerException();
- }
- else
- {
- if( this.targetedRuntimes.remove( runtime ) )
- {
- notifyListeners( EVENT_TARGETED_RUNTIMES_CHANGED );
-
- if( runtime.equals( this.primaryRuntime ) )
- {
- autoAssignPrimaryRuntime();
- }
- }
- }
- }
-
- public synchronized IRuntime getPrimaryRuntime()
- {
- return this.primaryRuntime;
- }
-
- public synchronized void setPrimaryRuntime( final IRuntime runtime )
- {
- if( ! equals( this.primaryRuntime, runtime ) )
- {
- if( runtime == null && this.targetedRuntimes.size() > 0 )
- {
- throw new IllegalArgumentException();
- }
-
- if( this.targetedRuntimes.contains( runtime ) )
- {
- this.primaryRuntime = runtime;
- }
-
- notifyListeners( EVENT_PRIMARY_RUNTIME_CHANGED );
- }
- }
-
- private void autoAssignPrimaryRuntime()
- {
- if( this.targetedRuntimes.isEmpty() )
- {
- this.primaryRuntime = null;
- }
- else
- {
- // Pick one to be the primary. No special semantics as to which
- // one.
-
- this.primaryRuntime = this.targetedRuntimes.iterator().next();
- }
-
- notifyListeners( EVENT_PRIMARY_RUNTIME_CHANGED );
- }
-
- public void dispose()
- {
- RuntimeManager.removeRuntimeListener( this.runtimeManagerListener );
- }
-
- private static boolean equals( final IRuntime r1,
- final IRuntime r2 )
- {
- if( r1 == null && r2 == null )
- {
- return true;
- }
- else if( r1 == null || r2 == null )
- {
- return false;
- }
- else
- {
- return r1.equals( r2 );
- }
- }
-
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.java
deleted file mode 100644
index fdd4e13..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.draw2d.AbsoluteBendpoint;
-import org.eclipse.draw2d.AbstractBorder;
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.ChopboxAnchor;
-import org.eclipse.draw2d.CompoundBorder;
-import org.eclipse.draw2d.Ellipse;
-import org.eclipse.draw2d.EllipseAnchor;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.LightweightSystem;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.PolylineConnection;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.draw2d.graph.DirectedGraph;
-import org.eclipse.draw2d.graph.DirectedGraphLayout;
-import org.eclipse.draw2d.graph.Edge;
-import org.eclipse.draw2d.graph.Node;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.common.project.facet.core.IConstraint;
-import org.eclipse.wst.common.project.facet.core.IGroup;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IVersionExpr;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ConstraintDisplayDialog
-
- extends Dialog
-
-{
- private static final Font BOLD_FONT;
-
- static
- {
- final FontData sys
- = Display.getCurrent().getSystemFont().getFontData()[ 0 ];
-
- final FontData bold
- = new FontData( sys.getName(), sys.getHeight(), SWT.BOLD );
-
- BOLD_FONT = new Font( Display.getCurrent(), bold );
- }
-
- private final IConstraint constraint;
- private final Point location;
- private int width;
- private int height;
-
- protected ConstraintDisplayDialog( final Shell parentShell,
- final Point location,
- final IConstraint constraint )
- {
- super( parentShell );
-
- setShellStyle( SWT.APPLICATION_MODAL | getDefaultOrientation() );
-
- this.constraint = constraint;
- this.location = location;
- }
-
- protected Control createDialogArea( final Composite parent )
- {
- final Canvas canvas = new Canvas( parent, SWT.NONE );
- canvas.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
-
- final Color infoBackgroundColor
- = parent.getDisplay().getSystemColor( SWT.COLOR_INFO_BACKGROUND );
-
- canvas.setBackground( infoBackgroundColor );
-
- final LightweightSystem lws = new LightweightSystem( canvas );
- final Figure outer = new Figure();
- outer.setLayoutManager( new ToolbarLayout() );
- lws.setContents( outer );
- final Figure contents = new Figure();
- contents.setBorder( new MarginBorder( 10 ) );
- outer.add( contents );
-
- createConstraintGraph( contents, null, this.constraint );
- contents.setLayoutManager( new GraphLayoutManager() );
-
- final Label escLabel = new Label( Resources.pressEscToClose );
- escLabel.setLabelAlignment( Label.RIGHT );
- escLabel.setBorder( new CompoundBorder( new DividerBorder( 2 ), new MarginBorder( 2 ) ) );
-
- outer.add( escLabel );
-
- final Dimension size = outer.getPreferredSize();
- this.width = ( size.width < 200 ? 200 : size.width );
- this.height = size.height;
-
- return canvas;
- }
-
- protected Control createButtonBar( final Composite parent )
- {
- return null;
- }
-
- protected Point getInitialLocation( final Point size )
- {
- return this.location;
- }
-
- protected Point getInitialSize()
- {
- return new Point( this.width, this.height );
- }
-
- private void createConstraintGraph( final IFigure container,
- final PolylineConnection parentCon,
- final IConstraint constraint )
- {
- if( constraint.getType() == IConstraint.Type.AND ||
- constraint.getType() == IConstraint.Type.OR )
- {
- if( constraint.getOperands().size() == 1 )
- {
- final IConstraint child
- = (IConstraint) constraint.getOperand( 0 );
-
- createConstraintGraph( container, parentCon, child );
- }
- else
- {
- final AndOrConstraintFigure node
- = new AndOrConstraintFigure( constraint );
-
- container.add( node );
-
- if( parentCon != null )
- {
- parentCon.setTargetAnchor( new EllipseAnchor( node ) );
- }
-
- for( Object operand : constraint.getOperands() )
- {
- final IConstraint child = (IConstraint) operand;
- final PolylineConnection childEdge = new PolylineConnection();
- container.add( childEdge );
- childEdge.setSourceAnchor( new EllipseAnchor( node ) );
- createConstraintGraph( container, childEdge, child );
- }
- }
- }
- else if( constraint.getType() == IConstraint.Type.REQUIRES )
- {
- final RequiresConstraintFigure node
- = new RequiresConstraintFigure( constraint );
-
- container.add( node );
-
- if( parentCon != null )
- {
- parentCon.setTargetAnchor( new ChopboxAnchor( node ) );
- }
- }
- else if( constraint.getType() == IConstraint.Type.CONFLICTS )
- {
- final ConflictsConstraintFigure node
- = new ConflictsConstraintFigure( constraint );
-
- container.add( node );
-
- if( parentCon != null )
- {
- parentCon.setTargetAnchor( new ChopboxAnchor( node ) );
- }
- }
- else
- {
- throw new IllegalStateException();
- }
- }
-
- private static final class GraphLayoutManager
-
- extends AbstractLayout
-
- {
- private int laidout = 0;
-
- protected Dimension calculatePreferredSize( final IFigure container,
- final int wHint,
- final int hHint )
- {
- container.validate();
- List children = container.getChildren();
- Rectangle result = new Rectangle().setLocation(container.getClientArea().getLocation());
- for (int i = 0; i < children.size(); i++)
- result.union(((IFigure) children.get(i)).getBounds());
- result.resize(container.getInsets().getWidth() + 2, container.getInsets().getHeight() + 2);
- return result.getSize();
- }
-
- @SuppressWarnings( "unchecked" )
- public void layout( final IFigure container )
- {
- if( this.laidout > 5 )
- {
- return;
- }
-
- // Create the graph.
-
- final DirectedGraph graph = new DirectedGraph();
- final Map<IFigure,Node> nodes = new HashMap<IFigure,Node>();
-
- for( Object child : container.getChildren() )
- {
- final IFigure childFigure = (IFigure) child;
-
- if( ! ( childFigure instanceof PolylineConnection ) )
- {
- final Node node = new Node( childFigure );
- final Dimension size = childFigure.getPreferredSize();
- node.height = size.height;
- node.width = size.width;
- graph.nodes.add( node );
- nodes.put( childFigure, node );
- }
- }
-
- for( Object child : container.getChildren() )
- {
- if( child instanceof PolylineConnection )
- {
- final PolylineConnection cn = (PolylineConnection) child;
-
- final IFigure source = cn.getSourceAnchor().getOwner();
- final Node sourceNode = nodes.get( source );
-
- final IFigure target = cn.getTargetAnchor().getOwner();
- final Node targetNode = nodes.get( target );
-
- final Edge edge = new Edge( cn, sourceNode, targetNode );
- graph.edges.add( edge );
- }
- }
-
- // Call the graph layout algorith to determine node positions.
-
- ( new DirectedGraphLayout() ).visit( graph );
-
- // Layout nodes based on the results of the graph layout.
-
- for( Object obj : graph.nodes )
- {
- final Node node = (Node) obj;
- final IFigure figure = (IFigure) node.data;
-
- final Rectangle bounds
- = new Rectangle( node.x + 10, node.y - 6,
- figure.getPreferredSize().width,
- figure.getPreferredSize().height );
-
- figure.setBounds( bounds );
- }
-
- for( Object obj : graph.edges )
- {
- final Edge edge = (Edge) obj;
- final PolylineConnection cn = (PolylineConnection) edge.data;
-
- if( edge.vNodes == null )
- {
- cn.setRoutingConstraint( Collections.EMPTY_LIST );
- }
- else
- {
- final List<AbsoluteBendpoint> bends = new ArrayList<AbsoluteBendpoint>();
-
- for( Object obj2 : edge.vNodes )
- {
- final Node vn = (Node) obj2;
-
- if( edge.isFeedback() )
- {
- bends.add( new AbsoluteBendpoint( vn.x, vn.y + vn.height ) );
- bends.add( new AbsoluteBendpoint( vn.x, vn.y ) );
- }
- else
- {
- bends.add( new AbsoluteBendpoint( vn.x, vn.y ) );
- bends.add( new AbsoluteBendpoint( vn.x, vn.y + vn.height ) );
- }
- }
-
- cn.setRoutingConstraint( bends );
- }
- }
-
- this.laidout++;
- }
- }
-
- private static final class DividerBorder
-
- extends AbstractBorder
-
- {
- private final int lines;
- private final Insets insets;
-
- public DividerBorder( final int lines )
- {
- this.lines = lines;
- this.insets = new Insets( 1 + ( this.lines - 1 ) * 2 );
- }
-
- public Insets getInsets( final IFigure figure )
- {
- return this.insets;
- }
-
- public void paint( final IFigure figure,
- final Graphics graphics,
- final Insets insets )
- {
- final Rectangle paintRectangle
- = getPaintRectangle( figure, insets );
-
- final int xLeft = paintRectangle.getTopLeft().x;
- final int xRight = paintRectangle.getTopRight().x;
-
- int y = paintRectangle.getTopLeft().y;
-
- for( int i = 0; i < this.lines; i++, y += 2 )
- {
- graphics.drawLine( xLeft, y, xRight, y );
- }
- }
- }
-
- private static final class DashedLineBorder
-
- extends LineBorder
-
- {
- public DashedLineBorder()
- {
- super( 1 );
- }
-
- public void paint(IFigure figure, Graphics graphics, Insets insets)
- {
- graphics.setLineStyle( SWT.LINE_DASH );
- super.paint( figure, graphics, insets );
- graphics.setLineStyle( SWT.LINE_SOLID );
- }
- }
-
- private static final class AndOrConstraintFigure
-
- extends Figure
-
- {
- public AndOrConstraintFigure( final IConstraint constraint )
- {
- setLayoutManager( new StackLayout() );
-
- final String labelText;
- final Color background;
-
- if( constraint.getType() == IConstraint.Type.AND )
- {
- labelText = Resources.andOperator;
- background = new Color( null, 0, 175, 0 );
- }
- else if( constraint.getType() == IConstraint.Type.OR )
- {
- labelText = Resources.orOperator;
- background = new Color( null, 255, 128, 0 );
- }
- else
- {
- throw new IllegalStateException();
- }
-
- final Ellipse circle = new Ellipse();
- circle.setOpaque( true );
- circle.setBackgroundColor( background );
- add( circle );
-
- final Label label = new Label();
- label.setFont( BOLD_FONT );
- label.setText( labelText );
- add( label );
- }
-
- public Dimension getPreferredSize( final int wHint,
- final int hHint )
- {
- return new Dimension( 35, 35 );
- }
- }
-
- private static final class RequiresConstraintFigure
-
- extends Figure
-
- {
- public RequiresConstraintFigure( final IConstraint constraint )
- {
- final Boolean soft
- = (Boolean) constraint.getOperand( constraint.getOperands().size() - 1 );
-
- setLayoutManager( new ToolbarLayout() );
- setBackgroundColor( new Color( null, 255, 255, 255 ) );
- setOpaque( true );
-
- setBorder( soft.booleanValue()
- ? new DashedLineBorder() : new LineBorder( 1 ) );
-
- final Label headerLabel = new Label();
- headerLabel.setFont( BOLD_FONT );
- headerLabel.setBorder( new MarginBorder( 2 ) );
- add( headerLabel );
-
- final StringBuffer bodyLabelText = new StringBuffer();
- final Object firstOperand = constraint.getOperand( 0 );
-
- if( firstOperand instanceof IGroup )
- {
- final IGroup group = (IGroup) firstOperand;
-
- headerLabel.setText( Resources.requiresGroupMemberOperator );
- bodyLabelText.append( group.toString() );
- }
- else
- {
- final IProjectFacet f = (IProjectFacet) firstOperand;
- final IVersionExpr vexpr = (IVersionExpr) constraint.getOperand( 1 );
-
- headerLabel.setText( Resources.requiresFacetOperator );
-
- bodyLabelText.append( f.getLabel() );
-
- if( ! vexpr.toString().equals( IVersionExpr.WILDCARD_SYMBOL ) )
- {
- bodyLabelText.append( ' ' );
- bodyLabelText.append( vexpr.toDisplayString() );
- }
- }
-
- final Label bodyLabel = new Label();
- bodyLabel.setText( bodyLabelText.toString() );
- bodyLabel.setBorder( new CompoundBorder( new DividerBorder( 1 ), new MarginBorder( 2 ) ) );
- add( bodyLabel );
- }
- }
-
- private static final class ConflictsConstraintFigure
-
- extends Figure
-
- {
- public ConflictsConstraintFigure( final IConstraint constraint )
- {
- setLayoutManager( new ToolbarLayout() );
- setBorder( new LineBorder( 1 ) );
- setOpaque( true );
- setBackgroundColor( new Color( null, 255, 255, 255 ) );
-
- final Label headerLabel = new Label();
- headerLabel.setFont( BOLD_FONT );
- headerLabel.setBorder( new MarginBorder( 2 ) );
- add( headerLabel );
-
- final StringBuffer bodyLabelText = new StringBuffer();
- final Object firstOperand = constraint.getOperand( 0 );
-
- if( firstOperand instanceof IGroup )
- {
- headerLabel.setText( Resources.conflictsWithGroupOperator );
-
- bodyLabelText.append( ( (IGroup) firstOperand ).getId() );
- }
- else
- {
- headerLabel.setText( Resources.conflictsWithFacetOperator );
-
- final IProjectFacet f = (IProjectFacet) firstOperand;
-
- bodyLabelText.append( f.getLabel() );
-
- if( constraint.getOperands().size() == 2 )
- {
- final IVersionExpr vexpr
- = (IVersionExpr) constraint.getOperand( 1 );
-
- bodyLabelText.append( ' ' );
- bodyLabelText.append( vexpr.toDisplayString() );
- }
- }
-
- final Label bodyLabel = new Label();
- bodyLabel.setText( bodyLabelText.toString() );
- bodyLabel.setBorder( new CompoundBorder( new DividerBorder( 1 ), new MarginBorder( 2 ) ) );
- add( bodyLabel );
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String pressEscToClose;
- public static String andOperator;
- public static String orOperator;
- public static String requiresFacetOperator;
- public static String requiresGroupMemberOperator;
- public static String conflictsWithGroupOperator;
- public static String conflictsWithFacetOperator;
-
- static
- {
- initializeMessages( ConstraintDisplayDialog.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.properties
deleted file mode 100644
index 2b5148a..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-pressEscToClose = Press 'Esc' to close.
-andOperator = AND
-orOperator = OR
-requiresFacetOperator = \ requires facet\
-requiresGroupMemberOperator = \ requires group member\
-conflictsWithGroupOperator = \ conflicts with group\
-conflictsWithFacetOperator = \ conflicts with facet\
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/DecorationsProvider.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/DecorationsProvider.java
deleted file mode 100644
index 6e74ac6..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/DecorationsProvider.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.common.project.facet.ui.IDecorationsProvider;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class DecorationsProvider
-
- implements IDecorationsProvider
-
-{
- private final Object adaptable;
-
- public DecorationsProvider( final Object adaptable )
- {
- this.adaptable = adaptable;
- }
-
- public ImageDescriptor getIcon()
- {
- return ProjectFacetsUiManagerImpl.getIcon( this.adaptable );
- }
-
- public static final class Factory
-
- implements IAdapterFactory
-
- {
- private static final Class[] ADAPTER_TYPES = { IDecorationsProvider.class };
-
- public Object getAdapter( final Object adaptable,
- final Class adapterType )
- {
- if( adapterType == IDecorationsProvider.class )
- {
- return new DecorationsProvider( adaptable );
- }
- else
- {
- return null;
- }
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetUiPlugin.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetUiPlugin.java
deleted file mode 100644
index 902c023..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetUiPlugin.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class FacetUiPlugin
-
- extends AbstractUIPlugin
-
-{
- public static final String PLUGIN_ID
- = "org.eclipse.wst.common.project.facet.ui"; //$NON-NLS-1$
-
- private static FacetUiPlugin plugin;
- private static final Set<String> messagesLogged = new HashSet<String>();
-
- public FacetUiPlugin()
- {
- super();
- plugin = this;
- }
-
- public static FacetUiPlugin getInstance()
- {
- return plugin;
- }
-
- public static ImageDescriptor getImageDescriptor( final String path )
- {
- return imageDescriptorFromPlugin( PLUGIN_ID, path );
- }
-
- public static void log( final Exception e )
- {
- final String msg = e.getMessage() + ""; //$NON-NLS-1$
- log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e ) );
- }
-
- public static void log( final IStatus status )
- {
- getInstance().getLog().log( status );
- }
-
- public static void log( final String msg )
- {
- log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null ) );
- }
-
- public static void logError( final String msg )
- {
- logError( msg, false );
- }
-
- public static void logError( final String msg,
- final boolean suppressDuplicates )
- {
- if( suppressDuplicates && messagesLogged.contains( msg ) )
- {
- return;
- }
-
- messagesLogged.add( msg );
-
- log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null ) );
- }
-
- public static void logWarning( final String msg )
- {
- logWarning( msg, false );
- }
-
- public static void logWarning( final String msg,
- final boolean suppressDuplicates )
- {
- if( suppressDuplicates && messagesLogged.contains( msg ) )
- {
- return;
- }
-
- messagesLogged.add( msg );
-
- log( new Status( IStatus.WARNING, PLUGIN_ID, IStatus.OK, msg, null ) );
- }
-
- public static IStatus createErrorStatus( final String msg,
- final Exception e )
- {
- return new Status( IStatus.ERROR, FacetUiPlugin.PLUGIN_ID, 0, msg, e );
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetedProjectActionFilter.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetedProjectActionFilter.java
deleted file mode 100644
index b3e6ddf..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetedProjectActionFilter.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class FacetedProjectActionFilter
-
- implements IActionFilter
-
-{
- public boolean testAttribute( final Object target,
- final String name,
- final String value )
- {
- if( name.equals( "facet" ) ) //$NON-NLS-1$
- {
- final IFacetedProject fproj = (IFacetedProject) target;
-
- final int colon = value.indexOf( ':' );
- final String fid;
- final String vexprstr;
-
- if( colon == -1 || colon == value.length() - 1 )
- {
- fid = value;
- vexprstr = null;
- }
- else
- {
- fid = value.substring( 0, colon );
- vexprstr = value.substring( colon + 1 );
- }
-
- if( ! ProjectFacetsManager.isProjectFacetDefined( fid ) )
- {
- return false;
- }
-
- final IProjectFacet f = ProjectFacetsManager.getProjectFacet( fid );
-
- if( ! fproj.hasProjectFacet( f ) )
- {
- return false;
- }
-
- if( vexprstr == null )
- {
- return true;
- }
- else
- {
- final IProjectFacetVersion fv = fproj.getInstalledVersion( f );
-
- try
- {
- if( f.getVersions( vexprstr ).contains( fv ) )
- {
- return true;
- }
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e.getStatus() );
- }
- }
-
- return false;
- }
- else
- {
- return false;
- }
- }
-
- public static final class Factory
-
- implements IAdapterFactory
-
- {
- private static final Class[] ADAPTER_TYPES = { IActionFilter.class };
-
- public Object getAdapter( final Object adaptable,
- final Class adapterType )
- {
- if( adapterType == IActionFilter.class )
- {
- return new FacetedProjectActionFilter();
- }
- else
- {
- return null;
- }
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.java
deleted file mode 100644
index 1d78ecf..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Karl Lum - initial implementation
- * Konstantin Komissarchik - ongoing maintenance
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-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.Display;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectListener;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
-
-/**
- * @author <a href="mailto:klum@bea.com">Karl Lum</a>
- */
-
-public class FacetsPropertyPage extends PropertyPage
-{
- private IFacetedProject project;
- private IFacetedProjectListener projectListener;
- private TableViewer viewer;
-
- protected Control createContents(Composite parent)
- {
- noDefaultAndApplyButton();
- final IAdaptable element = getElement();
-
- if (element instanceof IProject)
- {
- final IProject project = (IProject)element;
- try {
- this.project = ProjectFacetsManager.create(project);
- }
- catch (CoreException ce)
- {
- return null;
- }
-
- this.projectListener = new IFacetedProjectListener()
- {
- public void projectChanged()
- {
- handleProjectChangedEvent();
- }
- };
-
- this.project.addListener( this.projectListener );
-
- Composite composite = new Composite(parent, SWT.NONE);
-
- final GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
-
- composite.setLayout( layout );
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createTableGroup(composite);
-
- composite.addDisposeListener
- (
- new DisposeListener()
- {
- public void widgetDisposed( final DisposeEvent e )
- {
- handleDisposeEvent();
- }
- }
- );
- Dialog.applyDialogFont(parent);
- return composite;
- }
- return null;
- }
-
- /**
- * Create the table viewer and add/remove facet button group.
- * @param parent
- */
- private void createTableGroup(Composite parent)
- {
- final Composite composite = new Composite(parent, SWT.NONE);
- final GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- this.viewer = createTableViewer(composite);
- this.viewer.setInput(this.project);
-
- // Create the button that will open the Modify Faceted Project wizard.
-
- final Button button = new Button( parent, SWT.PUSH );
- button.setText( Resources.modifyProjectButtonLabel );
-
- final GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_END );
- gd.widthHint = button.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x + 15;
- button.setLayoutData( gd );
-
- button.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- final IWizard wizard = new ModifyFacetedProjectWizard( FacetsPropertyPage.this.project );
- final WizardDialog dialog = new WizardDialog( getShell(), wizard );
-
- dialog.open();
- }
- }
- );
- }
-
- private TableViewer createTableViewer(Composite parent)
- {
- final Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
-
- table.setLayout(new GridLayout());
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
-
- final TableColumn labelCol = new TableColumn(table, SWT.NONE);
- labelCol.setText(Resources.facetLabel);
- labelCol.setResizable(true);
- labelCol.setWidth(200);
-
- final TableColumn versionCol = new TableColumn(table, SWT.NONE);
- versionCol.setText(Resources.versionLabel);
- versionCol.setResizable(true);
- versionCol.setWidth(100);
-
- TableViewer viewer = new TableViewer(table);
-
- viewer.setContentProvider(new FacetsContentProvider());
- viewer.setLabelProvider(new FacetsLabelProvider());
-
- return viewer;
- }
-
- private void handleProjectChangedEvent()
- {
- final Display display = this.viewer.getTable().getDisplay();
-
- if( ! Thread.currentThread().equals( display.getThread() ) )
- {
- display.syncExec
- (
- new Runnable()
- {
- public void run()
- {
- handleProjectChangedEvent();
- }
- }
- );
-
- return;
- }
-
- this.viewer.refresh();
- }
-
- private void handleDisposeEvent()
- {
- this.project.removeListener( this.projectListener );
- }
-
- private static class FacetsLabelProvider extends LabelProvider implements ITableLabelProvider
- {
- static final int DESCRIPTION_FIELD = 0;
- static final int VERSION_FIELD = 1;
-
- public Image getColumnImage(Object element, int columnIndex) { return null; }
- public String getColumnText(Object element, int columnIndex)
- {
- if (element instanceof IProjectFacetVersion)
- {
- final IProjectFacetVersion facet = (IProjectFacetVersion)element;
- switch (columnIndex)
- {
- case DESCRIPTION_FIELD:
- return facet.getProjectFacet().getLabel();
- case VERSION_FIELD:
- return facet.getVersionString();
- }
- }
- return null;
- }
- }
-
- private static class FacetsContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object inputElement )
- {
- if( inputElement instanceof IFacetedProject )
- {
- final IFacetedProject project = (IFacetedProject) inputElement;
-
- final List<IProjectFacetVersion> facets
- = new ArrayList<IProjectFacetVersion>( project.getProjectFacets() );
-
- Collections.sort
- (
- facets,
- new Comparator<IProjectFacetVersion>()
- {
- public int compare( final IProjectFacetVersion fv1,
- final IProjectFacetVersion fv2 )
- {
- if( fv1 == fv2 )
- {
- return 0;
- }
- else
- {
- final String label1 = fv1.getProjectFacet().getLabel();
- final String label2 = fv2.getProjectFacet().getLabel();
-
- return label1.compareTo( label2 );
- }
- }
- }
- );
-
- return facets.toArray( new IProjectFacetVersion[ facets.size() ] );
- }
-
- return new String[ 0 ];
- }
-
- public void dispose(){}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput){}
- }
-
- private static final class Resources extends NLS
- {
- public static String modifyProjectButtonLabel;
- public static String facetLabel;
- public static String versionLabel;
-
- static
- {
- initializeMessages( FacetsPropertyPage.class.getName(),
- Resources.class );
- }
- }
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.properties
deleted file mode 100644
index 1770474..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-modifyProjectButtonLabel = Modify Project...
-facetLabel = Project Facet
-versionLabel = Version
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java
deleted file mode 100644
index 0fd6888..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.wst.common.project.facet.core.IActionConfig;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.ui.FacetUiHelpContextIds;
-import org.eclipse.wst.common.project.facet.ui.IWizardContext;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class FacetsSelectionPage
-
- extends WizardPage
-
-{
- private static final String IMG_PATH_WIZBAN
- = "images/facets-page-wizban.png"; //$NON-NLS-1$
-
- private IWizardContext context;
- private Set<IProjectFacetVersion> base;
- private IPreset initialPreset;
- private Set<IProjectFacetVersion> initialSelection;
- private final Set<IProjectFacet> fixed;
- public FacetsSelectionPanel panel;
- private List<Listener> listeners;
- private List<Combo> initialSyncWithPresetsCombos;
- private IRuntime initialSetDefaultFacetsForRuntime;
- private ModifyFacetedProjectDataModel model;
-
- public FacetsSelectionPage( final IWizardContext context,
- final Set<IProjectFacetVersion> base,
- final ModifyFacetedProjectDataModel model )
- {
- super( "facets.selection.page" ); //$NON-NLS-1$
-
- setTitle( Resources.pageTitle );
- setDescription( Resources.pageDescription );
- setImageDescriptor( FacetUiPlugin.getImageDescriptor( IMG_PATH_WIZBAN ) );
-
- this.context = context;
- this.base = base;
- this.model = model;
- this.initialPreset = null;
- this.initialSelection = null;
- this.fixed = new HashSet<IProjectFacet>();
- this.listeners = new ArrayList<Listener>();
- this.initialSyncWithPresetsCombos = new ArrayList<Combo>();
- this.initialSetDefaultFacetsForRuntime = null;
- }
-
- public void setInitialPreset( final IPreset preset )
- {
- this.initialPreset = preset;
- }
-
- public void setInitialSelection( final Set<IProjectFacetVersion> sel )
- {
- this.initialSelection = sel;
- }
-
- public void setFixedProjectFacets( final Set<IProjectFacet> fixed )
- {
- this.fixed.clear();
- this.fixed.addAll( fixed );
- }
-
- public Set<Action> getActions()
- {
- return this.panel.getActions();
- }
-
- public Set<IProjectFacetVersion> getSelectedProjectFacets()
- {
- return this.panel.getSelectedProjectFacets();
- }
-
- public void addSelectedFacetsChangedListener( final Listener listener )
- {
- synchronized( this.listeners )
- {
- this.listeners.add( listener );
- }
- }
-
- public void removeSelectedFacetsChangedListener( final Listener listener )
- {
- synchronized( this.listeners )
- {
- this.listeners.remove( listener );
- }
- }
-
- public void setDefaultFacetsForRuntime( final IRuntime runtime )
- {
- if( this.panel == null )
- {
- this.initialSetDefaultFacetsForRuntime = runtime;
- }
- else
- {
- this.panel.setDefaultFacetsForRuntime( runtime );
- }
- }
-
- public void syncWithPresetsModel( final Combo combo )
- {
- if( this.initialSyncWithPresetsCombos == null )
- {
- this.panel.syncWithPresetsModel( combo );
- }
- else
- {
- this.initialSyncWithPresetsCombos.add( combo );
- }
- }
-
- public void createControl( final Composite parent )
- {
- this.panel
- = new FacetsSelectionPanel( parent, SWT.NONE, this.context,
- this.base, this.model );
-
- this.panel.setFixedProjectFacets( this.fixed );
-
- if( this.initialPreset != null )
- {
- this.panel.getDataModel().setSelectedPreset( this.initialPreset.getId() );
- }
-
- if( this.initialSelection != null )
- {
- this.panel.setSelectedProjectFacets( this.initialSelection );
- }
-
- if( this.initialSetDefaultFacetsForRuntime != null )
- {
- this.panel.setDefaultFacetsForRuntime( this.initialSetDefaultFacetsForRuntime );
- }
-
- setPageComplete( this.panel.isSelectionValid() );
-
- this.panel.addProjectFacetsListener
- (
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handleSelectedFacetsChangedEvent( event );
- }
- }
- );
-
- for( Combo combo : this.initialSyncWithPresetsCombos )
- {
- this.panel.syncWithPresetsModel( combo );
- }
-
- this.initialSyncWithPresetsCombos = null;
-
- final IWorkbenchHelpSystem h = PlatformUI.getWorkbench().getHelpSystem();
- h.setHelp( this.panel, FacetUiHelpContextIds.FACETS_SELECTION_PAGE );
-
- setControl( this.panel );
- }
-
- private void handleSelectedFacetsChangedEvent( final Event event )
- {
- setPageComplete( this.panel.isSelectionValid() );
-
- final List<Listener> copyOfListenersList = new ArrayList<Listener>();
-
- synchronized( this.listeners )
- {
- copyOfListenersList.addAll( this.listeners );
- }
-
- for( Listener listener : copyOfListenersList )
- {
- try
- {
- listener.handleEvent( event );
- }
- catch( Exception e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- if( getContainer().getCurrentPage() != null )
- {
- getContainer().updateButtons();
- }
- }
-
- public void setVisible( final boolean visible )
- {
- if( visible )
- {
- for( Action action : this.panel.getActions() )
- {
- final Object config = action.getConfig();
-
- if( config != null )
- {
- IActionConfig c = null;
-
- if( config instanceof IActionConfig )
- {
- c = (IActionConfig) config;
- }
- else
- {
- final IAdapterManager m
- = Platform.getAdapterManager();
-
- final String t
- = IActionConfig.class.getName();
-
- c = (IActionConfig) m.loadAdapter( config, t );
- }
-
- if( c != null )
- {
- c.setProjectName( this.context.getProjectName() );
- }
- }
- }
- }
-
- super.setVisible( visible );
-
- if( visible )
- {
- this.panel.setFocus();
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String pageTitle;
- public static String pageDescription;
-
- static
- {
- initializeMessages( FacetsSelectionPage.class.getName(),
- Resources.class );
- }
- }
-
-}
-
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.properties
deleted file mode 100644
index a91b135..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-pageTitle = Project Facets
-pageDescription = Select the facets that should be enabled for this project.
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java
deleted file mode 100644
index 24c7289..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java
+++ /dev/null
@@ -1,2465 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial implementation and ongoing maintenance
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import static java.lang.Math.max;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gd;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhalign;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhhint;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhspan;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdwhint;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gl;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.SwtUtil.getPreferredWidth;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.window.ToolTip;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.wst.common.project.facet.core.IActionConfig;
-import org.eclipse.wst.common.project.facet.core.ICategory;
-import org.eclipse.wst.common.project.facet.core.IConstraint;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.ui.IDecorationsProvider;
-import org.eclipse.wst.common.project.facet.ui.IWizardContext;
-import org.eclipse.wst.common.project.facet.ui.internal.AbstractDataModel.IDataModelListener;
-import org.eclipse.wst.common.project.facet.ui.internal.ChangeTargetedRuntimesDataModel.IRuntimeFilter;
-import org.eclipse.wst.common.project.facet.ui.internal.util.BasicToolTip;
-import org.eclipse.wst.common.project.facet.ui.internal.util.HeaderToolTip;
-import org.osgi.framework.Bundle;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class FacetsSelectionPanel
-
- extends Composite
- implements ISelectionProvider
-
-{
- private static final String FACET_COLUMN = "facet"; //$NON-NLS-1$
- private static final String VERSION_COLUMN = "version"; //$NON-NLS-1$
- private static final String WIDTH = "width"; //$NON-NLS-1$
- private static final String HEIGHT = "height"; //$NON-NLS-1$
- private static final String CW_FACET = "cw.facet"; //$NON-NLS-1$
- private static final String CW_VERSION = "cw.version"; //$NON-NLS-1$
- private static final String SASH1W1 = "sash.1.weight.1"; //$NON-NLS-1$
- private static final String SASH1W2 = "sash.1.weight.2"; //$NON-NLS-1$
- private static final String SASH2W1 = "sash.2.weight.1"; //$NON-NLS-1$
- private static final String SASH2W2 = "sash.2.weight.2"; //$NON-NLS-1$
-
- private static final String IMG_ERROR = "##error##"; //$NON-NLS-1$
- private static final String IMG_WARNING = "##warning##"; //$NON-NLS-1$
- private static final String IMG_DOWN_ARROW = "##down-arrow##"; //$NON-NLS-1$
-
- private final IDialogSettings settings;
- private final Composite topComposite;
- private final SashForm sform1;
- private final SashForm sform2;
- private final Label presetsLabel;
- private final Combo presetsCombo;
- private final Button savePresetButton;
- private final Button deletePresetButton;
- private final CheckboxTreeViewer treeViewer;
- private final Tree tree;
- private final TreeColumn colFacet;
- private final TreeColumn colVersion;
- private final Menu popupMenu;
- private final MenuItem popupMenuConstraints;
- private final ComboBoxCellEditor ceditor;
- private final FixedFacetToolTip fixedFacetToolTip;
- private final TableViewer problemsView;
- private final RuntimesPanel runtimesPanel;
- private final Button showHideRuntimesButton;
-
- private final IWizardContext context;
-
- /**
- * Contains the <code>TableRowData</code> objects representing all of the
- * facets, regardless whether they are displayed or not.
- */
-
- private final List<TableRowData> data;
- private final Set<IProjectFacetVersion> base;
- private final Set<Action> actions;
- private Object oldSelection;
-
- private IStatus problems;
- private final List<Listener> listeners;
- private final List<ISelectionChangedListener> selectionListeners;
-
- private final ModifyFacetedProjectDataModel model;
-
- /**
- * Holds images used throughout the panel.
- */
-
- private final ImageRegistry imageRegistry;
-
- public interface IFilter
- {
- boolean check( IProjectFacetVersion fv );
- }
-
- public FacetsSelectionPanel( final Composite parent,
- final int style,
- final IWizardContext context,
- final Set<IProjectFacetVersion> base,
- final ModifyFacetedProjectDataModel model )
- {
- super( parent, style );
-
- this.context = context;
- this.data = new ArrayList<TableRowData>();
- this.model = model;
- this.base = ( base == null ? new HashSet<IProjectFacetVersion>() : base );
- this.actions = new HashSet<Action>();
- this.oldSelection = null;
- this.problems = Status.OK_STATUS;
- this.listeners = new ArrayList<Listener>();
- this.selectionListeners = new ArrayList<ISelectionChangedListener>();
-
- for( IProjectFacet f : ProjectFacetsManager.getProjectFacets() )
- {
- try
- {
- this.data.add( new TableRowData( f ) );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- // Initialize the image registry.
-
- this.imageRegistry = new ImageRegistry();
- final Bundle bundle = Platform.getBundle( FacetUiPlugin.PLUGIN_ID );
-
- URL url = bundle.getEntry( "images/error.gif" ); //$NON-NLS-1$
- this.imageRegistry.put( IMG_ERROR, ImageDescriptor.createFromURL( url ) );
-
- url = bundle.getEntry( "images/warning.gif" ); //$NON-NLS-1$
- this.imageRegistry.put( IMG_WARNING, ImageDescriptor.createFromURL( url ) );
-
- url = bundle.getEntry( "images/down-arrow.gif" ); //$NON-NLS-1$
- this.imageRegistry.put( IMG_DOWN_ARROW, ImageDescriptor.createFromURL( url ) );
-
- // Read the dialog settings.
-
- final IDialogSettings root
- = FacetUiPlugin.getInstance().getDialogSettings();
-
- IDialogSettings temp = root.getSection( getClass().getName() );
-
- if( temp == null )
- {
- temp = root.addNewSection( getClass().getName() );
- }
-
- if( temp.get( WIDTH ) == null ) temp.put( WIDTH, 600 );
- if( temp.get( HEIGHT ) == null ) temp.put( HEIGHT, 300 );
- if( temp.get( SASH1W1 ) == null ) temp.put( SASH1W1, 60 );
- if( temp.get( SASH1W2 ) == null ) temp.put( SASH1W2, 40 );
- if( temp.get( SASH2W1 ) == null ) temp.put( SASH2W1, 70 );
- if( temp.get( SASH2W2 ) == null ) temp.put( SASH2W2, 30 );
-
- this.settings = temp;
-
- // Layout the panel.
-
- final GridLayout layout = new GridLayout( 1, false );
- layout.marginWidth = 0;
- layout.marginHeight = 0;
-
- setLayout( layout );
-
- final GridData topgd = gdfill();
- topgd.heightHint = this.settings.getInt( HEIGHT );
- topgd.widthHint = this.settings.getInt( WIDTH );
-
- this.topComposite = new Composite( this, SWT.NONE );
- this.topComposite.setLayout( new GridLayout( 4, false ) );
- this.topComposite.setLayoutData( topgd );
-
- this.topComposite.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- final Point size
- = FacetsSelectionPanel.this.topComposite.getSize();
-
- FacetsSelectionPanel.this.settings.put( WIDTH, size.x );
- FacetsSelectionPanel.this.settings.put( HEIGHT, size.y );
- }
- }
- );
-
- this.presetsLabel = new Label( this.topComposite, SWT.NONE );
- this.presetsLabel.setText( Resources.presetsLabel );
-
- this.presetsCombo = new Combo( this.topComposite, SWT.READ_ONLY );
- this.presetsCombo.setLayoutData( gdhfill() );
-
- syncWithPresetsModel( this.presetsCombo );
-
- this.savePresetButton = new Button( this.topComposite, SWT.PUSH );
- this.savePresetButton.setText( Resources.saveButtonLabel );
-
- this.savePresetButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleSavePreset();
- }
- }
- );
-
- this.deletePresetButton = new Button( this.topComposite, SWT.PUSH );
- this.deletePresetButton.setText( Resources.deleteButtonLabel );
-
- this.deletePresetButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleDeletePreset();
- }
- }
- );
-
- final int width
- = Math.max( getPreferredWidth( this.savePresetButton ),
- getPreferredWidth( this.deletePresetButton ) ) + 15;
-
- this.savePresetButton.setLayoutData( gdwhint( gd(), width ) );
- this.deletePresetButton.setLayoutData( gdwhint( gd(), width ) );
-
- this.sform1 = new SashForm( this.topComposite, SWT.HORIZONTAL | SWT.SMOOTH );
- this.sform1.setLayoutData( gdhspan( gdfill(), 4 ) );
-
- this.sform2 = new SashForm( this.sform1, SWT.VERTICAL | SWT.SMOOTH );
- this.sform2.setLayoutData( gdhspan( gdfill(), 4 ) );
-
- this.treeViewer = new CheckboxTreeViewer( this.sform2, SWT.BORDER );
- this.tree = this.treeViewer.getTree();
-
- this.tree.setHeaderVisible( true );
-
- this.ceditor = new ComboBoxCellEditor( this.tree, new String[ 0 ], SWT.READ_ONLY );
-
- this.treeViewer.setColumnProperties( new String[] { FACET_COLUMN, VERSION_COLUMN } );
- this.treeViewer.setCellModifier( new CellModifier() );
- this.treeViewer.setCellEditors( new CellEditor[] { null, this.ceditor } );
-
- this.treeViewer.setContentProvider( new ContentProvider() );
- this.treeViewer.setLabelProvider( new LabelProvider() );
- this.treeViewer.setSorter( new Sorter() );
-
- this.colFacet = new TreeColumn( this.tree, SWT.NONE );
- this.colFacet.setText( Resources.facetColumnLabel );
- this.colFacet.setResizable( true );
-
- if( this.settings.get( CW_FACET ) == null )
- {
- this.settings.put( CW_FACET, computeDefaultFacetColumnWidth() );
- }
-
- this.colFacet.setWidth( this.settings.getInt( CW_FACET ) );
-
- this.colFacet.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- FacetsSelectionPanel.this.settings.put( CW_FACET, FacetsSelectionPanel.this.colFacet.getWidth() );
- }
- }
- );
-
- this.colVersion = new TreeColumn( this.tree, SWT.NONE );
- this.colVersion.setText( Resources.versionColumnLabel );
- this.colVersion.setResizable( true );
-
- if( this.settings.get( CW_VERSION ) == null )
- {
- this.settings.put( CW_VERSION, computeDefaultVersionColumnWidth() );
- }
-
- this.colVersion.setWidth( this.settings.getInt( CW_VERSION ) );
-
- this.colVersion.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- FacetsSelectionPanel.this.settings.put( CW_VERSION, FacetsSelectionPanel.this.colVersion.getWidth() );
- }
- }
- );
-
- this.popupMenu = new Menu( getShell(), SWT.POP_UP );
- this.popupMenuConstraints = new MenuItem( this.popupMenu, SWT.PUSH );
- this.popupMenuConstraints.setText( Resources.showConstraints );
-
- this.popupMenuConstraints.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( SelectionEvent e )
- {
- handleShowConstraints();
- }
- }
- );
-
- new FacetToolTip( this.tree );
- new CategoryToolTip( this.tree );
- this.fixedFacetToolTip = new FixedFacetToolTip( this.tree );
-
- this.treeViewer.setInput( new Object() );
-
- this.treeViewer.addSelectionChangedListener
- (
- new ISelectionChangedListener()
- {
- public void selectionChanged( final SelectionChangedEvent e )
- {
- FacetsSelectionPanel.this.selectionChanged( e );
- }
- }
- );
-
- this.treeViewer.addCheckStateListener
- (
- new ICheckStateListener()
- {
- public void checkStateChanged( final CheckStateChangedEvent e )
- {
- FacetsSelectionPanel.this.checkStateChanged( e );
- }
- }
- );
-
- this.tree.addListener
- (
- SWT.MouseDown,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handleMouseDownEvent( event );
- }
- }
- );
-
- this.tree.addListener
- (
- SWT.PaintItem,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handlePaintItemEvent( event );
- }
- }
- );
-
- this.problemsView = new TableViewer( this.sform2, SWT.BORDER );
- this.problemsView.setContentProvider( new ProblemsContentProvider() );
- this.problemsView.setLabelProvider( new ProblemsLabelProvider() );
- this.problemsView.setInput( new Object() );
-
- this.problemsView.getTable().addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- final int[] weights = FacetsSelectionPanel.this.sform2.getWeights();
- FacetsSelectionPanel.this.settings.put( SASH2W1, weights[ 0 ] );
- FacetsSelectionPanel.this.settings.put( SASH2W2, weights[ 1 ] );
- }
- }
- );
-
- final int[] weights2
- = new int[] { this.settings.getInt( SASH2W1 ),
- this.settings.getInt( SASH2W2 ) };
-
- this.sform2.setWeights( weights2 );
-
- this.runtimesPanel
- = new RuntimesPanel( this.sform1, SWT.NONE,
- this.model.getTargetedRuntimesDataModel() );
-
- this.runtimesPanel.setLayoutData( gdhhint( gdhfill(), 80 ) );
-
- this.model.getTargetedRuntimesDataModel().addRuntimeFilter
- (
- new IRuntimeFilter()
- {
- public boolean check( final IRuntime runtime )
- {
- final IFacetedProject project = getDataModel().getFacetedProject();
-
- if( project != null && project.getTargetedRuntimes().contains( runtime ) )
- {
- return true;
- }
- else
- {
- for( IProjectFacetVersion fv : getSelectedProjectFacets() )
- {
- if( ! runtime.supports( fv ) )
- {
- return false;
- }
- }
-
- return true;
- }
- }
- }
- );
-
- addProjectFacetsListener
- (
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- final ChangeTargetedRuntimesDataModel rdm
- = getDataModel().getTargetedRuntimesDataModel();
-
- rdm.refreshTargetableRuntimes();
- }
- }
- );
-
- this.runtimesPanel.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- final int[] weights = FacetsSelectionPanel.this.sform1.getWeights();
- FacetsSelectionPanel.this.settings.put( SASH1W1, weights[ 0 ] );
- FacetsSelectionPanel.this.settings.put( SASH1W2, weights[ 1 ] );
- }
- }
- );
-
- final int[] weights1
- = new int[] { this.settings.getInt( SASH1W1 ),
- this.settings.getInt( SASH1W2 ) };
-
- this.sform1.setWeights( weights1 );
- this.sform1.setMaximizedControl( this.sform2 );
-
- this.showHideRuntimesButton = new Button( this.topComposite, SWT.PUSH );
- this.showHideRuntimesButton.setText( Resources.showRuntimes );
- GridData gd = gdhalign( gdhspan( gd(), 4 ), GridData.END );
- gd = gdwhint( gd, getPreferredWidth( this.showHideRuntimesButton ) + 15 );
- this.showHideRuntimesButton.setLayoutData( gd );
-
- this.showHideRuntimesButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleShowHideRuntimes();
- }
- }
- );
-
- this.addDisposeListener
- (
- new DisposeListener()
- {
- public void widgetDisposed( final DisposeEvent e )
- {
- handleDisposeEvent();
- }
- }
- );
-
- updateValidationDisplay();
- Dialog.applyDialogFont(parent);
-
- // Bind to the model.
-
- this.model.addListener
- (
- ModifyFacetedProjectDataModel.EVENT_FIXED_FACETS_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handleModelChangedEvent( ModifyFacetedProjectDataModel.EVENT_FIXED_FACETS_CHANGED );
- }
- }
- );
-
- this.model.addListener
- (
- ModifyFacetedProjectDataModel.EVENT_SELECTED_PRESET_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handleModelChangedEvent( ModifyFacetedProjectDataModel.EVENT_SELECTED_PRESET_CHANGED );
- }
- }
- );
-
- syncWithPresetsModel( this.presetsCombo );
-
- this.model.getTargetedRuntimesDataModel().addListener
- (
- ChangeTargetedRuntimesDataModel.EVENT_TARGETED_RUNTIMES_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handleModelChangedEvent( ChangeTargetedRuntimesDataModel.EVENT_TARGETED_RUNTIMES_CHANGED );
- }
- }
- );
- }
-
- public ModifyFacetedProjectDataModel getDataModel()
- {
- return this.model;
- }
-
- public boolean isSelectionValid()
- {
- return ( this.problems.getSeverity() != IStatus.ERROR );
- }
-
- public Set<Action> getActions()
- {
- return this.actions;
- }
-
- public Action getAction( final Action.Type type,
- final IProjectFacetVersion f )
- {
- return getAction( this.actions, type, f );
- }
-
- private static Action getAction( final Set<Action> actions,
- final Action.Type type,
- final IProjectFacetVersion fv )
- {
- for( Action action : actions )
- {
- if( action.getType() == type && action.getProjectFacetVersion() == fv )
- {
- return action;
- }
- }
-
- return null;
- }
-
- private static Action getAction( final Set<Action> actions,
- final Action.Type type,
- final IProjectFacet f )
- {
- for( Action action : actions )
- {
- if( action.getType() == type &&
- action.getProjectFacetVersion().getProjectFacet() == f )
- {
- return action;
- }
- }
-
- return null;
- }
-
- private Action createAction( final Set<Action> actions,
- final Action.Type type,
- final IProjectFacetVersion fv )
- {
- Action action = getAction( actions, type, fv );
-
- if( action == null )
- {
- Object config = null;
-
- if( fv.supports( this.base, type ) )
- {
- try
- {
- final IProjectFacet f = fv.getProjectFacet();
-
- action = getAction( actions, type, f );
-
- if( action != null )
- {
- final IProjectFacetVersion current
- = action.getProjectFacetVersion();
-
- if( fv.supports( this.base, type ) &&
- current.supports( this.base, type ) &&
- fv.getActionDefinition( this.base, type )
- == current.getActionDefinition( this.base, type ) )
- {
- config = action.getConfig();
-
- IActionConfig c = null;
-
- if( config instanceof IActionConfig )
- {
- c = (IActionConfig) config;
- }
- else if( config != null )
- {
- final IAdapterManager m
- = Platform.getAdapterManager();
-
- final String t
- = IActionConfig.class.getName();
-
- c = (IActionConfig) m.loadAdapter( config, t );
- }
-
- if( c != null )
- {
- c.setVersion( fv );
- }
- }
- }
-
- if( config == null )
- {
- final String pjname = this.context.getProjectName();
- config = this.context.getConfig(fv, type, pjname);
- }
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- action = new Action( type, fv, config );
- }
-
- return action;
- }
-
- public void setDefaultFacetsForRuntime( final IRuntime runtime )
- {
- final Set<IProjectFacetVersion> defaultFacets;
-
- if( runtime != null )
- {
- try
- {
- defaultFacets = runtime.getDefaultFacets( this.model.getFixedFacets() );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- return;
- }
- }
- else
- {
- defaultFacets = new HashSet<IProjectFacetVersion>();
-
- for( IProjectFacet f : this.model.getFixedFacets() )
- {
- defaultFacets.add( f.getDefaultVersion() );
- }
- }
-
- setSelectedProjectFacets( defaultFacets );
- this.model.setSelectedPreset( null );
- }
-
- public Set<IProjectFacetVersion> getSelectedProjectFacets()
- {
- final Set<IProjectFacetVersion> set = new HashSet<IProjectFacetVersion>();
-
- for( TableRowData trd : this.data )
- {
- if( trd.isSelected() )
- {
- set.add( trd.getCurrentVersion() );
- }
- }
-
- return set;
- }
-
- public void setSelectedProjectFacets( final Set<IProjectFacetVersion> sel )
- {
- final List<TableRowData> toCheck = new ArrayList<TableRowData>();
- final List<TableRowData> needsCategoryRefresh = new ArrayList<TableRowData>();
-
- for( IProjectFacetVersion fv : sel )
- {
- final IProjectFacet f = fv.getProjectFacet();
- final TableRowData trd = findTableRowData( f, true );
-
- if( fv.getPluginId() == null )
- {
- trd.addUnknownVersion( fv );
- }
-
- trd.setSelected( true );
- trd.setCurrentVersion( fv );
-
- toCheck.add( trd );
- needsCategoryRefresh.add( trd );
- }
-
- for( TableRowData trd : this.data )
- {
- if( trd.isSelected() && ! sel.contains( trd.getCurrentVersion() ) )
- {
- trd.setSelected( false );
- needsCategoryRefresh.add( trd );
- }
- }
-
- refresh();
-
- this.treeViewer.setCheckedElements( toCheck.toArray() );
-
- for( TableRowData trd : needsCategoryRefresh )
- {
- refreshCategoryState( trd );
- }
-
- updateValidationDisplay();
- }
-
- public void setFixedProjectFacets( final Set<IProjectFacet> fixed )
- {
- this.model.setFixedFacets( fixed );
- }
-
- /**
- * @deprecated
- */
-
- public void selectPreset( final IPreset preset )
- {
- this.model.setSelectedPreset( preset.getId() );
- }
-
- public boolean setFocus()
- {
- return this.tree.setFocus();
- }
-
- public void addProjectFacetsListener( final Listener listener )
- {
- this.listeners.add( listener );
- }
-
- public void removeProjectFacetsListener( final Listener listener )
- {
- this.listeners.remove( listener );
- }
-
- private void notifyProjectFacetsListeners()
- {
- for( Listener listener : this.listeners )
- {
- listener.handleEvent( null );
- }
- }
-
- public void addSelectionChangedListener( final ISelectionChangedListener listener )
- {
- this.selectionListeners.add( listener );
- }
-
- public void removeSelectionChangedListener( final ISelectionChangedListener listener )
- {
- this.selectionListeners.remove( listener );
- }
-
- public ISelection getSelection()
- {
- final IStructuredSelection ss
- = (IStructuredSelection) this.treeViewer.getSelection();
-
- Object sel = ss.getFirstElement();
-
- if( sel instanceof TableRowData )
- {
- sel = ( (TableRowData) sel ).getProjectFacet();
- }
-
- if( sel == null )
- {
- return new StructuredSelection( new Object[ 0 ] );
- }
- else
- {
- return new StructuredSelection( sel );
- }
- }
-
- public void setSelection( final ISelection selection )
- {
- final IStructuredSelection ss = (IStructuredSelection) selection;
- final Object sel = ss.getFirstElement();
- final ISelection ts;
-
- if( sel == null )
- {
- ts = new StructuredSelection( new Object[ 0 ] );
- }
- else
- {
- if( sel instanceof IProjectFacet )
- {
- final TableRowData trd
- = findTableRowData( (IProjectFacet) sel );
-
- ts = new StructuredSelection( trd );
- }
- else
- {
- ts = selection;
- }
- }
-
- this.treeViewer.setSelection( ts );
- }
-
- public void notifySelectionChangedListeners()
- {
- final SelectionChangedEvent event = new SelectionChangedEvent( this, getSelection() );
-
- for( ISelectionChangedListener listener : this.selectionListeners )
- {
- listener.selectionChanged( event );
- }
- }
-
- private ImageRegistry getImageRegistry()
- {
- return this.imageRegistry;
- }
-
- private void selectionChanged( final SelectionChangedEvent event )
- {
- final Object selection
- = ( (IStructuredSelection) event.getSelection() ).getFirstElement();
-
- if( selection != this.oldSelection )
- {
- this.oldSelection = selection;
- refreshVersionsDropDown();
- notifySelectionChangedListeners();
- }
- }
-
- private void checkStateChanged( final CheckStateChangedEvent event )
- {
- final Object el = event.getElement();
- final boolean checked = event.getChecked();
-
- if( el instanceof TableRowData )
- {
- final TableRowData trd = (TableRowData) el;
-
- if( trd.isFixed() )
- {
- if( ! checked )
- {
- this.treeViewer.setChecked( el, true );
-
- final String msg
- = NLS.bind( Resources.couldNotDeselectFixedFacetMessage,
- trd.getProjectFacet().getLabel() );
-
- this.fixedFacetToolTip.setMessage( msg );
-
- final Point cursorLocation = getDisplay().getCursorLocation();
- this.fixedFacetToolTip.show( this.tree.toControl( cursorLocation ) );
- }
-
- return;
- }
-
- trd.setSelected( checked );
- refreshCategoryState( trd );
- }
- else
- {
- final ContentProvider cp
- = (ContentProvider) this.treeViewer.getContentProvider();
-
- final Object[] children = cp.getChildren( el );
- int selected = 0;
-
- for( Object child : children )
- {
- final TableRowData trd = (TableRowData) child;
-
- if( ! trd.isFixed() )
- {
- trd.setSelected( checked );
- this.treeViewer.setChecked( trd, checked );
- }
-
- if( trd.isSelected() )
- {
- selected++;
- }
- }
-
- if( selected == 0 || selected == children.length )
- {
- this.treeViewer.setGrayed( el, false );
- }
- else
- {
- this.treeViewer.setGrayChecked( el, true );
- }
- }
-
- updateValidationDisplay();
-
- this.model.setSelectedPreset( null );
- }
-
- private void updateValidationDisplay()
- {
- final Set<IProjectFacetVersion> sel = getSelectedProjectFacets();
- final Set<Action> old = new HashSet<Action>( this.actions );
- this.actions.clear();
-
- // What has been removed?
-
- for( IProjectFacetVersion fv : this.base )
- {
- if( ! sel.contains( fv ) )
- {
- this.actions.add( createAction( old, Action.Type.UNINSTALL, fv ) );
- }
- }
-
- // What has been added?
-
- for( IProjectFacetVersion fv : sel )
- {
- if( ! this.base.contains( fv ) )
- {
- this.actions.add( createAction( old, Action.Type.INSTALL, fv ) );
- }
- }
-
- // Coalesce uninstall/install pairs into version change actions, if
- // possible.
-
- final Set<Action> toadd = new HashSet<Action>();
- final Set<Action> toremove = new HashSet<Action>();
-
- for( Action action1 : this.actions )
- {
- for( Action action2 : this.actions )
- {
- if( action1.getType() == Action.Type.UNINSTALL &&
- action2.getType() == Action.Type.INSTALL )
- {
- final IProjectFacetVersion f1 = action1.getProjectFacetVersion();
- final IProjectFacetVersion f2 = action2.getProjectFacetVersion();
-
- if( f1.getProjectFacet() == f2.getProjectFacet() )
- {
- toremove.add( action1 );
- toremove.add( action2 );
- toadd.add( createAction( old, Action.Type.VERSION_CHANGE, f2 ) );
- }
- }
- }
- }
-
- this.actions.removeAll( toremove );
- this.actions.addAll( toadd );
-
- this.problems = calculateProblems();
- this.problemsView.refresh();
-
- if( this.problems.isOK() )
- {
- if( this.sform2.getMaximizedControl() == null )
- {
- this.sform2.setMaximizedControl( this.tree );
- }
- }
- else
- {
- if( this.sform2.getMaximizedControl() != null )
- {
- this.sform2.setMaximizedControl( null );
- }
- }
-
- notifyProjectFacetsListeners();
- }
-
- private IStatus calculateProblems()
- {
- MultiStatus st = (MultiStatus) ProjectFacetsManager.check( this.base, this.actions );
-
- for( IProjectFacetVersion fv : this.base )
- {
- final IProjectFacet f = fv.getProjectFacet();
-
- String msg = null;
-
- if( f.getPluginId() == null )
- {
- msg = NLS.bind( Resources.facetNotFound, f.getId() );
- }
- else if( fv.getPluginId() == null )
- {
- msg = NLS.bind( Resources.facetVersionNotFound, f.getId(),
- fv.getVersionString() );
- }
-
- if( msg != null )
- {
- final IStatus sub
- = new Status( IStatus.WARNING, FacetUiPlugin.PLUGIN_ID, 0, msg, null );
-
- st.add( sub );
- }
- }
-
- for( IRuntime r : getDataModel().getTargetedRuntimesDataModel().getTargetedRuntimes() )
- {
- for( IProjectFacetVersion fv : getSelectedProjectFacets() )
- {
- if( ! r.supports( fv ) )
- {
- final String msg
- = NLS.bind( Resources.facetNotSupportedByTarget, fv.toString(),
- r.getLocalizedName() );
-
- final IStatus sub
- = new Status( IStatus.ERROR, FacetUiPlugin.PLUGIN_ID, 0, msg, null );
-
- st.add( sub );
- }
- }
- }
-
- return st;
- }
-
- private void refresh()
- {
- // Somehow the checked state of nested items gets lost when a refresh
- // is performed, so we have to do this workaround.
-
- final Object[] checked = this.treeViewer.getCheckedElements();
- this.treeViewer.refresh();
- this.treeViewer.setCheckedElements( checked );
- refreshVersionsDropDown();
- }
-
- public void setCategoryExpandedState( final ICategory category,
- final boolean expanded )
- {
- this.treeViewer.setExpandedState( category, expanded );
- }
-
- public void syncWithPresetsModel( final Combo combo )
- {
- final List<IPreset> sortedPresets = new ArrayList<IPreset>();
-
- // Contents : model -> view
-
- final IDataModelListener modelToViewContentsListener = new IDataModelListener()
- {
- public void handleEvent()
- {
- synchronized( sortedPresets )
- {
- sortedPresets.clear();
- sortedPresets.addAll( FacetsSelectionPanel.this.model.getAvailablePresets() );
-
- Collections.sort
- (
- sortedPresets,
- new Comparator<IPreset>()
- {
- public int compare( final IPreset p1,
- final IPreset p2 )
- {
- if( p1 == p2 )
- {
- return 0;
- }
- else
- {
- return p1.getLabel().compareTo( p2.getLabel() );
- }
- }
- }
- );
-
- final IPreset selectedPreset
- = FacetsSelectionPanel.this.model.getSelectedPreset();
-
- combo.removeAll();
- combo.add( Resources.customPreset );
-
- if( selectedPreset == null )
- {
- combo.select( 0 );
- }
-
- for( IPreset preset : sortedPresets )
- {
- combo.add( preset.getLabel() );
-
- if( preset == selectedPreset )
- {
- combo.select( combo.getItemCount() - 1 );
- }
- }
- }
- }
- };
-
- this.model.addListener( ModifyFacetedProjectDataModel.EVENT_AVAILABLE_PRESETS_CHANGED,
- modelToViewContentsListener );
-
- // Selection : model -> view
-
- this.model.addListener
- (
- ModifyFacetedProjectDataModel.EVENT_SELECTED_PRESET_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- synchronized( sortedPresets )
- {
- final IPreset preset
- = FacetsSelectionPanel.this.model.getSelectedPreset();
-
- final int index;
-
- if( preset == null )
- {
- index = -1;
- }
- else
- {
- index = sortedPresets.indexOf( preset );
- }
-
- combo.select( index + 1 );
-
- handlePresetSelected();
- }
- }
- }
- );
-
- // Selection : view -> model
-
- combo.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- synchronized( sortedPresets )
- {
- final int selection = combo.getSelectionIndex();
- final String presetId;
-
- if( selection == 0 )
- {
- presetId = null;
- }
- else
- {
- presetId = sortedPresets.get( selection - 1 ).getId();
- }
-
- FacetsSelectionPanel.this.model.setSelectedPreset( presetId );
- }
- }
- }
- );
-
- // Trigger initial UI population.
-
- modelToViewContentsListener.handleEvent();
- }
-
- private void refreshCategoryState( final TableRowData trd )
- {
- final ICategory category = trd.getProjectFacet().getCategory();
-
- if( category != null )
- {
- int selected = 0;
-
- for( IProjectFacet f : category.getProjectFacets() )
- {
- final TableRowData ctrd = findTableRowData( f );
-
- if( ctrd.isSelected() )
- {
- selected++;
- }
- }
-
- if( selected == 0 )
- {
- this.treeViewer.setChecked( category, false );
- this.treeViewer.setGrayed( category, false );
- }
- else if( selected == category.getProjectFacets().size() )
- {
- this.treeViewer.setChecked( category, true );
- this.treeViewer.setGrayed( category, false );
- }
- else
- {
- this.treeViewer.setGrayChecked( category, true );
- }
- }
- }
-
- private void refreshVersionsDropDown()
- {
- final TableRowData trd = getSelectedTableRowData();
-
- if( trd == null )
- {
- return;
- }
-
- final List<IProjectFacetVersion> versions = trd.getVersions();
- final String[] verstrs = new String[ versions.size() ];
-
- for( int i = 0, n = versions.size(); i < n; i++ )
- {
- final IProjectFacetVersion fv = versions.get( i );
- verstrs[ i ] = fv.getVersionString();
- }
-
- this.ceditor.setItems( verstrs );
-
- for( int i = 0, n = versions.size(); i < n; i++ )
- {
- if( versions.get( i ) == trd.getCurrentVersion() )
- {
- this.ceditor.setValue( new Integer( i ) );
- break;
- }
- }
- }
-
- private TableRowData getSelectedTableRowData()
- {
- final IStructuredSelection ssel
- = (IStructuredSelection) this.treeViewer.getSelection();
-
- if( ssel != null && ! ssel.isEmpty() )
- {
- final Object obj = ssel.getFirstElement();
-
- if( obj instanceof TableRowData )
- {
- return (TableRowData) obj;
- }
- }
-
- return null;
- }
-
- private TableRowData findTableRowData( final IProjectFacet f )
- {
- return findTableRowData( f, false );
- }
-
- private TableRowData findTableRowData( final IProjectFacet f,
- final boolean createIfNecessary )
- {
- for( TableRowData trd : this.data )
- {
- if( trd.getProjectFacet() == f )
- {
- return trd;
- }
- }
-
- if( createIfNecessary )
- {
- try
- {
- final TableRowData trd = new TableRowData( f );
- this.data.add( trd );
- return trd;
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- throw new IllegalStateException();
- }
-
- private void handleMouseDownEvent( final Event event )
- {
- final List<TreeItem> items = getAllTreeItems();
-
- TreeItem onItem = null;
-
- for( TreeItem item : items )
- {
- if( item.getBounds( 0 ).contains( event.x, event.y ) )
- {
- onItem = item;
- break;
- }
-
- if( item.getBounds( 1 ).contains( event.x, event.y ) )
- {
- this.tree.setSelection( new TreeItem[] { item } );
- this.treeViewer.editElement( item.getData(), 1 );
- break;
- }
- }
-
- if( onItem != null && onItem.getData() instanceof TableRowData )
- {
- final TableRowData trd = (TableRowData) onItem.getData();
- final IProjectFacetVersion fv = trd.getCurrentVersion();
- final IConstraint c = fv.getConstraint();
-
- if( c.getType() == IConstraint.Type.AND &&
- c.getOperands().size() == 0 )
- {
- this.popupMenuConstraints.setEnabled( false );
- }
- else
- {
- this.popupMenuConstraints.setEnabled( true );
- }
-
- this.tree.setMenu( this.popupMenu );
- }
- else
- {
- this.tree.setMenu( null );
- }
- }
-
- private void handlePaintItemEvent( final Event event )
- {
- final TreeItem item = (TreeItem) event.item;
- final Object itemData = item.getData();
-
- if( itemData instanceof TableRowData && event.index == 1 )
- {
- final TableRowData trd = (TableRowData) itemData;
-
- if( trd.getVersions().size() > 1 )
- {
- final Image arrowImage = getImageRegistry().get( IMG_DOWN_ARROW );
- final Rectangle arrowImageBounds = arrowImage.getBounds();
-
- final int columnWidth = this.colVersion.getWidth();
- final int itemHeight = this.tree.getItemHeight();
-
- int x, y;
-
- x = event.x + columnWidth - arrowImageBounds.width - 10;
- y = event.y;
- event.gc.setBackground( item.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
- event.gc.fillRectangle( x, y, arrowImageBounds.width + 10, itemHeight );
-
- y = event.y + ( itemHeight - arrowImageBounds.height ) / 2;
- event.gc.drawImage( arrowImage, x, y );
- }
- }
- }
-
- private void handleDisposeEvent()
- {
- this.imageRegistry.dispose();
- }
-
- private void handleShowConstraints()
- {
- final TreeItem[] items = this.tree.getSelection();
- if( items.length != 1 ) throw new IllegalStateException();
- final TreeItem item = items[ 0 ];
- final TableRowData trd = (TableRowData) item.getData();
- final IProjectFacetVersion fv = trd.getCurrentVersion();
-
- final Rectangle bounds = item.getBounds();
-
- Point location = new Point( bounds.x, bounds.y + bounds.height );
- location = this.tree.toDisplay( location );
-
- final ConstraintDisplayDialog dialog
- = new ConstraintDisplayDialog( getShell(), location,
- fv.getConstraint() );
-
- dialog.open();
- }
-
- private void handlePresetSelected()
- {
- final IPreset preset = this.model.getSelectedPreset();
-
- if( preset != null )
- {
- final Set<TableRowData> selected = new HashSet<TableRowData>();
-
- for( IProjectFacetVersion fv : preset.getProjectFacets() )
- {
- final TableRowData trd = findTableRowData( fv.getProjectFacet() );
-
- if( ! trd.isSelected() )
- {
- this.treeViewer.setChecked( trd, true );
- trd.setSelected( true );
- refreshCategoryState( trd );
- }
-
- if( trd.getCurrentVersion() != fv )
- {
- trd.setCurrentVersion( fv );
- this.treeViewer.update( trd, null );
- }
-
- selected.add( trd );
- }
-
- for( TableRowData trd : this.data )
- {
- if( ! selected.contains( trd ) )
- {
- this.treeViewer.setChecked( trd, false );
- trd.setSelected( false );
- refreshCategoryState( trd );
- }
- }
-
- updateValidationDisplay();
- }
- }
-
- private void handleSavePreset()
- {
- final Set<IProjectFacetVersion> facets = getSelectedProjectFacets();
- final IPreset preset = SavePresetDialog.showDialog( getShell(), facets );
-
- if( preset != null )
- {
- this.model.refreshAvailablePresets();
- this.model.setSelectedPreset( preset.getId() );
- }
- }
-
- private void handleDeletePreset()
- {
- final IPreset preset = this.model.getSelectedPreset();
- this.model.setSelectedPreset( null );
- ProjectFacetsManager.deletePreset( preset );
- this.model.refreshAvailablePresets();
- }
-
- private void handleShowHideRuntimes()
- {
- if( this.sform1.getMaximizedControl() == null )
- {
- this.sform1.setMaximizedControl( this.sform2 );
- this.showHideRuntimesButton.setText( Resources.showRuntimes );
- }
- else
- {
- this.sform1.setMaximizedControl( null );
- this.showHideRuntimesButton.setText( Resources.hideRuntimes );
- }
- }
-
- private void handleModelChangedEvent( final String event )
- {
- if( event.equals( ModifyFacetedProjectDataModel.EVENT_FIXED_FACETS_CHANGED ) )
- {
- for( TableRowData trd : this.data )
- {
- trd.setFixed( false );
- }
-
- for( IProjectFacet f : this.model.getFixedFacets() )
- {
- final TableRowData trd = findTableRowData( f, true );
-
- trd.setFixed( true );
- trd.setSelected( true );
- this.treeViewer.setChecked( trd, true );
- }
-
- refresh();
- updateValidationDisplay();
- }
- else if( event.equals( ModifyFacetedProjectDataModel.EVENT_SELECTED_PRESET_CHANGED ) )
- {
- final IPreset preset = this.model.getSelectedPreset();
-
- if( preset == null )
- {
- this.savePresetButton.setEnabled( true );
- this.deletePresetButton.setEnabled( false );
- }
- else
- {
- this.savePresetButton.setEnabled( false );
- this.deletePresetButton.setEnabled( preset.getType() == IPreset.Type.USER_DEFINED );
- }
- }
- else if( event.equals( ChangeTargetedRuntimesDataModel.EVENT_TARGETED_RUNTIMES_CHANGED ) )
- {
- refresh();
- }
- }
-
- private List<TreeItem> getAllTreeItems()
- {
- final List<TreeItem> result = new ArrayList<TreeItem>();
- getAllTreeItems( this.tree.getItems(), result );
- return result;
- }
-
- private static void getAllTreeItems( final TreeItem[] items,
- final List<TreeItem> result )
- {
- for( TreeItem item : items )
- {
- result.add( item );
- getAllTreeItems( item.getItems(), result );
- }
- }
-
- private TreeItem getTreeItem( final int x,
- final int y )
- {
- return getTreeItemHelper( x, y, this.tree.getItems() );
- }
-
- private static TreeItem getTreeItemHelper( final int x,
- final int y,
- final TreeItem[] items )
- {
- for( TreeItem item : items )
- {
- if( item.getBounds().contains( x, y ) )
- {
- return item;
- }
-
- final TreeItem res = getTreeItemHelper( x, y, item.getItems() );
-
- if( res != null )
- {
- return res;
- }
- }
-
- return null;
- }
-
- /*private TreeItem getTreeItem( final Object modelObject )
- {
- for( TreeItem item : getAllTreeItems() )
- {
- if( item.getData().equals( modelObject ) )
- {
- return item;
- }
- }
-
- return null;
- }*/
-
- private int computeDefaultFacetColumnWidth()
- {
- final GC gc = new GC( this.getDisplay() );
- int maxFacetLabelWidth = 0;
-
- try
- {
- gc.setFont( this.tree.getFont() );
-
- for( IProjectFacet f : ProjectFacetsManager.getProjectFacets() )
- {
- maxFacetLabelWidth = max( maxFacetLabelWidth, gc.textExtent( f.getLabel() ).x );
- }
- }
- finally
- {
- gc.dispose();
- }
-
- return max( maxFacetLabelWidth + 100, 200 );
- }
-
- private int computeDefaultVersionColumnWidth()
- {
- final GC gc = new GC( this.getDisplay() );
- int maxVersionStringWidth = 0;
- final int columnLabelWidth;
-
- try
- {
- gc.setFont( this.tree.getFont() );
-
- for( IProjectFacet f : ProjectFacetsManager.getProjectFacets() )
- {
- for( IProjectFacetVersion fv : f.getVersions() )
- {
- final int textExtent = gc.textExtent( fv.getVersionString() ).x;
- maxVersionStringWidth = max( maxVersionStringWidth, textExtent + 30 );
- }
- }
-
- columnLabelWidth = gc.textExtent( Resources.versionColumnLabel ).x + 30;
- }
- finally
- {
- gc.dispose();
- }
-
- return max( maxVersionStringWidth, columnLabelWidth );
- }
-
- private final class TableRowData
- {
- private IProjectFacet f;
- private List<IProjectFacetVersion> allVersionsSorted;
- private IProjectFacetVersion current;
- private boolean isSelected;
- private boolean isFixed;
-
- public TableRowData( final IProjectFacet f )
-
- throws CoreException
-
- {
- this.f = f;
- // TODO: Remove this unnecessary copy.
- this.allVersionsSorted = new ArrayList<IProjectFacetVersion>( f.getSortedVersions( false ) );
- this.current = f.getDefaultVersion();
- this.isSelected = false;
- this.isFixed = false;
- }
-
- public IProjectFacet getProjectFacet()
- {
- return this.f;
- }
-
- public List<IProjectFacetVersion> getVersions()
- {
- final Set<IProjectFacetVersion> versions
- = FacetsSelectionPanel.this.model.getAvailableFacets().get( this.f );
-
- if( versions == null )
- {
- return Collections.emptyList();
- }
- else
- {
- final List<IProjectFacetVersion> sortedVersions
- = new ArrayList<IProjectFacetVersion>( this.allVersionsSorted );
-
- sortedVersions.retainAll( versions );
-
- return sortedVersions;
- }
- }
-
- public void addUnknownVersion( final IProjectFacetVersion fv )
- {
- try
- {
- final Comparator<String> c = this.f.getVersionComparator();
- boolean added = false;
-
- for( int i = 0, n = this.allVersionsSorted.size(); i < n; i++ )
- {
- final IProjectFacetVersion x = this.allVersionsSorted.get( i );
-
- if( c.compare( x.getVersionString(), fv.getVersionString() ) < 0 )
- {
- this.allVersionsSorted.add( i, fv );
- added = true;
- break;
- }
- }
-
- if( ! added )
- {
- this.allVersionsSorted.add( fv );
- }
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- public IProjectFacetVersion getCurrentVersion()
- {
- final Set<IProjectFacetVersion> versions
- = FacetsSelectionPanel.this.model.getAvailableFacets().get( this.f );
-
- if( versions == null )
- {
- if( this.current != null )
- {
- this.current = null;
- }
- }
- else
- {
- if( ! versions.contains( this.current ) )
- {
- this.current = getVersions().get( 0 );
- }
- }
-
- return this.current;
- }
-
- public void setCurrentVersion( final IProjectFacetVersion fv )
- {
- this.current = fv;
- }
-
- public boolean isSelected()
- {
- if( getVersions().isEmpty() )
- {
- this.isSelected = false;
- }
-
- return this.isSelected;
- }
-
- public void setSelected( final boolean isSelected )
- {
- this.isSelected = isSelected;
- }
-
- public boolean isFixed()
- {
- return this.isFixed;
- }
-
- public void setFixed( final boolean isFixed )
- {
- this.isFixed = isFixed;
- }
-
- public boolean isVisible()
- {
- return ! getVersions().isEmpty();
- }
-
- public String toString()
- {
- return this.current.toString();
- }
- }
-
- private final class ContentProvider
-
- implements ITreeContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- final List<Object> list = new ArrayList<Object>();
- final Set<ICategory> categories = ProjectFacetsManager.getCategories();
-
- for( ICategory cat : categories )
- {
- boolean visible = false;
-
- for( IProjectFacet f : cat.getProjectFacets() )
- {
- if( findTableRowData( f ).isVisible() )
- {
- visible = true;
- break;
- }
- }
-
- if( visible )
- {
- list.add( cat );
- }
- }
-
- for( TableRowData trd : FacetsSelectionPanel.this.data )
- {
- if( trd.getProjectFacet().getCategory() == null && trd.isVisible() )
- {
- list.add( trd );
- }
- }
-
- return list.toArray();
- }
-
- public Object[] getChildren( final Object parent )
- {
- if( parent instanceof ICategory )
- {
- final ICategory category = (ICategory) parent;
- final List<TableRowData> trds = new ArrayList<TableRowData>();
-
- for( IProjectFacet f : category.getProjectFacets() )
- {
- final TableRowData trd = findTableRowData( f );
-
- if( trd.isVisible() )
- {
- trds.add( trd );
- }
- }
-
- return trds.toArray();
- }
- else
- {
- return new Object[ 0 ];
- }
- }
-
- public Object getParent( final Object element )
- {
- if( element instanceof TableRowData )
- {
- final IProjectFacet f
- = ( (TableRowData) element ).getProjectFacet();
-
- return f.getCategory();
- }
- else
- {
- return null;
- }
- }
-
- public boolean hasChildren( final Object element )
- {
- return ( element instanceof ICategory ) &&
- ! ( (ICategory) element ).getProjectFacets().isEmpty();
- }
-
- public void dispose() { }
-
- public void inputChanged( final Viewer viewer,
- final Object oldObject,
- final Object newObject ) {}
- }
-
- private final class LabelProvider
-
- implements ITableLabelProvider
-
- {
- public String getColumnText( final Object element,
- final int column )
- {
- if( element instanceof ICategory )
- {
- if( column == 0 )
- {
- return ( (ICategory) element ).getLabel();
- }
- else
- {
- return ""; //$NON-NLS-1$
- }
- }
- else
- {
- final TableRowData trd = (TableRowData) element;
-
- switch( column )
- {
- case 0:
- {
- return trd.getProjectFacet().getLabel();
- }
- case 1:
- {
- return trd.getCurrentVersion().getVersionString();
- }
- default:
- {
- throw new IllegalStateException();
- }
- }
- }
- }
-
- public Image getColumnImage( final Object element,
- final int column )
- {
- if( column != 0 )
- {
- return null;
- }
-
- String id;
- IAdaptable obj;
- boolean isFixed = false;
-
- if( element instanceof TableRowData )
- {
- final TableRowData trd = (TableRowData) element;
- final IProjectFacet f = trd.getProjectFacet();
-
- isFixed = trd.isFixed;
- id = ( isFixed ? "F:" : "f:" ) + f.getId(); //$NON-NLS-1$ //$NON-NLS-2$
- obj = f;
- }
- else
- {
- id = "c:" + ( (ICategory) element ).getId(); //$NON-NLS-1$
- obj = (IAdaptable) element;
- }
-
- Image image = getImageRegistry().get( id );
-
- if( image == null )
- {
- final IDecorationsProvider decprov
- = (IDecorationsProvider) obj.getAdapter( IDecorationsProvider.class );
-
- ImageDescriptor imgdesc = decprov.getIcon();
-
- if( isFixed )
- {
- imgdesc = new FixedFacetImageDescriptor( imgdesc );
- }
-
- getImageRegistry().put( id, imgdesc );
- image = getImageRegistry().get( id );
- }
-
- return image;
- }
-
- public boolean isLabelProperty( final Object obj,
- final String s )
- {
- return false;
- }
-
- public void dispose() {}
- public void addListener( final ILabelProviderListener listener ) {}
- public void removeListener( ILabelProviderListener listener ) {}
- }
-
- private static final class FixedFacetImageDescriptor
-
- extends CompositeImageDescriptor
-
- {
- private static final String OVERLAY_IMG_LOCATION
- = "images/lock.gif"; //$NON-NLS-1$
-
- private static final ImageData OVERLAY
- = FacetUiPlugin.getImageDescriptor( OVERLAY_IMG_LOCATION ).getImageData();
-
- private final ImageData base;
- private final Point size;
-
- public FixedFacetImageDescriptor( final ImageDescriptor base )
- {
- this.base = base.getImageData();
- this.size = new Point( this.base.width, this.base.height );
- }
-
- protected void drawCompositeImage( final int width,
- final int height )
- {
- drawImage( this.base, 0, 0 );
- drawImage( OVERLAY, 0, height - OVERLAY.height );
- }
-
- protected Point getSize()
- {
- return this.size;
- }
- }
-
- private final class CellModifier
-
- implements ICellModifier
-
- {
- public Object getValue( final Object element,
- final String property )
- {
- final TableRowData trd = (TableRowData) element;
-
- if( property.equals( VERSION_COLUMN ) )
- {
- final List<IProjectFacetVersion> versions = trd.getVersions();
-
- for( int i = 0, n = versions.size(); i < n; i++ )
- {
- if( versions.get( i ) == trd.getCurrentVersion() )
- {
- return new Integer( i );
- }
- }
-
- return new IllegalStateException();
- }
- else
- {
- throw new IllegalStateException();
- }
- }
-
- public boolean canModify( final Object element,
- final String property )
- {
- return property.equals( VERSION_COLUMN ) &&
- element instanceof TableRowData &&
- ( (TableRowData) element ).getVersions().size() > 1;
- }
-
- public void modify( final Object element,
- final String property,
- final Object value )
- {
- final TreeItem item = (TreeItem) element;
- final TableRowData trd = (TableRowData) item.getData();
-
- if( property.equals( VERSION_COLUMN ) )
- {
- final int index = ( (Integer) value ).intValue();
-
- if( index != -1 )
- {
- final IProjectFacetVersion fv = trd.getVersions().get( index );
-
- if( trd.getCurrentVersion() != fv )
- {
- trd.setCurrentVersion( fv );
- FacetsSelectionPanel.this.treeViewer.update( trd, null );
-
- if( trd.isSelected() )
- {
- FacetsSelectionPanel.this.model.setSelectedPreset( null );
- }
-
- updateValidationDisplay();
- }
- }
- }
- else
- {
- throw new IllegalStateException();
- }
- }
- }
-
- private static final class Sorter
-
- extends ViewerSorter
-
- {
- public int compare( final Viewer viewer,
- final Object a,
- final Object b )
- {
- return getLabel( a ).compareToIgnoreCase( getLabel( b ) );
- }
-
- private static String getLabel( final Object obj )
- {
- if( obj instanceof TableRowData )
- {
- return ( (TableRowData) obj ).getProjectFacet().getLabel();
- }
- else
- {
- return ( (ICategory) obj ).getLabel();
- }
- }
- }
-
- private final class FacetToolTip
-
- extends HeaderToolTip
-
- {
- public FacetToolTip( final Control control )
- {
- super( control );
- }
-
- @Override
- protected final boolean shouldCreateToolTip( final Event event )
- {
- final TreeItem treeItem = getTreeItem( event.x, event.y );
- String description = null;
-
- if( treeItem != null && treeItem.getBounds( 0 ).contains( event.x, event.y ) )
- {
- final Object treeItemData = treeItem.getData();
-
- if( treeItemData instanceof TableRowData )
- {
- final IProjectFacetVersion fv
- = ( (TableRowData) treeItemData ).getCurrentVersion();
-
- description = fv.getProjectFacet().getDescription();
- }
- }
-
- return ( description != null && description.trim().length() > 0 );
- }
-
- @Override
- protected String getToolTipTitle( final Event event )
- {
- final TableRowData trd = (TableRowData) getTreeItem( event.x, event.y ).getData();
- return trd.getCurrentVersion().toString();
- }
-
- @Override
- protected Composite createContentArea( final Event event,
- final Composite parent )
- {
- final Display display = parent.getDisplay();
-
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( gl( 1 ) );
- composite.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
-
- final Label label = new Label( composite, SWT.WRAP );
- label.setLayoutData( gdfill() );
- label.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
-
- final TableRowData trd = (TableRowData) getTreeItem( event.x, event.y ).getData();
- label.setText( trd.getCurrentVersion().getProjectFacet().getDescription() );
-
- return composite;
- }
- }
-
- private final class CategoryToolTip
-
- extends HeaderToolTip
-
- {
- public CategoryToolTip( final Control control )
- {
- super( control );
- }
-
- @Override
- protected final boolean shouldCreateToolTip( final Event event )
- {
- final TreeItem treeItem = getTreeItem( event.x, event.y );
- String description = null;
-
- if( treeItem != null && treeItem.getBounds( 0 ).contains( event.x, event.y ) )
- {
- final Object treeItemData = treeItem.getData();
-
- if( treeItemData instanceof ICategory )
- {
- description = ( (ICategory) treeItemData ).getDescription();
- }
- }
-
- return ( description != null && description.trim().length() > 0 );
- }
-
- @Override
- protected String getToolTipTitle( final Event event )
- {
- return ( (ICategory) getTreeItem( event.x, event.y ).getData() ).getLabel();
- }
-
- @Override
- protected Composite createContentArea( final Event event,
- final Composite parent )
- {
- final Display display = parent.getDisplay();
-
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( gl( 1 ) );
- composite.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
-
- final Label label = new Label( composite, SWT.WRAP );
- label.setLayoutData( gdfill() );
- label.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
-
- final ICategory category = (ICategory) getTreeItem( event.x, event.y ).getData();
- label.setText( category.getDescription() );
-
- return composite;
- }
- }
-
- private final class FixedFacetToolTip
-
- extends BasicToolTip
-
- {
- private static final int FAKE_EVENT_TYPE = -9999;
-
- public FixedFacetToolTip( final Control control )
- {
- super( control );
- setPopupDelay( 0 );
- }
-
- public void show( final Point location )
- {
- // The JFace ToolTip class does not support alternative methods of tool tip activation.
- // An enhancement request https://bugs.eclipse.org/bugs/show_bug.cgi?id=174844 tracks
- // this issue. When that enhancement request has been resolved, this hacky
- // implementation should be replaced with something more sensible.
-
- final Event fakeEvent = new Event();
- fakeEvent.type = FAKE_EVENT_TYPE;
- fakeEvent.x = location.x;
- fakeEvent.y = location.y;
-
- try
- {
- final Method method
- = ToolTip.class.getDeclaredMethod( "toolTipCreate", Event.class ); //$NON-NLS-1$
-
- method.setAccessible( true );
- method.invoke( this, fakeEvent );
- }
- catch( Exception e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- @Override
- protected final boolean shouldCreateToolTip( final Event event )
- {
- return ( event.type == FAKE_EVENT_TYPE );
- }
- }
-
- private final class ProblemsContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- return FacetsSelectionPanel.this.problems.getChildren();
- }
-
- public void dispose() { }
-
- public void inputChanged( final Viewer viewer,
- final Object oldObject,
- final Object newObject ) {}
- }
-
- private final class ProblemsLabelProvider
-
- implements ITableLabelProvider
-
- {
- public String getColumnText( final Object element,
- final int column )
- {
- return ( (IStatus) element ).getMessage();
- }
-
- public Image getColumnImage( final Object element,
- final int column )
- {
- final IStatus st = (IStatus) element;
-
- if( st.getSeverity() == IStatus.ERROR )
- {
- return getImageRegistry().get( IMG_ERROR );
- }
- else
- {
- return getImageRegistry().get( IMG_WARNING );
- }
- }
-
- public boolean isLabelProperty( final Object obj,
- final String s )
- {
- return false;
- }
-
- public void dispose() {}
- public void addListener( final ILabelProviderListener listener ) {}
- public void removeListener( ILabelProviderListener listener ) {}
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String presetsLabel;
- public static String customPreset;
- public static String saveButtonLabel;
- public static String deleteButtonLabel;
- public static String savePresetDialogTitle;
- public static String savePresetDialogMessage;
- public static String facetColumnLabel;
- public static String versionColumnLabel;
- public static String showConstraints;
- public static String showRuntimes;
- public static String hideRuntimes;
- public static String couldNotDeselectFixedFacetMessage;
- public static String facetNotFound;
- public static String facetVersionNotFound;
- public static String facetNotSupportedByTarget;
-
- static
- {
- initializeMessages( FacetsSelectionPanel.class.getName(),
- Resources.class );
- }
-
- public static String bind( final String msg,
- final Object arg1,
- final Object arg2,
- final Object arg3 )
- {
- return NLS.bind( msg, new Object[] { arg1, arg2, arg3 } );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties
deleted file mode 100644
index 502ec28..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-presetsLabel = Configurations:\
-customPreset = <custom>
-saveButtonLabel = &Save
-deleteButtonLabel = &Delete
-savePresetDialogTitle = Save Configuration
-savePresetDialogMessage = Enter the name for the configuration.
-facetColumnLabel = Project Facet
-versionColumnLabel = Version
-showConstraints = Show Constraints...
-showRuntimes = << Show &Runtimes
-hideRuntimes = Hide &Runtimes >>
-couldNotDeselectFixedFacetMessage = Project facet {0} cannot be deselected. It is critical to the proper function of this project.
-facetNotFound = Implementation of project facet {0} could not be found. Functionality will be limited.
-facetVersionNotFound = Implementation of version {1} of project facet {0} could not be found. Functionality will be limited.
-facetNotSupportedByTarget = Project facet {0} is not supported by target runtime {1}.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ModifyFacetedProjectDataModel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ModifyFacetedProjectDataModel.java
deleted file mode 100644
index c2636fc..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ModifyFacetedProjectDataModel.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import static org.eclipse.wst.common.project.facet.ui.internal.ChangeTargetedRuntimesDataModel.EVENT_PRIMARY_RUNTIME_CHANGED;
-import static org.eclipse.wst.common.project.facet.ui.internal.ChangeTargetedRuntimesDataModel.EVENT_TARGETED_RUNTIMES_CHANGED;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.project.facet.core.IDynamicPreset;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.internal.util.IndexedSet;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ModifyFacetedProjectDataModel
-
- extends AbstractDataModel
-
-{
- public static String EVENT_FIXED_FACETS_CHANGED = "fixedFacetsChanged"; //$NON-NLS-1$
- public static String EVENT_AVAILABLE_FACETS_CHANGED = "availableFacetsChanged"; //$NON-NLS-1$
- public static String EVENT_AVAILABLE_PRESETS_CHANGED = "availablePresetsChanged"; //$NON-NLS-1$
- public static String EVENT_SELECTED_PRESET_CHANGED = "selectedPresetChanged"; //$NON-NLS-1$
-
- private final IFacetedProject project;
- private Set<IProjectFacet> fixedFacets;
- private Map<IProjectFacet,Set<IProjectFacetVersion>> availableFacets;
- private IndexedSet<String,IPreset> availablePresets;
- private IPreset selectedPreset;
- private final ChangeTargetedRuntimesDataModel runtimesDataModel;
-
- public ModifyFacetedProjectDataModel( final IFacetedProject project )
- {
- this.project = project;
- this.fixedFacets = Collections.emptySet();
- this.availableFacets = Collections.emptyMap();
- this.availablePresets = new IndexedSet<String,IPreset>();
- this.selectedPreset = null;
- this.runtimesDataModel = new ChangeTargetedRuntimesDataModel();
-
- refreshAvailableFacets();
-
- final IDataModelListener avFacetsListener = new IDataModelListener()
- {
- public void handleEvent()
- {
- refreshAvailableFacets();
- }
- };
-
- addListener( EVENT_FIXED_FACETS_CHANGED, avFacetsListener );
- this.runtimesDataModel.addListener( EVENT_TARGETED_RUNTIMES_CHANGED, avFacetsListener );
-
- refreshAvailablePresets();
-
- final IDataModelListener avPresetsListener = new IDataModelListener()
- {
- public void handleEvent()
- {
- refreshAvailablePresets();
- }
- };
-
- addListener( EVENT_FIXED_FACETS_CHANGED, avPresetsListener );
- addListener( EVENT_AVAILABLE_FACETS_CHANGED, avPresetsListener );
- this.runtimesDataModel.addListener( EVENT_PRIMARY_RUNTIME_CHANGED, avPresetsListener );
- }
-
- public IFacetedProject getFacetedProject()
- {
- return this.project;
- }
-
- public synchronized Set<IProjectFacet> getFixedFacets()
- {
- return this.fixedFacets;
- }
-
- public synchronized void setFixedFacets( final Set<IProjectFacet> fixed )
- {
- if( this.fixedFacets.equals( fixed ) )
- {
- return;
- }
-
- this.fixedFacets = Collections.unmodifiableSet( new HashSet<IProjectFacet>( fixed ) );
-
- notifyListeners( EVENT_FIXED_FACETS_CHANGED );
- }
-
- public synchronized Map<IProjectFacet,Set<IProjectFacetVersion>> getAvailableFacets()
- {
- return this.availableFacets;
- }
-
- public synchronized boolean isFacetAvailable( final IProjectFacet f )
- {
- return this.availableFacets.containsKey( f );
- }
-
- public synchronized boolean isFacetAvailable( final IProjectFacetVersion fv )
- {
- final Set<IProjectFacetVersion> versions = this.availableFacets.get( fv.getProjectFacet() );
- return ( versions != null && versions.contains( fv ) );
- }
-
- private synchronized void refreshAvailableFacets()
- {
- final Map<IProjectFacet,Set<IProjectFacetVersion>> newAvailableFacets
- = new HashMap<IProjectFacet,Set<IProjectFacetVersion>>();
-
- final Set<IRuntime> targetedRuntimes = this.runtimesDataModel.getTargetedRuntimes();
-
- for( IProjectFacet f : ProjectFacetsManager.getProjectFacets() )
- {
- Set<IProjectFacetVersion> versions = null;
-
- for( IProjectFacetVersion fv : f.getVersions() )
- {
- boolean available = true;
-
- if( this.project == null || ! this.project.hasProjectFacet( fv ) )
- {
- for( IRuntime r : targetedRuntimes )
- {
- if( ! r.supports( fv ) )
- {
- available = false;
- break;
- }
- }
-
- if( available && ! fv.isValidFor( this.fixedFacets ) )
- {
- available = false;
- }
- }
-
- if( available )
- {
- if( versions == null )
- {
- versions = new HashSet<IProjectFacetVersion>();
- }
-
- versions.add( fv );
- }
- }
-
- if( versions != null )
- {
- newAvailableFacets.put( f, Collections.unmodifiableSet( versions ) );
- }
- }
-
- if( ! this.availableFacets.equals( newAvailableFacets ) )
- {
- this.availableFacets = Collections.unmodifiableMap( newAvailableFacets );
- notifyListeners( EVENT_AVAILABLE_FACETS_CHANGED );
- }
- }
-
- public synchronized Set<IPreset> getAvailablePresets()
- {
- return this.availablePresets.getUnmodifiable();
- }
-
- public synchronized void refreshAvailablePresets()
- {
- final IndexedSet<String,IPreset> newAvailablePresets = new IndexedSet<String,IPreset>();
- Map<String,Object> context = null;
-
- for( IPreset preset : ProjectFacetsManager.getPresets() )
- {
- if( preset.getType() == IPreset.Type.DYNAMIC )
- {
- if( context == null )
- {
- context = new HashMap<String,Object>();
-
- context.put( IDynamicPreset.CONTEXT_KEY_FIXED_FACETS, this.fixedFacets );
-
- context.put( IDynamicPreset.CONTEXT_KEY_PRIMARY_RUNTIME,
- this.runtimesDataModel.getPrimaryRuntime() );
- }
-
- preset = ( (IDynamicPreset) preset ).resolve( context );
-
- if( preset == null )
- {
- continue;
- }
- }
-
- final Set<IProjectFacetVersion> facets = preset.getProjectFacets();
- boolean applicable = true;
-
- // All of the facets listed in the preset and their versions must be available.
-
- for( IProjectFacetVersion fv : facets )
- {
- if( ! isFacetAvailable( fv ) )
- {
- applicable = false;
- break;
- }
- }
-
- // The preset must span across all of the fixed facets.
-
- for( IProjectFacet f : this.fixedFacets )
- {
- boolean found = false;
-
- for( IProjectFacetVersion fv : f.getVersions() )
- {
- if( facets.contains( fv ) )
- {
- found = true;
- break;
- }
- }
-
- if( ! found )
- {
- applicable = false;
- break;
- }
- }
-
- if( applicable )
- {
- newAvailablePresets.add( preset.getId(), preset );
- }
- }
-
- if( ! this.availablePresets.equals( newAvailablePresets ) )
- {
- this.availablePresets = newAvailablePresets;
- notifyListeners( EVENT_AVAILABLE_PRESETS_CHANGED );
-
- if( this.selectedPreset != null &&
- ! this.availablePresets.contains( this.selectedPreset ) )
- {
- setSelectedPreset( null );
- }
- }
- }
-
- public synchronized IPreset getSelectedPreset()
- {
- return this.selectedPreset;
- }
-
- public synchronized void setSelectedPreset( final String presetId )
- {
- if( presetId != null && ! this.availablePresets.containsKey( presetId ) )
- {
- final String msg = Resources.bind( Resources.couldNotSelectPreset, presetId );
- throw new IllegalArgumentException( msg );
- }
-
- final IPreset preset = this.availablePresets.get( presetId );
-
- if( ! equals( this.selectedPreset, preset ) )
- {
- this.selectedPreset = preset;
-
- notifyListeners( EVENT_SELECTED_PRESET_CHANGED );
- }
- }
-
- public ChangeTargetedRuntimesDataModel getTargetedRuntimesDataModel()
- {
- return this.runtimesDataModel;
- }
-
- public void dispose()
- {
- this.runtimesDataModel.dispose();
- }
-
- private static boolean equals( final Object obj1,
- final Object obj2 )
- {
- if( obj1 == obj2 )
- {
- return true;
- }
- else if( obj1 == null || obj2 == null )
- {
- return false;
- }
- else
- {
- return obj1.equals( obj2 );
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String couldNotSelectPreset;
-
- static
- {
- initializeMessages( ModifyFacetedProjectDataModel.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ModifyFacetedProjectDataModel.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ModifyFacetedProjectDataModel.properties
deleted file mode 100644
index b7535e2..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ModifyFacetedProjectDataModel.properties
+++ /dev/null
@@ -1 +0,0 @@
-couldNotSelectPreset = Could not select preset "{0}". One or more required of the required facets are not visible.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.java
deleted file mode 100644
index 5fe48c8..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import static org.eclipse.wst.common.project.facet.core.internal.util.PluginUtil.findExtensions;
-import static org.eclipse.wst.common.project.facet.core.internal.util.PluginUtil.getTopLevelElements;
-import static org.eclipse.wst.common.project.facet.ui.internal.FacetUiPlugin.PLUGIN_ID;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.project.facet.core.IActionDefinition;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.internal.ProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
-import org.osgi.framework.Bundle;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ProjectFacetsUiManagerImpl
-{
- private static final String WIZARD_PAGES_EXTENSION_ID = "wizardPages"; //$NON-NLS-1$
- private static final String WIZARD_PAGES_EXTENSION_ID_OLD = "wizard"; //$NON-NLS-1$
- private static final String IMAGES_EXTENSION_ID = "images"; //$NON-NLS-1$
-
- private static final String EL_WIZARD_PAGES = "wizard-pages"; //$NON-NLS-1$
- private static final String EL_PAGE = "page"; //$NON-NLS-1$
- private static final String EL_IMAGE = "image"; //$NON-NLS-1$
- private static final String ATTR_PATH = "path"; //$NON-NLS-1$
- private static final String ATTR_RUNTIME_COMPONENT_TYPE = "runtime-component-type"; //$NON-NLS-1$
- private static final String ATTR_CATEGORY = "category"; //$NON-NLS-1$
- private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
- private static final String ATTR_VERSION = "version"; //$NON-NLS-1$
- private static final String ATTR_FACET = "facet"; //$NON-NLS-1$
- private static final String ATTR_ACTION = "action"; //$NON-NLS-1$
-
- private static final Map<String,WizardPagesInfo> wizardPages;
-
- /**
- * Maps either IProjectFacet or IRuntimeComponentType to an ImageDescriptor.
- */
-
- private static final Map<Object,ImageDescriptor> icons = new HashMap<Object,ImageDescriptor>();
- private static ImageDescriptor defaultIcon;
-
- static
- {
- // Make sure that the core extensions are loaded first.
-
- ProjectFacetsManager.getProjectFacets();
- RuntimeManager.getRuntimeComponentTypes();
-
- wizardPages = new HashMap<String,WizardPagesInfo>();
-
- final Bundle bundle = Platform.getBundle( FacetUiPlugin.PLUGIN_ID );
- final URL url = bundle.getEntry( "images/unknown.gif" ); //$NON-NLS-1$
- defaultIcon = ImageDescriptor.createFromURL( url );
-
- readWizardPagesExtensions();
- readWizardPagesExtensionsOld();
- readImagesExtensions();
- }
-
- private ProjectFacetsUiManagerImpl() {}
-
- public static ImageDescriptor getIcon( final Object obj )
- {
- final ImageDescriptor imgdesc = icons.get( obj );
- return imgdesc != null ? imgdesc : defaultIcon;
- }
-
- public static List<IFacetWizardPage> getWizardPages( final String actionId )
- {
- final WizardPagesInfo info = wizardPages.get( actionId );
-
- if( info != null )
- {
- return getWizardPages( info.plugin, info.pages );
- }
-
- return Collections.emptyList();
- }
-
- /**
- * @return (element type: {@see IFacetWizardPage})
- * @deprecated
- */
-
- public static List getWizardPages( final Action.Type actionType,
- final IProjectFacetVersion fv )
- {
- if( fv.supports( actionType ) )
- {
- try
- {
- final IActionDefinition def = ( (ProjectFacetVersion) fv ).getActionDefinition( actionType );
- return getWizardPages( def.getId() );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- return Collections.EMPTY_LIST;
- }
-
- private static List<IFacetWizardPage> getWizardPages( final String plugin,
- final List<String> clnames )
- {
- final List<IFacetWizardPage> pages = new ArrayList<IFacetWizardPage>();
-
- for( String clname : clnames )
- {
- try
- {
- pages.add( (IFacetWizardPage) create( plugin, clname ) );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- return pages;
- }
-
- private static Object create( final String plugin,
- final String clname )
-
- throws CoreException
-
- {
- final Bundle bundle = Platform.getBundle( plugin );
-
- try
- {
- final Class cl = bundle.loadClass( clname );
- return cl.newInstance();
- }
- catch( Exception e )
- {
- final String msg
- = NLS.bind( Resources.failedToCreate, clname );
-
- final IStatus st = FacetUiPlugin.createErrorStatus( msg, e );
-
- throw new CoreException( st );
- }
- }
-
- private static void readWizardPagesExtensions()
- {
- for( IConfigurationElement config
- : getTopLevelElements( findExtensions( PLUGIN_ID, WIZARD_PAGES_EXTENSION_ID ) ) )
- {
- final String ename = config.getName();
-
- if( ename.equals( EL_WIZARD_PAGES ) )
- {
- final String action = config.getAttribute( ATTR_ACTION );
-
- if( action == null )
- {
- reportMissingAttribute( config, ATTR_ACTION );
- return;
- }
-
- final String pluginId = config.getContributor().getName();
-
- if( ProjectFacetsManager.isActionDefined( action ) )
- {
- final WizardPagesInfo pagesInfo = new WizardPagesInfo();
-
- pagesInfo.plugin = pluginId;
- pagesInfo.pages = readPageList( config );
-
- wizardPages.put( action, pagesInfo );
- }
- else
- {
- final String msg = NLS.bind( Resources.actionNotDefined, pluginId, action );
- FacetUiPlugin.logError( msg );
- }
- }
- }
- }
-
- private static void readWizardPagesExtensionsOld()
- {
- for( IConfigurationElement config
- : getTopLevelElements( findExtensions( PLUGIN_ID, WIZARD_PAGES_EXTENSION_ID_OLD ) ) )
- {
- final String ename = config.getName();
-
- if( ename.equals( EL_WIZARD_PAGES ) )
- {
- readWizardPagesOld( config );
- }
- }
- }
-
- @SuppressWarnings( "deprecation" )
- private static void readWizardPagesOld( final IConfigurationElement config )
- {
- final String pluginId = config.getContributor().getName();
-
- final String depMsg
- = NLS.bind( Resources.wizardExtensionPointDeprecated, pluginId );
-
- FacetUiPlugin.logWarning( depMsg, true );
-
- final String id = config.getAttribute( ATTR_FACET );
-
- if( id == null )
- {
- reportMissingAttribute( config, ATTR_FACET );
- return;
- }
-
- if( ! ProjectFacetsManager.isProjectFacetDefined( id ) )
- {
- final String msg
- = NLS.bind( Resources.facetNotDefined,
- config.getContributor().getName(), id );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- final IProjectFacet f = ProjectFacetsManager.getProjectFacet( id );
-
- final String version = config.getAttribute( ATTR_VERSION );
-
- if( version == null )
- {
- reportMissingAttribute( config, ATTR_VERSION );
- return;
- }
-
- if( ! f.hasVersion( version ) )
- {
- final String[] params
- = new String[] { config.getContributor().getName(), id,
- version };
-
- final String msg
- = NLS.bind( Resources.facetVersionNotDefined,
- params );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- final IProjectFacetVersion fv = f.getVersion( version );
- final IConfigurationElement[] children = config.getChildren();
-
- for( int i = 0; i < children.length; i++ )
- {
- final IConfigurationElement child = children[ i ];
- final String childName = child.getName();
- final Action.Type actionType = Action.Type.valueOf( childName );
-
- if( actionType == null )
- {
- final String msg
- = NLS.bind( Resources.invalidActionType,
- config.getContributor().getName(), childName );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- if( fv.supports( actionType ) )
- {
- final IActionDefinition def;
-
- try
- {
- def = ( (ProjectFacetVersion) fv ).getActionDefinition( actionType );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- return;
- }
-
- final WizardPagesInfo pagesInfo = new WizardPagesInfo();
-
- pagesInfo.plugin = pluginId;
- pagesInfo.pages = readPageList( child );
-
- wizardPages.put( def.getId(), pagesInfo );
- }
- }
- }
-
- private static List<String> readPageList( final IConfigurationElement config )
- {
- final List<String> list = new ArrayList<String>();
- final IConfigurationElement[] children = config.getChildren();
-
- for( int i = 0; i < children.length; i++ )
- {
- final IConfigurationElement child = children[ i ];
- final String childName = child.getName();
-
- if( childName.equals( EL_PAGE ) )
- {
- final String clname = child.getAttribute( ATTR_CLASS );
-
- if( clname == null )
- {
- reportMissingAttribute( config, ATTR_CLASS );
- continue;
- }
-
- list.add( clname );
- }
- }
-
- return list;
- }
-
- private static void readImagesExtensions()
- {
- for( IConfigurationElement config
- : getTopLevelElements( findExtensions( PLUGIN_ID, IMAGES_EXTENSION_ID ) ) )
- {
- final String ename = config.getName();
-
- if( ename.equals( EL_IMAGE ) )
- {
- final String fid = config.getAttribute( ATTR_FACET );
- final String cid = config.getAttribute( ATTR_CATEGORY );
- final String rct = config.getAttribute( ATTR_RUNTIME_COMPONENT_TYPE );
-
- final Object target;
-
- if( fid != null )
- {
- if( ! ProjectFacetsManager.isProjectFacetDefined( fid ) )
- {
- final String msg
- = NLS.bind( Resources.facetNotDefined,
- config.getContributor().getName(), fid );
-
- FacetUiPlugin.log( msg );
-
- break;
- }
-
- target = ProjectFacetsManager.getProjectFacet( fid );
- }
- else if( cid != null )
- {
- if( ! ProjectFacetsManager.isCategoryDefined( cid ) )
- {
- final String msg
- = NLS.bind( Resources.categoryNotDefined,
- config.getContributor().getName(), fid );
-
- FacetUiPlugin.log( msg );
-
- break;
- }
-
- target = ProjectFacetsManager.getCategory( cid );
- }
- else if( rct != null )
- {
- if( ! RuntimeManager.isRuntimeComponentTypeDefined( rct ) )
- {
- final String msg
- = NLS.bind( Resources.runtimeComponentTypeNotDefined,
- config.getContributor().getName(), rct );
-
- FacetUiPlugin.log( msg );
-
- break;
- }
-
- target = RuntimeManager.getRuntimeComponentType( rct );
- }
- else
- {
- reportMissingAttribute( config, ATTR_FACET );
- break;
- }
-
- final String path = config.getAttribute( ATTR_PATH );
-
- if( path == null )
- {
- reportMissingAttribute( config, ATTR_PATH );
- }
-
- final String plugin = config.getContributor().getName();
- final Bundle bundle = Platform.getBundle( plugin );
- final URL url = FileLocator.find( bundle, new Path( path ), null );
-
- if( url == null )
- {
- final String msg
- = NLS.bind( Resources.iconNotFound, plugin, path );
-
- FacetUiPlugin.log( msg );
- }
- else
- {
- final ImageDescriptor imgdesc
- = ImageDescriptor.createFromURL( url );
-
- icons.put( target, imgdesc );
- }
- }
- }
- }
-
- private static void reportMissingAttribute( final IConfigurationElement el,
- final String attribute )
- {
- final String[] params
- = new String[] { el.getContributor().getName(), el.getName(),
- attribute };
-
- final String msg = NLS.bind( Resources.missingAttribute, params );
-
- FacetUiPlugin.log( msg );
- }
-
- private static class WizardPagesInfo
- {
- public String plugin;
- public List<String> pages;
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String missingAttribute;
- public static String facetNotDefined;
- public static String facetVersionNotDefined;
- public static String categoryNotDefined;
- public static String runtimeComponentTypeNotDefined;
- public static String failedToCreate;
- public static String invalidActionType;
- public static String iconNotFound;
- public static String wizardExtensionPointDeprecated;
- public static String actionNotDefined;
-
- static
- {
- initializeMessages( ProjectFacetsUiManagerImpl.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.properties
deleted file mode 100644
index 3186453..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-missingAttribute = An extension element <{1}> in plugin {0} is missing a required attribute {2}.
-facetNotDefined = Project facet {1} has not been defined. It is used in plugin {0}.
-facetVersionNotDefined = Version {2} of project facet {1} has not been defined. It is used in plugin {0}.
-categoryNotDefined = Category {1} has not been defined. It is used in plugin {0}.
-runtimeComponentTypeNotDefined = Runtime component type {1} has not been defined. It is used in plugin {0}.
-failedToCreate = Failed to instantiate class {0}.
-invalidActionType = "{1}" is an invalid action type. It is used in plugin {0}.
-iconNotFound = Could not load icon "{1}" from plugin {0}.
-
-wizardExtensionPointDeprecated = \
-Extension point org.eclipse.wst.common.project.facet.ui.wizard is deprecated. \
-It is used in plugin {0}. \
-Extension point org.eclipse.wst.common.project.facet.ui.wizardPages provides \
-analogous functionality.
-
-actionNotDefined = Project facet action "{1}" has not been defined. It is used in plugin {0}.
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.java
deleted file mode 100644
index 4103182..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.java
+++ /dev/null
@@ -1,866 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial implementation and ongoing maintenance
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gd;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhalign;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhhint;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdwhint;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gl;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.glmargins;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.SwtUtil.getPreferredWidth;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.IColorProvider;
-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.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentType;
-import org.eclipse.wst.common.project.facet.ui.IDecorationsProvider;
-import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider;
-import org.eclipse.wst.common.project.facet.ui.internal.AbstractDataModel.IDataModelListener;
-import org.osgi.framework.Bundle;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class RuntimesPanel
-
- extends Composite
-
-{
- private static final Object NO_RUNTIME_SELECTED_PLACEHOLDER = new Object();
-
- private final ChangeTargetedRuntimesDataModel model;
- private boolean showAllRuntimesSetting;
- private final Label runtimesLabel;
- private final CheckboxTableViewer runtimes;
- private final Button showAllRuntimesCheckbox;
- private final Button makePrimaryButton;
- private final Button newRuntimeButton;
- private final Label runtimeComponentsLabel;
- private final TableViewer runtimeComponents;
- private IRuntime currentPrimaryRuntime;
- private final List<IDataModelListener> listeners;
- private Color colorGray;
-
- public RuntimesPanel( final Composite parent,
- final int style,
- final ChangeTargetedRuntimesDataModel model )
- {
- super( parent, style );
-
- this.listeners = new ArrayList<IDataModelListener>();
-
- addDisposeListener
- (
- new DisposeListener()
- {
- public void widgetDisposed( final DisposeEvent e )
- {
- handleWidgetDisposed();
- }
- }
- );
-
- // Bind to the data model.
-
- this.model = model;
-
- addDataModelListener
- (
- ChangeTargetedRuntimesDataModel.EVENT_AVAILABLE_RUNTIMES_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handleAvailableRuntimesChanged();
- }
- }
- );
-
- addDataModelListener
- (
- ChangeTargetedRuntimesDataModel.EVENT_TARGETABLE_RUNTIMES_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handleTargetableRuntimesChanged();
- }
- }
- );
-
- addDataModelListener
- (
- ChangeTargetedRuntimesDataModel.EVENT_TARGETED_RUNTIMES_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handleTargetedRuntimesChanged();
- }
- }
- );
-
- addDataModelListener
- (
- ChangeTargetedRuntimesDataModel.EVENT_PRIMARY_RUNTIME_CHANGED,
- new IDataModelListener()
- {
- public void handleEvent()
- {
- handlePrimaryRuntimeChanged();
- }
- }
- );
-
- this.showAllRuntimesSetting = false;
-
- // Initialize the colors.
-
- this.colorGray = new Color( null, 160, 160, 164 );
-
- // Layout the panel.
-
- final GridLayout layout = new GridLayout( 1, false );
- layout.marginHeight = 0;
- layout.marginWidth = 0;
-
- setLayout( layout );
-
- this.runtimesLabel = new Label( this, SWT.NONE );
- this.runtimesLabel.setText( Resources.runtimesLabel );
- this.runtimesLabel.setLayoutData( gdhfill() );
-
- this.runtimes = CheckboxTableViewer.newCheckList( this, SWT.BORDER );
- this.runtimes.getTable().setLayoutData( gdfill() );
- this.runtimes.setContentProvider( new ContentProvider() );
- this.runtimes.setLabelProvider( new LabelProvider() );
- this.runtimes.setSorter( new Sorter() );
- this.runtimes.setInput( new Object() );
-
- this.runtimes.addSelectionChangedListener
- (
- new ISelectionChangedListener()
- {
- public void selectionChanged( final SelectionChangedEvent e )
- {
- handleRuntimeSelectionChanged();
- }
- }
- );
-
- this.runtimes.addCheckStateListener
- (
- new ICheckStateListener()
- {
- public void checkStateChanged( final CheckStateChangedEvent e )
- {
- handleCheckStateChanged( e );
- }
- }
- );
-
- this.showAllRuntimesCheckbox = new Button( this, SWT.CHECK );
- this.showAllRuntimesCheckbox.setText( Resources.showAllRuntimes );
- this.showAllRuntimesCheckbox.setSelection( this.showAllRuntimesSetting );
-
- this.showAllRuntimesCheckbox.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleShowAllRuntimesSelected();
- }
- }
- );
-
- final Composite buttons = new Composite( this, SWT.NONE );
- buttons.setLayoutData( gdhalign( gd(), GridData.END ) );
- buttons.setLayout( glmargins( gl( 2 ), 0, 0 ) );
-
- GridData gd;
-
- this.makePrimaryButton = new Button( buttons, SWT.PUSH );
- this.makePrimaryButton.setText( Resources.makePrimaryLabel );
- gd = gdwhint( gd(), getPreferredWidth( this.makePrimaryButton ) + 15 );
- this.makePrimaryButton.setLayoutData( gd );
- this.makePrimaryButton.setEnabled( false );
-
- this.makePrimaryButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleMakePrimarySelected();
- }
- }
- );
-
- this.newRuntimeButton = new Button( buttons, SWT.PUSH );
- this.newRuntimeButton.setText( Resources.newRuntimeButtonLabel );
- gd = gdwhint( gd(), getPreferredWidth( this.newRuntimeButton ) + 15 );
- this.newRuntimeButton.setLayoutData( gd );
-
- this.newRuntimeButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleNewRuntimeButtonSelected();
- }
- }
- );
-
- this.runtimeComponentsLabel = new Label( this, SWT.NONE );
- this.runtimeComponentsLabel.setText( Resources.runtimeCompositionLabel );
- this.runtimeComponentsLabel.setLayoutData( gdhfill() );
-
- final Color infoBackgroundColor
- = parent.getDisplay().getSystemColor( SWT.COLOR_INFO_BACKGROUND );
-
- this.runtimeComponents = new TableViewer( this, SWT.BORDER );
- this.runtimeComponents.getTable().setLayoutData( gdhhint( gdhfill(), 50 ) );
- this.runtimeComponents.getTable().setBackground( infoBackgroundColor );
- this.runtimeComponents.setContentProvider( new RuntimeComponentsContentProvider() );
- this.runtimeComponents.setLabelProvider( new RuntimeComponentsLabelProvider() );
-
- this.runtimeComponents.setInput( NO_RUNTIME_SELECTED_PLACEHOLDER );
- this.runtimeComponents.getTable().setEnabled( false );
- this.runtimeComponentsLabel.setEnabled( false );
-
- refresh();
- this.currentPrimaryRuntime = this.model.getPrimaryRuntime();
-
- Dialog.applyDialogFont( parent );
- }
-
- public ChangeTargetedRuntimesDataModel getDataModel()
- {
- return this.model;
- }
-
- private void handleAvailableRuntimesChanged()
- {
- if( ! Thread.currentThread().equals( getDisplay().getThread() ) )
- {
- getDisplay().asyncExec
- (
- new Runnable()
- {
- public void run()
- {
- handleAvailableRuntimesChanged();
- }
- }
- );
-
- return;
- }
-
- if( this.showAllRuntimesSetting )
- {
- refresh();
- }
- }
-
- private void handleTargetableRuntimesChanged()
- {
- if( ! Thread.currentThread().equals( getDisplay().getThread() ) )
- {
- getDisplay().asyncExec
- (
- new Runnable()
- {
- public void run()
- {
- handleTargetableRuntimesChanged();
- }
- }
- );
-
- return;
- }
-
- refresh();
- }
-
- private void handleTargetedRuntimesChanged()
- {
- if( ! Thread.currentThread().equals( getDisplay().getThread() ) )
- {
- getDisplay().asyncExec
- (
- new Runnable()
- {
- public void run()
- {
- handleTargetedRuntimesChanged();
- }
- }
- );
-
- return;
- }
-
- final Set<IRuntime> targeted = this.model.getTargetedRuntimes();
-
- for( IRuntime r : this.model.getTargetableRuntimes() )
- {
- if( targeted.contains( r ) )
- {
- if( ! this.runtimes.getChecked( r ) )
- {
- this.runtimes.setChecked( r, true );
- }
- }
- else
- {
- if( this.runtimes.getChecked( r ) )
- {
- this.runtimes.setChecked( r, false );
- }
- }
- }
- }
-
- private void handlePrimaryRuntimeChanged()
- {
- if( ! Thread.currentThread().equals( getDisplay().getThread() ) )
- {
- getDisplay().asyncExec
- (
- new Runnable()
- {
- public void run()
- {
- handlePrimaryRuntimeChanged();
- }
- }
- );
-
- return;
- }
-
- if( this.currentPrimaryRuntime != null )
- {
- this.runtimes.update( this.currentPrimaryRuntime, null );
- }
-
- this.currentPrimaryRuntime = this.model.getPrimaryRuntime();
-
- if( this.currentPrimaryRuntime != null )
- {
- this.runtimes.update( this.currentPrimaryRuntime, null );
- }
- }
-
- private void handleCheckStateChanged( final CheckStateChangedEvent e )
- {
- final IRuntime runtime = (IRuntime) e.getElement();
-
- if( ! this.model.getTargetableRuntimes().contains( runtime ) &&
- e.getChecked() )
- {
- this.runtimes.setChecked( runtime, false );
- return;
- }
-
- if( e.getChecked() )
- {
- this.model.addTargetedRuntime( runtime );
- }
- else
- {
- this.model.removeTargetedRuntime( runtime );
- }
- }
-
- private void handleRuntimeSelectionChanged()
- {
- final IRuntime r = getSelection();
-
- if( r == null )
- {
- if( this.runtimeComponents.getInput() != null )
- {
- this.runtimeComponentsLabel.setEnabled( false );
- this.runtimeComponents.getTable().setEnabled( false );
- this.runtimeComponents.setInput( NO_RUNTIME_SELECTED_PLACEHOLDER );
- }
- }
- else
- {
- if( this.runtimeComponents.getInput() == null ||
- ! this.runtimeComponents.getInput().equals( r ) )
- {
- this.runtimeComponentsLabel.setEnabled( true );
- this.runtimeComponents.getTable().setEnabled( true );
- this.runtimeComponents.setInput( r );
- }
-
- if( this.runtimes.getChecked( r ) &&
- this.model.getPrimaryRuntime() != null &&
- ! this.model.getPrimaryRuntime().equals( r ) &&
- this.model.getTargetableRuntimes().contains( r ) )
- {
- this.makePrimaryButton.setEnabled( true );
- }
- else
- {
- this.makePrimaryButton.setEnabled( false );
- }
- }
- }
-
- private void handleShowAllRuntimesSelected()
- {
- this.showAllRuntimesSetting
- = this.showAllRuntimesCheckbox.getSelection();
-
- refresh();
- }
-
- private void handleMakePrimarySelected()
- {
- this.model.setPrimaryRuntime( getSelection() );
- }
-
- @SuppressWarnings( "unchecked" )
- private void handleNewRuntimeButtonSelected()
- {
- final String SERVER_UI_PLUGIN_ID = "org.eclipse.wst.server.ui"; //$NON-NLS-1$
- final String CLASS_NAME = "org.eclipse.wst.server.ui.internal.ServerUIPlugin"; //$NON-NLS-1$
- final String METHOD_NAME = "showNewRuntimeWizard"; //$NON-NLS-1$
-
- final Bundle serverUiBundle = Platform.getBundle( SERVER_UI_PLUGIN_ID );
-
- if( serverUiBundle == null )
- {
- this.newRuntimeButton.setEnabled( false );
- return;
- }
-
- try
- {
- final Class serverUiPluginClass = serverUiBundle.loadClass( CLASS_NAME );
-
- final Method method
- = serverUiPluginClass.getMethod( METHOD_NAME, Shell.class, String.class );
-
- final Object result = method.invoke( null, getShell(), null );
-
- if( result.equals( true ) )
- {
- this.model.refreshTargetableRuntimes();
- }
- }
- catch( Exception e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- private void handleWidgetDisposed()
- {
- removeDataModelListeners();
-
- this.colorGray.dispose();
- }
-
- private void refresh()
- {
- this.runtimes.refresh();
-
- final Set<IRuntime> untargetable = new HashSet<IRuntime>( this.model.getAllRuntimes() );
- untargetable.removeAll( this.model.getTargetableRuntimes() );
-
- this.runtimes.setCheckedElements( this.model.getTargetedRuntimes().toArray() );
- }
-
- private IRuntime getSelection()
- {
- final IStructuredSelection ssel
- = (IStructuredSelection) this.runtimes.getSelection();
-
- if( ssel.isEmpty() )
- {
- return null;
- }
- else
- {
- return (IRuntime) ssel.getFirstElement();
- }
- }
-
- private void addDataModelListener( final String event,
- final IDataModelListener listener )
- {
- this.model.addListener( event, listener );
- this.listeners.add( listener );
- }
-
- private void removeDataModelListeners()
- {
- for( IDataModelListener listener : this.listeners )
- {
- this.model.removeListener( listener );
- }
- }
-
- private final class ContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- if( RuntimesPanel.this.showAllRuntimesSetting )
- {
- return getDataModel().getAllRuntimes().toArray();
- }
- else
- {
- return getDataModel().getTargetableRuntimes().toArray();
- }
- }
-
- public void dispose() { }
-
- public void inputChanged( final Viewer viewer,
- final Object oldObject,
- final Object newObject ) {}
- }
-
- private final class LabelProvider
-
- implements ILabelProvider, IColorProvider
-
- {
- private final ImageRegistry imageRegistry;
-
- public LabelProvider()
- {
- this.imageRegistry = new ImageRegistry();
- }
-
- public String getText( final Object element )
- {
- return ( (IRuntime) element ).getLocalizedName();
- }
-
- public Image getImage( final Object element )
- {
- final IRuntime r = (IRuntime) element;
-
- final IRuntimeComponent rc = r.getRuntimeComponents().get( 0 );
- final IRuntimeComponentType rct = rc.getRuntimeComponentType();
-
- final IRuntime primary = getDataModel().getPrimaryRuntime();
- final boolean isPrimary = primary != null && primary.equals( r );
-
- final String imgid
- = ( isPrimary ? "p:" : "s" ) //$NON-NLS-1$ //$NON-NLS-2$
- + rct.getId();
-
- Image image = this.imageRegistry.get( imgid );
-
- if( image == null )
- {
- final IDecorationsProvider decprov
- = (IDecorationsProvider) rct.getAdapter( IDecorationsProvider.class );
-
- ImageDescriptor imgdesc = decprov.getIcon();
-
- if( isPrimary )
- {
- imgdesc = new PrimaryRuntimeImageDescriptor( imgdesc );
- }
-
- this.imageRegistry.put( imgid, imgdesc );
- image = this.imageRegistry.get( imgid );
- }
-
- if( getDataModel().getTargetableRuntimes().contains( r ) )
- {
- if( RuntimesPanel.this.model.getTargetedRuntimes().contains( r ) )
- {
- RuntimesPanel.this.runtimes.setChecked( r, true );
- }
- else
- {
- RuntimesPanel.this.runtimes.setChecked( r, false );
- }
-
- return image;
- }
- else
- {
- RuntimesPanel.this.runtimes.setChecked( r, false );
-
- final String greyedId = rct.getId() + "##greyed##"; //$NON-NLS-1$
- Image greyed = this.imageRegistry.get( greyedId );
-
- if( greyed == null )
- {
- greyed = new Image( null, image, SWT.IMAGE_GRAY );
- this.imageRegistry.put( greyedId, greyed );
- }
-
- return greyed;
- }
- }
-
- public Color getForeground( final Object element )
- {
- if( ! getDataModel().getTargetableRuntimes().contains( element ) )
- {
- return RuntimesPanel.this.colorGray;
- }
- else
- {
- return null;
- }
- }
-
- public Color getBackground( final Object element )
- {
- return null;
- }
-
- public void dispose()
- {
- this.imageRegistry.dispose();
- }
-
- public boolean isLabelProperty( final Object element,
- final String property )
- {
- return false;
- }
-
- public void addListener( final ILabelProviderListener listener ) {}
- public void removeListener( final ILabelProviderListener listener ) {}
- }
-
- private final class Sorter
-
- extends ViewerSorter
-
- {
- public int compare( final Viewer viewer,
- final Object a,
- final Object b )
- {
- final IRuntime r1 = (IRuntime) a;
- final IRuntime r2 = (IRuntime) b;
-
- return r1.getLocalizedName().compareToIgnoreCase( r2.getLocalizedName() );
- }
- }
-
- private final class RuntimeComponentsContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- if( element == NO_RUNTIME_SELECTED_PLACEHOLDER )
- {
- return new Object[] { NO_RUNTIME_SELECTED_PLACEHOLDER };
- }
- else
- {
- final IRuntime r = (IRuntime) element;
- return r.getRuntimeComponents().toArray();
- }
- }
-
- public void dispose() { }
-
- public void inputChanged( final Viewer viewer,
- final Object oldObject,
- final Object newObject ) {}
- }
-
- private final class RuntimeComponentsLabelProvider
-
- implements ILabelProvider
-
- {
- private final ImageRegistry imageRegistry = new ImageRegistry();
-
- public String getText( final Object element )
- {
- if( element == NO_RUNTIME_SELECTED_PLACEHOLDER )
- {
- return Resources.noRuntimeSelectedLabel;
- }
-
- final IRuntimeComponent comp = (IRuntimeComponent) element;
-
- final IRuntimeComponentLabelProvider provider
- = (IRuntimeComponentLabelProvider) comp.getAdapter( IRuntimeComponentLabelProvider.class );
-
- if( provider == null )
- {
- final StringBuffer label = new StringBuffer();
- label.append( comp.getRuntimeComponentType().getId() );
- label.append( ' ' );
- label.append( comp.getRuntimeComponentVersion().getVersionString() );
-
- return label.toString();
- }
- else
- {
- return provider.getLabel();
- }
- }
-
- public Image getImage( final Object element )
- {
- if( element == NO_RUNTIME_SELECTED_PLACEHOLDER )
- {
- return null;
- }
-
- final IRuntimeComponent rc = (IRuntimeComponent) element;
- final IRuntimeComponentType rct = rc.getRuntimeComponentType();
-
- Image image = this.imageRegistry.get( rct.getId() );
-
- if( image == null )
- {
- final IDecorationsProvider decprov
- = (IDecorationsProvider) rct.getAdapter( IDecorationsProvider.class );
-
- this.imageRegistry.put( rct.getId(), decprov.getIcon() );
- image = this.imageRegistry.get( rct.getId() );
- }
-
- return image;
- }
-
- public void dispose()
- {
- this.imageRegistry.dispose();
- }
-
- public boolean isLabelProperty( final Object element,
- final String property )
- {
- return false;
- }
-
- public void addListener( final ILabelProviderListener listener ) {}
- public void removeListener( final ILabelProviderListener listener ) {}
- }
-
- private static final class PrimaryRuntimeImageDescriptor
-
- extends CompositeImageDescriptor
-
- {
- private static final String OVERLAY_IMG_LOCATION
- = "images/primary-runtime-overlay.gif"; //$NON-NLS-1$
-
- private static final ImageData OVERLAY
- = FacetUiPlugin.getImageDescriptor( OVERLAY_IMG_LOCATION ).getImageData();
-
- private final ImageData base;
- private final Point size;
-
- public PrimaryRuntimeImageDescriptor( final ImageDescriptor base )
- {
- this.base = base.getImageData();
- this.size = new Point( this.base.width, this.base.height );
- }
-
- protected void drawCompositeImage( final int width,
- final int height )
- {
- drawImage( this.base, 0, 0 );
- drawImage( OVERLAY, 0, height - OVERLAY.height );
- }
-
- protected Point getSize()
- {
- return this.size;
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String runtimesLabel;
- public static String runtimeCompositionLabel;
- public static String makePrimaryLabel;
- public static String newRuntimeButtonLabel;
- public static String showAllRuntimes;
- public static String noRuntimeSelectedLabel;
-
- static
- {
- initializeMessages( RuntimesPanel.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.properties
deleted file mode 100644
index c87b092..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-runtimesLabel = Runtimes:
-runtimeCompositionLabel = Runtime Composition:
-makePrimaryLabel = Make Primary
-newRuntimeButtonLabel = New...
-showAllRuntimes = Show all runtimes
-noRuntimeSelectedLabel = <no runtime selected>
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
deleted file mode 100644
index f2d1f07..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial implementation and ongoing maintenance
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectListener;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class RuntimesPropertyPage extends PropertyPage
-{
- private IFacetedProject project;
- private IFacetedProjectListener projectListener;
- private ChangeTargetedRuntimesDataModel model;
- private RuntimesPanel panel;
-
- protected Control createContents( final Composite parent )
- {
- final IAdaptable element = getElement();
-
- if( element instanceof IProject )
- {
- final IProject project = (IProject) element;
-
- try
- {
- this.project = ProjectFacetsManager.create( project );
- }
- catch( CoreException e ) {}
-
- if( this.project == null )
- {
- return null;
- }
-
- this.model = new ChangeTargetedRuntimesDataModel();
-
- this.model.setTargetedRuntimes( this.project.getTargetedRuntimes() );
- this.model.setPrimaryRuntime( this.project.getPrimaryRuntime() );
-
- this.model.addRuntimeFilter
- (
- new ChangeTargetedRuntimesDataModel.IRuntimeFilter()
- {
- public boolean check( final IRuntime runtime )
- {
- final IFacetedProject fpj = RuntimesPropertyPage.this.project;
-
- if( fpj.getTargetedRuntimes().contains( runtime ) )
- {
- return true;
- }
- else
- {
- for( IProjectFacetVersion fv : fpj.getProjectFacets() )
- {
- if( ! runtime.supports( fv ) )
- {
- return false;
- }
- }
-
- return true;
- }
- }
- }
- );
-
- this.projectListener = new IFacetedProjectListener()
- {
- public void projectChanged()
- {
- handleProjectChangedEvent();
- }
- };
-
- this.project.addListener( this.projectListener );
-
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayoutData( gdfill() );
-
- final GridLayout layout = new GridLayout( 1, false );
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginBottom = 5;
-
- composite.setLayout( layout );
-
- this.panel = new RuntimesPanel( composite, SWT.NONE, this.model );
- this.panel.setLayoutData( gdfill() );
-
- final Label hint = new Label( composite, SWT.WRAP );
- hint.setText( Resources.hint );
-
- final GridData gd = gdhfill();
- gd.grabExcessHorizontalSpace = true;
- gd.widthHint = 300;
- gd.verticalIndent = 5;
-
- hint.setLayoutData( gd );
-
- final Hyperlink uninstallFacetsLink = new Hyperlink( composite, SWT.NONE );
- uninstallFacetsLink.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_DARK_BLUE ) );
- uninstallFacetsLink.setUnderlined( true );
- uninstallFacetsLink.setText( Resources.uninstallFacetsLinkLabel );
-
- uninstallFacetsLink.addHyperlinkListener
- (
- new HyperlinkAdapter()
- {
- public void linkActivated( final HyperlinkEvent evt )
- {
- performAddRemoveFacets();
- }
- }
- );
-
- composite.addDisposeListener
- (
- new DisposeListener()
- {
- public void widgetDisposed( final DisposeEvent e )
- {
- handleDisposeEvent();
- }
- }
- );
-
- Dialog.applyDialogFont( parent );
-
- return composite;
- }
- return null;
- }
-
- public boolean performOk()
- {
- final Set<IRuntime> targeted = this.model.getTargetedRuntimes();
- final IRuntime primary = this.model.getPrimaryRuntime();
-
- if( ! this.project.getTargetedRuntimes().equals( primary ) ||
- ! equals( this.project.getPrimaryRuntime(), primary ) )
- {
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
- {
- public void run( final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFacetedProject fpj = RuntimesPropertyPage.this.project;
- fpj.setTargetedRuntimes( targeted, null );
-
- if( primary != null )
- {
- fpj.setPrimaryRuntime( primary, null );
- }
- }
- };
-
- final Runnable op = new Runnable()
- {
- public void run()
- {
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
-
- try
- {
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
- }
- catch( CoreException e )
- {
- final IStatus st = e.getStatus();
-
- ErrorDialog.openError( getShell(), Resources.errDlgTitle,
- st.getMessage(), st );
-
- FacetUiPlugin.log( st );
- }
- }
- };
-
- BusyIndicator.showWhile( null, op );
- }
-
- return true;
- }
-
- protected void performDefaults()
- {
- super.performDefaults();
-
- this.model.setTargetedRuntimes( this.project.getTargetedRuntimes() );
- this.model.setPrimaryRuntime( this.project.getPrimaryRuntime() );
- }
-
- private void performAddRemoveFacets()
- {
- final IWizard wizard = new ModifyFacetedProjectWizard( this.project );
- final WizardDialog dialog = new WizardDialog( getShell(), wizard );
-
- dialog.open();
- }
-
- private void handleProjectChangedEvent()
- {
- this.model.refreshTargetableRuntimes();
-
- final Set<IRuntime> targetedRuntimes = this.project.getTargetedRuntimes();
- this.model.setTargetedRuntimes( targetedRuntimes );
-
- final IRuntime primaryRuntime = this.project.getPrimaryRuntime();
- this.model.setPrimaryRuntime( primaryRuntime );
- }
-
- private void handleDisposeEvent()
- {
- this.project.removeListener( this.projectListener );
- this.model.dispose();
- }
-
- private static boolean equals( final IRuntime r1,
- final IRuntime r2 )
- {
- if( r1 == null && r2 == null )
- {
- return true;
- }
- else if( r1 == null || r2 == null )
- {
- return false;
- }
- else
- {
- return r1.equals( r2 );
- }
- }
-
- private static GridData gdfill()
- {
- return new GridData( SWT.FILL, SWT.FILL, true, true );
- }
-
- private static GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
-
- private static final class Resources extends NLS
- {
- public static String errDlgTitle;
- public static String hint;
- public static String uninstallFacetsLinkLabel;
-
- static
- {
- initializeMessages( RuntimesPropertyPage.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.properties
deleted file mode 100644
index d36a585..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-errDlgTitle = Error
-
-hint = \
-If a runtime that you want to select is not displayed or is disabled you may \
-need to uninstall one or more of the currently installed project facets.
-
-uninstallFacetsLinkLabel = Uninstall Facets...
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/SavePresetDialog.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/SavePresetDialog.java
deleted file mode 100644
index 30e327f..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/SavePresetDialog.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial implementation and ongoing maintenance
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.Set;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class SavePresetDialog
-
- extends Dialog
-
-{
- private static final String WIDTH = "width"; //$NON-NLS-1$
- private static final String HEIGHT = "height"; //$NON-NLS-1$
-
- private IDialogSettings settings;
- private Text nameTextField;
- private Text descTextField;
- private Label msgLabel;
- private String name;
- private String description;
-
- protected SavePresetDialog( final Shell shell )
- {
- super( shell );
-
- setShellStyle( getShellStyle() | SWT.RESIZE );
- }
-
- public static IPreset showDialog( final Shell shell,
- final Set<IProjectFacetVersion> facets )
- {
- final SavePresetDialog dialog = new SavePresetDialog( shell );
-
- IPreset preset = null;
-
- if( dialog.open() == IDialogConstants.OK_ID )
- {
- final String name = dialog.name;
- final String desc = dialog.description;
-
- preset = ProjectFacetsManager.definePreset( name, desc, facets );
- }
-
- return preset;
- }
-
- protected void configureShell( final Shell shell )
- {
- super.configureShell( shell );
- shell.setText( Resources.dialogTitle );
- }
-
- protected Control createDialogArea( final Composite parent )
- {
- final IDialogSettings root
- = FacetUiPlugin.getInstance().getDialogSettings();
-
- IDialogSettings temp = root.getSection( getClass().getName() );
-
- if( temp == null )
- {
- temp = root.addNewSection( getClass().getName() );
- }
-
- if( temp.get( WIDTH ) == null ) temp.put( WIDTH, 300 );
- if( temp.get( HEIGHT ) == null ) temp.put( HEIGHT, 160 );
-
- this.settings = temp;
-
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( new GridLayout( 1, false ) );
-
- final GridData gd = gdfill();
- gd.widthHint = this.settings.getInt( WIDTH );
- gd.heightHint = this.settings.getInt( HEIGHT );
-
- composite.setLayoutData( gd );
-
- composite.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- final Point size = composite.getSize();
-
- SavePresetDialog.this.settings.put( WIDTH, size.x );
- SavePresetDialog.this.settings.put( HEIGHT, size.y );
- }
- }
- );
-
- final Label nameLabel = new Label( composite, SWT.NONE );
- nameLabel.setLayoutData( gdhfill() );
- nameLabel.setText( Resources.nameLabel );
-
- this.nameTextField = new Text( composite, SWT.NONE | SWT.BORDER );
- this.nameTextField.setLayoutData( gdhfill() );
-
- this.nameTextField.addModifyListener
- (
- new ModifyListener()
- {
- public void modifyText( final ModifyEvent e )
- {
- handleNameChange();
- }
- }
- );
-
- final Label descLabel = new Label( composite, SWT.NONE );
- descLabel.setLayoutData( gdhfill() );
- descLabel.setText( Resources.descLabel );
-
- this.descTextField
- = new Text( composite, SWT.NONE | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP );
-
- this.descTextField.setLayoutData( gdfill() );
-
- this.descTextField.addModifyListener
- (
- new ModifyListener()
- {
- public void modifyText( final ModifyEvent e )
- {
- handleDescriptionChange();
- }
- }
- );
-
- this.msgLabel = new Label( composite, SWT.NONE );
- this.msgLabel.setLayoutData( gdhfill() );
- this.msgLabel.setForeground( color( SWT.COLOR_RED ) );
-
- handleNameChange();
-
- return composite;
- }
-
- private void handleNameChange()
- {
- this.name = this.nameTextField.getText().trim();
-
- boolean okButtonEnabled = false;
- boolean conflictDetected = false;
-
- if( this.name.length() > 0 )
- {
- for( IPreset preset : ProjectFacetsManager.getPresets() )
- {
- if( preset.getLabel().equals( this.name ) )
- {
- conflictDetected = true;
- break;
- }
- }
-
- if( ! conflictDetected )
- {
- okButtonEnabled = true;
- }
- }
-
- if( conflictDetected )
- {
- this.msgLabel.setText( Resources.nameInUseMessage );
- }
- else
- {
- this.msgLabel.setText( "" ); //$NON-NLS-1$
- }
-
- setOkButtonEnabled( okButtonEnabled );
- }
-
- private void handleDescriptionChange()
- {
- this.description = this.descTextField.getText().trim();
- }
-
- private void setOkButtonEnabled( final boolean enabled )
- {
- Button button = getButton( IDialogConstants.OK_ID );
-
- if( button != null )
- {
- button.setEnabled( enabled );
- }
- else
- {
- // If the button has not been created yet (this happens during the
- // execution of the createDialogArea method), spin off a thread to
- // wait for it's creation.
-
- final Display display = Display.getCurrent();
-
- final Thread t = new Thread()
- {
- public void run()
- {
- Button b = getButton( IDialogConstants.OK_ID );
-
- while( b == null )
- {
- try
- {
- Thread.sleep( 50 );
- }
- catch( InterruptedException e ) {}
-
- b = getButton( IDialogConstants.OK_ID );
- }
-
- final Button finalButton = b;
-
- display.asyncExec( new Runnable()
- {
- public void run()
- {
- finalButton.setEnabled( enabled );
- }
- } );
- }
- };
-
- t.start();
- }
- }
-
- private static GridData gdfill()
- {
- return new GridData( SWT.FILL, SWT.FILL, true, true );
- }
-
- private static GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
- public static Color color( final int id )
- {
- return Display.getCurrent().getSystemColor( id );
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String dialogTitle;
- public static String nameLabel;
- public static String descLabel;
- public static String nameInUseMessage;
-
- static
- {
- initializeMessages( SavePresetDialog.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/SavePresetDialog.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/SavePresetDialog.properties
deleted file mode 100644
index f4b006c..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/SavePresetDialog.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-dialogTitle = Save Preset
-nameLabel = Name:
-descLabel = Description:
-nameInUseMessage = Selected name already in use.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/BasicToolTip.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/BasicToolTip.java
deleted file mode 100644
index 8f9cada..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/BasicToolTip.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal.util;
-
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdwhint;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gl;
-
-import org.eclipse.jface.window.ToolTip;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class BasicToolTip
-
- extends ToolTip
-
-{
- private String message = ""; //$NON-NLS-1$
-
- public BasicToolTip( final Control control )
- {
- super( control );
-
- setPopupDelay( 1000 );
- setShift( new Point( 10, 3 ) );
- }
-
- @Override
- protected final Composite createToolTipContentArea( final Event event,
- final Composite parent )
- {
- final Display display = parent.getDisplay();
-
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( gl( 1 ) );
- composite.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
-
- final Label label = new Label( composite, SWT.WRAP );
- label.setLayoutData( gdwhint( gdfill(), 300 ) );
- label.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
- label.setText( this.message );
-
- return composite;
- }
-
- public String getMessage()
- {
- return this.message;
- }
-
- public void setMessage( final String message )
- {
- this.message = message;
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/GridLayoutUtil.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/GridLayoutUtil.java
deleted file mode 100644
index 8dfa58d..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/GridLayoutUtil.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal.util;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class GridLayoutUtil
-{
- public static final GridLayout gl( final int columns )
- {
- return new GridLayout( columns, false );
- }
-
- public static final GridLayout glmargins( final GridLayout layout,
- final int marginWidth,
- final int marginHeight )
- {
- layout.marginWidth = marginWidth;
- layout.marginHeight = marginHeight;
- layout.marginLeft = 0;
- layout.marginRight = 0;
- layout.marginTop = 0;
- layout.marginBottom = 0;
-
- return layout;
- }
-
- public static final GridLayout glmargins( final GridLayout layout,
- final int leftMargin,
- final int rightMargin,
- final int topMargin,
- final int bottomMargin )
- {
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.marginLeft = leftMargin;
- layout.marginRight = rightMargin;
- layout.marginTop = topMargin;
- layout.marginBottom = bottomMargin;
-
- return layout;
- }
-
- public static final GridData gd()
- {
- return new GridData();
- }
-
- public static final GridData gdfill()
- {
- return new GridData( SWT.FILL, SWT.FILL, true, true );
- }
-
- public static final GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
- public static final GridData gdvfill()
- {
- return new GridData( GridData.FILL_VERTICAL );
- }
-
- public static final GridData gdhhint( final GridData gd,
- final int heightHint )
- {
- gd.heightHint = heightHint;
- return gd;
- }
-
- public static final GridData gdwhint( final GridData gd,
- final int widthHint )
- {
- gd.widthHint = widthHint;
- return gd;
- }
-
- public static final GridData gdhindent( final GridData gd,
- final int horizontalIndent )
- {
- gd.horizontalIndent = horizontalIndent;
- return gd;
- }
-
- public static final GridData gdvindent( final GridData gd,
- final int verticalIndent )
- {
- gd.verticalIndent = verticalIndent;
- return gd;
- }
-
- public static final GridData gdhspan( final GridData gd,
- final int span )
- {
- gd.horizontalSpan = span;
- return gd;
- }
-
- public static final GridData gdvspan( final GridData gd,
- final int span )
- {
- gd.verticalSpan = span;
- return gd;
- }
-
- public static final GridData gdhalign( final GridData gd,
- final int alignment )
- {
- gd.horizontalAlignment = alignment;
- return gd;
- }
-
- public static final GridData gdvalign( final GridData gd,
- final int alignment )
- {
- gd.verticalAlignment = alignment;
- return gd;
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/HeaderToolTip.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/HeaderToolTip.java
deleted file mode 100644
index 825eab7..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/HeaderToolTip.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal.util;
-
-import static java.lang.Math.max;
-import static org.eclipse.jface.resource.JFaceResources.getColorRegistry;
-import static org.eclipse.jface.resource.JFaceResources.getDefaultFont;
-import static org.eclipse.jface.resource.JFaceResources.getFontRegistry;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdhfill;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gdwhint;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.gl;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.GridLayoutUtil.glmargins;
-import static org.eclipse.wst.common.project.facet.ui.internal.util.SwtUtil.getPreferredWidth;
-
-import org.eclipse.jface.window.ToolTip;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class HeaderToolTip
-
- extends ToolTip
-
-{
- private static final String HEADER_BG_COLOR
- = HeaderToolTip.class.getName() + ".TOOLTIP_HEAD_BG_COLOR"; //$NON-NLS-1$
-
- private static final String HEADER_FG_COLOR
- = HeaderToolTip.class.getName() + ".TOOLTIP_HEAD_FG_COLOR"; //$NON-NLS-1$
-
- private static final String HEADER_FONT
- = HeaderToolTip.class.getName() + ".TOOLTIP_HEAD_FONT"; //$NON-NLS-1$
-
- static
- {
- getColorRegistry().put( HEADER_BG_COLOR, new RGB( 255, 255, 255 ) );
- getColorRegistry().put( HEADER_FG_COLOR, new RGB( 0, 0, 0 ) );
-
- final String defaultFontName = getDefaultFont().getFontData()[ 0 ].getName();
- final FontData[] fontData = getFontRegistry().getBold( defaultFontName ).getFontData();
-
- getFontRegistry().put( HEADER_FONT, fontData );
- }
-
- public HeaderToolTip( final Control control )
- {
- super( control );
-
- setPopupDelay( 1000 );
- setShift( new Point( 10, 3 ) );
- }
-
- @Override
- protected final Composite createToolTipContentArea( final Event event,
- final Composite parent )
- {
- final Composite composite = new Composite( parent, SWT.NONE );
- final GridLayout layout = glmargins( gl( 1 ), 0, 0 );
- layout.verticalSpacing = 1;
- composite.setLayout( layout );
-
- final Composite topArea = new Composite( composite, SWT.NONE );
- topArea.setBackground( getColorRegistry().get( HEADER_BG_COLOR ) );
- topArea.setLayout( glmargins( gl( 3 ), 5, 5, 2, 2 ) );
-
- final Label titleLabel = new Label( topArea, SWT.NONE );
- titleLabel.setLayoutData( gdfill() );
- titleLabel.setBackground( getColorRegistry().get( HEADER_BG_COLOR ) );
- titleLabel.setFont( getFontRegistry().get( HEADER_FONT ) );
- titleLabel.setForeground( getColorRegistry().get( HEADER_FG_COLOR ) );
- titleLabel.setText( getToolTipTitle( event ) );
-
- final Control content = createContentArea( event, composite );
-
- final int width = max( getPreferredWidth( titleLabel ) + 50, 300 );
- topArea.setLayoutData( gdwhint( gdhfill(), width ) );
- content.setLayoutData( gdwhint( gdfill(), width ) );
-
- return composite;
- }
-
- protected abstract String getToolTipTitle( Event event );
-
- protected abstract Composite createContentArea( Event event,
- Composite parent );
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/SwtUtil.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/SwtUtil.java
deleted file mode 100644
index bef9ad2..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/util/SwtUtil.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal.util;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class SwtUtil
-{
- public static final int getPreferredWidth( final Control control )
- {
- return control.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x;
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/.classpath b/tests/org.eclipse.wst.common.project.facet.core.tests/.classpath
deleted file mode 100644
index 304e861..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <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="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/.cvsignore b/tests/org.eclipse.wst.common.project.facet.core.tests/.cvsignore
deleted file mode 100644
index 52e8206..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-javaCompiler.tests.jar.args
-build.xml
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/.project b/tests/org.eclipse.wst.common.project.facet.core.tests/.project
deleted file mode 100644
index 34d80fc..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.common.project.facet.core.tests</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>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.common.project.facet.core.tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 7a5f1c3..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Fri Feb 02 16:51:39 PST 2007
-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
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.common.project.facet.core.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index b043f4d..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Vendor: Eclipse.org
-Bundle-Name: Facet Core Tests Plug-in
-Bundle-SymbolicName: org.eclipse.wst.common.project.facet.core.tests;singleton:=true
-Bundle-Version: 1.2.0.qualifier
-Bundle-Localization: plugin
-Require-Bundle: org.junit;bundle-version="[3.8.0,4.0.0)",
- org.eclipse.wst.common.project.facet.core;bundle-version="[1.2.0,1.3.0)",
- org.eclipse.core.runtime,
- org.eclipse.core.resources
-Export-Package: org.eclipse.wst.common.project.facet.core.tests,
- org.eclipse.wst.common.project.facet.core.tests.support
-Bundle-ClassPath: tests.jar
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/about.html b/tests/org.eclipse.wst.common.project.facet.core.tests/about.html
deleted file mode 100644
index 9e73bda..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>June 06, 2007</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/build.properties b/tests/org.eclipse.wst.common.project.facet.core.tests/build.properties
deleted file mode 100644
index 50e54ee..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/build.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-bin.includes = META-INF/,\
- plugin.xml,\
- test.xml,\
- tests.jar,\
- about.html
-jars.compile.order = tests.jar
-source.tests.jar = src/
-output.tests.jar = bin/
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.properties b/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.properties
deleted file mode 100644
index 5883308..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# properties file for org.eclipse.wst.common.project.facet.core.tests
-Bundle-Name.0 = Facet Core Tests Plug-in
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.xml b/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.xml
deleted file mode 100644
index 5876447..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.xml
+++ /dev/null
@@ -1,556 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-
-<plugin>
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <category id="cat1">
- <label>Category 1</label>
- <description>This is the category description.</description>
- </category>
-
- <project-facet id="facet1">
- <label>Facet 1</label>
- <description>This is the description of facet1.</description>
- </project-facet>
-
- <project-facet-version facet="facet1" version="1.0">
- <action type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1InstallDelegate"/>
- </action>
- <action type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1UninstallDelegate"/>
- </action>
- <action type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1VersionChangeDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="facet1" version="1.2">
- <action type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1InstallDelegate"/>
- </action>
- <action type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1UninstallDelegate"/>
- </action>
- <action type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1VersionChangeDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="facet1" version="1.2.1"/>
- <project-facet-version facet="facet1" version="1.3"/>
- <project-facet-version facet="facet1" version="2.0"/>
-
- <action facet="facet1" version="[1.2.1-2.0]" type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1InstallDelegate"/>
- </action>
-
- <action facet="facet1" version="[1.2.1-2.0]" type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1UninstallDelegate"/>
- </action>
-
- <action facet="facet1" version="[1.2.1-2.0]" type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1VersionChangeDelegate"/>
- </action>
-
- <project-facet id="facet2">
- <version-comparator class="org.eclipse.wst.common.project.facet.core.tests.support.CustomVersionComparator"/>
- <member category="cat1"/>
- </project-facet>
-
- <project-facet-version facet="facet2" version="3.5">
- <constraint>
- <requires facet="facet1" version="1.0"/>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="3.5#a">
- <constraint>
- <and>
- <requires facet="facet1" version="[1.2-1.3)"/>
- </and>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="4.7">
- <constraint>
- <or>
- <requires facet="facet1" version="[1.3"/>
- </or>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="4.7#b">
- <constraint>
- <or>
- <requires facet="facet1" version="1.3"/>
- <requires facet="facet1" version="2.0"/>
- </or>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="4.7#c">
- <constraint>
- <and>
- <or>
- <requires facet="facet1" version="1.2.1"/>
- <requires facet="facet1" version="1.3"/>
- <requires facet="facet1" version="2.0"/>
- </or>
- <conflicts facet="facet3a"/>
- <conflicts facet="facet3b" version="1.0"/>
- <conflicts group="group1"/>
- </and>
- </constraint>
- <group-member id="group1"/>
- </project-facet-version>
-
- <project-facet id="facet2ext">
- <member category="cat1"/>
- </project-facet>
-
- <project-facet-version facet="facet2ext" version="1.0"/>
-
- <category id="cat2"/>
-
- <project-facet id="facet3a"> <!-- Tests a facet with no description. -->
- <member category="cat2"/>
- </project-facet>
-
- <project-facet-version facet="facet3a" version="1.0"/>
- <project-facet-version facet="facet3a" version="2.0"/>
-
- <action facet="facet3a" version="[1.0-2.0]" type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet3aInstallDelegate"/>
- </action>
-
- <action facet="facet3a" version="[1.0-2.0]" type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet3aUninstallDelegate"/>
- </action>
-
- <action facet="facet3a" version="[1.0-2.0]" type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet3aVersionChangeDelegate"/>
- </action>
-
- <project-facet id="facet3b">
- <member category="cat2"/>
- <description></description> <!-- Tests a facet with an empty description. -->
- </project-facet>
-
- <project-facet-version facet="facet3b" version="1.0"/>
- <project-facet-version facet="facet3b" version="2.0"/>
-
- <project-facet id="facet3c">
- <member category="cat2"/>
- </project-facet>
-
- <project-facet-version facet="facet3c" version="1.0">
- <group-member id="group1"/>
- </project-facet-version>
-
- <project-facet-version facet="facet3c" version="2.0">
- <group-member id="group1"/>
- </project-facet-version>
-
- </extension>
-
- <!-- PresetsTests -->
-
- <extension point="org.eclipse.wst.common.project.facet.core.presets">
-
- <static-preset id="pt_preset1">
- <label>Preset 1</label>
- <description>This is the description for the first preset.</description>
- <facet id="facet1" version="2.0"/>
- <facet id="facet2" version="3.5#a"/>
- <facet id="facet2ext" version="1.0"/>
- </static-preset>
-
- <static-preset id="pt_preset2">
- <facet id="facet3a" version="1.0"/>
- <facet id="facet3b" version="1.0"/>
- <facet id="facet3c" version="1.0"/>
- </static-preset>
-
- <static-preset id="pt_preset3" extends="pt_preset1">
- <facet id="facet3a" version="1.0"/>
- <facet id="facet1" version="1.2.1"/> <!-- Tests that the version in derived preset wins. -->
- </static-preset>
-
- <dynamic-preset id="pt_dyn_preset">
- <factory class="org.eclipse.wst.common.project.facet.core.tests.PresetsTests$PresetFactory"/>
- </dynamic-preset>
-
- <static-preset id="pt_static_extending_dynamic_preset_1" extends="pt_dyn_preset">
- <label>Static Extending Dynamic Preset</label>
- <description>This is the static-dynamic description.</description>
- <facet id="facet2" version="3.5#a"/>
- <facet id="facet3b" version="1.0"/>
- </static-preset>
-
- <static-preset id="pt_static_extending_dynamic_preset_2" extends="pt_static_extending_dynamic_preset_1">
- <label>Static Extending Dynamic Preset 2</label>
- <description>This is the static-dynamic description 2.</description>
- <facet id="facet1" version="1.2.1"/>
- <facet id="facet3a" version="1.0"/>
- </static-preset>
-
- <!-- References facet that doesn't exist. -->
-
- <static-preset id="pt_bad.preset1">
- <facet id="abc" version="1.0"/>
- </static-preset>
-
- <!-- References facet version that doesn't exist. -->
-
- <static-preset id="pt_bad.preset2">
- <facet id="facet2" version="99.98"/>
- </static-preset>
-
- <!-- References base preset that doesn't exist. -->
-
- <static-preset id="pt_bad.preset3" extends="does.not.exist">
- <facet id="facet2" version="3.5#a"/>
- </static-preset>
-
- <!-- The following four presets form a cycle. -->
-
- <static-preset id="pt_cycle_preset1" extends="pt_cycle_preset3">
- <facet id="facet1" version="1.2.1"/>
- </static-preset>
-
- <static-preset id="pt_cycle_preset2" extends="pt_cycle_preset1">
- <facet id="facet1" version="1.2.1"/>
- </static-preset>
-
- <static-preset id="pt_cycle_preset3" extends="pt_cycle_preset2">
- <facet id="facet1" version="1.2.1"/>
- </static-preset>
-
- <static-preset id="pt_cycle_preset4" extends="pt_cycle_preset3">
- <facet id="facet1" version="1.2.1"/>
- </static-preset>
-
- </extension>
-
- <!-- Facet Constraint Tests -->
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <project-facet id="fct_f1"/>
-
- <project-facet-version facet="fct_f1" version="1.0">
- <constraint>
- <conflicts facet="fct_f2"/>
- </constraint>
- </project-facet-version>
-
- <project-facet id="fct_f2"/>
-
- <project-facet-version facet="fct_f2" version="1.0">
- <constraint>
- <conflicts facet="fct_f4"/>
- </constraint>
- </project-facet-version>
-
- <project-facet id="fct_f3"/>
-
- <project-facet-version facet="fct_f3" version="1.0">
- <constraint>
- <requires facet="fct_f2" version="1.0"/>
- </constraint>
- </project-facet-version>
-
- <project-facet id="fct_f4"/>
-
- <project-facet-version facet="fct_f4" version="1.0">
- </project-facet-version>
-
- <project-facet id="fct_f5"/>
-
- <project-facet-version facet="fct_f5" version="1.0">
- <constraint>
- <requires facet="fct_f2" version="1.0" soft="true"/>
- </constraint>
- </project-facet-version>
-
- <project-facet id="fct_f6"/>
-
- <project-facet-version facet="fct_f6" version="1.0"/>
- <project-facet-version facet="fct_f6" version="2.3"/>
- <project-facet-version facet="fct_f6" version="3.7"/>
- <project-facet-version facet="fct_f6" version="4.0"/>
- <project-facet-version facet="fct_f6" version="4.5"/>
-
- <project-facet id="fct_f7"/>
-
- <project-facet-version facet="fct_f7" version="1.0">
- <constraint>
- <requires facet="fct_f6"/>
- </constraint>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="fct_f7" version="2.0">
- <constraint>
- <requires facet="fct_f6" version="[5.0-6.5)"/>
- </constraint>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet id="fct_f8"/>
-
- <project-facet-version facet="fct_f8" version="1.0">
- <group-member id="fct_g1"/>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="fct_f8" version="2.0">
- <group-member id="fct_g1"/>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="fct_f8" version="3.0">
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet id="fct_f9"/>
-
- <project-facet-version facet="fct_f9" version="1.0">
- <group-member id="fct_g1"/>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet id="fct_f10"/>
-
- <project-facet-version facet="fct_f10" version="1.0">
- <constraint>
- <requires group="fct_g1"/>
- </constraint>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="fct_f10" version="2.0">
- <constraint>
- <requires group="fct_g1" soft="true"/>
- </constraint>
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <group id="fct_g1">
- <label>FCT Group 1</label>
- <description>This is the description.</description>
- </group>
-
- </extension>
-
- <!-- Default Version Tests -->
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <project-facet id="dvt_f1"/>
-
- <project-facet-version facet="dvt_f1" version="1.0"/>
- <project-facet-version facet="dvt_f1" version="2.0"/>
- <project-facet-version facet="dvt_f1" version="3.0"/>
- <project-facet-version facet="dvt_f1" version="4.0"/>
-
- <project-facet id="dvt_f2">
- <default-version version="2.0"/>
- </project-facet>
-
- <project-facet-version facet="dvt_f2" version="1.0"/>
- <project-facet-version facet="dvt_f2" version="2.0"/>
- <project-facet-version facet="dvt_f2" version="3.0"/>
- <project-facet-version facet="dvt_f2" version="4.0"/>
-
- <project-facet id="dvt_f3">
- <default-version provider="org.eclipse.wst.common.project.facet.core.tests.DefaultVersionTests$FacetDvtF3DefaultVersionProvider"/>
- </project-facet>
-
- <project-facet-version facet="dvt_f3" version="1.0"/>
- <project-facet-version facet="dvt_f3" version="2.0"/>
- <project-facet-version facet="dvt_f3" version="3.0"/>
- <project-facet-version facet="dvt_f3" version="4.0"/>
-
- <project-facet id="dvt_f4">
- <default-version provider="org.eclipse.wst.common.project.facet.core.tests.DefaultVersionTests$FacetDvtF3DefaultVersionProvider"/>
- </project-facet>
-
- <project-facet-version facet="dvt_f4" version="1.0"/>
- <project-facet-version facet="dvt_f4" version="2.0"/>
- <project-facet-version facet="dvt_f4" version="3.0"/>
- <project-facet-version facet="dvt_f4" version="4.0"/>
-
- <project-facet id="dvt_f5">
- <default-version provider="org.eclipse.wst.common.project.facet.core.tests.DefaultVersionTests$FacetDvtF5DefaultVersionProvider"/>
- </project-facet>
-
- <project-facet-version facet="dvt_f5" version="1.0"/>
- <project-facet-version facet="dvt_f5" version="2.0"/>
- <project-facet-version facet="dvt_f5" version="3.0"/>
- <project-facet-version facet="dvt_f5" version="4.0"/>
-
- <project-facet id="dvt_f6">
- <default-version provider="org.eclipse.wst.common.project.facet.core.tests.DefaultVersionTests$FacetDvtF6DefaultVersionProvider"/>
- </project-facet>
-
- <project-facet-version facet="dvt_f6" version="1.0"/>
- <project-facet-version facet="dvt_f6" version="2.0"/>
- <project-facet-version facet="dvt_f6" version="3.0"/>
- <project-facet-version facet="dvt_f6" version="4.0"/>
-
- <project-facet id="dvt_f7">
- <default-version version="5.0"/>
- </project-facet>
-
- <project-facet-version facet="dvt_f7" version="1.0"/>
- <project-facet-version facet="dvt_f7" version="2.0"/>
- <project-facet-version facet="dvt_f7" version="3.0"/>
- <project-facet-version facet="dvt_f7" version="4.0"/>
-
- </extension>
-
- <!-- FacetActionExecutionTests -->
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <project-facet id="fat_f1"/>
-
- <project-facet-version facet="fat_f1" version="1.0">
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.FacetActionsTests$F1v1InstallDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="fat_f1" version="2.0">
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.FacetActionsTests$F1v2InstallDelegate"/>
- </action>
- </project-facet-version>
-
- </extension>
-
- <!-- UI Tests -->
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <project-facet id="ui_long_label1">
- <label>This facet has a really really rather long label</label>
- <description>And a short description.</description>
- </project-facet>
-
- <project-facet-version facet="ui_long_label1" version="1.0">
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <category id="ui_long_label_category">
- <label>Category for facets with long labels</label>
- </category>
-
- <project-facet id="ui_long_label2">
- <label>This facet has a really really rather long label</label>
- <member category="ui_long_label_category"/>
- </project-facet>
-
- <project-facet-version facet="ui_long_label2" version="1.2.3.4.5.6.7.8.9">
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="ui_long_label2" version="9.8.7.6.5.4.3.2.1">
- <action type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- </project-facet-version>
-
- </extension>
-
- <!-- EventDeliveryTests -->
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <project-facet id="edt_f1"/>
- <project-facet-version facet="edt_f1" version="1.0"/>
- <project-facet-version facet="edt_f1" version="2.0"/>
- <action facet="edt_f1" type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f1" type="UNINSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f1" type="VERSION_CHANGE">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
-
- <project-facet id="edt_f2"/>
- <project-facet-version facet="edt_f2" version="1.1"/>
- <project-facet-version facet="edt_f2" version="2.1"/>
- <action facet="edt_f2" type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f2" type="UNINSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f2" type="VERSION_CHANGE">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
-
- <project-facet id="edt_f3"/>
- <project-facet-version facet="edt_f3" version="1.2"/>
- <project-facet-version facet="edt_f3" version="2.2"/>
- <action facet="edt_f3" type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f3" type="UNINSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f3" type="VERSION_CHANGE">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
-
- <project-facet id="edt_f4"/>
- <project-facet-version facet="edt_f4" version="1.3"/>
- <project-facet-version facet="edt_f4" version="2.3"/>
- <action facet="edt_f4" type="INSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f4" type="UNINSTALL">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
- <action facet="edt_f4" type="VERSION_CHANGE">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.NoOpDelegate"/>
- </action>
-
- </extension>
-
- <extension point="org.eclipse.wst.common.project.facet.core.listeners">
- <listener
- class="org.eclipse.wst.common.project.facet.core.tests.EventDeliveryTests$FullExtensionBasedListener"/>
- <listener
- class="org.eclipse.wst.common.project.facet.core.tests.EventDeliveryTests$PartialExtensionBasedListener"
- eventTypes="PRE_INSTALL,FIXED_FACETS_CHANGED"/>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AbstractTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AbstractTests.java
deleted file mode 100644
index b79703f..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AbstractTests.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class AbstractTests
-
- extends TestCase
-
-{
- protected static final String DEFAULT_TEST_PROJECT_NAME = "testProject";
- protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
- protected final Set<IResource> resourcesToCleanup = new HashSet<IResource>();
- protected final List<Runnable> tearDownOperations = new ArrayList<Runnable>();
-
- protected AbstractTests( final String name )
- {
- super( name );
- }
-
- protected void tearDown()
-
- throws CoreException
-
- {
- for( IResource r : this.resourcesToCleanup )
- {
- r.delete( true, null );
- }
-
- for( Runnable runnable : this.tearDownOperations )
- {
- runnable.run();
- }
- }
-
- protected final void addResourceToCleanup( final IResource resource )
- {
- this.resourcesToCleanup.add( resource );
- }
-
- protected final void addTearDownOperation( final Runnable runnable )
- {
- this.tearDownOperations.add( runnable );
- }
-
- protected final IFacetedProject createFacetedProject()
-
- throws CoreException
-
- {
- return createFacetedProject( DEFAULT_TEST_PROJECT_NAME );
- }
-
- protected IFacetedProject createFacetedProject( final String name )
-
- throws CoreException
-
- {
- assertFalse( ws.getRoot().getProject( name ).exists() );
- final IFacetedProject fpj = ProjectFacetsManager.create( name, null, null );
- final IProject pj = fpj.getProject();
- assertTrue( pj.exists() );
- addResourceToCleanup( pj );
-
- return fpj;
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AllTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AllTests.java
deleted file mode 100644
index 3e115b6..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AllTests.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class AllTests
-
- extends TestCase
-
-{
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "All Faceted Project Framework Tests" );
-
- suite.addTest( BasicTests.suite() );
- suite.addTest( PresetsTests.suite() );
- suite.addTest( ProjectCreationTests.suite() );
- suite.addTest( BasicFacetActionTests.suite() );
- suite.addTest( FacetActionSortTests.suite() );
- suite.addTest( FacetActionsTests.suite() );
- suite.addTest( ProjectChangeReactionTests.suite() );
- suite.addTest( FacetConstraintsTests.suite() );
- suite.addTest( DefaultVersionTests.suite() );
- suite.addTest( EventDeliveryTests.suite() );
-
- return suite;
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicFacetActionTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicFacetActionTests.java
deleted file mode 100644
index 7dce648..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicFacetActionTests.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class BasicFacetActionTests
-
- extends TestCase
-
-{
- private static final String TEST_PROJECT_NAME = "testProject";
- private static final IWorkspace ws = ResourcesPlugin.getWorkspace();
-
- private static final IFile facet1ArtifactFile
- = ws.getRoot().getProject( TEST_PROJECT_NAME ).getFile( "facet1.txt" );
-
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private IFacetedProject fpj;
-
- private BasicFacetActionTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Basic Facet Action Tests" );
-
- suite.addTest( new BasicFacetActionTests( "testFacetInstall1" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetInstall2" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetInstall3" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetUninstall1" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetUninstall2" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetUninstall3" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetVersionChange1" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetVersionChange2" ) );
- suite.addTest( new BasicFacetActionTests( "testActionSeries" ) );
-
- return suite;
- }
-
- protected void setUp()
-
- throws CoreException
-
- {
- assertFalse( ws.getRoot().getProject( TEST_PROJECT_NAME ).exists() );
- this.fpj = ProjectFacetsManager.create( TEST_PROJECT_NAME, null, null );
- assertTrue( fpj.getProject().exists() );
- }
-
- protected void tearDown()
-
- throws CoreException
-
- {
- this.fpj.getProject().delete( true, null );
- }
-
- public void testFacetInstall1()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v10, null, null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v10.getVersionString() );
- }
-
- public void testFacetInstall2()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v121, null, null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
- }
-
- public void testFacetInstall3()
-
- throws CoreException, IOException
-
- {
- final Action action = new Action( Action.Type.INSTALL, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v20.getVersionString() );
- }
-
- public void testFacetUninstall1()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v10, null, null );
- this.fpj.uninstallProjectFacet( f1v10, null, null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
- public void testFacetUninstall2()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v121, null, null );
- this.fpj.uninstallProjectFacet( f1v121, null, null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
- public void testFacetUninstall3()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v20, null, null );
- this.fpj.uninstallProjectFacet( f1v20, null, null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
- public void testFacetVersionChange1()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v10, null, null );
- final Action action = new Action( Action.Type.VERSION_CHANGE, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
- }
-
- public void testFacetVersionChange2()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v13, null, null );
- final Action action = new Action( Action.Type.VERSION_CHANGE, f1v12, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v12.getVersionString() );
- }
-
- public void testActionSeries()
-
- throws CoreException, IOException
-
- {
- Action action;
-
- action = new Action( Action.Type.INSTALL, f1v10, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v10.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v12, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v12.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v13, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v13.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v20.getVersionString() );
-
- action = new Action( Action.Type.UNINSTALL, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- assertFalse( facet1ArtifactFile.exists() );
-
- action = new Action( Action.Type.INSTALL, f1v12, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v12.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v13, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v13.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v10, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v10.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v20.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
-
- action = new Action( Action.Type.UNINSTALL, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicTests.java
deleted file mode 100644
index a07769a..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicTests.java
+++ /dev/null
@@ -1,672 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.asSet;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.ICategory;
-import org.eclipse.wst.common.project.facet.core.IConstraint;
-import org.eclipse.wst.common.project.facet.core.IGroup;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class BasicTests
-
- extends TestCase
-
-{
- private static final String PLUGIN_ID
- = "org.eclipse.wst.common.project.facet.core.tests";
-
- public static IProjectFacet f1;
- public static IProjectFacetVersion f1v10;
- public static IProjectFacetVersion f1v12;
- public static IProjectFacetVersion f1v121;
- public static IProjectFacetVersion f1v13;
- public static IProjectFacetVersion f1v20;
-
- public static IProjectFacet f2;
- public static IProjectFacetVersion f2v35;
- public static IProjectFacetVersion f2v35a;
- public static IProjectFacetVersion f2v47;
- public static IProjectFacetVersion f2v47b;
- public static IProjectFacetVersion f2v47c;
-
- public static IProjectFacet f2ext;
- public static IProjectFacetVersion f2extv10;
-
- public static IProjectFacet f3a;
- public static IProjectFacetVersion f3av10;
- public static IProjectFacetVersion f3av20;
-
- public static IProjectFacet f3b;
- public static IProjectFacetVersion f3bv10;
- public static IProjectFacetVersion f3bv20;
-
- public static IProjectFacet f3c;
- public static IProjectFacetVersion f3cv10;
- public static IProjectFacetVersion f3cv20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
-
- f2 = ProjectFacetsManager.getProjectFacet( "facet2" );
- f2v35 = f2.getVersion( "3.5" );
- f2v35a = f2.getVersion( "3.5#a" );
- f2v47 = f2.getVersion( "4.7" );
- f2v47b = f2.getVersion( "4.7#b" );
- f2v47c = f2.getVersion( "4.7#c" );
-
- f2ext = ProjectFacetsManager.getProjectFacet( "facet2ext" );
- f2extv10 = f2ext.getVersion( "1.0" );
-
- f3a = ProjectFacetsManager.getProjectFacet( "facet3a" );
- f3av10 = f3a.getVersion( "1.0" );
- f3av20 = f3a.getVersion( "2.0" );
-
- f3b = ProjectFacetsManager.getProjectFacet( "facet3b" );
- f3bv10 = f3b.getVersion( "1.0" );
- f3bv20 = f3b.getVersion( "2.0" );
-
- f3c = ProjectFacetsManager.getProjectFacet( "facet3c" );
- f3cv10 = f3c.getVersion( "1.0" );
- f3cv20 = f3c.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private BasicTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Basic Tests" );
-
- suite.addTest( new BasicTests( "testProjectFacetExtensionPoint" ) );
- suite.addTest( new BasicTests( "testProjectFacetVersionExtensionPoint" ) );
- suite.addTest( new BasicTests( "testCategoryExtensionPoint" ) );
- suite.addTest( new BasicTests( "testDefaultVersionComparator" ) );
- suite.addTest( new BasicTests( "testCustomVersionComparator" ) );
- suite.addTest( new BasicTests( "testVersionExpressions" ) );
- suite.addTest( new BasicTests( "testVersionExpressionsWithUnknownVersions" ) );
- suite.addTest( new BasicTests( "testConstraints" ) );
- suite.addTest( new BasicTests( "testConstraintApi" ) );
-
- return suite;
- }
-
- public void testProjectFacetExtensionPoint()
- {
- assertTrue( ProjectFacetsManager.isProjectFacetDefined( "facet1" ) );
- final IProjectFacet f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- assertTrue( ProjectFacetsManager.getProjectFacets().contains( f1 ) );
-
- assertEquals( f1.getId(), "facet1" );
- assertEquals( f1.getLabel(), "Facet 1" );
- assertEquals( f1.getDescription(), "This is the description of facet1." );
- assertEquals( f1.getPluginId(), PLUGIN_ID );
-
- assertTrue( ProjectFacetsManager.isProjectFacetDefined( "facet2" ) );
- final IProjectFacet f2 = ProjectFacetsManager.getProjectFacet( "facet2" );
- assertTrue( ProjectFacetsManager.getProjectFacets().contains( f2 ) );
-
- assertEquals( f2.getId(), "facet2" );
- assertEquals( f2.getLabel(), "facet2" );
- assertEquals( f2.getDescription(), "" );
- assertEquals( f2.getPluginId(), PLUGIN_ID );
- }
-
- public void testProjectFacetVersionExtensionPoint()
- {
- assertTrue( f1.hasVersion( "1.0" ) );
- final IProjectFacetVersion f1v10 = f1.getVersion( "1.0" );
- assertEquals( f1v10.getVersionString(), "1.0" );
- assertEquals( f1v10.getProjectFacet(), f1 );
- assertEquals( f1v10.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "1.2" ) );
- final IProjectFacetVersion f1v12 = f1.getVersion( "1.2" );
- assertEquals( f1v12.getVersionString(), "1.2" );
- assertEquals( f1v12.getProjectFacet(), f1 );
- assertEquals( f1v12.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "1.2.1" ) );
- final IProjectFacetVersion f1v121 = f1.getVersion( "1.2.1" );
- assertEquals( f1v121.getVersionString(), "1.2.1" );
- assertEquals( f1v121.getProjectFacet(), f1 );
- assertEquals( f1v121.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "1.3" ) );
- final IProjectFacetVersion f1v13 = f1.getVersion( "1.3" );
- assertEquals( f1v13.getVersionString(), "1.3" );
- assertEquals( f1v13.getProjectFacet(), f1 );
- assertEquals( f1v13.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "2.0" ) );
- final IProjectFacetVersion f1v20 = f1.getVersion( "2.0" );
- assertEquals( f1v20.getVersionString(), "2.0" );
- assertEquals( f1v20.getProjectFacet(), f1 );
- assertEquals( f1v20.getPluginId(), PLUGIN_ID );
-
- assertEquals( f1.getVersions(),
- asSet( f1v10, f1v12, f1v121, f1v13, f1v20 ) );
-
- assertTrue( f2.hasVersion( "3.5" ) );
- final IProjectFacetVersion f2v35 = f2.getVersion( "3.5" );
- assertEquals( f2v35.getVersionString(), "3.5" );
- assertEquals( f2v35.getProjectFacet(), f2 );
- assertEquals( f2v35.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "3.5#a" ) );
- final IProjectFacetVersion f2v35a = f2.getVersion( "3.5#a" );
- assertEquals( f2v35a.getVersionString(), "3.5#a" );
- assertEquals( f2v35a.getProjectFacet(), f2 );
- assertEquals( f2v35a.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "4.7" ) );
- final IProjectFacetVersion f2v47 = f2.getVersion( "4.7" );
- assertEquals( f2v47.getVersionString(), "4.7" );
- assertEquals( f2v47.getProjectFacet(), f2 );
- assertEquals( f2v47.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "4.7#b" ) );
- final IProjectFacetVersion f2v47b = f2.getVersion( "4.7#b" );
- assertEquals( f2v47b.getVersionString(), "4.7#b" );
- assertEquals( f2v47b.getProjectFacet(), f2 );
- assertEquals( f2v47b.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "4.7#c" ) );
- final IProjectFacetVersion f2v47c = f2.getVersion( "4.7#c" );
- assertEquals( f2v47c.getVersionString(), "4.7#c" );
- assertEquals( f2v47c.getProjectFacet(), f2 );
- assertEquals( f2v47c.getPluginId(), PLUGIN_ID );
-
- assertEquals( f2.getVersions(),
- asSet( f2v35, f2v35a, f2v47, f2v47b, f2v47c ) );
-
- // Check for version that doesn't exist.
-
- assertFalse( f2.hasVersion( "6.9" ) );
-
- try
- {
- f2.getVersion( "6.9" );
- fail();
- }
- catch( IllegalArgumentException e ) {}
- }
-
- public void testCategoryExtensionPoint()
- {
- assertTrue( ProjectFacetsManager.isCategoryDefined( "cat1" ) );
- final ICategory cat1 = ProjectFacetsManager.getCategory( "cat1" );
- assertTrue( ProjectFacetsManager.getCategories().contains( cat1 ) );
-
- assertEquals( cat1.getId(), "cat1" );
- assertEquals( cat1.getLabel(), "Category 1" );
- assertEquals( cat1.getDescription(), "This is the category description." );
- assertEquals( cat1.getPluginId(), PLUGIN_ID );
-
- assertEquals( cat1.getProjectFacets(), asSet( f2, f2ext ) );
- assertEquals( f2.getCategory(), cat1 );
- assertEquals( f2ext.getCategory(), cat1 );
-
- assertTrue( ProjectFacetsManager.isCategoryDefined( "cat2" ) );
- final ICategory cat2 = ProjectFacetsManager.getCategory( "cat2" );
- assertTrue( ProjectFacetsManager.getCategories().contains( cat2 ) );
-
- assertEquals( cat2.getId(), "cat2" );
- assertEquals( cat2.getLabel(), "cat2" );
- assertEquals( cat2.getDescription(), "" );
- assertEquals( cat2.getPluginId(), PLUGIN_ID );
-
- assertEquals( cat2.getProjectFacets(), asSet( f3a, f3b, f3c ) );
- assertEquals( f3a.getCategory(), cat2 );
- assertEquals( f3b.getCategory(), cat2 );
- assertEquals( f3c.getCategory(), cat2 );
- }
-
- @SuppressWarnings( "unchecked" )
- public void testDefaultVersionComparator()
-
- throws CoreException
-
- {
- final Comparator<String> comp = f1.getVersionComparator();
-
- assertEquals( comp.getClass().getName(),
- "org.eclipse.wst.common.project.facet.core.DefaultVersionComparator" );
-
- assertTrue( comp.compare( "1.0", "1.2" ) < 0 );
- assertTrue( comp.compare( "1.2", "1.2.1" ) < 0 );
- assertTrue( comp.compare( "1.2.1", "2.0" ) < 0 );
-
- assertTrue( comp.compare( "1.2", "1.0" ) > 0 );
- assertTrue( comp.compare( "1.2.1", "1.2" ) > 0 );
- assertTrue( comp.compare( "2.0", "1.2.1" ) > 0 );
-
- assertTrue( comp.compare( "1.0", "1.0" ) == 0 );
- assertTrue( comp.compare( "1.2", "1.2" ) == 0 );
- assertTrue( comp.compare( "1.2.1", "1.2.1" ) == 0 );
- assertTrue( comp.compare( "2.0", "2.0" ) == 0 );
-
- assertTrue( f1v10.compareTo( f1v12 ) < 0 );
- assertTrue( f1v12.compareTo( f1v121 ) < 0 );
- assertTrue( f1v121.compareTo( f1v20 ) < 0 );
-
- assertTrue( f1v12.compareTo( f1v10 ) > 0 );
- assertTrue( f1v121.compareTo( f1v12 ) > 0 );
- assertTrue( f1v20.compareTo( f1v121 ) > 0 );
-
- assertTrue( f1v10.compareTo( f1v10 ) == 0 );
- assertTrue( f1v12.compareTo( f1v12 ) == 0 );
- assertTrue( f1v121.compareTo( f1v121 ) == 0 );
- assertTrue( f1v20.compareTo( f1v20 ) == 0 );
-
- assertEquals( f1.getLatestVersion(), f1v20 );
-
- final List asc = f1.getSortedVersions( true );
-
- assertEquals( asc.size(), 5 );
- assertEquals( asc.get( 0 ), f1v10 );
- assertEquals( asc.get( 1 ), f1v12 );
- assertEquals( asc.get( 2 ), f1v121 );
- assertEquals( asc.get( 3 ), f1v13 );
- assertEquals( asc.get( 4 ), f1v20 );
-
- final List desc = f1.getSortedVersions( false );
-
- assertEquals( desc.size(), 5 );
- assertEquals( desc.get( 0 ), f1v20 );
- assertEquals( desc.get( 1 ), f1v13 );
- assertEquals( desc.get( 2 ), f1v121 );
- assertEquals( desc.get( 3 ), f1v12 );
- assertEquals( desc.get( 4 ), f1v10 );
- }
-
- @SuppressWarnings( "unchecked" )
- public void testCustomVersionComparator()
-
- throws CoreException
-
- {
- final Comparator<String> comp = f2.getVersionComparator();
-
- assertEquals( comp.getClass().getName(),
- "org.eclipse.wst.common.project.facet.core.tests.support.CustomVersionComparator" );
-
- assertTrue( comp.compare( "3.5", "4.7" ) < 0 );
- assertTrue( comp.compare( "3.5", "3.5#a" ) < 0 );
- assertTrue( comp.compare( "4.7#c", "4.7#b" ) < 0 );
-
- assertTrue( comp.compare( "4.7", "3.5" ) > 0 );
- assertTrue( comp.compare( "3.5#a", "3.5" ) > 0 );
- assertTrue( comp.compare( "4.7#b", "4.7#c" ) > 0 );
-
- assertTrue( comp.compare( "3.5", "3.5" ) == 0 );
- assertTrue( comp.compare( "3.5#a", "3.5#a" ) == 0 );
- assertTrue( comp.compare( "4.7", "4.7" ) == 0 );
- assertTrue( comp.compare( "4.7#b", "4.7#b" ) == 0 );
-
- assertTrue( f2v35.compareTo( f2v47 ) < 0 );
- assertTrue( f2v35.compareTo( f2v35a ) < 0 );
- assertTrue( f2v47c.compareTo( f2v47b ) < 0 );
-
- assertTrue( f2v47.compareTo( f2v35 ) > 0 );
- assertTrue( f2v35a.compareTo( f2v35 ) > 0 );
- assertTrue( f2v47b.compareTo( f2v47c ) > 0 );
-
- assertTrue( f2v35.compareTo( f2v35 ) == 0 );
- assertTrue( f2v35a.compareTo( f2v35a ) == 0 );
- assertTrue( f2v47.compareTo( f2v47 ) == 0 );
- assertTrue( f2v47b.compareTo( f2v47b ) == 0 );
-
- assertEquals( f2.getLatestVersion(), f2v47b );
-
- final List asc = f2.getSortedVersions( true );
-
- assertEquals( asc.size(), 5 );
- assertEquals( asc.get( 0 ), f2v35 );
- assertEquals( asc.get( 1 ), f2v35a );
- assertEquals( asc.get( 2 ), f2v47 );
- assertEquals( asc.get( 3 ), f2v47c );
- assertEquals( asc.get( 4 ), f2v47b );
-
- final List desc = f2.getSortedVersions( false );
-
- assertEquals( desc.size(), 5 );
- assertEquals( desc.get( 0 ), f2v47b );
- assertEquals( desc.get( 1 ), f2v47c );
- assertEquals( desc.get( 2 ), f2v47 );
- assertEquals( desc.get( 3 ), f2v35a );
- assertEquals( desc.get( 4 ), f2v35 );
- }
-
- public void testVersionExpressions()
-
- throws CoreException
-
- {
- assertEquals( f1.getVersions( "1.2" ),
- asSet( f1v12 ) );
-
- assertEquals( f1.getVersions( "1.2,1.3" ),
- asSet( f1v12, f1v13 ) );
-
- assertEquals( f1.getVersions( "1.0,1.2,1.2.1,1.3,2.0" ),
- asSet( f1v10, f1v12, f1v121, f1v13, f1v20 ) );
-
- assertEquals( f1.getVersions( "[1.2" ),
- asSet( f1v12, f1v121, f1v13, f1v20 ) );
-
- assertEquals( f1.getVersions( "(1.2" ),
- asSet( f1v121, f1v13, f1v20 ) );
-
- assertEquals( f1.getVersions( "1.3]" ),
- asSet( f1v10, f1v12, f1v121, f1v13 ) );
-
- assertEquals( f1.getVersions( "1.3)" ),
- asSet( f1v10, f1v12, f1v121 ) );
-
- assertEquals( f1.getVersions( "[1.2-1.3]" ),
- asSet( f1v12, f1v121, f1v13 ) );
-
- assertEquals( f1.getVersions( "[1.2-1.3)" ),
- asSet( f1v12, f1v121 ) );
-
- assertEquals( f1.getVersions( "(1.2-1.3]" ),
- asSet( f1v121, f1v13 ) );
-
- assertEquals( f1.getVersions( "1.0,(1.2-1.3],2.0" ),
- asSet( f1v10, f1v121, f1v13, f1v20 ) );
- }
-
- /**
- * Tests the cases where version expressions make references to facet versions that don't
- * actually exist.
- *
- * @throws CoreException
- */
-
- public void testVersionExpressionsWithUnknownVersions()
-
- throws CoreException
-
- {
- assertEquals( f1.getVersions( "[0.5-1.2]" ), asSet( f1v10, f1v12 ) );
- assertEquals( f1.getVersions( "[1.2.2-2.0]" ), asSet( f1v13, f1v20 ) );
- assertEquals( f1.getVersions( "[0.5-10.0)" ), asSet( f1v10, f1v12, f1v121, f1v13, f1v20 ) );
- assertEquals( f1.getVersions( "[10.0-25]" ), Collections.emptySet() );
- assertEquals( f1.getVersions( "3.0,4.5" ), Collections.emptySet() );
- assertEquals( f1.getVersions( "5.7" ), Collections.emptySet() );
- }
-
- @SuppressWarnings( "unchecked" )
- public void testConstraints()
- {
- /*
- * Version: 3.5
- *
- * <requires facet="facet1" version="1.0"/>
- */
-
- assertFalse( f2v35.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertTrue( f2v35.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 3.5#a
- *
- * <and>
- * <requires facet="facet1" version="[1.2-1.3)"/>
- * </and>
- */
-
- assertFalse( f2v35a.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v35a.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertTrue( f2v35a.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertTrue( f2v35a.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertFalse( f2v35a.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertFalse( f2v35a.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 4.7
- *
- * <or>
- * <requires facet="facet1" version="[1.3"/>
- * </or>
- */
-
- assertFalse( f2v47.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v47.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v47.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertFalse( f2v47.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertTrue( f2v47.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertTrue( f2v47.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 4.7#b
- *
- * <or>
- * <requires facet="facet1" version="1.3"/>
- * <requires facet="facet1" version="2.0"/>
- * </or>
- */
-
- assertFalse( f2v47b.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v47b.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v47b.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertFalse( f2v47b.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertTrue( f2v47b.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertTrue( f2v47b.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 4.7#c
- *
- * <and>
- * <or>
- * <requires facet="facet1" version="1.2.1"/>
- * <requires facet="facet1" version="1.3"/>
- * <requires facet="facet1" version="2.0"/>
- * </or>
- * <conflicts facet="facet3a"/>
- * <conflicts facet="facet3b" version="1.0"/>
- * <conflicts group="group1"/>
- * </and>
- */
-
- assertFalse( f2v47c.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3av10 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3av20 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3bv10 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v20, f3bv20 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3cv10 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3cv20 ) ).isOK() );
- }
-
- public void testConstraintApi()
- {
- assertEquals( IConstraint.Type.AND.name(), "and" );
- assertTrue( IConstraint.Type.valueOf( "and" ) == IConstraint.Type.AND );
- assertTrue( IConstraint.Type.valueOf( "aNd" ) == IConstraint.Type.AND );
-
- assertEquals( IConstraint.Type.OR.name(), "or" );
- assertTrue( IConstraint.Type.valueOf( "or" ) == IConstraint.Type.OR );
- assertTrue( IConstraint.Type.valueOf( "oR" ) == IConstraint.Type.OR );
-
- assertEquals( IConstraint.Type.REQUIRES.name(), "requires" );
- assertTrue( IConstraint.Type.valueOf( "requires" ) == IConstraint.Type.REQUIRES );
- assertTrue( IConstraint.Type.valueOf( "rEqUiRes" ) == IConstraint.Type.REQUIRES );
-
- assertEquals( IConstraint.Type.CONFLICTS.name(), "conflicts" );
- assertTrue( IConstraint.Type.valueOf( "conflicts" ) == IConstraint.Type.CONFLICTS );
- assertTrue( IConstraint.Type.valueOf( "cOnFlIcTs" ) == IConstraint.Type.CONFLICTS );
-
- /*
- * <and>
- * <or>
- * <requires facet="facet1" version="1.2.1"/>
- * <requires facet="facet1" version="1.3"/>
- * <requires facet="facet1" version="2.0"/>
- * </or>
- * <conflicts facet="facet3a"/>
- * <conflicts facet="facet3b" version="1.0"/>
- * <conflicts group="group1"/>
- * </and>
- */
-
- assertTrue( ProjectFacetsManager.isGroupDefined( "group1" ) );
- final IGroup g = ProjectFacetsManager.getGroup( "group1" );
- assertEquals( g.getId(), "group1" );
- assertEquals( g.getMembers(), asSet( f2v47c, f3cv10, f3cv20 ) );
-
- final IConstraint root = f2v47c.getConstraint();
- checkConstraint( root, IConstraint.Type.AND, null, null, null, null );
-
- IConstraint c1, c2;
-
- c1 = (IConstraint) root.getOperand( 0 );
- checkConstraint( c1, IConstraint.Type.OR, null, null, null );
-
- c2 = (IConstraint) c1.getOperand( 0 );
- checkConstraint( c2, IConstraint.Type.REQUIRES, f1, "1.2.1", Boolean.FALSE );
-
- c2 = (IConstraint) c1.getOperand( 1 );
- checkConstraint( c2, IConstraint.Type.REQUIRES, f1, "1.3", Boolean.FALSE );
-
- c2 = (IConstraint) c1.getOperand( 2 );
- checkConstraint( c2, IConstraint.Type.REQUIRES, f1, "2.0", Boolean.FALSE );
-
- c1 = (IConstraint) root.getOperand( 1 );
- checkConstraint( c1, IConstraint.Type.CONFLICTS, f3a, "*" );
-
- c1 = (IConstraint) root.getOperand( 2 );
- checkConstraint( c1, IConstraint.Type.CONFLICTS, f3b, "1.0" );
-
- c1 = (IConstraint) root.getOperand( 3 );
- checkConstraint( c1, IConstraint.Type.CONFLICTS, g );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand )
- {
- checkConstraint( c, expectedType, new Object[] { expectedOperand } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand1,
- final Object expectedOperand2 )
- {
- checkConstraint( c, expectedType,
- new Object[] { expectedOperand1, expectedOperand2 } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand1,
- final Object expectedOperand2,
- final Object expectedOperand3 )
- {
- checkConstraint( c, expectedType,
- new Object[] { expectedOperand1, expectedOperand2,
- expectedOperand3 } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand1,
- final Object expectedOperand2,
- final Object expectedOperand3,
- final Object expectedOperand4 )
- {
- checkConstraint( c, expectedType,
- new Object[] { expectedOperand1, expectedOperand2,
- expectedOperand3, expectedOperand4 } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object[] expectedOperands )
- {
- assertEquals( c.getType(), expectedType );
-
- final int count = c.getOperands().size();
- assertEquals( count, expectedOperands.length );
-
- final List<Object> list = new ArrayList<Object>();
-
- for( int i = 0; i < count; i++ )
- {
- final Object operand = c.getOperand( i );
- final Object expected = expectedOperands[ i ];
-
- if( expected != null )
- {
- if( ( expected instanceof String ) &&
- ! ( operand instanceof String ) )
- {
- assertEquals( operand.toString(), expected );
- }
- else
- {
- assertEquals( operand, expected );
- }
- }
-
- list.add( c.getOperand( i ) );
- }
-
- assertEquals( c.getOperands(), list );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/DefaultVersionTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/DefaultVersionTests.java
deleted file mode 100644
index 449f9a3..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/DefaultVersionTests.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.common.project.facet.core.IDefaultVersionProvider;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class DefaultVersionTests
-
- extends TestCase
-
-{
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v4;
-
- private static IProjectFacet f2;
- private static IProjectFacetVersion f2v2;
-
- private static IProjectFacet f3;
- private static IProjectFacetVersion f3v3;
-
- private static IProjectFacet f4;
- private static IProjectFacetVersion f4v4;
-
- private static IProjectFacet f5;
- private static IProjectFacetVersion f5v4;
-
- private static IProjectFacet f6;
- private static IProjectFacetVersion f6v4;
-
- private static IProjectFacet f7;
- private static IProjectFacetVersion f7v4;
-
- static
- {
- f1 = ProjectFacetsManager.getProjectFacet( "dvt_f1" );
- f1v4 = f1.getVersion( "4.0" );
-
- f2 = ProjectFacetsManager.getProjectFacet( "dvt_f2" );
- f2v2 = f2.getVersion( "2.0" );
-
- f3 = ProjectFacetsManager.getProjectFacet( "dvt_f3" );
- f3v3 = f3.getVersion( "3.0" );
-
- f4 = ProjectFacetsManager.getProjectFacet( "dvt_f4" );
- f4v4 = f4.getVersion( "4.0" );
-
- f5 = ProjectFacetsManager.getProjectFacet( "dvt_f5" );
- f5v4 = f5.getVersion( "4.0" );
-
- f6 = ProjectFacetsManager.getProjectFacet( "dvt_f6" );
- f6v4 = f6.getVersion( "4.0" );
-
- f7 = ProjectFacetsManager.getProjectFacet( "dvt_f7" );
- f7v4 = f7.getVersion( "4.0" );
- }
-
- private DefaultVersionTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Default Version Tests" );
-
- suite.addTest( new DefaultVersionTests( "testUnspecifiedDefaultVersion" ) );
- suite.addTest( new DefaultVersionTests( "testStaticDefaultVersion" ) );
- suite.addTest( new DefaultVersionTests( "testDefaultVersionProvider" ) );
- suite.addTest( new DefaultVersionTests( "testBadDefaultVersionProvider1" ) );
- suite.addTest( new DefaultVersionTests( "testBadDefaultVersionProvider2" ) );
- suite.addTest( new DefaultVersionTests( "testBadDefaultVersionProvider3" ) );
- suite.addTest( new DefaultVersionTests( "testBadDefaultVersion" ) );
-
- return suite;
- }
-
- public void testUnspecifiedDefaultVersion()
- {
- assertEquals( f1.getDefaultVersion(), f1v4 );
- }
-
- public void testStaticDefaultVersion()
- {
- assertEquals( f2.getDefaultVersion(), f2v2 );
- }
-
- public void testDefaultVersionProvider()
- {
- assertEquals( f3.getDefaultVersion(), f3v3 );
- }
-
- /**
- * Tests the handling of the case where the associated default version
- * provider returns a version that doesn't belong to the facet that the
- * version provider is associated with.
- */
-
- public void testBadDefaultVersionProvider1()
- {
- assertEquals( f4.getDefaultVersion(), f4v4 );
- }
-
- /**
- * Tests the handling of the case where the associated default version
- * provider throws an exception when invoked.
- */
-
- public void testBadDefaultVersionProvider2()
- {
- assertEquals( f5.getDefaultVersion(), f5v4 );
- }
-
- /**
- * Tests the handling of the case where the associated default version
- * provider returns null.
- */
-
- public void testBadDefaultVersionProvider3()
- {
- assertEquals( f6.getDefaultVersion(), f6v4 );
- }
-
- /**
- * Tests the handling of the case where the specified static default version
- * is not defined for the facet.
- */
-
- public void testBadDefaultVersion()
- {
- assertEquals( f7.getDefaultVersion(), f7v4 );
- }
-
- public static final class FacetDvtF3DefaultVersionProvider
-
- implements IDefaultVersionProvider
-
- {
-
- public IProjectFacetVersion getDefaultVersion()
- {
- return ProjectFacetsManager.getProjectFacet( "dvt_f3" ).getVersion( "3.0" );
- }
- }
-
- public static final class FacetDvtF5DefaultVersionProvider
-
- implements IDefaultVersionProvider
-
- {
- public IProjectFacetVersion getDefaultVersion()
- {
- throw new RuntimeException();
- }
- }
-
- public static final class FacetDvtF6DefaultVersionProvider
-
- implements IDefaultVersionProvider
-
- {
- public IProjectFacetVersion getDefaultVersion()
- {
- return null;
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/EventDeliveryTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/EventDeliveryTests.java
deleted file mode 100644
index afd08a2..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/EventDeliveryTests.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.asSet;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
-import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-@SuppressWarnings( "unused" )
-public final class EventDeliveryTests
-
- extends AbstractTests
-
-{
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v20;
-
- private static IProjectFacet f2;
- private static IProjectFacetVersion f2v11;
- private static IProjectFacetVersion f2v21;
-
- private static IProjectFacet f3;
- private static IProjectFacetVersion f3v12;
- private static IProjectFacetVersion f3v22;
-
- private static IProjectFacet f4;
- private static IProjectFacetVersion f4v13;
- private static IProjectFacetVersion f4v23;
-
- static
- {
- f1 = ProjectFacetsManager.getProjectFacet( "edt_f1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v20 = f1.getVersion( "2.0" );
-
- f2 = ProjectFacetsManager.getProjectFacet( "edt_f2" );
- f2v11 = f2.getVersion( "1.1" );
- f2v21 = f2.getVersion( "2.1" );
-
- f3 = ProjectFacetsManager.getProjectFacet( "edt_f3" );
- f3v12 = f3.getVersion( "1.2" );
- f3v22 = f3.getVersion( "2.2" );
-
- f4 = ProjectFacetsManager.getProjectFacet( "edt_f4" );
- f4v13 = f4.getVersion( "1.3" );
- f4v23 = f4.getVersion( "2.3" );
- }
-
- private EventDeliveryTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Event Delivery Tests" );
-
- suite.addTest( new EventDeliveryTests( "testEventDelivery" ) );
-
- return suite;
- }
-
- public void testEventDelivery()
-
- throws CoreException
-
- {
- // Create a test project.
-
- final IFacetedProject fpj = createFacetedProject();
-
- // Setup listeners.
-
- final Listener fullListenerProjectApi = new Listener();
- fpj.addListener( fullListenerProjectApi );
-
- final Listener fullListenerGlobalApi = new Listener();
- FacetedProjectFramework.addListener( fullListenerGlobalApi );
-
- final Listener partialListenerProjectApi = new Listener();
-
- fpj.addListener( partialListenerProjectApi, IFacetedProjectEvent.Type.PRE_INSTALL,
- IFacetedProjectEvent.Type.FIXED_FACETS_CHANGED );
-
- final Listener partialListenerGlobalApi = new Listener();
-
- FacetedProjectFramework.addListener( partialListenerGlobalApi,
- IFacetedProjectEvent.Type.PRE_INSTALL,
- IFacetedProjectEvent.Type.FIXED_FACETS_CHANGED );
-
- if( FullExtensionBasedListener.instance != null )
- {
- FullExtensionBasedListener.instance.retrieveDeliveredEvents();
- }
-
- if( PartialExtensionBasedListener.instance != null )
- {
- PartialExtensionBasedListener.instance.retrieveDeliveredEvents();
- }
-
- addTearDownOperation
- (
- new Runnable()
- {
- public void run()
- {
- FacetedProjectFramework.removeListener( fullListenerGlobalApi );
- FacetedProjectFramework.removeListener( partialListenerGlobalApi );
- }
- }
- );
-
- // Run through a series of operations, checking to make sure that the listeners are seeing
- // the expected events.
-
- fpj.setFixedProjectFacets( asSet( f1, f2 ) );
-
- check( fullListenerProjectApi, Resources.fullStep1 );
- check( fullListenerGlobalApi, Resources.fullStep1 );
- check( FullExtensionBasedListener.instance, Resources.fullStep1 );
- check( partialListenerProjectApi, Resources.partialStep1 );
- check( partialListenerGlobalApi, Resources.partialStep1 );
- check( PartialExtensionBasedListener.instance, Resources.partialStep1 );
-
- fpj.modify( asSet( new Action( Action.Type.INSTALL, f1v10, null ),
- new Action( Action.Type.INSTALL, f2v11, null ),
- new Action( Action.Type.INSTALL, f3v12, null ) ), null );
-
- check( fullListenerProjectApi, Resources.fullStep2 );
- check( fullListenerGlobalApi, Resources.fullStep2 );
- check( FullExtensionBasedListener.instance, Resources.fullStep2 );
- check( partialListenerProjectApi, Resources.partialStep2 );
- check( partialListenerGlobalApi, Resources.partialStep2 );
- check( PartialExtensionBasedListener.instance, Resources.partialStep2 );
-
- fpj.installProjectFacet( f4v13, null, null );
-
- check( fullListenerProjectApi, Resources.fullStep3 );
- check( fullListenerGlobalApi, Resources.fullStep3 );
- check( FullExtensionBasedListener.instance, Resources.fullStep3 );
- check( partialListenerProjectApi, Resources.partialStep3 );
- check( partialListenerGlobalApi, Resources.partialStep3 );
- check( PartialExtensionBasedListener.instance, Resources.partialStep3 );
-
- fpj.uninstallProjectFacet( f3v12, null, null );
-
- check( fullListenerProjectApi, Resources.fullStep4 );
- check( fullListenerGlobalApi, Resources.fullStep4 );
- check( FullExtensionBasedListener.instance, Resources.fullStep4 );
- check( partialListenerProjectApi, Resources.partialStep4 );
- check( partialListenerGlobalApi, Resources.partialStep4 );
- check( PartialExtensionBasedListener.instance, Resources.partialStep4 );
-
- fpj.setFixedProjectFacets( asSet( f4 ) );
-
- check( fullListenerProjectApi, Resources.fullStep5 );
- check( fullListenerGlobalApi, Resources.fullStep5 );
- check( FullExtensionBasedListener.instance, Resources.fullStep5 );
- check( partialListenerProjectApi, Resources.partialStep5 );
- check( partialListenerGlobalApi, Resources.partialStep5 );
- check( PartialExtensionBasedListener.instance, Resources.partialStep5 );
-
- fpj.modify( asSet( new Action( Action.Type.VERSION_CHANGE, f1v20, null ),
- new Action( Action.Type.VERSION_CHANGE, f4v23, null ) ), null );
-
- check( fullListenerProjectApi, Resources.fullStep6 );
- check( fullListenerGlobalApi, Resources.fullStep6 );
- check( FullExtensionBasedListener.instance, Resources.fullStep6 );
- check( partialListenerProjectApi, Resources.partialStep6 );
- check( partialListenerGlobalApi, Resources.partialStep6 );
- check( PartialExtensionBasedListener.instance, Resources.partialStep6 );
- }
-
- private static String toString( final List<IFacetedProjectEvent> events )
- {
- final StringBuilder buf = new StringBuilder();
-
- for( IFacetedProjectEvent event : events )
- {
- buf.append( event.toString() ).append( '\n' );
- }
-
- return buf.toString();
- }
-
- private static void check( final Listener listener,
- final String expectedEvents )
- {
- final String actual = toString( listener.retrieveDeliveredEvents() ).trim();
- final String expected = expectedEvents.trim();
-
- assertEquals( expected, actual );
- }
-
- private static class Listener
-
- implements IFacetedProjectListener
-
- {
- private final List<IFacetedProjectEvent> events = new ArrayList<IFacetedProjectEvent>();
-
- public final void handleEvent( final IFacetedProjectEvent event )
- {
- this.events.add( event );
- }
-
- public final List<IFacetedProjectEvent> retrieveDeliveredEvents()
- {
- final List<IFacetedProjectEvent> result
- = new ArrayList<IFacetedProjectEvent>( this.events );
-
- this.events.clear();
-
- return result;
- }
- }
-
- public static final class FullExtensionBasedListener
-
- extends Listener
-
- {
- public static Listener instance = null;
-
- public FullExtensionBasedListener()
- {
- instance = this;
- }
- }
-
- public static final class PartialExtensionBasedListener
-
- extends Listener
-
- {
- public static Listener instance = null;
-
- public PartialExtensionBasedListener()
- {
- instance = this;
- }
- }
-
- public static final class Resources
-
- extends NLS
-
- {
- public static String fullStep1;
- public static String fullStep2;
- public static String fullStep3;
- public static String fullStep4;
- public static String fullStep5;
- public static String fullStep6;
- public static String partialStep1;
- public static String partialStep2;
- public static String partialStep3;
- public static String partialStep4;
- public static String partialStep5;
- public static String partialStep6;
-
- static
- {
- initializeMessages( EventDeliveryTests.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/EventDeliveryTests.properties b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/EventDeliveryTests.properties
deleted file mode 100644
index 13fd967..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/EventDeliveryTests.properties
+++ /dev/null
@@ -1,123 +0,0 @@
-fullStep1 = \
-<event project\="testProject" type\="FIXED_FACETS_CHANGED">\n\
-\ <old-fixed-facets>\n\
-\ </old-fixed-facets>\n\
-\ <new-fixed-facets>\n\
-\ <facet id\="edt_f1"/>\n\
-\ <facet id\="edt_f2"/>\n\
-\ </new-fixed-facets>\n\
-</event>\n\
-<event project\="testProject" type\="PROJECT_MODIFIED">\n\
-</event>
-
-fullStep2 = \
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f1" version\="1.0"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_INSTALL">\n\
-\ <facet id\="edt_f1" version\="1.0"/>\n\
-</event>\n\
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f2" version\="1.1"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_INSTALL">\n\
-\ <facet id\="edt_f2" version\="1.1"/>\n\
-</event>\n\
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f3" version\="1.2"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_INSTALL">\n\
-\ <facet id\="edt_f3" version\="1.2"/>\n\
-</event>\n\
-<event project\="testProject" type\="PROJECT_MODIFIED">\n\
-</event>
-
-fullStep3 = \
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f4" version\="1.3"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_INSTALL">\n\
-\ <facet id\="edt_f4" version\="1.3"/>\n\
-</event>\n\
-<event project\="testProject" type\="PROJECT_MODIFIED">\n\
-</event>
-
-fullStep4 = \
-<event project\="testProject" type\="PRE_UNINSTALL">\n\
-\ <facet id\="edt_f3" version\="1.2"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_UNINSTALL">\n\
-\ <facet id\="edt_f3" version\="1.2"/>\n\
-</event>\n\
-<event project\="testProject" type\="PROJECT_MODIFIED">\n\
-</event>
-
-fullStep5 = \
-<event project\="testProject" type\="FIXED_FACETS_CHANGED">\n\
-\ <old-fixed-facets>\n\
-\ <facet id\="edt_f1"/>\n\
-\ <facet id\="edt_f2"/>\n\
-\ </old-fixed-facets>\n\
-\ <new-fixed-facets>\n\
-\ <facet id\="edt_f4"/>\n\
-\ </new-fixed-facets>\n\
-</event>\n\
-<event project\="testProject" type\="PROJECT_MODIFIED">\n\
-</event>
-
-fullStep6 = \
-<event project\="testProject" type\="PRE_VERSION_CHANGE">\n\
-\ <facet id\="edt_f1" version\="2.0"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_VERSION_CHANGE">\n\
-\ <facet id\="edt_f1" version\="2.0"/>\n\
-</event>\n\
-<event project\="testProject" type\="PRE_VERSION_CHANGE">\n\
-\ <facet id\="edt_f4" version\="2.3"/>\n\
-</event>\n\
-<event project\="testProject" type\="POST_VERSION_CHANGE">\n\
-\ <facet id\="edt_f4" version\="2.3"/>\n\
-</event>\n\
-<event project\="testProject" type\="PROJECT_MODIFIED">\n\
-</event>
-
-partialStep1 = \
-<event project\="testProject" type\="FIXED_FACETS_CHANGED">\n\
-\ <old-fixed-facets>\n\
-\ </old-fixed-facets>\n\
-\ <new-fixed-facets>\n\
-\ <facet id\="edt_f1"/>\n\
-\ <facet id\="edt_f2"/>\n\
-\ </new-fixed-facets>\n\
-</event>
-
-partialStep2 = \
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f1" version\="1.0"/>\n\
-</event>\n\
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f2" version\="1.1"/>\n\
-</event>\n\
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f3" version\="1.2"/>\n\
-</event>
-
-partialStep3 = \
-<event project\="testProject" type\="PRE_INSTALL">\n\
-\ <facet id\="edt_f4" version\="1.3"/>\n\
-</event>
-
-partialStep4 =
-
-partialStep5 = \
-<event project\="testProject" type\="FIXED_FACETS_CHANGED">\n\
-\ <old-fixed-facets>\n\
-\ <facet id\="edt_f1"/>\n\
-\ <facet id\="edt_f2"/>\n\
-\ </old-fixed-facets>\n\
-\ <new-fixed-facets>\n\
-\ <facet id\="edt_f4"/>\n\
-\ </new-fixed-facets>\n\
-</event>
-
-partialStep6 =
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionSortTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionSortTests.java
deleted file mode 100644
index aa7d7bd..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionSortTests.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import static java.util.Arrays.asList;
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.asSet;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-@SuppressWarnings( "unused" )
-public class FacetActionSortTests
-
- extends TestCase
-
-{
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- private static IProjectFacet f2;
- private static IProjectFacetVersion f2v35;
- private static IProjectFacetVersion f2v35a;
- private static IProjectFacetVersion f2v47;
- private static IProjectFacetVersion f2v47b;
- private static IProjectFacetVersion f2v47c;
-
- private static IProjectFacet f2ext;
- private static IProjectFacetVersion f2extv10;
-
- private static IProjectFacet f3a;
- private static IProjectFacetVersion f3av10;
- private static IProjectFacetVersion f3av20;
-
- private static IProjectFacet f3b;
- private static IProjectFacetVersion f3bv10;
- private static IProjectFacetVersion f3bv20;
-
- private static IProjectFacet f3c;
- private static IProjectFacetVersion f3cv10;
- private static IProjectFacetVersion f3cv20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
-
- f2 = ProjectFacetsManager.getProjectFacet( "facet2" );
- f2v35 = f2.getVersion( "3.5" );
- f2v35a = f2.getVersion( "3.5#a" );
- f2v47 = f2.getVersion( "4.7" );
- f2v47b = f2.getVersion( "4.7#b" );
- f2v47c = f2.getVersion( "4.7#c" );
-
- f2ext = ProjectFacetsManager.getProjectFacet( "facet2ext" );
- f2extv10 = f2ext.getVersion( "1.0" );
-
- f3a = ProjectFacetsManager.getProjectFacet( "facet3a" );
- f3av10 = f3a.getVersion( "1.0" );
- f3av20 = f3a.getVersion( "2.0" );
-
- f3b = ProjectFacetsManager.getProjectFacet( "facet3b" );
- f3bv10 = f3b.getVersion( "1.0" );
- f3bv20 = f3b.getVersion( "2.0" );
-
- f3c = ProjectFacetsManager.getProjectFacet( "facet3c" );
- f3cv10 = f3c.getVersion( "1.0" );
- f3cv20 = f3c.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private FacetActionSortTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Facet Action Sort Tests" );
-
- suite.addTest( new FacetActionSortTests( "testUninstallComesFirst1" ) );
- suite.addTest( new FacetActionSortTests( "testUninstallComesFirst2" ) );
- suite.addTest( new FacetActionSortTests( "testSortStability1" ) );
- suite.addTest( new FacetActionSortTests( "testSortStability2" ) );
-
- return suite;
- }
-
- /**
- * Tests whether the sort places uninstall actions first. This is the
- * control test case. The input already places uninstall first.
- */
-
- public void testUninstallComesFirst1()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.UNINSTALL, f3av10, null );
-
- final List<Action> actions = new ArrayList<Action>();
-
- actions.add( a2 );
- actions.add( a1 );
-
- ProjectFacetsManager.sort( asSet( f3av10 ), actions );
- assertEquals( actions, asList( a2, a1 ) );
- }
-
- /**
- * Tests whether the sort places uninstall actions first. The test case
- * places an install action in front of the uninstall action and checks
- * whether the sort algorithm reverses the order.
- */
-
- public void testUninstallComesFirst2()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.UNINSTALL, f3av10, null );
-
- final List<Action> actions = new ArrayList<Action>();
-
- actions.add( a1 );
- actions.add( a2 );
-
- ProjectFacetsManager.sort( asSet( f3av10 ), actions );
- assertEquals( actions, asList( a2, a1 ) );
- }
-
- /**
- * Tests whether the sort produces "stable" results given unrelated facets.
- * This is the control test case. The input is already in the correct order.
- */
-
- @SuppressWarnings( "unchecked" )
- public void testSortStability1()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.INSTALL, f3av10, null );
-
- final List<Action> actions = new ArrayList<Action>();
-
- actions.add( a1 );
- actions.add( a2 );
-
- ProjectFacetsManager.sort( Collections.EMPTY_SET, actions );
- assertEquals( actions, asList( a1, a2 ) );
- }
-
- /**
- * Tests whether the sort produces "stable" results given unrelated facets.
- * The input facets are in the reverse order.
- */
-
- @SuppressWarnings( "unchecked" )
- public void testSortStability2()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.INSTALL, f3av10, null );
-
- final List<Action> actions = new ArrayList<Action>();
-
- actions.add( a2 );
- actions.add( a1 );
-
- ProjectFacetsManager.sort( Collections.EMPTY_SET, actions );
- assertEquals( actions, asList( a1, a2 ) );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionsTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionsTests.java
deleted file mode 100644
index 48906d5..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionsTests.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.ByteArrayInputStream;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class FacetActionsTests
-
- extends AbstractTests
-
-{
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v1;
- private static IProjectFacetVersion f1v2;
-
- static
- {
- f1 = ProjectFacetsManager.getProjectFacet( "fat_f1" );
- f1v1 = f1.getVersion( "1.0" );
- f1v2 = f1.getVersion( "2.0" );
- }
-
- private FacetActionsTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Facet Actions Tests" );
-
- suite.addTest( new FacetActionsTests( "testMultiVersionInstall1" ) );
- suite.addTest( new FacetActionsTests( "testMultiVersionInstall2" ) );
-
- return suite;
- }
-
- /*
- * The following test cases test the scenario where different
- * implementations of the INSTALL action are provided for two versions of
- * the same facet.
- *
- * Scenario Test Code:
- *
- * testMultiVersionInstall1
- * testMultiVersionInstall2
- * F1v1InstallDelegate
- * F1v2InstallDelegate
- */
-
- public void testMultiVersionInstall1()
-
- throws CoreException
-
- {
- final IFacetedProject fpj = createFacetedProject();
- final IProject pj = fpj.getProject();
- fpj.installProjectFacet( f1v1, null, null );
-
- assertTrue( F1v1InstallDelegate.getMarkerFile( pj ).exists() );
- assertFalse( F1v2InstallDelegate.getMarkerFile( pj ).exists() );
- }
-
- public void testMultiVersionInstall2()
-
- throws CoreException
-
- {
- final IFacetedProject fpj = createFacetedProject();
- final IProject pj = fpj.getProject();
- fpj.installProjectFacet( f1v2, null, null );
-
- assertFalse( F1v1InstallDelegate.getMarkerFile( pj ).exists() );
- assertTrue( F1v2InstallDelegate.getMarkerFile( pj ).exists() );
- }
-
- public static final class F1v1InstallDelegate
-
- implements IDelegate
-
- {
- public static IFile getMarkerFile( final IProject project )
- {
- return project.getFile( "v1marker" );
- }
-
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile marker = getMarkerFile( project );
-
- final ByteArrayInputStream emptyStream
- = new ByteArrayInputStream( new byte[ 0 ] );
-
- marker.create( emptyStream, false, null );
- }
- }
-
- public static final class F1v2InstallDelegate
-
- implements IDelegate
-
- {
- public static IFile getMarkerFile( final IProject project )
- {
- return project.getFile( "v2marker" );
- }
-
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile marker = getMarkerFile( project );
-
- final ByteArrayInputStream emptyStream
- = new ByteArrayInputStream( new byte[ 0 ] );
-
- marker.create( emptyStream, false, null );
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetConstraintsTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetConstraintsTests.java
deleted file mode 100644
index 0f790b6..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetConstraintsTests.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.asSet;
-
-import java.util.Collections;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class FacetConstraintsTests
-
- extends TestCase
-
-{
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
-
- private static IProjectFacet f3;
- private static IProjectFacetVersion f3v10;
-
- private static IProjectFacet f4;
- private static IProjectFacetVersion f4v10;
-
- private static IProjectFacet f5;
- private static IProjectFacetVersion f5v10;
-
- private static IProjectFacet f6;
- private static IProjectFacetVersion f6v10;
- private static IProjectFacetVersion f6v23;
- private static IProjectFacetVersion f6v37;
- private static IProjectFacetVersion f6v40;
- private static IProjectFacetVersion f6v45;
-
- private static IProjectFacet f7;
- private static IProjectFacetVersion f7v10;
- private static IProjectFacetVersion f7v20;
-
- private static IProjectFacet f8;
- private static IProjectFacetVersion f8v10;
- private static IProjectFacetVersion f8v20;
- private static IProjectFacetVersion f8v30;
-
- private static IProjectFacet f9;
- private static IProjectFacetVersion f9v10;
-
- private static IProjectFacet f10;
- private static IProjectFacetVersion f10v10;
- private static IProjectFacetVersion f10v20;
-
- static
- {
- f1 = ProjectFacetsManager.getProjectFacet( "fct_f1" );
- f1v10 = f1.getVersion( "1.0" );
-
- f3 = ProjectFacetsManager.getProjectFacet( "fct_f3" );
- f3v10 = f3.getVersion( "1.0" );
-
- f4 = ProjectFacetsManager.getProjectFacet( "fct_f4" );
- f4v10 = f4.getVersion( "1.0" );
-
- f5 = ProjectFacetsManager.getProjectFacet( "fct_f5" );
- f5v10 = f5.getVersion( "1.0" );
-
- f6 = ProjectFacetsManager.getProjectFacet( "fct_f6" );
- f6v10 = f6.getVersion( "1.0" );
- f6v23 = f6.getVersion( "2.3" );
- f6v37 = f6.getVersion( "3.7" );
- f6v40 = f6.getVersion( "4.0" );
- f6v45 = f6.getVersion( "4.5" );
-
- f7 = ProjectFacetsManager.getProjectFacet( "fct_f7" );
- f7v10 = f7.getVersion( "1.0" );
- f7v20 = f7.getVersion( "2.0" );
-
- f8 = ProjectFacetsManager.getProjectFacet( "fct_f8" );
- f8v10 = f8.getVersion( "1.0" );
- f8v20 = f8.getVersion( "2.0" );
- f8v30 = f8.getVersion( "3.0" );
-
- f9 = ProjectFacetsManager.getProjectFacet( "fct_f9" );
- f9v10 = f9.getVersion( "1.0" );
-
- f10 = ProjectFacetsManager.getProjectFacet( "fct_f10" );
- f10v10 = f10.getVersion( "1.0" );
- f10v20 = f10.getVersion( "2.0" );
- }
-
- private FacetConstraintsTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Facet Constraint Tests" );
-
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict1" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict2" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict3" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict4" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict5" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict6" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict7" ) );
- suite.addTest( new FacetConstraintsTests( "testIndirectConflict8" ) );
- suite.addTest( new FacetConstraintsTests( "testRequiresWithNoVersion" ) );
- suite.addTest( new FacetConstraintsTests( "testRequiresWithUnknownVersion" ) );
- suite.addTest( new FacetConstraintsTests( "testGroupRequires" ) );
- suite.addTest( new FacetConstraintsTests( "testGroupRequiresSoft" ) );
-
- return suite;
- }
-
- /*
- * Tests whether the conflict detection code picks up on an indirect
- * conflict. Also tests that a soft constraint is not used to flag a
- * conflict.
- *
- * Here is the relationship diagram between the five facets involved in
- * this test:
- *
- * conflicts requires
- * f1 ----------------> f2 <---------------- f3
- * f4 <---------------- <---------------- f5
- * conflicts soft requires
- *
- * These case should come back positive for conflict:
- *
- * f1 with f3
- * f3 with f1
- * f4 with f3
- * f3 with f4
- *
- * These case should come back negative for conflict:
- *
- * f1 with f5
- * f5 with f1
- * f4 with f5
- * f5 with f4
- */
-
- public void testIndirectConflict1()
- {
- assertTrue( f1v10.conflictsWith( f3v10 ) );
- }
-
- public void testIndirectConflict2()
- {
- assertTrue( f3v10.conflictsWith( f1v10 ) );
- }
-
- public void testIndirectConflict3()
- {
- assertTrue( f4v10.conflictsWith( f3v10 ) );
- }
-
- public void testIndirectConflict4()
- {
- assertTrue( f3v10.conflictsWith( f4v10 ) );
- }
-
- public void testIndirectConflict5()
- {
- assertFalse( f1v10.conflictsWith( f5v10 ) );
- }
-
- public void testIndirectConflict6()
- {
- assertFalse( f5v10.conflictsWith( f1v10 ) );
- }
-
- public void testIndirectConflict7()
- {
- assertFalse( f4v10.conflictsWith( f5v10 ) );
- }
-
- public void testIndirectConflict8()
- {
- assertFalse( f5v10.conflictsWith( f4v10 ) );
- }
-
- /*
- * Tests the following constraint:
- *
- * <requires facet="fct_f6"/>
- */
-
- @SuppressWarnings( "unchecked" )
- public void testRequiresWithNoVersion()
- {
- assertFalse( f7v10.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertTrue( f7v10.getConstraint().check( asSet( f6v10 ) ).isOK() );
- assertTrue( f7v10.getConstraint().check( asSet( f6v23 ) ).isOK() );
- assertTrue( f7v10.getConstraint().check( asSet( f6v37 ) ).isOK() );
- assertTrue( f7v10.getConstraint().check( asSet( f6v40 ) ).isOK() );
- assertTrue( f7v10.getConstraint().check( asSet( f6v45 ) ).isOK() );
- }
-
- /*
- * Tests the following constraint that specifies versions that don't exist:
- *
- * <requires facet="fct_f6" version="[5.0-6.5)"/>
- */
-
- @SuppressWarnings( "unchecked" )
- public void testRequiresWithUnknownVersion()
- {
- assertFalse( f7v20.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f7v20.getConstraint().check( asSet( f6v10 ) ).isOK() );
- assertFalse( f7v20.getConstraint().check( asSet( f6v23 ) ).isOK() );
- assertFalse( f7v20.getConstraint().check( asSet( f6v37 ) ).isOK() );
- assertFalse( f7v20.getConstraint().check( asSet( f6v40 ) ).isOK() );
- assertFalse( f7v20.getConstraint().check( asSet( f6v45 ) ).isOK() );
- }
-
- /*
- * Tests the "requires any group member" constraint:
- *
- * <requires group="fct_g1"/>
- */
-
- @SuppressWarnings( "unchecked" )
- public void testGroupRequires()
- {
- assertFalse( f10v10.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertTrue( f10v10.getConstraint().check( asSet( f8v10 ) ).isOK() );
- assertTrue( f10v10.getConstraint().check( asSet( f8v20 ) ).isOK() );
- assertFalse( f10v10.getConstraint().check( asSet( f8v30 ) ).isOK() );
- assertTrue( f10v10.getConstraint().check( asSet( f9v10 ) ).isOK() );
- assertFalse( f10v10.getConstraint().check( asSet( f1v10 ) ).isOK() );
- }
-
- /*
- * Tests the soft version of the "requires any group member" constraint:
- *
- * <requires group="fct_g1" soft="true"/>
- */
-
- @SuppressWarnings( "unchecked" )
- public void testGroupRequiresSoft()
- {
- assertTrue( f10v20.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertTrue( f10v20.getConstraint().check( asSet( f8v10 ) ).isOK() );
- assertTrue( f10v20.getConstraint().check( asSet( f8v20 ) ).isOK() );
- assertTrue( f10v20.getConstraint().check( asSet( f8v30 ) ).isOK() );
- assertTrue( f10v20.getConstraint().check( asSet( f9v10 ) ).isOK() );
- assertTrue( f10v20.getConstraint().check( asSet( f1v10 ) ).isOK() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/PresetsTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/PresetsTests.java
deleted file mode 100644
index fa702e3..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/PresetsTests.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f1v121;
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f1v20;
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f2extv10;
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f2v35a;
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f3av10;
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f3bv10;
-import static org.eclipse.wst.common.project.facet.core.tests.BasicTests.f3cv10;
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.asSet;
-
-import java.util.Collections;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IDynamicPreset;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IPresetFactory;
-import org.eclipse.wst.common.project.facet.core.PresetDefinition;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class PresetsTests
-
- extends TestCase
-
-{
- private PresetsTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Presets Tests" );
-
- suite.addTest( new PresetsTests( "testSimpleStaticPresets" ) );
- suite.addTest( new PresetsTests( "testDerivedStaticPresets" ) );
- suite.addTest( new PresetsTests( "testDynamicPresets" ) );
- suite.addTest( new PresetsTests( "testStaticPresetsExtendingDynamicPresets1" ) );
- suite.addTest( new PresetsTests( "testStaticPresetsExtendingDynamicPresets2" ) );
- suite.addTest( new PresetsTests( "testUserDefinedPresets" ) );
-
- return suite;
- }
-
- public void testSimpleStaticPresets()
- {
- assertTrue( ProjectFacetsManager.isPresetDefined( "pt_preset1" ) );
- final IPreset preset1 = ProjectFacetsManager.getPreset( "pt_preset1" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset1 ) );
-
- assertEquals( preset1.getId(), "pt_preset1" );
- assertEquals( preset1.getType(), IPreset.Type.STATIC );
- assertEquals( preset1.getLabel(), "Preset 1" );
- assertEquals( preset1.getDescription(), "This is the description for the first preset." );
- assertEquals( preset1.getProjectFacets(), asSet( f1v20, f2v35a, f2extv10 ) );
-
- assertTrue( ProjectFacetsManager.isPresetDefined( "pt_preset2" ) );
- final IPreset preset2 = ProjectFacetsManager.getPreset( "pt_preset2" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset2 ) );
-
- assertEquals( preset2.getId(), "pt_preset2" );
- assertEquals( preset2.getType(), IPreset.Type.STATIC );
- assertEquals( preset2.getLabel(), "pt_preset2" );
- assertEquals( preset2.getDescription(), "" );
- assertEquals( preset2.getProjectFacets(), asSet( f3av10, f3bv10, f3cv10 ) );
- }
-
- public void testDerivedStaticPresets()
- {
- assertTrue( ProjectFacetsManager.isPresetDefined( "pt_preset3" ) );
- final IPreset preset3 = ProjectFacetsManager.getPreset( "pt_preset3" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset3 ) );
-
- assertEquals( preset3.getId(), "pt_preset3" );
- assertEquals( preset3.getType(), IPreset.Type.STATIC );
- assertEquals( preset3.getProjectFacets(), asSet( f1v121, f2v35a, f2extv10, f3av10 ) );
- }
-
- public void testDynamicPresets()
- {
- assertTrue( ProjectFacetsManager.isPresetDefined( "pt_dyn_preset" ) );
- final IPreset preset = ProjectFacetsManager.getPreset( "pt_dyn_preset" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset ) );
-
- assertEquals( preset.getId(), "pt_dyn_preset" );
- assertEquals( preset.getType(), IPreset.Type.DYNAMIC );
- assertEquals( preset.getLabel(), "pt_dyn_preset" );
- assertEquals( preset.getDescription(), "" );
- assertEquals( preset.getProjectFacets(), Collections.emptySet() );
-
- final IDynamicPreset dynamicPreset = (IDynamicPreset) preset;
- final IPreset resolved = dynamicPreset.resolve( Collections.<String,Object>emptyMap() );
-
- assertEquals( resolved.getId(), "pt_dyn_preset" );
- assertEquals( resolved.getType(), IPreset.Type.STATIC );
- assertEquals( resolved.getLabel(), "Dynamic Preset" );
- assertEquals( resolved.getDescription(), "The description of the dynamic preset." );
- assertEquals( resolved.getProjectFacets(), asSet( f1v20, f2extv10, f3cv10 ) );
- }
-
- public void testStaticPresetsExtendingDynamicPresets1()
- {
- assertTrue( ProjectFacetsManager.isPresetDefined( "pt_static_extending_dynamic_preset_1" ) );
- final IPreset preset = ProjectFacetsManager.getPreset( "pt_static_extending_dynamic_preset_1" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset ) );
-
- assertEquals( preset.getId(), "pt_static_extending_dynamic_preset_1" );
- assertEquals( preset.getType(), IPreset.Type.DYNAMIC );
- assertEquals( preset.getLabel(), "Static Extending Dynamic Preset" );
- assertEquals( preset.getDescription(), "This is the static-dynamic description." );
- assertEquals( preset.getProjectFacets(), Collections.emptySet() );
-
- final IDynamicPreset dynamicPreset = (IDynamicPreset) preset;
- final IPreset resolved = dynamicPreset.resolve( Collections.<String,Object>emptyMap() );
-
- assertEquals( resolved.getId(), "pt_static_extending_dynamic_preset_1" );
- assertEquals( resolved.getType(), IPreset.Type.STATIC );
- assertEquals( resolved.getLabel(), "Static Extending Dynamic Preset" );
- assertEquals( resolved.getDescription(), "This is the static-dynamic description." );
- assertEquals( resolved.getProjectFacets(), asSet( f1v20, f2extv10, f3cv10, f2v35a, f3bv10 ) );
- }
-
- public void testStaticPresetsExtendingDynamicPresets2()
- {
- assertTrue( ProjectFacetsManager.isPresetDefined( "pt_static_extending_dynamic_preset_2" ) );
- final IPreset preset = ProjectFacetsManager.getPreset( "pt_static_extending_dynamic_preset_2" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset ) );
-
- assertEquals( preset.getId(), "pt_static_extending_dynamic_preset_2" );
- assertEquals( preset.getType(), IPreset.Type.DYNAMIC );
- assertEquals( preset.getLabel(), "Static Extending Dynamic Preset 2" );
- assertEquals( preset.getDescription(), "This is the static-dynamic description 2." );
- assertEquals( preset.getProjectFacets(), Collections.emptySet() );
-
- final IDynamicPreset dynamicPreset = (IDynamicPreset) preset;
- final IPreset resolved = dynamicPreset.resolve( Collections.<String,Object>emptyMap() );
-
- assertEquals( resolved.getId(), "pt_static_extending_dynamic_preset_2" );
- assertEquals( resolved.getType(), IPreset.Type.STATIC );
- assertEquals( resolved.getLabel(), "Static Extending Dynamic Preset 2" );
- assertEquals( resolved.getDescription(), "This is the static-dynamic description 2." );
- assertEquals( resolved.getProjectFacets(), asSet( f1v121, f2extv10, f3cv10, f2v35a, f3bv10, f3av10 ) );
- }
-
- public void testUserDefinedPresets()
- {
- assertFalse( ProjectFacetsManager.isPresetDefined( "pt_user_defined" ) );
-
- final IPreset preset
- = ProjectFacetsManager.definePreset( "pt_user_defined", "the description",
- asSet( f1v121, f2extv10 ) );
-
- assertTrue( ProjectFacetsManager.isPresetDefined( preset.getId() ) );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset ) );
-
- assertEquals( preset.getType(), IPreset.Type.USER_DEFINED );
- assertEquals( preset.getLabel(), "pt_user_defined" );
- assertEquals( preset.getDescription(), "the description" );
- assertEquals( preset.getProjectFacets(), asSet( f1v121, f2extv10 ) );
-
- ProjectFacetsManager.deletePreset( preset );
- assertFalse( ProjectFacetsManager.isPresetDefined( "pt_user_defined" ) );
- }
-
- public static final class PresetFactory
-
- implements IPresetFactory
-
- {
- public PresetDefinition createPreset( final String presetId,
- final Map<String,Object> context )
-
- throws CoreException
-
- {
- return new PresetDefinition( "Dynamic Preset", "The description of the dynamic preset.",
- asSet( f1v20, f2extv10, f3cv10 ) );
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectChangeReactionTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectChangeReactionTests.java
deleted file mode 100644
index 4348f46..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectChangeReactionTests.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.asSet;
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.readFromFile;
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.waitForCondition;
-import static org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.writeToFile;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.ICondition;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-@SuppressWarnings( "unused" )
-public final class ProjectChangeReactionTests
-
- extends AbstractTests
-
-{
- private static final String METADATA_FILE
- = ".settings/org.eclipse.wst.common.project.facet.core.xml";
-
- private static final String TEST_PROJECT_NAME = "testProject";
-
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private IProject pj;
- private IFacetedProject fpj;
- private IFile mdfile;
-
- private ProjectChangeReactionTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Project Change Reaction Tests" );
-
- suite.addTest( new ProjectChangeReactionTests( "testReactionToProjectDelete" ) );
- suite.addTest( new ProjectChangeReactionTests( "testReactionToMetadataFileDelete" ) );
- suite.addTest( new ProjectChangeReactionTests( "testReactionToMetadataFileChange" ) );
-
- return suite;
- }
-
- protected void setUp()
-
- throws CoreException
-
- {
- assertFalse( ws.getRoot().getProject( TEST_PROJECT_NAME ).exists() );
-
- this.fpj = ProjectFacetsManager.create( TEST_PROJECT_NAME, null, null );
-
- this.pj = this.fpj.getProject();
- addResourceToCleanup( this.pj );
- assertTrue( this.fpj.getProject().exists() );
-
- this.fpj.installProjectFacet( f1v12, null, null );
- assertEquals( this.fpj.getProjectFacets(), asSet( f1v12 ) );
-
- this.mdfile = this.pj.getFile( METADATA_FILE );
- }
-
- public void testReactionToProjectDelete()
-
- throws CoreException
-
- {
- this.pj.delete( true, null );
-
- waitForCondition( createNoFacetsCondition( this.fpj ) );
- assertNull( ProjectFacetsManager.create( this.pj ) );
- }
-
- public void testReactionToMetadataFileDelete()
-
- throws CoreException
-
- {
- this.mdfile.delete( true, null );
-
- waitForCondition( createNoFacetsCondition( this.fpj ) );
- }
-
- public void testReactionToMetadataFileChange()
-
- throws CoreException, IOException
-
- {
- String contents;
-
- contents = readFromFile( this.mdfile );
- contents = contents.replaceFirst( "1.2", "2.0" );
- writeToFile( this.mdfile, contents );
-
- waitForCondition( createFacetCondition( this.fpj, f1v20 ) );
-
- contents = contents.replaceFirst( "2.0", "1.2.1" );
- writeToFile( this.mdfile, contents );
-
- waitForCondition( createFacetCondition( this.fpj, f1v121 ) );
-
- contents = contents.replaceFirst( "<installed facet=\"facet1\" version=\"1.2.1\"/>", "" );
- writeToFile( this.mdfile, contents );
-
- waitForCondition( createNoFacetsCondition( this.fpj ) );
- }
-
- private static ICondition createNoFacetsCondition( final IFacetedProject fpj )
- {
- return new ICondition()
- {
- public boolean check()
- {
- return fpj.getProjectFacets().size() == 0;
- }
- };
- }
-
- private static ICondition createFacetCondition( final IFacetedProject fpj,
- final IProjectFacetVersion fv )
- {
- return new ICondition()
- {
- public boolean check()
- {
- return fpj.hasProjectFacet( fv );
- }
- };
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectCreationTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectCreationTests.java
deleted file mode 100644
index 72e8665..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectCreationTests.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ProjectCreationTests
-
- extends AbstractTests
-
-{
- private static final String FACETED_PROJECT_NATURE
- = "org.eclipse.wst.common.project.facet.core.nature";
-
- private ProjectCreationTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Project Creation Tests" );
-
- suite.addTest( new ProjectCreationTests( "testCreationFromScratch1" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromScratch2" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromScratch3" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject1" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject2" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject3" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject4" ) );
- suite.addTest( new ProjectCreationTests( "testWrapperCreation1" ) );
- suite.addTest( new ProjectCreationTests( "testWrapperCreation2" ) );
- suite.addTest( new ProjectCreationTests( "testWrapperCreation3" ) );
-
- return suite;
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(String,IPath,IProgressMonitor)}
- * method. In this scenario, there is no project with the same name.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromScratch1()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject proj = fproj.getProject();
-
- assertNotNull( proj );
- assertTrue( proj.exists() );
-
- this.resourcesToCleanup.add( proj );
-
- TestUtils.assertFileContains( proj.getFile( ".project" ), FACETED_PROJECT_NATURE );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(String,IPath,IProgressMonitor)}
- * method. In this scenario, there is a faceted project with the same name.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromScratch2()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- this.resourcesToCleanup.add( fproj.getProject() );
-
- try
- {
- ProjectFacetsManager.create( "abc", null, null );
- fail();
- }
- catch( CoreException e )
- {
- // expected
- }
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(String,IPath,IProgressMonitor)}
- * method. In this scenario, there is a non-faceted project with the same
- * name.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromScratch3()
-
- throws CoreException, IOException
-
- {
- final IProject project = ws.getRoot().getProject( "abc" );
- final IProjectDescription desc = ws.newProjectDescription( "abc" );
-
- desc.setLocation( null );
-
- project.create( desc, null );
- project.open( IResource.BACKGROUND_REFRESH, null );
-
- this.resourcesToCleanup.add( project );
-
- try
- {
- ProjectFacetsManager.create( "abc", null, null );
- fail();
- }
- catch( CoreException e )
- {
- // expected
- }
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is not faceted and convertIfNecessary
- * is set to true.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject1()
-
- throws CoreException, IOException
-
- {
- final IProject project = ws.getRoot().getProject( "abc" );
- final IProjectDescription desc = ws.newProjectDescription( "abc" );
-
- desc.setLocation( null );
-
- project.create( desc, null );
- project.open( IResource.BACKGROUND_REFRESH, null );
-
- this.resourcesToCleanup.add( project );
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project, true, null );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is faceted and convertIfNecessary
- * is set to true.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject2()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject prior
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject project = prior.getProject();
-
- this.resourcesToCleanup.add( project );
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project, true, null );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is faceted and convertIfNecessary
- * is set to false.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject3()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject prior
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject project = prior.getProject();
-
- this.resourcesToCleanup.add( project );
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project, false, null );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is not faceted and convertIfNecessary
- * is set to false.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject4()
-
- throws CoreException, IOException
-
- {
- final IProject project = ws.getRoot().getProject( "abc" );
- final IProjectDescription desc = ws.newProjectDescription( "abc" );
-
- desc.setLocation( null );
-
- project.create( desc, null );
- project.open( IResource.BACKGROUND_REFRESH, null );
-
- this.resourcesToCleanup.add( project );
-
- assertNull( ProjectFacetsManager.create( project, false, null ) );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject)} method. This scenario
- * validates that the wrapper cache is working and the same instance is
- * returned when the create method is called multiple times.
- *
- * @throws CoreException
- */
-
- public void testWrapperCreation1()
-
- throws CoreException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject proj = fproj.getProject();
- this.resourcesToCleanup.add( proj );
-
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject)} method. In this
- * scenario, the input project does not exist.
- *
- * @throws CoreException
- */
-
- public void testWrapperCreation2()
-
- throws CoreException
-
- {
- final IProject proj = ws.getRoot().getProject( "abc" );
- assertNull( ProjectFacetsManager.create( proj ) );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject)} method. In this
- * scenario, the input project is closed.
- *
- * @throws CoreException
- */
-
- public void testWrapperCreation3()
-
- throws CoreException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject proj = fproj.getProject();
- this.resourcesToCleanup.add( proj );
-
- proj.close( null );
-
- assertNull( ProjectFacetsManager.create( proj ) );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/CustomVersionComparator.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/CustomVersionComparator.java
deleted file mode 100644
index cab08f0..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/CustomVersionComparator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
-import org.eclipse.wst.common.project.facet.core.VersionFormatException;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class CustomVersionComparator
-
- extends DefaultVersionComparator
-
-{
- protected String getSeparators()
- {
- return ".#";
- }
-
- protected Comparable parse( final String version,
- final String segment,
- final int position )
-
- throws VersionFormatException
-
- {
- if( position == 2 )
- {
- return new Inverter( segment );
- }
- else
- {
- return super.parse( version, segment, position );
- }
- }
-
- public static class Inverter
-
- implements Comparable
-
- {
- private final Comparable base;
-
- public Inverter( final Comparable base )
- {
- this.base = base;
- }
-
- public boolean equals( final Object obj )
- {
- if( ! ( obj instanceof Inverter ) )
- {
- return false;
- }
- else
- {
- return this.base.equals( ( (Inverter) obj ).base );
- }
- }
-
- public int compareTo( final Object obj )
- {
- return -1 * this.base.compareTo( ( (Inverter) obj ).base );
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1InstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1InstallDelegate.java
deleted file mode 100644
index ee7af79..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1InstallDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class Facet1InstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet1.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1UninstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1UninstallDelegate.java
deleted file mode 100644
index 8836770..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1UninstallDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class Facet1UninstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet1.txt" );
- file.delete( true, null );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1VersionChangeDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1VersionChangeDelegate.java
deleted file mode 100644
index 3934e03..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1VersionChangeDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class Facet1VersionChangeDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet1.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aInstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aInstallDelegate.java
deleted file mode 100644
index 664d7f2..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aInstallDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class Facet3aInstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet3a.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aUninstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aUninstallDelegate.java
deleted file mode 100644
index c85a107..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aUninstallDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class Facet3aUninstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet3a.txt" );
- file.delete( true, null );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aVersionChangeDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aVersionChangeDelegate.java
deleted file mode 100644
index 5d7c86a..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aVersionChangeDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class Facet3aVersionChangeDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet3a.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/NoOpDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/NoOpDelegate.java
deleted file mode 100644
index 1d2f3ba..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/NoOpDelegate.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class NoOpDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
- {
- // do nothing
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/TestUtils.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/TestUtils.java
deleted file mode 100644
index 218cee6..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/TestUtils.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class TestUtils
-{
- public static void writeToFile( final IFile file,
- final String contents )
-
- throws CoreException
-
- {
- try
- {
- final byte[] bytes = contents.getBytes( "UTF-8" );
-
- if( file.exists() )
- {
- file.setContents( new ByteArrayInputStream( bytes ),
- false, false, null );
- }
- else
- {
- file.create( new ByteArrayInputStream( bytes ), false, null );
- }
- }
- catch( UnsupportedEncodingException e )
- {
- throw new RuntimeException( e );
- }
- }
-
- public static String readFromFile( final IFile file )
-
- throws CoreException, IOException
-
- {
- TestCase.assertTrue( file.exists() );
-
- final StringBuffer buf = new StringBuffer();
- final Reader r = new InputStreamReader( file.getContents() );
-
- try
- {
- char[] chars = new char[ 1024 ];
-
- for( int count; ( count = r.read( chars ) ) != -1; )
- {
- buf.append( chars, 0, count );
- }
- }
- finally
- {
- try
- {
- r.close();
- }
- catch( IOException e ) {}
- }
-
- return buf.toString();
- }
-
-
- public static void assertEquals( final IFile file,
- final String expectedContents )
-
- throws CoreException, IOException
-
- {
- TestCase.assertEquals( readFromFile( file ), expectedContents );
- }
-
- public static void assertFileContains( final IFile file,
- final String str )
-
- throws CoreException, IOException
-
- {
- TestCase.assertTrue( readFromFile( file ).indexOf( str ) != -1 );
- }
-
- public static void waitForCondition( final ICondition condition )
- {
- waitForCondition( condition, 10 );
- }
-
- public static void waitForCondition( final ICondition condition,
- final int seconds )
- {
- for( int i = 0; i < seconds && ! condition.check(); i++ )
- {
- try
- {
- Thread.sleep( 1000 );
- }
- catch( InterruptedException e ) {}
- }
-
- TestCase.assertTrue( condition.check() );
- }
-
- public static interface ICondition
- {
- boolean check();
- }
-
- public static <T> Set<T> asSet( final T... objects )
- {
- final Set<T> set = new LinkedHashSet<T>();
- set.addAll( Arrays.asList( objects ) );
- return set;
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/test.xml b/tests/org.eclipse.wst.common.project.facet.core.tests/test.xml
deleted file mode 100644
index f1b343d..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/test.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
-
- <echo message="basedir ${basedir}" />
- <echo message="eclipse place ${eclipse-home}" />
-
- <property name="plugin-name" value="org.eclipse.wst.common.project.facet.core.tests"/>
- <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
-
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="${plugin-name}*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
-
- <target name="suite">
- <property name="wst-folder" value="${eclipse-home}/wst_folder"/>
- <delete dir="${wst-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${wst-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.wst.common.project.facet.core.tests.AllTests" />
- <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
-
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
-
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="${plugin-name}*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
\ No newline at end of file