Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 81898 Details for
Bug 174905
Wizard to export EAR and WAR should allow customization
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Patch
patch174905.txt (text/plain), 74.10 KB, created by
Konstantin Komissarchik
on 2007-11-01 18:45:04 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Konstantin Komissarchik
Created:
2007-11-01 18:45:04 EDT
Size:
74.10 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.j2ee >Index: property_files/eararchiveops.properties >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/property_files/eararchiveops.properties,v >retrieving revision 1.4 >diff -u -r1.4 eararchiveops.properties >--- property_files/eararchiveops.properties 11 Oct 2007 20:49:22 -0000 1.4 >+++ property_files/eararchiveops.properties 1 Nov 2007 22:30:17 -0000 >@@ -33,4 +33,5 @@ > _jar_UI_=.jar > Updating_manifest_Class_Path__attributes_UI_=Updating manifest Class-Path: attributes > _preDeploy_ERROR_=IWAE0002E {0}.preDeploy >+noRuntimeSelectedLabel = <none> > MISSING_CLIENT_JAR=EJB Client Jar \"{0}\" for EJB Jar \"{1}\" missing from EAR \"{2}\". >Index: archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java,v >retrieving revision 1.15 >diff -u -r1.15 IJ2EEComponentExportDataModelProperties.java >--- archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java 30 Oct 2007 00:40:25 -0000 1.15 >+++ archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java 1 Nov 2007 22:30:17 -0000 >@@ -10,7 +10,9 @@ > *******************************************************************************/ > package org.eclipse.jst.j2ee.datamodel.properties; > >+import org.eclipse.jst.j2ee.archive.IArchiveExportParticipant; > import org.eclipse.jst.j2ee.internal.archive.operations.EARArchiveOpsResourceHandler; >+import org.eclipse.wst.common.frameworks.datamodel.IDataModel; > import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; > /** > * <p> >@@ -60,14 +62,34 @@ > > public static final String COMPONENT = "IJ2EEComponentExportDataModelProperties.COMPONENT"; //$NON-NLS-1$ > >+ /** >+ * @since 3.0 >+ */ >+ >+ public static final String OPTIMIZE_FOR_SPECIFIC_RUNTIME = "IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME"; >+ >+ /** >+ * @since 3.0 >+ */ >+ > public static final String RUNTIME = "IJ2EEComponentExportDataModelProperties.RUNTIME"; //$NON-NLS-1 > >- public static final Object NO_RUNTIME_SELECTED = new Object() >+ /** >+ * @since 3.0 >+ */ >+ >+ public static final String RUNTIME_SPECIFIC_PARTICIPANTS >+ = "IJ2EEComponentExportDataModelProperties.RUNTIME_SPECIFIC_PARTICIPANTS"; //$NON-NLS-1 >+ >+ /** >+ * @since 3.0 >+ */ >+ >+ interface IArchiveExportParticipantData > { >- public String toString() >- { >- return EARArchiveOpsResourceHandler.noRuntimeSelectedLabel; >- } >- }; >+ String getId(); >+ IArchiveExportParticipant getParticipant(); >+ IDataModel getDataModel(); >+ } > > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/plugin.xml,v >retrieving revision 1.116 >diff -u -r1.116 plugin.xml >--- plugin.xml 12 Jun 2007 20:15:42 -0000 1.116 >+++ plugin.xml 1 Nov 2007 22:30:17 -0000 >@@ -21,6 +21,7 @@ > <extension-point id="optionalRefactorHandler" name="optionalRefactorHandler" schema="schema/optionalRefactorHandler.exsd"/> > <extension-point id="classpathdep" name="classpathdep" schema="schema/ClasspathDep.exsd"/> > <extension-point id="J2EEModelProvider" name="J2EE Model Provider" schema="schema/J2EEModelProvider.exsd"/> >+ <extension-point id="archiveExportParticipants" name="Archive Export Participants Extension Point" schema="schema/archiveExportParticipants.exsd"/> > > <!--============================--> > <!-- Module Core Nature --> >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java,v >retrieving revision 1.22 >diff -u -r1.22 J2EEArtifactExportOperation.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java 28 Aug 2007 14:48:43 -0000 1.22 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java 1 Nov 2007 22:30:17 -0000 >@@ -10,10 +10,13 @@ > *******************************************************************************/ > package org.eclipse.jst.j2ee.internal.archive.operations; > >+import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.*; >+ > import java.io.File; > import java.lang.reflect.InvocationTargetException; > import java.util.HashSet; > import java.util.Iterator; >+import java.util.List; > import java.util.Set; > > import org.eclipse.core.commands.ExecutionException; >@@ -37,6 +40,7 @@ > import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile; > import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; > import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties; >+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.IArchiveExportParticipantData; > import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveLoadAdapter; > import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; > import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler; >@@ -48,6 +52,7 @@ > import org.eclipse.wst.common.componentcore.resources.IVirtualReference; > import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; > import org.eclipse.wst.common.frameworks.datamodel.IDataModel; >+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; > > public abstract class J2EEArtifactExportOperation extends AbstractDataModelOperation { > >@@ -70,40 +75,75 @@ > protected final int LIB_BUILDER_WORK = 100; > protected final int EXPORT_WORK = 1000; > protected final int CLOSE_WORK = 10; >+ protected final int SINGLE_PARTICIPANT_WORK = 200; > > protected int computeTotalWork() { > int totalWork = REFRESH_WORK; >- if (model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.RUN_BUILD)) { >+ if (model.getBooleanProperty(RUN_BUILD)) { > totalWork += JAVA_BUILDER_WORK + LIB_BUILDER_WORK; > } > totalWork += EXPORT_WORK + CLOSE_WORK; >+ >+ final IDataModel dm = getDataModel(); >+ >+ if( dm.getProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) == Boolean.TRUE ) >+ { >+ final List<IArchiveExportParticipantData> extensions >+ = (List<IArchiveExportParticipantData>) dm.getProperty( RUNTIME_SPECIFIC_PARTICIPANTS ); >+ >+ totalWork += extensions.size() * SINGLE_PARTICIPANT_WORK; >+ } >+ > return totalWork; > } > > public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { >- setComponent((IVirtualComponent) model.getProperty(IJ2EEComponentExportDataModelProperties.COMPONENT)); >- setDestinationPath(new Path(model.getStringProperty(IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION))); >- setExportSource(model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES)); >- try { >- monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive, new Object [] { getDestinationPath().lastSegment() }), computeTotalWork()); >- setProgressMonitor(monitor); >- // defect 240999 >- component.getProject().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, REFRESH_WORK)); >- if (model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.RUN_BUILD)) { >- runNecessaryBuilders(component, new SubProgressMonitor(monitor, JAVA_BUILDER_WORK + LIB_BUILDER_WORK)); >- } >- export(); >- } catch (Exception e) { >- if(moduleFile != null){ >- //The module fil will be closed if the export succeeds >- //Need to be careful not to close the archive twice because of ReferenceCounted Archives >- moduleFile.close(); >- monitor.worked(CLOSE_WORK); >- } >- throw new ExecutionException(EJBArchiveOpsResourceHandler.Error_exporting__UI_ + archiveString(), e); >- } finally { >- monitor.done(); >+ setComponent((IVirtualComponent) model.getProperty(COMPONENT)); >+ setDestinationPath(new Path(model.getStringProperty(ARCHIVE_DESTINATION))); >+ setExportSource(model.getBooleanProperty(EXPORT_SOURCE_FILES)); >+ >+ try >+ { >+ monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive, new Object [] { getDestinationPath().lastSegment() }), computeTotalWork()); >+ setProgressMonitor(monitor); >+ >+ try { >+ // defect 240999 >+ component.getProject().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, REFRESH_WORK)); >+ if (model.getBooleanProperty(RUN_BUILD)) { >+ runNecessaryBuilders(component, new SubProgressMonitor(monitor, JAVA_BUILDER_WORK + LIB_BUILDER_WORK)); >+ } >+ export(); >+ } catch (Exception e) { >+ if(moduleFile != null){ >+ //The module fil will be closed if the export succeeds >+ //Need to be careful not to close the archive twice because of ReferenceCounted Archives >+ moduleFile.close(); >+ monitor.worked(CLOSE_WORK); >+ } >+ throw new ExecutionException(EJBArchiveOpsResourceHandler.Error_exporting__UI_ + archiveString(), e); >+ } >+ >+ final IDataModel dm = getDataModel(); >+ >+ if( dm.getProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) == Boolean.TRUE ) >+ { >+ for( IArchiveExportParticipantData extData >+ : (List<IArchiveExportParticipantData>) dm.getProperty( RUNTIME_SPECIFIC_PARTICIPANTS ) ) >+ { >+ final IDataModelOperation op >+ = extData.getParticipant().createOperation( extData.getDataModel() ); >+ >+ op.execute( null, null ); >+ monitor.worked( SINGLE_PARTICIPANT_WORK ); >+ } >+ } >+ } >+ finally >+ { >+ monitor.done(); > } >+ > return OK_STATUS; > } > >@@ -125,7 +165,7 @@ > > protected IVirtualComponent getComponent() { > if (component == null) >- component = (IVirtualComponent) model.getProperty(IJ2EEComponentExportDataModelProperties.COMPONENT); >+ component = (IVirtualComponent) model.getProperty(COMPONENT); > return component; > } > >@@ -241,7 +281,7 @@ > IArchiveLoadAdapter loadAdapter = archiveToSave.getLoadAdapter(); > if(loadAdapter instanceof ComponentArchiveLoadAdapter){ > ComponentArchiveLoadAdapter cLoadAdapter = (ComponentArchiveLoadAdapter)loadAdapter; >- cLoadAdapter.setExportSource(getDataModel().getBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES)); >+ cLoadAdapter.setExportSource(getDataModel().getBooleanProperty(EXPORT_SOURCE_FILES)); > > } > IArchiveFactory.INSTANCE.saveArchive(archiveToSave, outputPath, monitor); >Index: earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java,v >retrieving revision 1.19 >diff -u -r1.19 J2EEArtifactExportDataModelProvider.java >--- earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java 30 Oct 2007 00:40:24 -0000 1.19 >+++ earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java 1 Nov 2007 22:30:17 -0000 >@@ -14,10 +14,10 @@ > import java.util.Collections; > import java.util.Comparator; > import java.util.HashMap; >-import java.util.Iterator; > import java.util.List; > import java.util.Set; > >+import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IWorkspace; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -25,7 +25,9 @@ > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Path; >+import org.eclipse.jst.j2ee.archive.IArchiveExportParticipant; > import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties; >+import org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint; > import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; > import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; > import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities; >@@ -42,7 +44,29 @@ > > public abstract class J2EEArtifactExportDataModelProvider extends AbstractDataModelProvider implements IJ2EEComponentExportDataModelProperties { > >- public HashMap componentMap; >+ private static final class ArchiveExportParticipantData implements IArchiveExportParticipantData >+ { >+ private String id = null; >+ private IArchiveExportParticipant extension = null; >+ private IDataModel datamodel = null; >+ >+ public String getId() >+ { >+ return this.id; >+ } >+ >+ public IArchiveExportParticipant getParticipant() >+ { >+ return this.extension; >+ } >+ >+ public IDataModel getDataModel() >+ { >+ return this.datamodel; >+ } >+ } >+ >+ public HashMap componentMap; > > public J2EEArtifactExportDataModelProvider() { > super(); >@@ -56,7 +80,9 @@ > propertyNames.add(OVERWRITE_EXISTING); > propertyNames.add(RUN_BUILD); > propertyNames.add(COMPONENT); >+ propertyNames.add(OPTIMIZE_FOR_SPECIFIC_RUNTIME); > propertyNames.add(RUNTIME); >+ propertyNames.add(RUNTIME_SPECIFIC_PARTICIPANTS); > return propertyNames; > } > >@@ -75,12 +101,31 @@ > return Boolean.FALSE; > } else if (propertyName.equals(RUN_BUILD)) { > return Boolean.TRUE; >+ } else if (propertyName.equals(RUNTIME_SPECIFIC_PARTICIPANTS)) { >+ return new ArrayList<IArchiveExportParticipantData>(); > } > return super.getDefaultProperty(propertyName); > } > >- public boolean propertySet(String propertyName, Object propertyValue) { >+ public boolean isPropertyEnabled( final String propertyName ) >+ { >+ if( propertyName.equals( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) ) >+ { >+ return getDataModel().getValidPropertyDescriptors( RUNTIME ).length > 0; >+ } >+ else if( propertyName.equals( RUNTIME ) ) >+ { >+ return ( (Boolean) getProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) ).booleanValue(); >+ } >+ >+ return true; >+ } >+ >+ public boolean propertySet(String propertyName, Object propertyValue) >+ { > boolean set = super.propertySet(propertyName, propertyValue); >+ final IDataModel dm = getDataModel(); >+ > if (propertyName.equals(PROJECT_NAME)) { > if (getComponentMap().isEmpty()) > intializeComponentMap(); >@@ -91,41 +136,111 @@ > setProperty(COMPONENT, null); > } > >- getDataModel().notifyPropertyChange( RUNTIME, IDataModel.VALID_VALUES_CHG ); >+ dm.notifyPropertyChange( RUNTIME, IDataModel.VALID_VALUES_CHG ); >+ >+ IFacetedProject fproj = null; > > if( component != null ) > { > try > { >- final IFacetedProject fproj = ProjectFacetsManager.create( component.getProject() ); >- final IRuntime primary = fproj.getPrimaryRuntime(); >- >- if( primary != null ) >- { >- setProperty( RUNTIME, primary ); >- } >- else >- { >- setProperty( RUNTIME, NO_RUNTIME_SELECTED ); >- } >+ fproj = ProjectFacetsManager.create( component.getProject() ); > } > catch( CoreException e ) > { > J2EEPlugin.logError( -1, e.getMessage(), e ); > } > } >- else >+ >+ boolean optimize = false; >+ IRuntime runtime = null; >+ >+ if( fproj != null ) > { >- setProperty( RUNTIME, NO_RUNTIME_SELECTED ); >+ runtime = fproj.getPrimaryRuntime(); >+ >+ if( runtime != null ) >+ { >+ optimize = true; >+ } >+ else >+ { >+ final DataModelPropertyDescriptor[] validValues >+ = dm.getValidPropertyDescriptors( RUNTIME ); >+ >+ if( validValues.length > 0 ) >+ { >+ runtime = (IRuntime) validValues[ 0 ].getPropertyValue(); >+ } >+ } > } >+ >+ setProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME, optimize); >+ setProperty( RUNTIME, runtime ); >+ } >+ else if( propertyName.equals( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) ) >+ { >+ dm.notifyPropertyChange( RUNTIME, IDataModel.ENABLE_CHG ); > } > else if( propertyName.equals( RUNTIME ) ) > { >- if( propertyValue == null ) >+ final List<IArchiveExportParticipantData> currentExtDataList >+ = (List<IArchiveExportParticipantData>) getProperty( RUNTIME_SPECIFIC_PARTICIPANTS ); >+ >+ if( currentExtDataList != null ) >+ { >+ for( IArchiveExportParticipantData extData : currentExtDataList ) >+ { >+ dm.removeNestedModel( extData.getId() ); >+ } >+ } >+ >+ final List<IArchiveExportParticipantData> extensions = new ArrayList<IArchiveExportParticipantData>(); >+ >+ if( propertyValue != null ) > { >- setProperty( RUNTIME, NO_RUNTIME_SELECTED ); >+ final IProject project = getProject(); >+ >+ if( project != null && propertyValue != null ) >+ { >+ final IRuntime runtime = (IRuntime) propertyValue; >+ >+ for( ArchiveExportParticipantsExtensionPoint.ParticipantInfo partInfo >+ : ArchiveExportParticipantsExtensionPoint.getExtensions( project, runtime ) ) >+ { >+ ArchiveExportParticipantData partData = new ArchiveExportParticipantData(); >+ partData.id = partInfo.getId(); >+ partData.extension = partInfo.loadParticipant(); >+ >+ if( partData.extension != null ) >+ { >+ try >+ { >+ partData.datamodel = partData.extension.createDataModel( dm ); >+ dm.addNestedModel( partData.id, partData.datamodel ); >+ } >+ catch( Exception e ) >+ { >+ J2EEPlugin.logError( -1, e.getMessage(), e ); >+ partData = null; >+ } >+ } >+ else >+ { >+ partData = null; >+ } >+ >+ if( partData != null ) >+ { >+ extensions.add( partData ); >+ } >+ } >+ } > } >+ >+ setProperty( RUNTIME_SPECIFIC_PARTICIPANTS, Collections.unmodifiableList( extensions ) ); > } >+ > return set; > } > >@@ -171,6 +286,7 @@ > } > else if( propertyName.equals( RUNTIME ) ) > { >+ final List<IRuntime> runtimes = new ArrayList<IRuntime>(); > final IVirtualComponent component = (IVirtualComponent) getProperty( COMPONENT ); > > if( component != null ) >@@ -180,41 +296,25 @@ > try > { > final IFacetedProject fproj = ProjectFacetsManager.create( component.getProject() ); >- final List runtimes = new ArrayList(); > >- for( Iterator itr = RuntimeManager.getRuntimes().iterator(); itr.hasNext(); ) >+ for( IRuntime runtime : RuntimeManager.getRuntimes() ) > { >- final IRuntime runtime = (IRuntime) itr.next(); >- > if( fproj.isTargetable( runtime ) ) > { > runtimes.add( runtime ); > } > } > >- final Comparator comparator = new Comparator() >+ final Comparator<IRuntime> comparator = new Comparator<IRuntime>() > { >- public int compare( final Object obj1, >- final Object obj2 ) >+ public int compare( final IRuntime r1, >+ final IRuntime r2 ) > { >- final String rname1 = ( (IRuntime) obj1 ).getName(); >- final String rname2 = ( (IRuntime) obj2 ).getName(); >- return rname1.compareTo( rname2 ); >+ return r1.getName().compareTo( r2.getName() ); > } > }; > > Collections.sort( runtimes, comparator ); >- >- final Object[] array = new Object[ runtimes.size() + 1 ]; >- >- array[ 0 ] = NO_RUNTIME_SELECTED; >- >- for( int i = 0, n = runtimes.size(); i < n; i++ ) >- { >- array[ i + 1 ] = runtimes.get( i ); >- } >- >- return DataModelPropertyDescriptor.createDescriptors(array); > } > catch( CoreException e ) > { >@@ -222,6 +322,8 @@ > } > } > } >+ >+ return DataModelPropertyDescriptor.createDescriptors( runtimes.toArray() ); > } > > return super.getValidPropertyDescriptors(propertyName); >@@ -322,5 +424,19 @@ > } > return true; > } >+ >+ private IProject getProject() >+ { >+ final IVirtualComponent component = (IVirtualComponent) getProperty( COMPONENT ); >+ >+ if( component != null ) >+ { >+ return component.getProject(); >+ } >+ else >+ { >+ return null; >+ } >+ } > > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF,v >retrieving revision 1.42 >diff -u -r1.42 MANIFEST.MF >--- META-INF/MANIFEST.MF 17 Oct 2007 22:36:47 -0000 1.42 >+++ META-INF/MANIFEST.MF 1 Nov 2007 22:30:17 -0000 >@@ -10,6 +10,7 @@ > org.eclipse.jst.j2ee.applicationclient.componentcore.util, > org.eclipse.jst.j2ee.applicationclient.internal.creation;x-internal:=true, > org.eclipse.jst.j2ee.applicationclient.internal.modulecore.util;x-internal:=true, >+ org.eclipse.jst.j2ee.archive, > org.eclipse.jst.j2ee.classpathdep, > org.eclipse.jst.j2ee.common.internal.provider;x-internal:=true, > org.eclipse.jst.j2ee.componentcore, >Index: schema/archiveExportParticipants.exsd >=================================================================== >RCS file: schema/archiveExportParticipants.exsd >diff -N schema/archiveExportParticipants.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/archiveExportParticipants.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,183 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.jst.j2ee"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.jst.j2ee" id="archiveExportParticipants" name="Archive Export Participants Extension Point"/> >+ </appInfo> >+ <documentation> >+ Used for extending the archive export operation. >+ </documentation> >+ </annotation> >+ >+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="participant" minOccurs="1" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="participant"> >+ <annotation> >+ <documentation> >+ Registers a single archive export participant. >+ </documentation> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="runtime-component"/> >+ <element ref="factory"/> >+ <element ref="enablement" minOccurs="0" maxOccurs="1"/> >+ </sequence> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The unique identifier for this participant. This should not include the plugin id. Plugin id will be automatically prepended to the supplied id. >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="runtime-component"> >+ <annotation> >+ <documentation> >+ Specifies the type of the runtime component that has to be present in the selected runtime in order for this participant to be applicable. >+ </documentation> >+ </annotation> >+ <complexType> >+ <attribute name="type" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The type id of the runtime component. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="version" type="string"> >+ <annotation> >+ <documentation> >+ Optional version or a version expression. >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="factory"> >+ <annotation> >+ <documentation> >+ Registers the factory class that the framework will use for constructing the participant's data model and operation. >+ </documentation> >+ </annotation> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The factory implementation class. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.j2ee.archive.IArchiveExportParticipant"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.0 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ This example registers an export participant that's applicable to runtimes that contain "my.runtime.type" component type and to projects that have either the web or ear project facet. >+ >+<pre> >+<extension point="org.eclipse.jst.j2ee.archiveExportParticipants"> >+ <participant id="MyExportParticipant"> >+ <runtime-component type="my.runtime.type" version="[1.0-3.0)"/> >+ <factory class="com.somecorp.MyExportParticipant"/> >+ <enablement> >+ <or> >+ <test >+ forcePluginActivation="true" >+ property="org.eclipse.wst.common.project.facet.core.projectFacet" >+ value="jst.web"/> >+ <test >+ forcePluginActivation="true" >+ property="org.eclipse.wst.common.project.facet.core.projectFacet" >+ value="jst.ear"/> >+ </or> >+ </enablement> >+ </participant> >+</extension> >+</pre> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2005, 2007 BEA Systems, Inc. and others.<br> >+All rights reserved. This program and the accompanying materials are made >+available under the terms of the Eclipse Public License v1.0 which accompanies >+this distribution, and is available at <a >+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> >+ </documentation> >+ </annotation> >+ >+</schema> >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties >=================================================================== >RCS file: archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties >diff -N archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+missingAttribute = Extension element <{2}> is missing required attribute "{3}". [plugin: "{0}"; extension point: "{1}"] >+missingElement = Extension element <{2}> is missing required child element <{3}>. [plugin: "{0}"; extension point: "{1}"] >+failedToCreate = Failed to instantiate class {0}. >+doesNotImplement = Class {0} does not implement {1} interface. >Index: archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java >=================================================================== >RCS file: archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java >diff -N archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,47 @@ >+/****************************************************************************** >+ * Copyright (c) 2005, 2007 BEA Systems, Inc. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Konstantin Komissarchik >+ ******************************************************************************/ >+ >+package org.eclipse.jst.j2ee.archive; >+ >+import org.eclipse.wst.common.frameworks.datamodel.IDataModel; >+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; >+ >+/** >+ * Used in conjunction with the <code>org.eclipse.jst.j2ee.archiveExportParticipants</code> >+ * extension point in order to extend the base module archive export operation. >+ * >+ * @since 3.0 >+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> >+ */ >+ >+public interface IArchiveExportParticipant >+{ >+ /** >+ * Creates the data model that will be used to configure the operation. >+ * >+ * @param rootArchiveExportDataModel the data model of the module archive export >+ * operation that this participant is extending >+ * @return the created data model >+ */ >+ >+ IDataModel createDataModel( IDataModel rootArchiveExportDataModel ); >+ >+ /** >+ * Creates the operation that will be invoked in order to let this extension >+ * participate in the export process. >+ * >+ * @param extensionDataModel the data model associated with this export >+ * participant (previously returned by the createDataModel() method) >+ * @return the created operation >+ */ >+ >+ IDataModelOperation createOperation( IDataModel extensionDataModel ); >+} >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java >=================================================================== >RCS file: archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java >diff -N archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,436 @@ >+/****************************************************************************** >+ * Copyright (c) 2005, 2007 BEA Systems, Inc. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Konstantin Komissarchik >+ ******************************************************************************/ >+ >+package org.eclipse.jst.j2ee.internal.archive; >+ >+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.*; >+import static org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.*; >+ >+import java.util.ArrayList; >+import java.util.Collection; >+import java.util.Collections; >+import java.util.List; >+ >+import org.eclipse.core.expressions.EvaluationContext; >+import org.eclipse.core.expressions.EvaluationResult; >+import org.eclipse.core.expressions.Expression; >+import org.eclipse.core.expressions.ExpressionConverter; >+import org.eclipse.core.resources.IProject; >+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.Platform; >+import org.eclipse.jst.j2ee.archive.IArchiveExportParticipant; >+import org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.InvalidExtensionException; >+import org.eclipse.osgi.util.NLS; >+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.IRuntimeComponentVersion; >+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager; >+import org.osgi.framework.Bundle; >+ >+/** >+ * Contains the logic for processing the <code>org.eclipse.jst.j2ee.archiveExportParticipants</code> >+ * extension point. >+ * >+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> >+ */ >+ >+public final class ArchiveExportParticipantsExtensionPoint >+{ >+ public static final String EXTENSION_POINT_ID = "archiveExportParticipants"; //$NON-NLS-1$ >+ >+ private static final String EL_PARTICIPANT = "participant"; //$NON-NLS-1$ >+ private static final String EL_RUNTIME_COMPONENT = "runtime-component"; //$NON-NLS-1$ >+ private static final String EL_FACTORY = "factory"; //$NON-NLS-1$ >+ private static final String EL_ENABLEMENT = "enablement"; >+ private static final String ATTR_ID = "id"; //$NON-NLS-1$ >+ private static final String ATTR_TYPE = "type"; //$NON-NLS-1$ >+ private static final String ATTR_VERSION = "version"; //$NON-NLS-1$ >+ private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ >+ >+ private static List<ParticipantInfo> extensions = null; >+ >+ public static class ParticipantInfo >+ { >+ private String id; >+ private String pluginId = null; >+ private String className = null; >+ private IRuntimeComponentType runtimeComponentType = null; >+ private String runtimeComponentVersionExpr = null; >+ private Expression enablementCondition = null; >+ >+ public String getId() >+ { >+ return this.id; >+ } >+ >+ public IArchiveExportParticipant loadParticipant() >+ { >+ try >+ { >+ return instantiate( this.pluginId, this.className, IArchiveExportParticipant.class ); >+ } >+ catch( CoreException e ) >+ { >+ log( e.getStatus() ); >+ return null; >+ } >+ } >+ } >+ >+ public static List<ParticipantInfo> getExtensions( final IProject project, >+ final IRuntime runtime ) >+ { >+ readExtensions(); >+ >+ final List<ParticipantInfo> result = new ArrayList<ParticipantInfo>(); >+ >+ for( ParticipantInfo partInfo : extensions ) >+ { >+ boolean match = false; >+ >+ for( IRuntimeComponent rc : runtime.getRuntimeComponents() ) >+ { >+ final IRuntimeComponentType rct = rc.getRuntimeComponentType(); >+ >+ if( rct == partInfo.runtimeComponentType ) >+ { >+ final IRuntimeComponentVersion rcv = rc.getRuntimeComponentVersion(); >+ >+ try >+ { >+ if( rct.getVersions( partInfo.runtimeComponentVersionExpr ).contains( rcv ) ) >+ { >+ match = true; >+ break; >+ } >+ } >+ catch( CoreException e ) >+ { >+ logError( -1, e.getMessage(), e ); >+ } >+ } >+ } >+ >+ if( match && partInfo.enablementCondition != null ) >+ { >+ final EvaluationContext evalContext = new EvaluationContext( null, project ); >+ evalContext.setAllowPluginActivation( true ); >+ >+ try >+ { >+ final EvaluationResult evalResult >+ = partInfo.enablementCondition.evaluate( evalContext ); >+ >+ if( evalResult != EvaluationResult.TRUE ) >+ { >+ match = false; >+ } >+ } >+ catch( CoreException e ) >+ { >+ logError( -1, e.getMessage(), e ); >+ } >+ } >+ >+ if( match ) >+ { >+ result.add( partInfo ); >+ } >+ } >+ >+ return Collections.unmodifiableList( result ); >+ } >+ >+ private static synchronized void readExtensions() >+ { >+ if( extensions != null ) >+ { >+ return; >+ } >+ >+ extensions = new ArrayList<ParticipantInfo>(); >+ >+ for( IConfigurationElement element >+ : getTopLevelElements( findExtensions( PLUGIN_ID, EXTENSION_POINT_ID ) ) ) >+ { >+ if( element.getName().equals( EL_PARTICIPANT ) ) >+ { >+ try >+ { >+ readExtension( element ); >+ } >+ catch( InvalidExtensionException e ) >+ { >+ // Continue. The problem has been reported to the user via the log. >+ } >+ } >+ } >+ } >+ >+ private static void readExtension( final IConfigurationElement config ) >+ >+ throws InvalidExtensionException >+ >+ { >+ final ParticipantInfo info = new ParticipantInfo(); >+ >+ info.pluginId = config.getContributor().getName(); >+ info.id = info.pluginId + "." + findRequiredAttribute( config, ATTR_ID ); >+ >+ final IConfigurationElement elFactory = findRequiredElement( config, EL_FACTORY ); >+ info.className = findRequiredAttribute( elFactory, ATTR_CLASS ); >+ >+ final IConfigurationElement elRuntimeComponent >+ = findRequiredElement( config, EL_RUNTIME_COMPONENT ); >+ >+ final String rcTypeString = findRequiredAttribute( elRuntimeComponent, ATTR_TYPE ); >+ >+ if( ! RuntimeManager.isRuntimeComponentTypeDefined( rcTypeString ) ) >+ { >+ // TODO: Log the problem >+ throw new InvalidExtensionException(); >+ } >+ >+ info.runtimeComponentType = RuntimeManager.getRuntimeComponentType( rcTypeString ); >+ info.runtimeComponentVersionExpr = elRuntimeComponent.getAttribute( ATTR_VERSION ); >+ >+ final IConfigurationElement elEnablement = findOptionalElement( config, EL_ENABLEMENT ); >+ >+ try >+ { >+ info.enablementCondition = ExpressionConverter.getDefault().perform( elEnablement ); >+ } >+ catch( CoreException e ) >+ { >+ logError( -1, e.getMessage(), e ); >+ throw new InvalidExtensionException(); >+ } >+ >+ extensions.add( info ); >+ } >+ >+ /** >+ * Utility methods that are helpful for implementing extension points. >+ * >+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> >+ */ >+ >+ public static final class PluginUtil >+ { >+ public static final class InvalidExtensionException >+ >+ extends Exception >+ >+ { >+ private static final long serialVersionUID = 1L; >+ } >+ >+ private PluginUtil() {} >+ >+ public static Collection<IExtension> findExtensions( final String pluginId, >+ final String extensionPointId ) >+ { >+ final IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ final IExtensionPoint point = registry.getExtensionPoint( pluginId, extensionPointId ); >+ >+ if( point == null ) >+ { >+ throw new RuntimeException(); >+ } >+ >+ final List<IExtension> extensions = new ArrayList<IExtension>(); >+ >+ for( IExtension extension : point.getExtensions() ) >+ { >+ extensions.add( extension ); >+ } >+ >+ return extensions; >+ } >+ >+ public static Collection<IConfigurationElement> getTopLevelElements( final Collection<IExtension> extensions ) >+ { >+ final List<IConfigurationElement> elements = new ArrayList<IConfigurationElement>(); >+ >+ for( IExtension extension : extensions ) >+ { >+ for( IConfigurationElement element : extension.getConfigurationElements() ) >+ { >+ elements.add( element ); >+ } >+ } >+ >+ return elements; >+ } >+ >+ public static void reportMissingAttribute( final IConfigurationElement el, >+ final String attribute ) >+ { >+ final String pluginId = el.getContributor().getName(); >+ final String extPointId = el.getDeclaringExtension().getExtensionPointUniqueIdentifier(); >+ >+ final String msg >+ = Resources.bind( Resources.missingAttribute, pluginId, extPointId, el.getName(), >+ attribute ); >+ >+ log( createErrorStatus( -1, msg, null ) ); >+ } >+ >+ public static void reportMissingElement( final IConfigurationElement el, >+ final String element ) >+ { >+ final String pluginId = el.getContributor().getName(); >+ final String extPointId = el.getDeclaringExtension().getExtensionPointUniqueIdentifier(); >+ >+ final String msg >+ = Resources.bind( Resources.missingElement, pluginId, extPointId, el.getName(), >+ element ); >+ >+ log( createErrorStatus( -1, msg, null ) ); >+ } >+ >+ public static String findRequiredAttribute( final IConfigurationElement el, >+ final String attribute ) >+ >+ throws InvalidExtensionException >+ >+ { >+ final String val = el.getAttribute( attribute ); >+ >+ if( val == null ) >+ { >+ reportMissingAttribute( el, attribute ); >+ throw new InvalidExtensionException(); >+ } >+ >+ return val; >+ } >+ >+ public static IConfigurationElement findRequiredElement( final IConfigurationElement el, >+ final String childElement ) >+ >+ throws InvalidExtensionException >+ >+ { >+ final IConfigurationElement[] children = el.getChildren( childElement ); >+ >+ if( children.length == 0 ) >+ { >+ reportMissingElement( el, childElement ); >+ throw new InvalidExtensionException(); >+ } >+ >+ return children[ 0 ]; >+ } >+ >+ public static IConfigurationElement findOptionalElement( final IConfigurationElement el, >+ final String childElement ) >+ { >+ final IConfigurationElement[] children = el.getChildren( childElement ); >+ >+ if( children.length == 0 ) >+ { >+ return null; >+ } >+ else >+ { >+ return children[ 0 ]; >+ } >+ } >+ >+ public static String getElementValue( final IConfigurationElement el, >+ final String defaultValue ) >+ { >+ if( el != null ) >+ { >+ String text = el.getValue(); >+ >+ if( text != null ) >+ { >+ text = text.trim(); >+ >+ if( text.length() > 0 ) >+ { >+ return text; >+ } >+ } >+ } >+ >+ return defaultValue; >+ } >+ >+ @SuppressWarnings( "unchecked" ) >+ public static <T> T instantiate( final String pluginId, >+ final String clname, >+ final Class<T> interfc ) >+ >+ throws CoreException >+ >+ { >+ final Bundle bundle = Platform.getBundle( pluginId ); >+ >+ final Object obj; >+ >+ try >+ { >+ final Class cl = bundle.loadClass( clname ); >+ obj = cl.newInstance(); >+ } >+ catch( Exception e ) >+ { >+ final String msg = NLS.bind( Resources.failedToCreate, clname ); >+ throw new CoreException( createErrorStatus( -1, msg, e ) ); >+ } >+ >+ if( ! interfc.isAssignableFrom( obj.getClass() ) ) >+ { >+ final String msg >+ = NLS.bind( Resources.doesNotImplement, clname, interfc.getClass().getName() ); >+ >+ throw new CoreException( createErrorStatus( -1, msg, null ) ); >+ } >+ >+ return (T) obj; >+ } >+ >+ private static final class Resources >+ >+ extends NLS >+ >+ { >+ public static String missingAttribute; >+ public static String missingElement; >+ public static String failedToCreate; >+ public static String doesNotImplement; >+ >+ static >+ { >+ initializeMessages( PluginUtil.class.getName(), Resources.class ); >+ } >+ >+ public static String bind( final String message, >+ final String arg1, >+ final String arg2, >+ final String arg3, >+ final String arg4 ) >+ { >+ return bind( message, new Object[] { arg1, arg2, arg3, arg4 } ); >+ } >+ } >+ >+ } >+ >+} >#P org.eclipse.jst.j2ee.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.ui/plugin.xml,v >retrieving revision 1.113 >diff -u -r1.113 plugin.xml >--- plugin.xml 14 Aug 2007 21:14:58 -0000 1.113 >+++ plugin.xml 1 Nov 2007 22:30:19 -0000 >@@ -1,7 +1,11 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> > <plugin> >- >+ >+ <extension-point >+ id="archiveExportParticipantPanels" >+ name="Archive Export Participant Panels Extension Point" >+ schema="schema/archiveExportParticipantPanels.exsd"/> > > <!-- ====================================================== --> > <!-- --> >Index: property_files/j2ee_ui.properties >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ui.properties,v >retrieving revision 1.41 >diff -u -r1.41 j2ee_ui.properties >--- property_files/j2ee_ui.properties 30 Oct 2007 00:40:30 -0000 1.41 >+++ property_files/j2ee_ui.properties 1 Nov 2007 22:30:20 -0000 >@@ -20,7 +20,7 @@ > 10=&Select All > 11=&Deselect All > 12=New &Module... >-13=EAR application: >+13=EAR project: > 14=N&ew... > 14a=Ne&w... > 15=Add module to an EAR application. >@@ -28,10 +28,10 @@ > 17=Create a new module project for the selected module type > 18=New Module Project > 19=Create default module projects. >-20=Application Client module: >-21=EJB module: >-22=Web module: >-23=Connector module: >+20=Application Client project: >+21=EJB project: >+22=Web project: >+23=Connector project: > 24=New Application Client Project > 25=Application Client module > 26=Create an Application Client project and add it to a new or existing Enterprise Application project >@@ -107,7 +107,7 @@ > 100=Module Version: > 101=Configure Application Client module settings. > 102=Content Folder: >-103=Target Runtime: >+103=Target Runtime > Entity_UI_=Entity Beans > Message_Driven_Beans_UI_=Message-Driven Beans > Session_Beans_UI_=Session Beans >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.39 >diff -u -r1.39 MANIFEST.MF >--- META-INF/MANIFEST.MF 17 Oct 2007 22:37:09 -0000 1.39 >+++ META-INF/MANIFEST.MF 1 Nov 2007 22:30:19 -0000 >@@ -23,6 +23,7 @@ > org.eclipse.jst.j2ee.internal.ui.util;x-internal:=true, > org.eclipse.jst.j2ee.internal.war.ui.util;x-internal:=true, > org.eclipse.jst.j2ee.internal.wizard;x-internal:=true, >+ org.eclipse.jst.j2ee.ui.archive, > org.eclipse.jst.j2ee.ui.project.facet, > org.eclipse.jst.j2ee.ui.project.facet.appclient > Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)", >Index: j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java,v >retrieving revision 1.22 >diff -u -r1.22 J2EEExportPage.java >--- j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java 30 Oct 2007 00:40:31 -0000 1.22 >+++ j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java 1 Nov 2007 22:30:19 -0000 >@@ -19,6 +19,7 @@ > > import java.util.ArrayList; > import java.util.Iterator; >+import java.util.List; > > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; >@@ -28,8 +29,11 @@ > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties; >+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.IArchiveExportParticipantData; > import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages; > import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin; >+import org.eclipse.jst.j2ee.ui.archive.IArchiveExportParticipantPanelFactory; >+import org.eclipse.jst.j2ee.ui.archive.internal.ArchiveExportParticipantPanelsExtensionPoint; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >@@ -38,10 +42,14 @@ > 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.FileDialog; >+import org.eclipse.swt.widgets.Group; > import org.eclipse.swt.widgets.Label; >+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; > import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; > import org.eclipse.wst.common.frameworks.datamodel.IDataModel; >+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; > import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; > > /** >@@ -64,6 +72,7 @@ > protected String LABEL_RUNTIME = J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_RUNTIME); > private Combo resourceNameCombo; > private Combo destinationNameCombo; >+ private Button optimizeForRuntimeCheckbox; > private Combo runtimeNameCombo; > private Button destinationBrowseButton; > protected Button overwriteExistingFilesCheckbox; >@@ -116,6 +125,7 @@ > composite.setLayout(layout); > > createSourceAndDestinationGroup(composite); >+ createRuntimeGroup(composite); > createOptionsGroup(composite); > > //setupBasedOnInitialSelections(); >@@ -135,7 +145,6 @@ > composite.setLayout(layout); > createExportComponentGroup(composite); > createDestinationGroup(composite); >- createRuntimeGroup(composite); > > } > /** >@@ -190,18 +199,114 @@ > > } > >- protected void createRuntimeGroup(org.eclipse.swt.widgets.Composite parent) { >- // Create runtime label >- Label runtimeLabel = new Label(parent, SWT.NONE); >- runtimeLabel.setText(LABEL_RUNTIME); >- // Create runtime combo >- runtimeNameCombo = new Combo(parent, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER); >- GridData data = new GridData(GridData.FILL_HORIZONTAL); >- data.widthHint = SIZING_TEXT_FIELD_WIDTH; >- runtimeNameCombo.setLayoutData(data); >- synchHelper.synchCombo(runtimeNameCombo, IJ2EEComponentExportDataModelProperties.RUNTIME, null); >+ protected void createRuntimeGroup( final Composite parent ) >+ { >+ final Group group = new Group( parent, SWT.NONE ); >+ group.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); >+ group.setLayout( new GridLayout( 1, false ) ); >+ group.setText( LABEL_RUNTIME ); >+ >+ this.optimizeForRuntimeCheckbox = new Button( group, SWT.CHECK ); >+ this.optimizeForRuntimeCheckbox.setText( "Optimize for a specific server runtime" ); >+ this.synchHelper.synchCheckbox( this.optimizeForRuntimeCheckbox, IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME, null ); >+ >+ final GridData gd = new GridData(); >+ gd.verticalIndent = 2; >+ >+ this.optimizeForRuntimeCheckbox.setLayoutData( gd ); >+ >+ this.runtimeNameCombo = new Combo( group, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER ); >+ this.runtimeNameCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); >+ this.synchHelper.synchCombo( this.runtimeNameCombo, IJ2EEComponentExportDataModelProperties.RUNTIME, null ); >+ >+ final Composite extComposite = new EnhancedComposite( group, SWT.NONE ); >+ extComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); >+ >+ final GridLayout layout = new GridLayout( 1, false ); >+ layout.marginWidth = 10; >+ layout.marginHeight = 1; >+ >+ extComposite.setLayout( layout ); >+ >+ getDataModel().addListener >+ ( >+ new IDataModelListener() >+ { >+ public void propertyChanged( final DataModelEvent event ) >+ { >+ if( event.getPropertyName().equals( IJ2EEComponentExportDataModelProperties.RUNTIME ) && >+ event.getFlag() == IDataModel.VALUE_CHG ) >+ { >+ refreshExtensionsComposite( extComposite ); >+ } >+ else if( event.getPropertyName().equals( IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME ) && >+ event.getFlag() == IDataModel.VALUE_CHG ) >+ { >+ final boolean optimize = ( (Boolean) event.getProperty() ).booleanValue(); >+ extComposite.setEnabled( optimize ); >+ } >+ } >+ } >+ ); >+ >+ refreshExtensionsComposite( extComposite ); > } > >+ private void refreshExtensionsComposite( final Composite extComposite ) >+ { >+ for( Control child : extComposite.getChildren() ) >+ { >+ child.dispose(); >+ } >+ >+ final List<IArchiveExportParticipantData> extensions >+ = (List<IArchiveExportParticipantData>) getDataModel().getProperty( IJ2EEComponentExportDataModelProperties.RUNTIME_SPECIFIC_PARTICIPANTS ); >+ >+ if( extensions != null ) >+ { >+ Composite innerComposite = null; >+ >+ for( IArchiveExportParticipantData extension : extensions ) >+ { >+ final String id = extension.getId(); >+ >+ final ArchiveExportParticipantPanelsExtensionPoint.PanelFactoryInfo panelExtInfo >+ = ArchiveExportParticipantPanelsExtensionPoint.getExtension( id ); >+ >+ if( panelExtInfo != null ) >+ { >+ final IArchiveExportParticipantPanelFactory panelFactory = panelExtInfo.loadPanelFactory(); >+ >+ if( panelFactory != null ) >+ { >+ if( innerComposite == null ) >+ { >+ innerComposite = new EnhancedComposite( extComposite, SWT.NONE ); >+ innerComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); >+ >+ final GridLayout innerCompositeLayout = new GridLayout( 1, false ); >+ innerCompositeLayout.marginWidth = 0; >+ innerCompositeLayout.marginHeight = 0; >+ >+ innerComposite.setLayout( innerCompositeLayout ); >+ } >+ >+ try >+ { >+ panelFactory.createPanel( innerComposite, extension.getDataModel() ); >+ } >+ catch( Exception e ) >+ { >+ J2EEUIPlugin.logError( -1, e.getMessage(), e ); >+ } >+ } >+ } >+ } >+ } >+ >+ extComposite.getShell().layout( true, true ); >+ } >+ > /** > * Create the export options specification widgets. > * >@@ -418,5 +523,28 @@ > protected IDialogSettings getDialogSettings() { > return J2EEUIPlugin.getDefault().getDialogSettings(); > } >+ >+ private static class EnhancedComposite >+ >+ extends Composite >+ >+ { >+ public EnhancedComposite( final Composite parent, >+ final int style ) >+ { >+ super( parent, style ); >+ } >+ >+ @Override >+ public void setEnabled( boolean enabled ) >+ { >+ super.setEnabled( enabled ); >+ >+ for( Control child : getChildren() ) >+ { >+ child.setEnabled( enabled ); >+ } >+ } >+ } > > } >Index: j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java >=================================================================== >RCS file: j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java >diff -N j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,119 @@ >+/****************************************************************************** >+ * Copyright (c) 2005, 2007 BEA Systems, Inc. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Konstantin Komissarchik >+ ******************************************************************************/ >+ >+package org.eclipse.jst.j2ee.ui.archive.internal; >+ >+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.findExtensions; >+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.findRequiredAttribute; >+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.getTopLevelElements; >+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.instantiate; >+import static org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin.PLUGIN_ID; >+import static org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin.log; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.InvalidExtensionException; >+import org.eclipse.jst.j2ee.ui.archive.IArchiveExportParticipantPanelFactory; >+ >+/** >+ * Contains the logic for processing the <code>org.eclipse.jst.j2ee.ui.archiveExportParticipantPanels</code> >+ * extension point. >+ * >+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> >+ */ >+ >+public final class ArchiveExportParticipantPanelsExtensionPoint >+{ >+ public static final String EXTENSION_POINT_ID = "archiveExportParticipantPanels"; //$NON-NLS-1$ >+ >+ private static final String EL_PANEL_FACTORY = "panel-factory"; //$NON-NLS-1$ >+ private static final String ATTR_ARCHIVE_EXPORT_PARTICIPANT_ID = "archiveExportParticipantId"; //$NON-NLS-1$ >+ private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ >+ >+ private static Map<String,PanelFactoryInfo> extensions = null; >+ >+ public static class PanelFactoryInfo >+ { >+ private String archiveExportParticipantId; >+ private String pluginId = null; >+ private String className = null; >+ >+ public String getArchiveExportExtensionId() >+ { >+ return this.archiveExportParticipantId; >+ } >+ >+ public IArchiveExportParticipantPanelFactory loadPanelFactory() >+ { >+ try >+ { >+ return instantiate( this.pluginId, this.className, >+ IArchiveExportParticipantPanelFactory.class ); >+ } >+ catch( CoreException e ) >+ { >+ log( e.getStatus() ); >+ return null; >+ } >+ } >+ } >+ >+ public static PanelFactoryInfo getExtension( final String archiveExportParticipantId ) >+ { >+ readExtensions(); >+ >+ return extensions.get( archiveExportParticipantId ); >+ } >+ >+ private static synchronized void readExtensions() >+ { >+ if( extensions != null ) >+ { >+ return; >+ } >+ >+ extensions = new HashMap<String,PanelFactoryInfo>(); >+ >+ for( IConfigurationElement element >+ : getTopLevelElements( findExtensions( PLUGIN_ID, EXTENSION_POINT_ID ) ) ) >+ { >+ if( element.getName().equals( EL_PANEL_FACTORY ) ) >+ { >+ try >+ { >+ readExtension( element ); >+ } >+ catch( InvalidExtensionException e ) >+ { >+ // Continue. The problem has been reported to the user via the log. >+ } >+ } >+ } >+ } >+ >+ private static void readExtension( final IConfigurationElement config ) >+ >+ throws InvalidExtensionException >+ >+ { >+ final PanelFactoryInfo ext = new PanelFactoryInfo(); >+ >+ ext.archiveExportParticipantId = findRequiredAttribute( config, ATTR_ARCHIVE_EXPORT_PARTICIPANT_ID ); >+ ext.pluginId = config.getContributor().getName(); >+ ext.className = findRequiredAttribute( config, ATTR_CLASS ); >+ >+ extensions.put( ext.archiveExportParticipantId, ext ); >+ } >+ >+} >Index: j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java >=================================================================== >RCS file: j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java >diff -N j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/****************************************************************************** >+ * Copyright (c) 2005, 2007 BEA Systems, Inc. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Konstantin Komissarchik >+ ******************************************************************************/ >+ >+package org.eclipse.jst.j2ee.ui.archive; >+ >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.wst.common.frameworks.datamodel.IDataModel; >+ >+/** >+ * Used in conjunction with the <code>org.eclipse.jst.j2ee.ui.archiveExportParticipantPanels</code> >+ * extension point in order to extend the UI of the base module archive export wizard. >+ * >+ * @since 3.0 >+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> >+ */ >+ >+public interface IArchiveExportParticipantPanelFactory >+{ >+ /** >+ * Creates a composite containing the UI elements appropriate for the export participant >+ * that this panel factory is registered with. >+ * >+ * @param parent the parent composite >+ * @param dataModel the data model of the export participant >+ * @return the created composite >+ */ >+ >+ Composite createPanel( Composite parent, >+ IDataModel dataModel ); >+} >Index: schema/archiveExportParticipantPanels.exsd >=================================================================== >RCS file: schema/archiveExportParticipantPanels.exsd >diff -N schema/archiveExportParticipantPanels.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/archiveExportParticipantPanels.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,127 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.jst.j2ee.ui"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.jst.j2ee.ui" id="archiveExportParticipantPanels" name="Archive Export Participant Panels Extension Point"/> >+ </appInfo> >+ <documentation> >+ Used for supplying UI for the archive export participants registered via the <code>org.eclipse.jst.j2ee.archiveExportParticipants</code> extension point. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="panel-factory" minOccurs="1" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="panel-factory"> >+ <annotation> >+ <documentation> >+ Registers a single archive export participant. >+ </documentation> >+ </annotation> >+ <complexType> >+ <attribute name="archiveExportParticipantId" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The id of the archive export participant that this panel factory should be registered with. Has to include plugin id. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The factory implementation class. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.j2ee.ui.archive.IArchiveExportParticipantPanelFactory"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.0 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ <pre> >+<extension point="org.eclipse.jst.j2ee.ui.archiveExportParticipantPanels"> >+ <panel-factory >+ archiveExportParticipantId="com.somecorp.MyExportParticipant" >+ class="com.somecorp.MyPanelFactory"/> >+</extension> >+</pre> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2005, 2007 BEA Systems, Inc. and others.<br> >+All rights reserved. This program and the accompanying materials are made >+available under the terms of the Eclipse Public License v1.0 which accompanies >+this distribution, and is available at <a >+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> >+ </documentation> >+ </annotation> >+ >+</schema>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 174905
:
81897
| 81898 |
81976