This commit was manufactured by cvs2svn to create tag 'v20051207_1309PST'.
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 065ac06..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.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <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 fc40a91..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-bin
-build.xml
-facet-ui.jar
-temp.folder
-@dot
-src.zip
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 12271fa..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Thu Oct 13 08:14:13 PDT 2005
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 0c69057..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Thu Oct 13 08:14:13 PDT 2005
-eclipse.preferences.version=1
-internal.default.compliance=default
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 4bd09b2..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +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.0.0
-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,
- org.eclipse.ui.ide,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.wst.common.project.facet.core,
- org.eclipse.draw2d,
- org.eclipse.gef
-Eclipse-AutoStart: true
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 1acc328..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/build.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- plugin.xml,\
- plugin.properties,\
- images/,\
- schemas/,\
- META-INF/
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/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/plugin.properties b/plugins/org.eclipse.wst.common.project.facet.ui/plugin.properties
deleted file mode 100644
index a12c48c..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/plugin.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-pluginName = Project Facet UI
-providerName = Eclipse.org
-project.facets = Project Facets
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 1f3fe53..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/plugin.xml
+++ /dev/null
@@ -1,54 +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"
- 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.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>
- </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 62007ba..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/images.exsd
+++ /dev/null
@@ -1,131 +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>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <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">
- <complexType>
- <attribute name="facet" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="runtime-component-type" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="path" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- This extension point is part of an interim API that is still under
- development and expected to change significantly before reaching
- stability. It is being made available at this early stage to solicit
- feedback from pioneering adopters on the understanding that any code
- that uses this API will almost certainly be broken (repeatedly) as
- the API evolves.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 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.
- </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 3d7adae..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/schemas/wizard-pages.exsd
+++ /dev/null
@@ -1,152 +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>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="wizard-pages" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="decorations" 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="wizard-pages">
- <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>
- </annotation>
- </attribute>
- <attribute name="version" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="install">
- <complexType>
- <sequence>
- <element ref="config"/>
- <element ref="page" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="uninstall">
- <complexType>
- <sequence>
- <element ref="config"/>
- <element ref="page" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="page">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- This extension point is part of an interim API that is still under
- development and expected to change significantly before reaching
- stability. It is being made available at this early stage to solicit
- feedback from pioneering adopters on the understanding that any code
- that uses this API will almost certainly be broken (repeatedly) as
- the API evolves.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 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.
- </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 ff819d0..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AbstractFacetWizardPage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.wizard.WizardPage;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @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 d59d11b..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-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.ConflictingFacetsFilter;
-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.FacetsSelectionPanel;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class AddRemoveFacetsWizard
-
- extends Wizard
-
-{
- protected IFacetedProject fproj;
-
- private final WizardContext context = new WizardContext();
- protected FacetsSelectionPage facetsSelectionPage;
- private FacetPages[] facetPages = new FacetPages[ 0 ];
- private Composite pageContainer;
-
- private IRuntime initialRuntime;
-
- public AddRemoveFacetsWizard( final IFacetedProject fproj )
- {
- this.fproj = fproj;
-
- setNeedsProgressMonitor( true );
- setForcePreviousAndNextButtons( true );
- setWindowTitle( "Add/Remove Project Facets" );
- }
-
- public final IRuntime getRuntime()
- {
- if( this.facetsSelectionPage.panel == null )
- {
- return this.initialRuntime;
- }
- else
- {
- return this.facetsSelectionPage.panel.getRuntime();
- }
- }
-
- public final void setRuntime( final IRuntime runtime )
- {
- if( this.facetsSelectionPage.panel == null )
- {
- this.initialRuntime = runtime;
- }
- else
- {
- this.facetsSelectionPage.panel.setRuntime( runtime );
- }
- }
-
- public final void addRuntimeListener( final Listener listener )
- {
- this.facetsSelectionPage.addRuntimeListener( listener );
- }
-
- public final void removeRuntimeListener( final Listener listener )
- {
- this.facetsSelectionPage.removeRuntimeListener( listener );
- }
-
- public void addPages()
- {
- Set base = null;
-
- if( this.fproj != null )
- {
- base = this.fproj.getProjectFacets();
- }
-
- this.facetsSelectionPage
- = new FacetsSelectionPage( context, base );
-
- if( this.fproj != null )
- {
- this.facetsSelectionPage.setInitialSelection( this.fproj.getProjectFacets() );
- this.facetsSelectionPage.setFixedProjectFacets( this.fproj.getFixedProjectFacets());
- this.facetsSelectionPage.setFilters( new FacetsSelectionPanel.IFilter[] { new ConflictingFacetsFilter( this.fproj.getFixedProjectFacets() ) } );
- setRuntime( this.fproj.getRuntime() );
- }
-
- 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 ArrayList list = new ArrayList();
-
- list.add( this.facetsSelectionPage );
-
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- list.addAll( this.facetPages[ i ].pages );
- }
-
- return (IWizardPage[]) list.toArray( new IWizardPage[ 0 ] );
- }
-
- 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();
- }
-
- public boolean performFinish()
- {
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- final FacetPages fp = this.facetPages[ i ];
-
- for( Iterator itr = fp.pages.iterator(); itr.hasNext(); )
- {
- ( (IFacetWizardPage) itr.next() ).transferStateToConfig();
- }
- }
-
- final Set actions = this.facetsSelectionPage.getActions();
-
- final IRunnableWithProgress op = new IRunnableWithProgress()
- {
- public void run( final IProgressMonitor monitor )
-
- throws InvocationTargetException, InterruptedException
-
- {
- monitor.beginTask( "", actions.size() );
-
- try
- {
- try
- {
- performFinish( monitor );
- }
- catch( CoreException e )
- {
- throw new InvocationTargetException( e );
- }
- }
- finally
- {
- monitor.done();
- }
- }
- };
-
- try
- {
- getContainer().run( false, 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
-
- {
- monitor.beginTask( "", 2 );
-
- try
- {
- this.fproj.setRuntime( this.facetsSelectionPage.getSelectedRuntime(),
- new SubProgressMonitor( monitor, 1 ) );
-
- this.fproj.modify( this.facetsSelectionPage.getActions(),
- new SubProgressMonitor( monitor, 1 ) );
- }
- finally
- {
- monitor.done();
- }
- }
-
- public String getProjectName()
- {
- return this.fproj.getProject().getName();
- }
-
- public Object getConfig(IProjectFacetVersion fv, Type type, String pjname) throws CoreException{
- return null;
- }
-
- public void dispose()
- {
- super.dispose();
-
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- for( Iterator itr = this.facetPages[ i ].pages.iterator();
- itr.hasNext(); )
- {
- ( (IWizardPage) itr.next() ).dispose();
- }
- }
- }
-
- private static final class FacetPages
- {
- public Action action;
- public List 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 base;
-
- if( this.fproj == null )
- {
- base = Collections.EMPTY_SET;
- }
- else
- {
- base = this.fproj.getProjectFacets();
- }
-
- final Set actions = this.facetsSelectionPage.getActions();
- final ArrayList sortedActions = new ArrayList( actions );
- ProjectFacetsManager.sort( base, sortedActions );
-
- // Recalculate the sequence of wizard pages.
-
- final ArrayList newFacetPages = new ArrayList();
- final boolean[] markers = new boolean[ this.facetPages.length ];
-
- for( Iterator itr1 = sortedActions.iterator(); itr1.hasNext(); )
- {
- final Action action = (Action) itr1.next();
- final IProjectFacetVersion f = action.getProjectFacetVersion();
- FacetPages fp = findFacetPages( action, markers );
-
- if( fp == null )
- {
- fp = new FacetPages();
- fp.action = action;
- fp.pages = ProjectFacetsUiManager.getWizardPages( action.getType(), f );
-
- for( Iterator itr2 = fp.pages.iterator(); itr2.hasNext(); )
- {
- final IFacetWizardPage page
- = (IFacetWizardPage) itr2.next();
-
- page.setWizard( this );
- page.setWizardContext( this.context );
- page.setConfig( action.getConfig() );
-
- if( page.getControl() == null )
- {
- page.createControl( this.pageContainer );
- page.getControl().setVisible( false );
- }
- }
- }
-
- newFacetPages.add( fp );
- }
-
- for( int i = 0; i < this.facetPages.length; i++ )
- {
- if( ! markers[ i ] )
- {
- for( Iterator itr = this.facetPages[ i ].pages.iterator();
- itr.hasNext(); )
- {
- final IFacetWizardPage page
- = (IFacetWizardPage) itr.next();
-
- page.setWizard( null );
- page.dispose();
- }
- }
- }
-
- 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;
- }
-
- /**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
- private final class WizardContext
-
- implements IWizardContext
-
- {
- public String getProjectName()
- {
- return AddRemoveFacetsWizard.this.getProjectName();
- }
-
- public Set getSelectedProjectFacets()
- {
- return AddRemoveFacetsWizard.this.facetsSelectionPage.getSelectedProjectFacets();
- }
-
- public boolean isProjectFacetSelected( final IProjectFacetVersion fv )
- {
- return getSelectedProjectFacets().contains( fv );
- }
-
- public Set getActions()
- {
- final FacetsSelectionPage page
- = AddRemoveFacetsWizard.this.facetsSelectionPage;
-
- return page.getActions();
- }
-
- public Action getAction( final Action.Type type,
- final IProjectFacetVersion f )
- {
- for( Iterator itr = getActions().iterator(); itr.hasNext(); )
- {
- final Action action = (Action) itr.next();
-
- if( action.getType() == type && action.getProjectFacetVersion() == f )
- {
- return action;
- }
- }
-
- return null;
- }
-
- public Object getConfig(IProjectFacetVersion fv, Type type, String pjname) throws CoreException {
- Object config = AddRemoveFacetsWizard.this.getConfig(fv, type, pjname);
- if (null == config) {
- config = fv.createActionConfig(type, pjname);
- }
- return config;
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String errDlgTitle;
-
- static
- {
- initializeMessages( AddRemoveFacetsWizard.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.properties
deleted file mode 100644
index feb2801..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/AddRemoveFacetsWizard.properties
+++ /dev/null
@@ -1 +0,0 @@
-errDlgTitle = Error
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 866c8ba..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/FacetedProjectWizard.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-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.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.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.ui.internal.ConflictingFacetsFilter;
-import org.eclipse.wst.common.project.facet.ui.internal.FacetsSelectionPanel;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class FacetedProjectWizard
-
- extends AddRemoveFacetsWizard
- implements INewWizard
-
-{
- private final IFacetedProjectTemplate template;
- private WizardNewProjectCreationPage firstPage;
- private String projectName;
- private IPath customPath;
-
- public FacetedProjectWizard()
- {
- super( null );
-
- this.template = getTemplate();
-
- this.setWindowTitle( "New " + this.template.getLabel() );
- this.setDefaultPageImageDescriptor( getDefaultPageImageDescriptor() );
- }
-
- public void init( final IWorkbench workbench,
- final IStructuredSelection selection )
- {
-
- }
-
- public void addPages()
- {
- this.firstPage = new WizardNewProjectCreationPage( "first.page" );
- this.firstPage.setTitle( this.template.getLabel() );
- this.firstPage.setDescription( getPageDescription() );
-
- addPage( this.firstPage );
-
- super.addPages();
-
- this.facetsSelectionPage.setInitialPreset( this.template.getInitialPreset() );
-
- final Set fixed = this.template.getFixedProjectFacets();
-
- this.facetsSelectionPage.setFixedProjectFacets( fixed );
-
- final ConflictingFacetsFilter filter
- = new ConflictingFacetsFilter( fixed );
-
- this.facetsSelectionPage.setFilters( new FacetsSelectionPanel.IFilter[] { filter } );
- }
-
- 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 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();
-
-}
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 d485873..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IDecorationsProvider.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @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 06f90aa..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IFacetWizardPage.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-import org.eclipse.jface.wizard.IWizardPage;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IFacetWizardPage
-
- extends IWizardPage
-
-{
- void setWizardContext( final IWizardContext context );
- void setConfig( final Object config );
- 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 bae1d2f..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IRuntimeComponentLabelProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @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 ab9becb..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/IWizardContext.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-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;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IWizardContext
-{
- String getProjectName();
-
- Set getSelectedProjectFacets();
-
- boolean isProjectFacetSelected( IProjectFacetVersion fv );
-
- Set getActions();
-
- Action getAction( Action.Type type,
- IProjectFacetVersion f );
-
- 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/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 3d33143..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 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 API and implementation
- ******************************************************************************/
-
-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;
-
-/**
- * <p><i>This class is part of an interim API that is still under development
- * and expected to change significantly before reaching stability. It is being
- * made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.</i></p>
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ProjectFacetsUiManager
-{
- private ProjectFacetsUiManager() {}
-
- /**
- * @return (element type: {@see IFacetWizardPage})
- */
-
- 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/ConflictingFacetsFilter.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConflictingFacetsFilter.java
deleted file mode 100644
index 48ecbd5..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConflictingFacetsFilter.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-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 ConflictingFacetsFilter
-
- implements FacetsSelectionPanel.IFilter
-
-{
- private final Set fixed;
-
- public ConflictingFacetsFilter( final Set fixed )
- {
- this.fixed = fixed;
- }
-
- public boolean check( final IProjectFacetVersion fv )
- {
- for( Iterator itr = this.fixed.iterator(); itr.hasNext(); )
- {
- final IProjectFacet f = (IProjectFacet) itr.next();
-
- if( f.getVersions().contains( fv ) )
- {
- return true;
- }
- }
-
- return check( fv.getConstraint() );
- }
-
- private boolean check( final IConstraint op )
- {
- if( op.getType() == IConstraint.Type.AND )
- {
- for( Iterator itr = op.getOperands().iterator(); itr.hasNext(); )
- {
- if( ! check( (IConstraint) itr.next() ) )
- {
- return false;
- }
- }
-
- return true;
- }
- else if( op.getType() == IConstraint.Type.OR )
- {
- for( Iterator itr = op.getOperands().iterator(); itr.hasNext(); )
- {
- if( check( (IConstraint) itr.next() ) )
- {
- return true;
- }
- }
-
- return false;
- }
- else if( op.getType() == IConstraint.Type.CONFLICTS )
- {
- final String gid = (String) op.getOperand( 0 );
- final IGroup group = ProjectFacetsManager.getGroup( gid );
-
- for( Iterator itr = this.fixed.iterator(); itr.hasNext(); )
- {
- final IProjectFacet f = (IProjectFacet) itr.next();
-
- if( group.getMembers().containsAll( f.getVersions() ) )
- {
- return false;
- }
- }
-
- return true;
- }
- else if( op.getType() == IConstraint.Type.REQUIRES )
- {
- final String name = (String) op.getOperand( 0 );
- final String vexpr = (String) op.getOperand( 1 );
-
- final boolean soft
- = ( (Boolean) op.getOperand( 2 ) ).booleanValue();
-
- if( soft )
- {
- return true;
- }
- else
- {
- final IProjectFacet rf
- = ProjectFacetsManager.getProjectFacet( name );
-
- try
- {
- for( Iterator itr = rf.getVersions( vexpr ).iterator();
- itr.hasNext(); )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) itr.next();
-
- if( check( fv ) )
- {
- return true;
- }
- }
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- return false;
- }
-
-
- return false;
- }
- }
- else
- {
- throw new IllegalStateException();
- }
- }
-
-}
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 7911f13..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ConstraintDisplayDialog.java
+++ /dev/null
@@ -1,491 +0,0 @@
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-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.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.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-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 ) );
- canvas.setBackground( new Color( null, 255, 255, 206 ) );
-
- 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( "Press 'Esc' to close." );
- 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( Iterator itr = constraint.getOperands().iterator();
- itr.hasNext(); )
- {
- final IConstraint child = (IConstraint) itr.next();
- 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();
- }
-
- public void layout( final IFigure container )
- {
- if( this.laidout > 5 )
- {
- return;
- }
-
- // Create the graph.
-
- final DirectedGraph graph = new DirectedGraph();
- final Map nodes = new HashMap();
-
- for( Iterator itr = container.getChildren().iterator();
- itr.hasNext(); )
- {
- final IFigure child = (IFigure) itr.next();
-
- if( ! ( child instanceof PolylineConnection ) )
- {
- final Node node = new Node( child );
- final Dimension size = child.getPreferredSize();
- node.height = size.height;
- node.width = size.width;
- graph.nodes.add( node );
- nodes.put( child, node );
- }
- }
-
- for( Iterator itr = container.getChildren().iterator();
- itr.hasNext(); )
- {
- final Object child = itr.next();
-
- if( child instanceof PolylineConnection )
- {
- final PolylineConnection cn = (PolylineConnection) child;
-
- final IFigure source = cn.getSourceAnchor().getOwner();
- final Node sourceNode = (Node) nodes.get( source );
-
- final IFigure target = cn.getTargetAnchor().getOwner();
- final Node targetNode = (Node) 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( Iterator itr = graph.nodes.iterator(); itr.hasNext(); )
- {
- final Node node = (Node) itr.next();
- 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( Iterator itr = graph.edges.iterator(); itr.hasNext(); )
- {
- final Edge edge = (Edge) itr.next();
- final PolylineConnection cn = (PolylineConnection) edge.data;
-
- if( edge.vNodes == null )
- {
- cn.setRoutingConstraint( Collections.EMPTY_LIST );
- }
- else
- {
- final List bends = new ArrayList();
-
- for( Iterator itr2 = edge.vNodes.iterator();
- itr2.hasNext(); )
- {
- final Node vn = (Node) itr2.next();
-
- 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 = "AND";
- background = new Color( null, 0, 175, 0 );
- }
- else if( constraint.getType() == IConstraint.Type.OR )
- {
- labelText = "OR";
- 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 String fid = (String) constraint.getOperand( 0 );
- final String vstr = (String) constraint.getOperand( 1 );
- final Boolean soft = (Boolean) constraint.getOperand( 2 );
-
- 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.setText( "requires" );
- headerLabel.setBorder( new MarginBorder( 2 ) );
- add( headerLabel );
-
- final IProjectFacet f = ProjectFacetsManager.getProjectFacet( fid );
-
- final StringBuffer bodyLabelText = new StringBuffer();
-
- bodyLabelText.append( f.getLabel() );
- bodyLabelText.append( ' ' );
- bodyLabelText.append( vstr );
-
- 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.setText( "conflicts (group)" );
- headerLabel.setBorder( new MarginBorder( 2 ) );
- add( headerLabel );
-
- final StringBuffer bodyLabelText = new StringBuffer();
-
- bodyLabelText.append( (String) constraint.getOperand( 0 ) );
-
- final Label bodyLabel = new Label();
- bodyLabel.setText( bodyLabelText.toString() );
- bodyLabel.setBorder( new CompoundBorder( new DividerBorder( 1 ), new MarginBorder( 2 ) ) );
- add( bodyLabel );
- }
- }
-
-}
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 ea685d2..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/DecorationsProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-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 afa410d..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetUiPlugin.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-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";
-
- private static FacetUiPlugin plugin;
-
- public FacetUiPlugin()
- {
- super();
- plugin = this;
- }
-
- public static FacetUiPlugin getInstance()
- {
- return plugin;
- }
-
- public static void log( final Exception e )
- {
- final String msg = e.getMessage();
- 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 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/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 f1620a7..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-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.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.window.Window;
-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.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.Label;
-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.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.AddRemoveFacetsWizard;
-
-/**
- * @author <a href="mailto:klum@bea.com">Karl Lum</a>
- */
-
-public class FacetsPropertyPage extends PropertyPage
-{
- private IFacetedProject _project;
- private TableViewer _viewer;
- private Label _runtimeLabel;
-
- protected Control createContents(Composite parent)
- {
- noDefaultAndApplyButton();
- final IAdaptable element = getElement();
-
- if (element instanceof IProject)
- {
- final IProject project = (IProject)element;
- try {
- _project = ProjectFacetsManager.create(project);
- }
- catch (CoreException ce)
- {
- return null;
- }
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- _runtimeLabel = new Label(composite, SWT.NONE);
- setRuntimeLabel();
-
- // quick hack to get a bit of separation.
- new Label(composite,SWT.NONE);
-
- final Label pageLabel = new Label(composite, SWT.NONE);
- pageLabel.setText(Resources.pageLabel);
-
- createTableGroup(composite);
- 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));
-
- _viewer = createTableViewer(composite);
- _viewer.setInput(_project);
-
- // add the button for the facets wizard
- final Button button = new Button(parent, SWT.PUSH);
- button.setText(Resources.addRemoveLabel);
- button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- button.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- final IWizard wizard = new AddRemoveFacetsWizard( _project );
- final WizardDialog dialog = new WizardDialog( getShell(), wizard );
-
- if (dialog.open() == Window.OK)
- {
- // redisplay the facets information
- _viewer.setInput(_project);
- setRuntimeLabel();
- }
- }
- });
- }
-
- 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 setRuntimeLabel()
- {
- final IRuntime runtime = _project.getRuntime();
- if (runtime != null)
- _runtimeLabel.setText(NLS.bind(Resources.runtimeLabel, _project.getRuntime().getName()));
- else
- _runtimeLabel.setText(Resources.runtimeText);
- _runtimeLabel.redraw();
- }
-
- 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(Object inputElement)
- {
- if (inputElement instanceof IFacetedProject)
- {
- final IFacetedProject project = (IFacetedProject)inputElement;
- final List facets = new ArrayList();
- for (Iterator it = project.getProjectFacets().iterator(); it.hasNext();)
- {
- facets.add(it.next());
- }
- Collections.sort(facets, new Comparator()
- {
- public int compare( final Object p1, final Object p2 )
- {
- if( p1 == p2 )
- {
- return 0;
- }
- else
- {
- final String label1 = ((IProjectFacetVersion)p1).getProjectFacet().getLabel();
- final String label2 = ((IProjectFacetVersion)p2).getProjectFacet().getLabel();
-
- return label1.compareTo( label2 );
- }
- }
- });
-
- return facets.toArray(new IProjectFacetVersion[0]);
- }
- 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 pageLabel;
- public static String runtimeLabel;
- public static String runtimeText;
- public static String addRemoveLabel;
- 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 64455d1..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsPropertyPage.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-pageLabel = The following facets are installed on this project:
-runtimeLabel = Runtime : {0}
-runtimeText = Runtime :
-addRemoveLabel = Add/Remove Project Facets...
-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 dab4deb..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-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.IActionConfig;
-import org.eclipse.wst.common.project.facet.core.ICategory;
-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.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.ui.AddRemoveFacetsWizard;
-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 IWizardContext context;
- private Set base;
- private IPreset initialPreset;
- private Set initialSelection;
- private final Set fixed;
- private FacetsSelectionPanel.IFilter[] filters;
- public FacetsSelectionPanel panel;
- private ArrayList listeners;
- private ArrayList runtimeListeners;
-
- public FacetsSelectionPage( final IWizardContext context,
- final Set base )
- {
- super( "facets.selection.page" ); //$NON-NLS-1$
-
- setTitle( "Select Project Facets" );
- setDescription( "Select facets for this project." );
-
- this.context = context;
- this.base = base;
- this.initialPreset = null;
- this.initialSelection = null;
- this.fixed = new HashSet();
- this.filters = new FacetsSelectionPanel.IFilter[ 0 ];
- this.listeners = new ArrayList();
- this.runtimeListeners = new ArrayList();
- }
-
- public void setInitialPreset( final IPreset preset )
- {
- this.initialPreset = preset;
- }
-
- public void setInitialSelection( final Set sel )
- {
- this.initialSelection = sel;
- }
-
- public void setFixedProjectFacets( final Set fixed )
- {
- this.fixed.clear();
- this.fixed.addAll( fixed );
- }
-
- public void setFilters( final FacetsSelectionPanel.IFilter[] filters )
- {
- this.filters = filters;
- }
-
- public Set getActions()
- {
- return this.panel.getActions();
- }
-
- public Set getSelectedProjectFacets()
- {
- return this.panel.getSelectedProjectFacets();
- }
-
- public void addSelectedFacetsChangedListener( final Listener listener )
- {
- this.listeners.add( listener );
- }
-
- public void removeSelectedFacetsChangedListener( final Listener listener )
- {
- this.listeners.remove( listener );
- }
-
- public final void addRuntimeListener( final Listener listener )
- {
- this.runtimeListeners.add( listener );
- }
-
- public final void removeRuntimeListener( final Listener listener )
- {
- this.runtimeListeners.remove( listener );
- }
-
- public IRuntime getSelectedRuntime()
- {
- return this.panel.getRuntime();
- }
-
- public void createControl( final Composite parent )
- {
- final AddRemoveFacetsWizard wizard
- = (AddRemoveFacetsWizard) getWizard();
-
- final IRuntime initialRuntime = wizard.getRuntime();
-
- this.panel
- = new FacetsSelectionPanel( parent, SWT.NONE, this.context,
- this.base );
-
- this.panel.setFixedProjectFacets( this.fixed );
-
- this.panel.setRuntime( initialRuntime );
-
- if( this.initialPreset != null )
- {
- this.panel.selectPreset( this.initialPreset );
- }
-
- if( this.initialSelection != null )
- {
- this.panel.setSelectedProjectFacets( this.initialSelection );
- }
-
- for( int i = 0; i < this.filters.length; i++ )
- {
- this.panel.addFilter( this.filters[ i ] );
- }
-
- this.panel.addSelectionChangedListener
- (
- new ISelectionChangedListener()
- {
- public void selectionChanged( final SelectionChangedEvent e )
- {
- handleSelectionChangedEvent( e );
- }
- }
- );
-
- this.panel.addProjectFacetsListener
- (
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handleSelectedFacetsChangedEvent( event );
- }
- }
- );
-
- this.panel.addRuntimeListener
- (
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handleRuntimeChangedEvent( event );
- }
- }
- );
-
- setControl( this.panel );
- }
-
- private void handleSelectionChangedEvent( final SelectionChangedEvent e )
- {
- final IStructuredSelection ss
- = (IStructuredSelection) e.getSelection();
-
- final Object sel = ss.getFirstElement();
-
- if( sel != null )
- {
- final String desc;
-
- if( sel instanceof IProjectFacet )
- {
- desc = ( (IProjectFacet) sel ).getDescription();
- }
- else
- {
- desc = ( (ICategory) sel ).getDescription();
- }
-
- setDescription( desc );
- }
- }
-
- private void handleSelectedFacetsChangedEvent( final Event event )
- {
- setPageComplete( this.panel.isSelectionValid() );
-
- for( int i = 0, n = this.listeners.size(); i < n; i++ )
- {
- ( (Listener) this.listeners.get( i ) ).handleEvent( event );
- }
-
- getContainer().updateButtons();
- }
-
- private void handleRuntimeChangedEvent( final Event event )
- {
- for( int i = 0, n = this.runtimeListeners.size(); i < n; i++ )
- {
- ( (Listener) this.runtimeListeners.get( i ) ).handleEvent( event );
- }
- }
-
- public void setVisible( final boolean visible )
- {
- if( visible )
- {
- for( Iterator itr = this.panel.getActions().iterator();
- itr.hasNext(); )
- {
- final Object config = ( (Action) itr.next() ).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 );
- }
-
-}
-
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 9cab254..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java
+++ /dev/null
@@ -1,1883 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-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.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.InputDialog;
-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.IFontProvider;
-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.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-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.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.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.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 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 Font FIXED_FONT;
-
- static
- {
- final FontData system
- = Display.getCurrent().getSystemFont().getFontData()[ 0 ];
-
- final FontData bold
- = new FontData( system.getName(), system.getHeight(), SWT.BOLD );
-
- FIXED_FONT = new Font( Display.getCurrent(), bold );
- }
-
- private final IDialogSettings settings;
- 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 tree;
- private final TreeColumn colFacet;
- private final TreeColumn colVersion;
- private final Menu popupMenu;
- private final MenuItem popupMenuConstraints;
- private final ComboBoxCellEditor ceditor;
- 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 ArrayList data;
- private final HashSet fixed;
- private final Set base;
- private final HashSet actions;
- private final ArrayList presets;
-
- private IStatus problems;
- private final HashSet filters;
- private final ArrayList listeners;
- private final ArrayList selectionListeners;
-
- public interface IFilter
- {
- boolean check( IProjectFacetVersion fv );
- }
-
- public FacetsSelectionPanel( final Composite parent,
- final int style,
- final IWizardContext context,
- final Set base )
- {
- super( parent, style );
-
- this.context = context;
- this.data = new ArrayList();
- this.fixed = new HashSet();
- this.base = ( base == null ? new HashSet() : base );
- this.actions = new HashSet();
- this.presets = new ArrayList();
- this.problems = Status.OK_STATUS;
- this.filters = new HashSet();
- this.listeners = new ArrayList();
- this.selectionListeners = new ArrayList();
-
- for( Iterator itr = ProjectFacetsManager.getProjectFacets().iterator();
- itr.hasNext(); )
- {
- try
- {
- this.data.add( new TableRowData( (IProjectFacet) itr.next() ) );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- }
- }
-
- // 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( CW_FACET ) == null ) temp.put( CW_FACET, 200 );
- if( temp.get( CW_VERSION ) == null ) temp.put( CW_VERSION, 100 );
- 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.
-
- setLayout( new GridLayout( 4, false ) );
-
- this.presetsLabel = new Label( this, SWT.NONE );
- this.presetsLabel.setText( "Presets: " );
-
- this.presetsCombo = new Combo( this, SWT.READ_ONLY );
- this.presetsCombo.setLayoutData( gdhfill() );
-
- this.presetsCombo.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handlePresetSelected();
- }
- }
- );
-
- this.savePresetButton = new Button( this, SWT.PUSH );
- this.savePresetButton.setText( "Save" );
- this.savePresetButton.setLayoutData( whint( new GridData(), 60 ) );
-
- this.savePresetButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleSavePreset();
- }
- }
- );
-
- this.deletePresetButton = new Button( this, SWT.PUSH );
- this.deletePresetButton.setText( "Delete" );
- this.deletePresetButton.setLayoutData( whint( new GridData(), 60 ) );
-
- this.deletePresetButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleDeletePreset();
- }
- }
- );
-
- refreshPresetsCombo();
-
- this.sform1 = new SashForm( this, SWT.HORIZONTAL | SWT.SMOOTH );
- this.sform1.setLayoutData( hspan( gdfill(), 4 ) );
-
- this.sform2 = new SashForm( this.sform1, SWT.VERTICAL | SWT.SMOOTH );
- this.sform2.setLayoutData( hspan( gdfill(), 4 ) );
-
- this.tree = new CheckboxTreeViewer( this.sform2, SWT.BORDER );
- this.tree.getTree().setHeaderVisible( true );
-
- this.ceditor
- = new ComboBoxCellEditor( this.tree.getTree(), new String[ 0 ],
- SWT.READ_ONLY );
-
- this.tree.setColumnProperties( new String[] { "facet", "version" } );
- this.tree.setCellModifier( new CellModifier() );
- this.tree.setCellEditors( new CellEditor[] { null, this.ceditor } );
-
- this.tree.setContentProvider( new ContentProvider() );
- this.tree.setLabelProvider( new LabelProvider() );
- this.tree.setSorter( new Sorter() );
-
- this.colFacet = new TreeColumn( this.tree.getTree(), SWT.NONE );
- this.colFacet.setText( "Project Facet" );
- this.colFacet.setWidth( this.settings.getInt( CW_FACET ) );
- this.colFacet.setResizable( true );
-
- this.colFacet.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- settings.put( CW_FACET, colFacet.getWidth() );
- }
- }
- );
-
- this.colVersion = new TreeColumn( this.tree.getTree(), SWT.NONE );
- this.colVersion.setText( "Version" );
- this.colVersion.setWidth( this.settings.getInt( CW_VERSION ) );
- this.colVersion.setResizable( true );
-
- this.colVersion.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- settings.put( CW_VERSION, colVersion.getWidth() );
- }
- }
- );
-
- this.popupMenu = new Menu( getShell(), SWT.POP_UP );
- this.popupMenuConstraints = new MenuItem( this.popupMenu, SWT.PUSH );
- this.popupMenuConstraints.setText( "Show Constraints..." );
-
- this.popupMenuConstraints.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( SelectionEvent e )
- {
- handleShowConstraints();
- }
- }
- );
-
- this.tree.setInput( new Object() );
-
- this.tree.addSelectionChangedListener
- (
- new ISelectionChangedListener()
- {
- public void selectionChanged( final SelectionChangedEvent e )
- {
- FacetsSelectionPanel.this.selectionChanged( e );
- }
- }
- );
-
- this.tree.addCheckStateListener
- (
- new ICheckStateListener()
- {
- public void checkStateChanged( final CheckStateChangedEvent e )
- {
- FacetsSelectionPanel.this.checkStateChanged( e );
- }
- }
- );
-
- this.tree.getTree().addListener
- (
- SWT.MouseDown,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- handleMouseDownEvent( 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 = sform2.getWeights();
- settings.put( SASH2W1, weights[ 0 ] );
- 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 );
- this.runtimesPanel.setLayoutData( hhint( gdhfill(), 80 ) );
-
- this.runtimesPanel.addFilter
- (
- new RuntimesPanel.IFilter()
- {
- public boolean check( final IRuntime runtime )
- {
- for( Iterator itr = getSelectedProjectFacets().iterator();
- itr.hasNext(); )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) itr.next();
-
- if( ! runtime.supports( fv ) )
- {
- return false;
- }
- }
-
- return true;
- }
- }
- );
-
- this.runtimesPanel.addListener
- (
- SWT.Resize,
- new Listener()
- {
- public void handleEvent( final Event event )
- {
- final int[] weights = sform1.getWeights();
- settings.put( SASH1W1, weights[ 0 ] );
- 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, SWT.PUSH );
- this.showHideRuntimesButton.setText( Resources.showRuntimes );
- GridData gd = halign( hspan( new GridData(), 4 ), GridData.END );
- gd = whint( gd, getPreferredWidth( this.showHideRuntimesButton ) + 15 );
- this.showHideRuntimesButton.setLayoutData( gd );
-
- this.showHideRuntimesButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleShowHideRuntimes();
- }
- }
- );
-
- updateValidationDisplay();
- }
-
- public boolean isSelectionValid()
- {
- return this.problems.isOK();
- }
-
- public Set 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 actions,
- final Action.Type type,
- final IProjectFacetVersion fv )
- {
- for( Iterator itr = actions.iterator(); itr.hasNext(); )
- {
- final Action action = (Action) itr.next();
-
- if( action.getType() == type && action.getProjectFacetVersion() == fv )
- {
- return action;
- }
- }
-
- return null;
- }
-
- private static Action getAction( final Set actions,
- final Action.Type type,
- final IProjectFacet f )
- {
- for( Iterator itr = actions.iterator(); itr.hasNext(); )
- {
- final Action action = (Action) itr.next();
-
- if( action.getType() == type &&
- action.getProjectFacetVersion().getProjectFacet() == f )
- {
- return action;
- }
- }
-
- return null;
- }
-
- private Action createAction( final Set actions,
- final Action.Type type,
- final IProjectFacetVersion fv )
- {
- Action action = getAction( actions, type, fv );
-
- if( action == null )
- {
- Object config = null;
-
- if( fv.supports( type ) )
- {
- try
- {
- final IProjectFacet f = fv.getProjectFacet();
-
- action = getAction( actions, type, f );
-
- if( action != null )
- {
- final IProjectFacetVersion current
- = action.getProjectFacetVersion();
-
- if( fv.isSameActionConfig( type, current ) )
- {
- 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 IRuntime getRuntime()
- {
- return this.runtimesPanel.getRuntime();
- }
-
- public void setRuntime( final IRuntime runtime )
- {
- this.runtimesPanel.setRuntime( runtime );
-
- if( runtime != null )
- {
- final Set defaultFacets;
-
- try
- {
- defaultFacets = runtime.getDefaultFacets( this.fixed );
- }
- catch( CoreException e )
- {
- FacetUiPlugin.log( e );
- return;
- }
-
- setSelectedProjectFacets( defaultFacets );
- }
- }
-
- public Set getSelectedProjectFacets()
- {
- final HashSet set = new HashSet();
-
- for( int i = 0, n = this.data.size(); i < n; i++ )
- {
- final TableRowData trd = (TableRowData) this.data.get( i );
-
- if( trd.isSelected() )
- {
- set.add( trd.getCurrentVersion() );
- }
- }
-
- return set;
- }
-
- public void setSelectedProjectFacets( final Set sel )
- {
- for( Iterator itr = sel.iterator(); itr.hasNext(); )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) itr.next();
-
- final IProjectFacet f = fv.getProjectFacet();
- final TableRowData trd = findTableRowData( f );
-
- trd.setSelected( true );
- trd.setCurrentVersion( fv );
-
- this.tree.setChecked( trd, true );
- refreshCategoryState( trd );
- }
-
- for( Iterator itr = this.data.iterator(); itr.hasNext(); )
- {
- final TableRowData trd = (TableRowData) itr.next();
-
- if( trd.isSelected() && ! sel.contains( trd.getCurrentVersion() ) )
- {
- trd.setSelected( false );
-
- this.tree.setChecked( trd, false );
- refreshCategoryState( trd );
- }
- }
-
- this.tree.refresh();
- this.runtimesPanel.refresh();
- updateValidationDisplay();
- }
-
- public void selectPreset( final IPreset preset )
- {
- if( preset != null )
- {
- final int index = this.presets.indexOf( preset );
-
- if( index == -1 )
- {
- throw new IllegalArgumentException();
- }
-
- this.presetsCombo.select( index + 1 );
- handlePresetSelected();
- }
- }
-
- public void setFixedProjectFacets( final Set fixed )
- {
- for( int i = 0, n = this.data.size(); i < n; i++ )
- {
- ( (TableRowData) this.data.get( i ) ).setFixed( false );
- }
-
- for( Iterator itr = fixed.iterator(); itr.hasNext(); )
- {
- final IProjectFacet f = (IProjectFacet) itr.next();
- final TableRowData trd = findTableRowData( f );
-
- this.fixed.add( f );
- trd.setFixed( true );
- trd.setSelected( true );
- this.tree.setChecked( trd, true );
- }
-
- this.tree.refresh();
- this.runtimesPanel.refresh();
- refreshPresetsCombo();
- updateValidationDisplay();
- }
-
- public void addFilter( final IFilter filter )
- {
- this.filters.add( filter );
- this.tree.refresh();
- refreshPresetsCombo();
- }
-
- public void removeFilter( final IFilter filter )
- {
- this.filters.remove( filter );
- this.tree.refresh();
- refreshPresetsCombo();
- }
-
- public void addProjectFacetsListener( final Listener listener )
- {
- this.listeners.add( listener );
- }
-
- public void removeProjectFacetsListener( final Listener listener )
- {
- this.listeners.remove( listener );
- }
-
- private void notifyProjectFacetsListeners()
- {
- for( int i = 0, n = this.listeners.size(); i < n; i++ )
- {
- ( (Listener) this.listeners.get( i ) ).handleEvent( null );
- }
- }
-
- public void addRuntimeListener( final Listener listener )
- {
- this.runtimesPanel.addRuntimeListener( listener );
- }
-
- public void removeRuntimeListener( final Listener listener )
- {
- this.runtimesPanel.removeRuntimeListener( listener );
- }
-
- 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.tree.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.tree.setSelection( ts );
- }
-
- public void notifySelectionChangedListeners()
- {
- final SelectionChangedEvent event
- = new SelectionChangedEvent( this, getSelection() );
-
- for( int i = 0, n = this.selectionListeners.size(); i < n; i++ )
- {
- final ISelectionChangedListener listener
- = (ISelectionChangedListener) this.selectionListeners.get( i );
-
- listener.selectionChanged( event );
- }
- }
-
- private void selectionChanged( final SelectionChangedEvent event )
- {
- final Object selection
- = ( (IStructuredSelection) event.getSelection() ).getFirstElement();
-
- if( selection instanceof TableRowData )
- {
- final TableRowData trd = (TableRowData) selection;
-
- if( trd == null )
- {
- return;
- }
-
- // Reset the contents of the combo box cell editor to contain the
- // versions of the selected project facet.
-
- final List versions = trd.getVersions();
- final String[] verstrs = new String[ versions.size() ];
-
- for( int i = 0, n = versions.size(); i < n; i++ )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) 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;
- }
- }
- }
-
- 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.tree.setChecked( el, true );
- }
-
- return;
- }
-
- trd.setSelected( checked );
- refreshCategoryState( trd );
- }
- else
- {
- final ContentProvider cp
- = (ContentProvider) this.tree.getContentProvider();
-
- final Object[] children = cp.getChildren( el );
-
- for( int i = 0; i < children.length; i++ )
- {
- final TableRowData trd = (TableRowData) children[ i ];
- trd.setSelected( checked );
- this.tree.setChecked( trd, checked );
- }
-
- this.tree.setGrayed( el, false );
- }
-
- updateValidationDisplay();
- this.runtimesPanel.refresh();
-
- this.presetsCombo.select( 0 );
- refreshPresetsButtons();
- }
-
- private void updateValidationDisplay()
- {
- final Set sel = getSelectedProjectFacets();
- final Set old = new HashSet( this.actions );
- this.actions.clear();
-
- // What has been removed?
-
- for( Iterator itr = base.iterator(); itr.hasNext(); )
- {
- final IProjectFacetVersion f
- = (IProjectFacetVersion) itr.next();
-
- if( ! sel.contains( f ) )
- {
- this.actions.add( createAction( old, Action.Type.UNINSTALL, f ) );
- }
- }
-
- // What has been added?
-
- for( Iterator itr = sel.iterator(); itr.hasNext(); )
- {
- final IProjectFacetVersion f
- = (IProjectFacetVersion) itr.next();
-
- if( ! base.contains( f ) )
- {
- this.actions.add( createAction( old, Action.Type.INSTALL, f ) );
- }
- }
-
- // Coalesce uninstall/install pairs into version change actions, if
- // possible.
-
- final HashSet toadd = new HashSet();
- final HashSet toremove = new HashSet();
-
- for( Iterator itr1 = this.actions.iterator(); itr1.hasNext(); )
- {
- final Action action1 = (Action) itr1.next();
-
- for( Iterator itr2 = this.actions.iterator(); itr2.hasNext(); )
- {
- final Action action2 = (Action) itr2.next();
-
- 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() )
- {
- if( f2.supports( Action.Type.VERSION_CHANGE ) )
- {
- 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 = ProjectFacetsManager.check( this.base, this.actions );
- this.problemsView.refresh();
-
- if( this.problems.isOK() )
- {
- this.sform2.setMaximizedControl( this.tree.getTree() );
- }
- else
- {
- this.sform2.setMaximizedControl( null );
- }
-
- notifyProjectFacetsListeners();
- }
-
- private void refreshPresetsCombo()
- {
- this.presetsCombo.removeAll();
- this.presets.clear();
-
- for( Iterator itr1 = ProjectFacetsManager.getPresets().iterator();
- itr1.hasNext(); )
- {
- final IPreset preset = (IPreset) itr1.next();
- final HashSet temp = new HashSet();
-
- for( Iterator itr2 = preset.getProjectFacets().iterator();
- itr2.hasNext(); )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) itr2.next();
-
- final IProjectFacet f = fv.getProjectFacet();
- final TableRowData trd = findTableRowData( f );
-
- if( ! trd.getVersions().contains( fv ) )
- {
- continue;
- }
-
- temp.add( fv.getProjectFacet() );
- }
-
- if( temp.containsAll( this.fixed ) )
- {
- this.presets.add( preset );
- }
- }
-
- Collections.sort
- (
- this.presets,
- new Comparator()
- {
- public int compare( final Object p1,
- final Object p2 )
- {
- if( p1 == p2 )
- {
- return 0;
- }
- else
- {
- final String label1 = ( (IPreset) p1 ).getLabel();
- final String label2 = ( (IPreset) p2 ).getLabel();
-
- return label1.compareTo( label2 );
- }
- }
- }
- );
-
- this.presetsCombo.add( "<custom>" );
-
- for( Iterator itr = this.presets.iterator(); itr.hasNext(); )
- {
- final IPreset preset = (IPreset) itr.next();
- this.presetsCombo.add( preset.getLabel() );
- }
-
- this.presetsCombo.select( 0 );
- refreshPresetsButtons();
- }
-
- private void refreshPresetsButtons()
- {
- final int selection = this.presetsCombo.getSelectionIndex();
-
- if( selection == 0 )
- {
- this.savePresetButton.setEnabled( true );
- this.deletePresetButton.setEnabled( false );
- }
- else
- {
- final IPreset preset = (IPreset) this.presets.get( selection - 1 );
-
- this.savePresetButton.setEnabled( false );
- this.deletePresetButton.setEnabled( preset.isUserDefined() );
- }
- }
-
- private void refreshCategoryState( final TableRowData trd )
- {
- final ICategory category = trd.getProjectFacet().getCategory();
-
- if( category != null )
- {
- int selected = 0;
-
- for( Iterator itr = category.getProjectFacets().iterator();
- itr.hasNext(); )
- {
- final TableRowData ctrd
- = findTableRowData( (IProjectFacet) itr.next() );
-
- if( ctrd.isSelected() )
- {
- selected++;
- }
- }
-
- if( selected == 0 )
- {
- this.tree.setChecked( category, false );
- this.tree.setGrayed( category, false );
- }
- else if( selected == category.getProjectFacets().size() )
- {
- this.tree.setChecked( category, true );
- this.tree.setGrayed( category, false );
- }
- else
- {
- this.tree.setGrayChecked( category, true );
- }
- }
- }
-
- private boolean isFilteredOut( final IProjectFacetVersion fv )
- {
- for( Iterator itr = FacetsSelectionPanel.this.filters.iterator();
- itr.hasNext(); )
- {
- if( ! ( (IFilter) itr.next() ).check( fv ) )
- {
- return true;
- }
- }
-
- return false;
- }
-
- private TableRowData findTableRowData( final IProjectFacet f )
- {
- for( int i = 0, n = this.data.size(); i < n; i++ )
- {
- final TableRowData trd = (TableRowData) this.data.get( i );
-
- if( trd.getProjectFacet() == f )
- {
- return trd;
- }
- }
-
- throw new IllegalStateException();
- }
-
- private void handleMouseDownEvent( final Event event )
- {
- final ArrayList items = getAllTreeItems();
-
- TreeItem onItem = null;
-
- for( int i = 0, n = items.size(); i < n; i++ )
- {
- final TreeItem item = (TreeItem) items.get( i );
-
- if( item.getBounds( 0 ).contains( event.x, event.y ) )
- {
- onItem = item;
- break;
- }
-
- if( item.getBounds( 1 ).contains( event.x, event.y ) )
- {
- this.tree.getTree().setSelection( new TreeItem[] { item } );
- this.tree.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.getTree().setMenu( this.popupMenu );
- }
- else
- {
- this.tree.getTree().setMenu( null );
- }
- }
-
- private void handleShowConstraints()
- {
- final TreeItem[] items = this.tree.getTree().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.getTree().toDisplay( location );
-
- final ConstraintDisplayDialog dialog
- = new ConstraintDisplayDialog( getShell(), location,
- fv.getConstraint() );
-
- dialog.open();
- }
-
- private void handlePresetSelected()
- {
- final int selection = this.presetsCombo.getSelectionIndex();
-
- if( selection > 0 )
- {
- final IPreset preset = (IPreset) this.presets.get( selection - 1 );
- final Set selected = new HashSet();
-
- for( Iterator itr = preset.getProjectFacets().iterator();
- itr.hasNext(); )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) itr.next();
-
- final TableRowData trd
- = findTableRowData( fv.getProjectFacet() );
-
- if( ! trd.isSelected() )
- {
- this.tree.setChecked( trd, true );
- trd.setSelected( true );
- refreshCategoryState( trd );
- }
-
- if( trd.getCurrentVersion() != fv )
- {
- trd.setCurrentVersion( fv );
- this.tree.update( trd, null );
- }
-
- selected.add( trd );
- }
-
- for( Iterator itr = this.data.iterator(); itr.hasNext(); )
- {
- final TableRowData trd = (TableRowData) itr.next();
-
- if( ! selected.contains( trd ) )
- {
- this.tree.setChecked( trd, false );
- trd.setSelected( false );
- refreshCategoryState( trd );
- }
- }
- }
-
- refreshPresetsButtons();
- updateValidationDisplay();
- this.runtimesPanel.refresh();
- }
-
- private void handleSavePreset()
- {
- final InputDialog dialog
- = new InputDialog( getShell(), "Save Preset",
- "Enter the name for the preset.",
- null, null );
-
- if( dialog.open() == IDialogConstants.OK_ID )
- {
- final String name = dialog.getValue();
- final Set facets = getSelectedProjectFacets();
-
- final IPreset preset
- = ProjectFacetsManager.definePreset( name, facets );
-
- refreshPresetsCombo();
-
- final int pos = this.presets.indexOf( preset );
- this.presetsCombo.select( pos + 1 );
- refreshPresetsButtons();
- }
- }
-
- private void handleDeletePreset()
- {
- final int selection = this.presetsCombo.getSelectionIndex();
- final IPreset preset = (IPreset) this.presets.get( selection - 1 );
-
- ProjectFacetsManager.deletePreset( preset );
-
- refreshPresetsCombo();
- }
-
- 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 ArrayList getAllTreeItems()
- {
- final ArrayList result = new ArrayList();
- getAllTreeItems( this.tree.getTree().getItems(), result );
- return result;
- }
-
- private static void getAllTreeItems( final TreeItem[] items,
- final ArrayList result)
- {
- for( int i = 0; i < items.length; i++ )
- {
- final TreeItem item = items[ i ];
- result.add( item );
-
- getAllTreeItems( item.getItems(), result );
- }
- }
-
- private final class TableRowData
- {
- private IProjectFacet f;
- private List versions;
- private IProjectFacetVersion current;
- private boolean isSelected;
- private boolean isFixed;
-
- public TableRowData( final IProjectFacet f )
-
- throws CoreException
-
- {
- this.f = f;
- this.versions = f.getSortedVersions( false );
- this.current = f.getLatestVersion();
- this.isSelected = false;
- this.isFixed = false;
- }
-
- public IProjectFacet getProjectFacet()
- {
- return this.f;
- }
-
- public List getVersions()
- {
- final ArrayList list = new ArrayList();
-
- for( Iterator itr = this.versions.iterator(); itr.hasNext(); )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) itr.next();
-
- if( ! isFilteredOut( fv ) )
- {
- list.add( fv );
- }
- }
-
- return list;
- }
-
- public IProjectFacetVersion getCurrentVersion()
- {
- if( isFilteredOut( this.current ) )
- {
- this.current = (IProjectFacetVersion) 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();
- }
- }
-
- private final class ContentProvider
-
- implements ITreeContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- final ArrayList list = new ArrayList();
- final Set categories = ProjectFacetsManager.getCategories();
-
- for( Iterator itr1 = categories.iterator(); itr1.hasNext(); )
- {
- boolean visible = false;
-
- final ICategory cat = (ICategory) itr1.next();
-
- for( Iterator itr2 = cat.getProjectFacets().iterator();
- itr2.hasNext(); )
- {
- final IProjectFacet f
- = (IProjectFacet) itr2.next();
-
- if( findTableRowData( f ).isVisible() )
- {
- visible = true;
- break;
- }
- }
-
- if( visible )
- {
- list.add( cat );
- }
- }
-
- for( int i = 0; i < FacetsSelectionPanel.this.data.size(); i++ )
- {
- final TableRowData trd
- = (TableRowData) FacetsSelectionPanel.this.data.get( i );
-
- 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 ArrayList trds = new ArrayList();
-
- for( Iterator itr = category.getProjectFacets().iterator();
- itr.hasNext(); )
- {
- final TableRowData trd
- = findTableRowData( (IProjectFacet) itr.next() );
-
- 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, IFontProvider
-
- {
- private ImageRegistry imageRegistry = new ImageRegistry();
-
- public String getColumnText( final Object element,
- final int column )
- {
- if( element instanceof ICategory )
- {
- if( column == 0 )
- {
- return ( (ICategory) element ).getLabel();
- }
- else
- {
- return "";
- }
- }
- else
- {
- final TableRowData trd = (TableRowData) element;
-
- switch( column )
- {
- case 0:
- {
- return trd.getProjectFacet().getLabel();
- }
- case 1:
- {
- final String vstr
- = trd.getCurrentVersion().getVersionString();
-
- return trd.getVersions().size() == 1
- ? vstr : vstr + " ...";
- }
- default:
- {
- throw new IllegalStateException();
- }
- }
- }
- }
-
- public Image getColumnImage( final Object element,
- final int column )
- {
- if( column != 0 )
- {
- return null;
- }
-
- String id;
- IAdaptable obj;
-
- if( element instanceof TableRowData )
- {
- final IProjectFacet f
- = ( (TableRowData) element ).getProjectFacet();
-
- id = "f:" + f.getId();
- obj = f;
- }
- else
- {
- id = "c:" + ( (ICategory) element ).getId();
- obj = (IAdaptable) element;
- }
-
- Image image = this.imageRegistry.get( id );
-
- if( image == null )
- {
- final IDecorationsProvider decprov
- = (IDecorationsProvider) obj.getAdapter( IDecorationsProvider.class );
-
- this.imageRegistry.put( id, decprov.getIcon() );
- image = this.imageRegistry.get( id );
- }
-
- return image;
- }
-
- public Font getFont( final Object element )
- {
- if( element instanceof TableRowData &&
- ( (TableRowData) element ).isFixed() )
- {
- return FIXED_FONT;
- }
-
- return null;
- }
-
- public void dispose()
- {
- this.imageRegistry.dispose();
- }
-
- public boolean isLabelProperty( final Object obj,
- final String s )
- {
- return false;
- }
-
- public void addListener( final ILabelProviderListener listener ) {}
- public void removeListener( ILabelProviderListener listener ) {}
- }
-
- private final class CellModifier
-
- implements ICellModifier
-
- {
- public Object getValue( final Object element,
- final String property )
- {
- final TableRowData trd = (TableRowData) element;
-
- if( property.equals( "version" ) )
- {
- final List 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" ) &&
- 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" ) )
- {
- final int index = ( (Integer) value ).intValue();
-
- if( index != -1 )
- {
- final IProjectFacetVersion fv
- = (IProjectFacetVersion) trd.getVersions().get( index );
-
- if( trd.getCurrentVersion() != fv )
- {
- trd.setCurrentVersion( fv );
- FacetsSelectionPanel.this.tree.refresh();
-
- if( trd.isSelected() )
- {
- FacetsSelectionPanel.this.presetsCombo.select( 0 );
- refreshPresetsButtons();
- }
-
- updateValidationDisplay();
- FacetsSelectionPanel.this.runtimesPanel.refresh();
- }
- }
- }
- else
- {
- throw new IllegalStateException();
- }
- }
- }
-
- private static final class Sorter
-
- extends ViewerSorter
-
- {
- public int compare( final Viewer viewer,
- final Object a,
- final Object b )
- {
- final Boolean fixed1 = Boolean.valueOf( getFixed( a ) );
- final Boolean fixed2 = Boolean.valueOf( getFixed( b ) );
-
- final String label1 = getLabel( a );
- final String label2 = getLabel( b );
-
- int res
- = fixed1.equals( fixed2 )
- ? 0
- : ( fixed1.booleanValue() ? -1 : 1 );
-
- if( res == 0 )
- {
- res = label1.compareToIgnoreCase( label2 );
- }
-
- return res;
- }
-
- private static String getLabel( final Object obj )
- {
- if( obj instanceof TableRowData )
- {
- return ( (TableRowData) obj ).getProjectFacet().getLabel();
- }
- else
- {
- return ( (ICategory) obj ).getLabel();
- }
- }
-
- private static boolean getFixed( final Object obj )
- {
- if( obj instanceof TableRowData )
- {
- return ( (TableRowData) obj ).isFixed();
- }
- else
- {
- return false;
- }
- }
- }
-
- private final class ProblemsContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- return problems.getChildren();
- }
-
- public void dispose() { }
-
- public void inputChanged( final Viewer viewer,
- final Object oldObject,
- final Object newObject ) {}
- }
-
- private final class ProblemsLabelProvider
-
- implements ITableLabelProvider
-
- {
- private Image errorImage;
-
- public ProblemsLabelProvider()
- {
- final Bundle bundle = Platform.getBundle( FacetUiPlugin.PLUGIN_ID );
- final URL url = bundle.getEntry( "images/error.gif" );
-
- this.errorImage
- = ImageDescriptor.createFromURL( url ).createImage();
- }
-
- public String getColumnText( final Object element,
- final int column )
- {
- return ( (IStatus) element ).getMessage();
- }
-
- public Image getColumnImage( final Object element,
- final int column )
- {
- return this.errorImage;
- }
-
- public boolean isLabelProperty( final Object obj,
- final String s )
- {
- return false;
- }
-
- public void dispose()
- {
- this.errorImage.dispose();
- }
-
- public void addListener( final ILabelProviderListener listener ) {}
- public void removeListener( ILabelProviderListener listener ) {}
- }
-
- private static final GridData gdfill()
- {
- return new GridData( SWT.FILL, SWT.FILL, true, true );
- }
-
- private static final GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
- private static final GridData whint( final GridData gd,
- final int width )
- {
- gd.widthHint = width;
- return gd;
- }
-
- private static final GridData hhint( final GridData gd,
- final int height )
- {
- gd.heightHint = height;
- return gd;
- }
-
- private static final GridData hspan( final GridData gd,
- final int span )
- {
- gd.horizontalSpan = span;
- return gd;
- }
-
- private static final GridData halign( final GridData gd,
- final int alignment )
- {
- gd.horizontalAlignment = alignment;
- return gd;
- }
-
- private static final int getPreferredWidth( final Control control )
- {
- return control.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x;
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String showRuntimes;
- public static String hideRuntimes;
-
- static
- {
- initializeMessages( FacetsSelectionPanel.class.getName(),
- Resources.class );
- }
- }
-
-}
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 02bcb50..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-showRuntimes = << Show Runtimes
-hideRuntimes = Hide Runtimes >>
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 5f4c8d9..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-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.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.RuntimeManager;
-import org.osgi.framework.Bundle;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ProjectFacetsUiManagerImpl
-{
- private static final String EXTENSION_ID = "wizard";
- private static final String IMAGES_EXTENSION_ID = "images";
-
- private static final HashMap metadata;
-
- /**
- * Maps either IProjectFacet or IRuntimeComponentType to an ImageDescriptor.
- */
-
- private static final HashMap icons = new HashMap();
- private static ImageDescriptor defaultIcon;
-
- static
- {
- // Make sure that the core extensions are loaded first.
-
- ProjectFacetsManager.getProjectFacets();
- RuntimeManager.getRuntimeComponentTypes();
-
- metadata = new HashMap();
-
- final Bundle bundle = Platform.getBundle( FacetUiPlugin.PLUGIN_ID );
- final URL url = bundle.getEntry( "images/unknown.gif" );
- defaultIcon = ImageDescriptor.createFromURL( url );
-
- readExtensions();
- readImagesExtensions();
- }
-
- private ProjectFacetsUiManagerImpl() {}
-
- public static ImageDescriptor getIcon( final Object obj )
- {
- final ImageDescriptor imgdesc = (ImageDescriptor) icons.get( obj );
- return imgdesc != null ? imgdesc : defaultIcon;
- }
-
- /**
- * @return (element type: {@see IFacetWizardPage})
- */
-
- public static List getWizardPages( final Action.Type actionType,
- final IProjectFacetVersion f )
- {
- final WizardPagesInfo info = (WizardPagesInfo) metadata.get( f );
-
- if( info != null )
- {
- final List clnames = (List) info.pagesets.get( actionType );
-
- if( clnames != null )
- {
- return getWizardPages( info.plugin, clnames );
- }
- }
-
- return Collections.EMPTY_LIST;
- }
-
- private static List getWizardPages( final String plugin,
- final List clnames )
- {
- final List pages = new ArrayList();
-
- for( Iterator itr = clnames.iterator(); itr.hasNext(); )
- {
- try
- {
- pages.add( create( plugin, (String) itr.next() ) );
- }
- 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 readExtensions()
- {
- final IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- final IExtensionPoint point
- = registry.getExtensionPoint( FacetUiPlugin.PLUGIN_ID,
- EXTENSION_ID );
-
- if( point == null )
- {
- throw new RuntimeException( "Extension point not found!" );
- }
-
- final IExtension[] extensions = point.getExtensions();
-
- for( int i = 0; i < extensions.length; i++ )
- {
- final IConfigurationElement[] elements
- = extensions[ i ].getConfigurationElements();
-
- for( int j = 0; j < elements.length; j++ )
- {
- final IConfigurationElement config = elements[ j ];
- final String ename = config.getName();
-
- if( ename.equals( "wizard-pages" ) )
- {
- readWizardPagesInfo( config );
- }
- }
- }
- }
-
- private static void readWizardPagesInfo( final IConfigurationElement config )
- {
- final String id = config.getAttribute( "facet" );
-
- if( id == null )
- {
- reportMissingAttribute( config, "facet" );
- return;
- }
-
- if( ! ProjectFacetsManager.isProjectFacetDefined( id ) )
- {
- final String msg
- = NLS.bind( Resources.facetNotDefined,
- config.getNamespace(), id );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- final IProjectFacet f = ProjectFacetsManager.getProjectFacet( id );
-
- final String version = config.getAttribute( "version" );
-
- if( version == null )
- {
- reportMissingAttribute( config, "version" );
- return;
- }
-
- if( ! f.hasVersion( version ) )
- {
- final String[] params
- = new String[] { config.getNamespace(), id,
- version };
-
- final String msg
- = NLS.bind( Resources.facetVersionNotDefined,
- params );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- final IProjectFacetVersion fv = f.getVersion( version );
-
- final WizardPagesInfo info = new WizardPagesInfo();
- info.plugin = config.getDeclaringExtension().getNamespace();
-
- 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;
-
- if( childName.equals( "install" ) )
- {
- actionType = Action.Type.INSTALL;
- }
- else if( childName.equals( "uninstall" ) )
- {
- actionType = Action.Type.UNINSTALL;
- }
- else if( childName.equals( "version-change" ) )
- {
- actionType = Action.Type.UNINSTALL;
- }
- else
- {
- final String msg
- = NLS.bind( Resources.invalidActionType,
- config.getNamespace(), childName );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- info.pagesets.put( actionType, readPageList( child ) );
- }
-
- metadata.put( fv, info );
- }
-
- private static List readPageList( final IConfigurationElement config )
- {
- final ArrayList list = new ArrayList();
- 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( "page" ) )
- {
- final String clname = child.getAttribute( "class" );
-
- if( clname == null )
- {
- reportMissingAttribute( config, "class" );
- continue;
- }
-
- list.add( clname );
- }
- }
-
- return list;
- }
-
- private static void readImagesExtensions()
- {
- final IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- final IExtensionPoint point
- = registry.getExtensionPoint( FacetUiPlugin.PLUGIN_ID,
- IMAGES_EXTENSION_ID );
-
- if( point == null )
- {
- throw new RuntimeException( "Extension point not found!" );
- }
-
- final IExtension[] extensions = point.getExtensions();
-
- for( int i = 0; i < extensions.length; i++ )
- {
- final IConfigurationElement[] elements
- = extensions[ i ].getConfigurationElements();
-
- for( int j = 0; j < elements.length; j++ )
- {
- final IConfigurationElement config = elements[ j ];
- final String ename = config.getName();
-
- if( ename.equals( "image" ) )
- {
- readImage( config );
- }
- }
- }
- }
-
- private static void readImage( final IConfigurationElement config )
- {
- final String fid = config.getAttribute( "facet" );
- final String cid = config.getAttribute( "category" );
- final String rct = config.getAttribute( "runtime-component-type" );
-
- final Object target;
-
- if( fid != null )
- {
- if( ! ProjectFacetsManager.isProjectFacetDefined( fid ) )
- {
- final String msg
- = NLS.bind( Resources.facetNotDefined,
- config.getNamespace(), fid );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- target = ProjectFacetsManager.getProjectFacet( fid );
- }
- else if( cid != null )
- {
- if( ! ProjectFacetsManager.isCategoryDefined( cid ) )
- {
- final String msg
- = NLS.bind( Resources.categoryNotDefined,
- config.getNamespace(), fid );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- target = ProjectFacetsManager.getCategory( cid );
- }
- else if( rct != null )
- {
- if( ! RuntimeManager.isRuntimeComponentTypeDefined( rct ) )
- {
- final String msg
- = NLS.bind( Resources.runtimeComponentTypeNotDefined,
- config.getNamespace(), rct );
-
- FacetUiPlugin.log( msg );
-
- return;
- }
-
- target = RuntimeManager.getRuntimeComponentType( rct );
- }
- else
- {
- reportMissingAttribute( config, "facet" );
- return;
- }
-
- final String path = config.getAttribute( "path" );
-
- if( path == null )
- {
- reportMissingAttribute( config, "path" );
- }
-
- final String plugin = config.getNamespace();
- final Bundle bundle = Platform.getBundle( plugin );
- final URL url = bundle.getEntry( path );
-
- 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.getNamespace(), el.getName(), attribute };
-
- final String msg = NLS.bind( Resources.missingAttribute, params );
-
- FacetUiPlugin.log( msg );
- }
-
- private static class WizardPagesInfo
- {
- public String plugin;
- public HashMap pagesets = new HashMap();
- }
-
- 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;
-
- 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 e2a8914..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/ProjectFacetsUiManagerImpl.properties
+++ /dev/null
@@ -1,8 +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}.
\ 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 d59fe03..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.java
+++ /dev/null
@@ -1,726 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 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 API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.common.project.facet.ui.internal;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-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.IFontProvider;
-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.Font;
-import org.eclipse.swt.graphics.FontData;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.wst.common.project.facet.core.IListener;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-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.core.runtime.RuntimeManager;
-import org.eclipse.wst.common.project.facet.ui.IDecorationsProvider;
-import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class RuntimesPanel
-
- extends Composite
-
-{
- private final Label runtimesLabel;
- private final CheckboxTableViewer runtimes;
- private final Button makePreferredButton;
- private final Label runtimeComponentsLabel;
- private final TableViewer runtimeComponents;
- private final FacetsSelectionPanel facetsSelectionPanel;
- private final Map facetFilters;
- private final Set filters;
- private IRuntime boundRuntime;
- private final Set listeners;
-
- public interface IFilter
- {
- boolean check( IRuntime runtime );
- }
-
- public RuntimesPanel( final Composite parent,
- final int style,
- final FacetsSelectionPanel facetsSelectionPanel )
- {
- super( parent, style );
-
- this.facetsSelectionPanel = facetsSelectionPanel;
- this.facetFilters = new HashMap();
- this.filters = new HashSet();
- this.listeners = new HashSet();
-
- // 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.makePreferredButton = new Button( this, SWT.PUSH );
- this.makePreferredButton.setText( Resources.makePreferredLabel );
- GridData gd = halign( new GridData(), GridData.END );
- gd = whint( gd, getPreferredWidth( this.makePreferredButton ) + 15 );
- this.makePreferredButton.setLayoutData( gd );
-
- this.makePreferredButton.setEnabled( false );
-
- this.makePreferredButton.addSelectionListener
- (
- new SelectionAdapter()
- {
- public void widgetSelected( final SelectionEvent e )
- {
- handleMakePreferred();
- }
- }
- );
-
- this.runtimeComponentsLabel = new Label( this, SWT.NONE );
- this.runtimeComponentsLabel.setText( Resources.runtimeCompositionLabel );
- this.runtimeComponentsLabel.setLayoutData( gdhfill() );
-
- this.runtimeComponents = new TableViewer( this, SWT.BORDER );
- this.runtimeComponents.getTable().setLayoutData( hhint( gdhfill(), 50 ) );
- this.runtimeComponents.setContentProvider( new RuntimeComponentsContentProvider() );
- this.runtimeComponents.setLabelProvider( new RuntimeComponentsLabelProvider() );
- this.runtimeComponents.getTable().setBackground( new Color( null, 255, 255, 206 ) );
-
- final IListener listener = new IListener()
- {
- public void handle()
- {
- refresh();
- }
- };
-
- RuntimeManager.addRuntimeListener( listener );
-
- addDisposeListener
- (
- new DisposeListener()
- {
- public void widgetDisposed( final DisposeEvent e )
- {
- RuntimeManager.removeRuntimeListener( listener );
- }
- }
- );
- }
-
- public IRuntime getRuntime()
- {
- return this.boundRuntime;
- }
-
- public void setRuntime( final IRuntime runtime )
- {
- final IRuntime old = this.boundRuntime;
-
- if( old != null )
- {
- removeProjectFacetsFilter( old );
- this.boundRuntime = null;
- this.runtimes.update( old, null );
- }
-
- this.boundRuntime = runtime;
-
- if( runtime != null )
- {
- addProjectFacetsFilter( runtime );
- this.runtimes.update( runtime, null );
- }
-
- notifyRuntimeListeners();
- }
-
- public void addRuntimeListener( final Listener listener )
- {
- this.listeners.add( listener );
- }
-
- public void removeRuntimeListener( final Listener listener )
- {
- this.listeners.remove( listener );
- }
-
- private void notifyRuntimeListeners()
- {
- for( Iterator itr = this.listeners.iterator(); itr.hasNext(); )
- {
- ( (Listener) itr.next() ).handleEvent( null );
- }
- }
-
- public void addFilter( final IFilter filter )
- {
- this.filters.add( filter );
- refresh();
- }
-
- public void removeFilter( final IFilter filter )
- {
- this.filters.remove( filter );
- refresh();
- }
-
- private boolean isFilteredOut( final IRuntime r )
- {
- for( Iterator itr = RuntimesPanel.this.filters.iterator();
- itr.hasNext(); )
- {
- final IFilter filter = (IFilter) itr.next();
-
- if( ! filter.check( r ) )
- {
- return true;
- }
- }
-
- return false;
- }
-
- public void refresh()
- {
- this.runtimes.refresh();
-
- for( Iterator itr = RuntimeManager.getRuntimes().iterator();
- itr.hasNext(); )
- {
- final IRuntime r = (IRuntime) itr.next();
-
- if( isFilteredOut( r ) )
- {
- this.runtimes.setGrayed( r, true );
- }
- else
- {
- this.runtimes.setGrayed( r, false );
- }
- }
- }
-
- private void addProjectFacetsFilter( final IRuntime r )
- {
- if( ! this.facetFilters.containsKey( r ) )
- {
- final FacetsSelectionPanel.IFilter filter
- = new SupportedFacetsFilter( r );
-
- this.facetFilters.put( r, filter );
- this.facetsSelectionPanel.addFilter( filter );
-
- if( ! this.runtimes.getChecked( r ) )
- {
- this.runtimes.setChecked( r, true );
- }
- }
- }
-
- private void removeProjectFacetsFilter( final IRuntime r )
- {
- final FacetsSelectionPanel.IFilter filter
- = (FacetsSelectionPanel.IFilter) this.facetFilters.remove( r );
-
- this.facetsSelectionPanel.removeFilter( filter );
-
- if( this.runtimes.getChecked( r ) )
- {
- this.runtimes.setChecked( r, false );
- }
- }
-
- private void handleCheckStateChanged( final CheckStateChangedEvent e )
- {
- final IRuntime runtime = (IRuntime) e.getElement();
-
- if( isFilteredOut( runtime ) && e.getChecked() )
- {
- this.runtimes.setChecked( runtime, false );
- return;
- }
-
- if( this.facetFilters.containsKey( runtime ) )
- {
- removeProjectFacetsFilter( runtime );
-
- if( runtime == this.boundRuntime )
- {
- if( this.facetFilters.isEmpty() )
- {
- this.boundRuntime = null;
- }
- else
- {
- final IRuntime r
- = (IRuntime) this.facetFilters.keySet().iterator().next();
-
- this.boundRuntime = r;
- this.runtimes.update( r, null );
-
- final IRuntime selection = getSelection();
-
- if( selection != null && selection.equals( r ) )
- {
- this.makePreferredButton.setEnabled( false );
- }
- }
-
- this.runtimes.update( runtime, null );
- notifyRuntimeListeners();
- }
- }
- else
- {
- addProjectFacetsFilter( runtime );
-
- if( this.boundRuntime == null )
- {
- this.boundRuntime = runtime;
- this.runtimes.update( runtime, null );
- notifyRuntimeListeners();
- }
- }
- }
-
- private void handleRuntimeSelectionChanged()
- {
- final IRuntime r = getSelection();
-
- if( r != null )
- {
- if( this.runtimeComponents.getInput() == null ||
- ! this.runtimeComponents.getInput().equals( r ) )
- {
- this.runtimeComponents.setInput( r );
- }
-
- if( this.runtimes.getChecked( r ) && this.boundRuntime != null &&
- ! this.boundRuntime.equals( r ) && ! isFilteredOut( r ) )
- {
- this.makePreferredButton.setEnabled( true );
- }
- else
- {
- this.makePreferredButton.setEnabled( false );
- }
- }
- }
-
- private void handleMakePreferred()
- {
- final IRuntime old = this.boundRuntime;
- this.boundRuntime = getSelection();
-
- this.runtimes.refresh( old );
- this.runtimes.refresh( this.boundRuntime );
-
- notifyRuntimeListeners();
- }
-
- private IRuntime getSelection()
- {
- final IStructuredSelection ssel
- = (IStructuredSelection) this.runtimes.getSelection();
-
- if( ssel.isEmpty() )
- {
- return null;
- }
- else
- {
- return (IRuntime) ssel.getFirstElement();
- }
- }
-
- private final class ContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- return RuntimeManager.getRuntimes().toArray();
- }
-
- public void dispose() { }
-
- public void inputChanged( final Viewer viewer,
- final Object oldObject,
- final Object newObject ) {}
- }
-
- private final class LabelProvider
-
- implements ILabelProvider, IFontProvider, IColorProvider
-
- {
- private final Color COLOR_GREY
- = new Color( null, 160, 160, 164 );
-
- private final ImageRegistry imageRegistry;
- private final Font boldFont;
-
- public LabelProvider()
- {
- this.imageRegistry = new ImageRegistry();
-
- final FontData system
- = Display.getCurrent().getSystemFont().getFontData()[ 0 ];
-
- final FontData bold
- = new FontData( system.getName(), system.getHeight(), SWT.BOLD );
-
- this.boldFont = new Font( Display.getCurrent(), bold );
- }
-
- public String getText( final Object element )
- {
- return ( (IRuntime) element ).getName();
- }
-
- public Image getImage( final Object element )
- {
- final IRuntime r = (IRuntime) element;
-
- final IRuntimeComponent rc
- = (IRuntimeComponent) r.getRuntimeComponents().get( 0 );
-
- 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() );
- }
-
- if( isFilteredOut( r ) )
- {
- final String greyedId = rct.getId() + "##greyed##";
- Image greyed = this.imageRegistry.get( greyedId );
-
- if( greyed == null )
- {
- greyed = new Image( null, image, SWT.IMAGE_GRAY );
- this.imageRegistry.put( greyedId, greyed );
- }
-
- return greyed;
- }
- else
- {
- return image;
- }
- }
-
- public Font getFont( final Object element )
- {
- if( RuntimesPanel.this.boundRuntime != null &&
- RuntimesPanel.this.boundRuntime.equals( element ) )
- {
- return this.boldFont;
- }
-
- return null;
- }
-
- public Color getForeground( final Object element )
- {
- if( isFilteredOut( (IRuntime) element ) )
- {
- return COLOR_GREY;
- }
- else
- {
- return null;
- }
- }
-
- public Color getBackground( final Object element )
- {
- return null;
- }
-
- public void dispose()
- {
- this.imageRegistry.dispose();
- this.boldFont.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 boolean r1fo = isFilteredOut( r1 );
-
- final IRuntime r2 = (IRuntime) b;
- final boolean r2fo = isFilteredOut( r2 );
-
- if( r1fo && ! r2fo )
- {
- return 1;
- }
- else if( ! r1fo && r2fo )
- {
- return -1;
- }
- else
- {
- return r1.getName().compareToIgnoreCase( r2.getName() );
- }
- }
- }
-
- private final class RuntimeComponentsContentProvider
-
- implements IStructuredContentProvider
-
- {
- public Object[] getElements( final Object element )
- {
- 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 )
- {
- 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 )
- {
- 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 SupportedFacetsFilter
-
- implements FacetsSelectionPanel.IFilter
-
- {
- private final IRuntime runtime;
-
- public SupportedFacetsFilter( final IRuntime runtime )
- {
- this.runtime = runtime;
- }
-
- public boolean check( final IProjectFacetVersion fv )
- {
- return this.runtime.supports( fv );
- }
- }
-
- private static final GridData gdfill()
- {
- return new GridData( SWT.FILL, SWT.FILL, true, true );
- }
-
- private static final GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
- private static final GridData whint( final GridData gd,
- final int width )
- {
- gd.widthHint = width;
- return gd;
- }
-
- private static final GridData hhint( final GridData gd,
- final int height )
- {
- gd.heightHint = height;
- return gd;
- }
-
- private static final GridData halign( final GridData gd,
- final int alignment )
- {
- gd.horizontalAlignment = alignment;
- return gd;
- }
-
- private static final int getPreferredWidth( final Control control )
- {
- return control.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x;
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String runtimesLabel;
- public static String runtimeCompositionLabel;
- public static String makePreferredLabel;
-
- 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 01d34c1..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPanel.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-runtimesLabel = Runtimes:
-runtimeCompositionLabel = Runtime Composition:
-makePreferredLabel = Make Preferred