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 213383 Details for
Bug 330894
Open J2EEFlexProjDeployable's list of participants to 3rd party plugins
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]
First patch (no behavior change) on potential changes
330894.v1.patch (text/plain), 30.69 KB, created by
Rob Stryker
on 2012-03-30 06:46:54 EDT
(
hide
)
Description:
First patch (no behavior change) on potential changes
Filename:
MIME Type:
Creator:
Rob Stryker
Created:
2012-03-30 06:46:54 EDT
Size:
30.69 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.common.frameworks >Index: src/org/eclipse/jst/common/jdt/internal/javalite/JavaLiteUtilities.java >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/javalite/JavaLiteUtilities.java,v >retrieving revision 1.8 >diff -u -r1.8 JavaLiteUtilities.java >--- src/org/eclipse/jst/common/jdt/internal/javalite/JavaLiteUtilities.java 13 Jan 2010 23:20:39 -0000 1.8 >+++ src/org/eclipse/jst/common/jdt/internal/javalite/JavaLiteUtilities.java 30 Mar 2012 10:26:40 -0000 >@@ -148,6 +148,7 @@ > containers.add(outputContainer); > } > break; >+ default: > } > } > } >#P org.eclipse.jst.j2ee >Index: j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java,v >retrieving revision 1.115 >diff -u -r1.115 J2EEFlexProjDeployable.java >--- j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java 31 Aug 2010 17:43:49 -0000 1.115 >+++ j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java 30 Mar 2012 10:26:42 -0000 >@@ -22,12 +22,6 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jem.workbench.utility.JemProjectUtilities; >-import org.eclipse.jst.common.internal.modulecore.AddClasspathFoldersParticipant; >-import org.eclipse.jst.common.internal.modulecore.AddClasspathLibReferencesParticipant; >-import org.eclipse.jst.common.internal.modulecore.AddMappedOutputFoldersParticipant; >-import org.eclipse.jst.common.internal.modulecore.IgnoreJavaInSourceFolderParticipant; >-import org.eclipse.jst.common.internal.modulecore.ReplaceManifestExportParticipant; >-import org.eclipse.jst.common.internal.modulecore.SingleRootExportParticipant; > import org.eclipse.jst.common.internal.modulecore.SingleRootUtil; > import org.eclipse.jst.common.jdt.internal.javalite.JavaLiteUtilities; > import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit; >@@ -35,8 +29,6 @@ > import org.eclipse.jst.j2ee.internal.EjbModuleExtensionHelper; > import org.eclipse.jst.j2ee.internal.IEJBModelExtenderManager; > import org.eclipse.jst.j2ee.internal.J2EEConstants; >-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyEnablement; >-import org.eclipse.jst.j2ee.internal.common.exportmodel.JEEHeirarchyExportParticipant; > import org.eclipse.jst.j2ee.internal.common.exportmodel.JavaEESingleRootCallback; > import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; > import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; >@@ -50,7 +42,6 @@ > import org.eclipse.wst.common.componentcore.ArtifactEdit; > import org.eclipse.wst.common.componentcore.ComponentCore; > import org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference; >-import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant; > import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities; > import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; > import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; >@@ -100,20 +91,17 @@ > } > > @Override >- protected IFlattenParticipant[] getParticipants() { >- List<IFlattenParticipant> participants = new ArrayList<IFlattenParticipant>(); >- >- participants.add(new SingleRootExportParticipant(new JavaEESingleRootCallback())); >- participants.add(new JEEHeirarchyExportParticipant()); >- participants.add(new AddClasspathLibReferencesParticipant()); >- participants.add(new AddClasspathFoldersParticipant()); >- participants.add(new AddMappedOutputFoldersParticipant()); >- participants.add(new IgnoreJavaInSourceFolderParticipant()); >- if (ClasspathDependencyEnablement.isAllowClasspathComponentDependency()) { >- participants.add(new ReplaceManifestExportParticipant(new Path(J2EEConstants.MANIFEST_URI))); >- } >- >- return participants.toArray(new IFlattenParticipant[participants.size()]); >+ protected String[] getDefaultFlattenParticipantIDs() { >+ String[] defaultParticipants = new String[]{ >+ JEEFlattenParticipantProvider.JEESingleRootParticipant, >+ JEEFlattenParticipantProvider.JEEHeirarchyExportParticipant, >+ JEEFlattenParticipantProvider.AddClasspathLibReferencesParticipant, >+ JEEFlattenParticipantProvider.AddClasspathFoldersParticipant, >+ JEEFlattenParticipantProvider.AddMappedOutputFoldersParticipant, >+ JEEFlattenParticipantProvider.IgnoreJavaInSourceFolderParticipant, >+ JEEFlattenParticipantProvider.JEEReplaceManifestExportParticipant >+ }; >+ return defaultParticipants; > } > > @Override >Index: j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/JEEFlattenParticipantProvider.java >=================================================================== >RCS file: j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/JEEFlattenParticipantProvider.java >diff -N j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/JEEFlattenParticipantProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/JEEFlattenParticipantProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+/******************************************************************************* >+ * Copyright (c) 2003, 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jst.j2ee.internal.deployables; >+ >+import org.eclipse.core.runtime.Path; >+import org.eclipse.jst.common.internal.modulecore.AddClasspathFoldersParticipant; >+import org.eclipse.jst.common.internal.modulecore.AddClasspathLibReferencesParticipant; >+import org.eclipse.jst.common.internal.modulecore.AddMappedOutputFoldersParticipant; >+import org.eclipse.jst.common.internal.modulecore.IgnoreJavaInSourceFolderParticipant; >+import org.eclipse.jst.common.internal.modulecore.ReplaceManifestExportParticipant; >+import org.eclipse.jst.common.internal.modulecore.SingleRootExportParticipant; >+import org.eclipse.jst.j2ee.internal.J2EEConstants; >+import org.eclipse.jst.j2ee.internal.common.exportmodel.JEEHeirarchyExportParticipant; >+import org.eclipse.jst.j2ee.internal.common.exportmodel.JavaEESingleRootCallback; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipantProvider; >+ >+public class JEEFlattenParticipantProvider implements >+ IFlattenParticipantProvider { >+ >+ /* >+ * The following are all internal to jeetools and are not API, >+ * though may at some point be saved in a settings file in a list >+ * format. if the user decides to customize their list of participants, >+ * they may add or remove items to the list in the .settings file >+ */ >+ protected static final String JEESingleRootParticipant = "JEESingleRootParticipant"; //$NON-NLS-1$ >+ protected static final String JEEHeirarchyExportParticipant = "JEEHeirarchyExportParticipant"; //$NON-NLS-1$ >+ protected static final String AddClasspathLibReferencesParticipant = "AddClasspathLibReferencesParticipant"; //$NON-NLS-1$ >+ protected static final String AddClasspathFoldersParticipant = "AddClasspathFoldersParticipant"; //$NON-NLS-1$ >+ protected static final String AddMappedOutputFoldersParticipant = "AddMappedOutputFoldersParticipant"; //$NON-NLS-1$ >+ protected static final String IgnoreJavaInSourceFolderParticipant = "IgnoreJavaInSourceFolderParticipant"; //$NON-NLS-1$ >+ protected static final String JEEReplaceManifestExportParticipant = "JEEReplaceManifestExportParticipant"; //$NON-NLS-1$ >+ >+ public IFlattenParticipant findParticipant(String id) { >+ if( JEESingleRootParticipant.equals(id)) >+ return new SingleRootExportParticipant(new JavaEESingleRootCallback()); >+ if( JEEHeirarchyExportParticipant.equals(id)) >+ return new JEEHeirarchyExportParticipant(); >+ if( AddClasspathLibReferencesParticipant.equals(id)) >+ return new AddClasspathLibReferencesParticipant(); >+ if( AddClasspathFoldersParticipant.equals(id)) >+ return new AddClasspathFoldersParticipant(); >+ if( AddMappedOutputFoldersParticipant.equals(id)) >+ return new AddMappedOutputFoldersParticipant(); >+ if( IgnoreJavaInSourceFolderParticipant.equals(id)) >+ return new IgnoreJavaInSourceFolderParticipant(); >+ if( JEEReplaceManifestExportParticipant.equals(id)) >+ return new ReplaceManifestExportParticipant(new Path(J2EEConstants.MANIFEST_URI)); >+ return null; >+ } >+ >+} >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.j2ee/plugin.xml,v >retrieving revision 1.146 >diff -u -r1.146 plugin.xml >--- plugin.xml 28 Mar 2011 14:59:56 -0000 1.146 >+++ plugin.xml 30 Mar 2012 10:26:48 -0000 >@@ -859,4 +859,11 @@ > class="org.eclipse.jst.j2ee.internal.modulecore.util.JEEManifestDiscerner"> > </discerner> > </extension> >+ <extension >+ point="org.eclipse.wst.common.modulecore.flattenParticipantProvider"> >+ <flattenParticipantProvider >+ class="org.eclipse.jst.j2ee.internal.deployables.JEEFlattenParticipantProvider" >+ weight="10"> >+ </flattenParticipantProvider> >+ </extension> > </plugin> >#P org.eclipse.wst.common.modulecore >Index: modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlattenParticipantModel.java >=================================================================== >RCS file: modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlattenParticipantModel.java >diff -N modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlattenParticipantModel.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlattenParticipantModel.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,123 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Red Hat and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Red Hat - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.common.componentcore.internal.flat; >+ >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.Comparator; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtensionRegistry; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.wst.common.componentcore.internal.ModulecorePlugin; >+ >+/** >+ * A class to load and keep track of all IFlattenParticipantProviders, >+ * and also to assist in locating IFlattenParticipants of a specific ID. >+ */ >+public class FlattenParticipantModel { >+ >+ private static FlattenParticipantModel model; >+ public static FlattenParticipantModel getDefault() { >+ if( model == null ) >+ model = new FlattenParticipantModel(); >+ return model; >+ } >+ >+ private ArrayList<FlattenParticipantProviderWrapper> providers; >+ public FlattenParticipantModel() { >+ >+ } >+ >+ public IFlattenParticipant getParticipant(String id) { >+ IFlattenParticipantProvider[] providers = getProviders(); >+ IFlattenParticipant result = null; >+ for( int i = 0; i < providers.length; i++ ) { >+ result = providers[i].findParticipant(id); >+ if( result != null ) >+ return result; >+ } >+ return null; >+ } >+ >+ protected IFlattenParticipantProvider[] getProviders() { >+ if( providers == null ) >+ loadProviders(); >+ return providers.toArray(new IFlattenParticipantProvider[providers.size()]); >+ } >+ >+ protected void loadProviders() { >+ ArrayList<FlattenParticipantProviderWrapper> tmp = new ArrayList<FlattenParticipantProviderWrapper>(); >+ IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(ModulecorePlugin.PLUGIN_ID, "flattenParticipantProvider"); //$NON-NLS-1$ >+ String id = null; >+ for( int j = 0; j < cf.length; j++ ) { >+ tmp.add(getWrapper(cf[j])); >+ } >+ >+ // Sort >+ Collections.sort(tmp, new Comparator<FlattenParticipantProviderWrapper>() { >+ public int compare(FlattenParticipantProviderWrapper o1, >+ FlattenParticipantProviderWrapper o2) { >+ if( o1 == null && o2 == null ) >+ return 0; >+ if( o1 == null ) >+ return 1; >+ if( o2 == null ) >+ return -1; >+ return o2.getWeight() - o1.getWeight(); >+ } >+ }); >+ >+ providers = tmp; >+ } >+ >+ private FlattenParticipantProviderWrapper getWrapper(IConfigurationElement element) { >+ return new FlattenParticipantProviderWrapper(element); >+ } >+ >+ private static class FlattenParticipantProviderWrapper implements IFlattenParticipantProvider { >+ private IConfigurationElement cf; >+ private int weight; >+ private IFlattenParticipantProvider delegate; >+ public FlattenParticipantProviderWrapper(IConfigurationElement element) { >+ this.cf = element; >+ System.out.println(element.getAttribute("class")); >+ String s = element.getAttribute("weight"); >+ try { >+ weight = Integer.parseInt(s); >+ } catch(NumberFormatException nfe ) { >+ // TODO trace / log? Maybe not necessary. Use default weight >+ weight = 0; // default weight >+ } >+ } >+ >+ public int getWeight() { >+ return weight; >+ } >+ >+ public IFlattenParticipant findParticipant(String id) { >+ if( delegate == null ) >+ loadDelegate(); >+ return delegate == null ? null : delegate.findParticipant(id); >+ } >+ >+ private void loadDelegate() { >+ try { >+ delegate = (IFlattenParticipantProvider) cf.createExecutableExtension("class"); >+ } catch(CoreException ce ) { >+ // TODO where to do the logging? >+ } >+ } >+ } >+ >+} >Index: modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipantProvider.java >=================================================================== >RCS file: modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipantProvider.java >diff -N modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipantProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipantProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Red Hat and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Red Hat - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.common.componentcore.internal.flat; >+ >+public interface IFlattenParticipantProvider { >+ >+ /** >+ * If this provider can find a participant for this specific >+ * id, it should do so now. Otherwise, return null. >+ * >+ * @param id A flatten participant id >+ * @return >+ */ >+ public IFlattenParticipant findParticipant(String id); >+} >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/common/plugins/org.eclipse.wst.common.modulecore/plugin.xml,v >retrieving revision 1.40 >diff -u -r1.40 plugin.xml >--- plugin.xml 18 Mar 2010 04:00:56 -0000 1.40 >+++ plugin.xml 30 Mar 2012 10:26:50 -0000 >@@ -56,6 +56,7 @@ > <extension-point id="componentimpl" name="componentimpl" schema="schema/componentimpl.exsd"/> > <extension-point id="resourceFactories" name="Resource Factory Association (Internal)" schema="schema/resourceFactories.exsd"/> > <extension-point id="referenceResolver" name="referenceResolver" schema="schema/referenceResolver.exsd"/> >+ <extension-point id="flattenParticipantProvider" name="flattenParticipantProvider" schema="schema/flattenParticipantProvider.exsd"/> > > <!-- Contribute a URIResolverExtension for flexible projects --> > <extension point="org.eclipse.wst.common.uriresolver.resolverExtensions"> >Index: schema/flattenParticipantProvider.exsd >=================================================================== >RCS file: schema/flattenParticipantProvider.exsd >diff -N schema/flattenParticipantProvider.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/flattenParticipantProvider.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,109 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.wst.common.modulecore" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.wst.common.modulecore" id="flattenParticipant" name="flattenParticipant"/> >+ </appInfo> >+ <documentation> >+ [Enter description of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element /> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="flattenParticipantProvider" 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="flattenParticipantProvider"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The implementation class for this participant provider. The class must have a 0-argument constructor. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipantProvider"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="weight" type="string"> >+ <annotation> >+ <documentation> >+ A weight for this provider. Providers will be sorted by their weight and polled individually in order for a specific key. If the provider can find or create that flatten participant, it should return it. >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </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> >+ >+ >+</schema> >#P org.eclipse.wst.common.tests >Index: commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider.java >=================================================================== >RCS file: commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider.java >diff -N commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+package org.eclipse.wst.common.tests.flatten; >+ >+import org.eclipse.wst.common.componentcore.internal.flat.AbstractFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipantProvider; >+ >+public class ExampleFlattenParticipantProvider implements >+ IFlattenParticipantProvider { >+ >+ public static final String DUMMY_PARTICIPANT = "example1"; >+ public IFlattenParticipant findParticipant(String id) { >+ if( DUMMY_PARTICIPANT.equals(id)) { >+ return new DummyFlattenParticipant(); >+ } >+ return null; >+ } >+ >+ public static class DummyFlattenParticipant extends AbstractFlattenParticipant { >+ >+ } >+ >+} >Index: commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider2.java >=================================================================== >RCS file: commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider2.java >diff -N commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+package org.eclipse.wst.common.tests.flatten; >+ >+import org.eclipse.wst.common.componentcore.internal.flat.AbstractFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipantProvider; >+ >+public class ExampleFlattenParticipantProvider2 implements >+ IFlattenParticipantProvider { >+ >+ public static final String DUMMY_PARTICIPANT = "example2"; >+ >+ public static final String COMMON_KEY = "common"; >+ public IFlattenParticipant findParticipant(String id) { >+ if( DUMMY_PARTICIPANT.equals(id)) { >+ return new Dummy2FlattenParticipant(); >+ } >+ if( COMMON_KEY.equals(id)) >+ return new Dummy2FlattenParticipant(); >+ >+ return null; >+ } >+ >+ public static class Dummy2FlattenParticipant extends AbstractFlattenParticipant { >+ >+ } >+ >+} >Index: commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider3.java >=================================================================== >RCS file: commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider3.java >diff -N commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider3.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ commontests/org/eclipse/wst/common/tests/flatten/ExampleFlattenParticipantProvider3.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+package org.eclipse.wst.common.tests.flatten; >+ >+import org.eclipse.wst.common.componentcore.internal.flat.AbstractFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipantProvider; >+ >+public class ExampleFlattenParticipantProvider3 implements >+ IFlattenParticipantProvider { >+ >+ public static final String DUMMY_PARTICIPANT = "example3"; >+ public static final String COMMON_KEY = ExampleFlattenParticipantProvider2.COMMON_KEY; >+ public IFlattenParticipant findParticipant(String id) { >+ if( DUMMY_PARTICIPANT.equals(id)) >+ return new Dummy3FlattenParticipant(); >+ if( COMMON_KEY.equals(id)) >+ return new Dummy3FlattenParticipant(); >+ return null; >+ } >+ >+ public static class Dummy3FlattenParticipant extends AbstractFlattenParticipant { >+ >+ } >+ >+} >Index: commontests/org/eclipse/wst/common/tests/flatten/FlattenParticipantProviderTest.java >=================================================================== >RCS file: commontests/org/eclipse/wst/common/tests/flatten/FlattenParticipantProviderTest.java >diff -N commontests/org/eclipse/wst/common/tests/flatten/FlattenParticipantProviderTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ commontests/org/eclipse/wst/common/tests/flatten/FlattenParticipantProviderTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.common.tests.flatten; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.wst.common.componentcore.internal.flat.FlattenParticipantModel; >+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant; >+ >+ >+public class FlattenParticipantProviderTest extends TestCase { >+ >+ public FlattenParticipantProviderTest(String name) { >+ super(name); >+ } >+ >+ public void testNotFoundParticipantFound() { >+ assertNull(searchModel("NOT FOUND")); >+ } >+ >+ public void testExample1ParticipantFound() { >+ IFlattenParticipant fp = searchModel(ExampleFlattenParticipantProvider.DUMMY_PARTICIPANT); >+ assertNotNull(fp); >+ assertTrue(fp.getClass().getName().endsWith("DummyFlattenParticipant")); >+ } >+ >+ public void testExample2ParticipantFound() { >+ IFlattenParticipant fp = searchModel(ExampleFlattenParticipantProvider2.DUMMY_PARTICIPANT); >+ assertNotNull(fp); >+ assertTrue(fp.getClass().getName().endsWith("Dummy2FlattenParticipant")); >+ } >+ >+ public void testExample3ParticipantFound() { >+ IFlattenParticipant fp = searchModel(ExampleFlattenParticipantProvider3.DUMMY_PARTICIPANT); >+ assertNotNull(fp); >+ assertTrue(fp.getClass().getName().endsWith("Dummy3FlattenParticipant")); >+ } >+ >+ /** >+ * This test ensures that the weighting is done properly. >+ * providers with a higher weight should be consulted first. >+ * Weight 10 should be asked before weight 0 >+ */ >+ public void testCommonParticipantFound() { >+ IFlattenParticipant fp = searchModel(ExampleFlattenParticipantProvider2.COMMON_KEY); >+ assertNotNull(fp); >+ assertTrue(fp.getClass().getName().endsWith("Dummy3FlattenParticipant")); >+ } >+ >+ private IFlattenParticipant searchModel(String id) { >+ return FlattenParticipantModel.getDefault().getParticipant(id); >+ } >+} >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/common/tests/org.eclipse.wst.common.tests/plugin.xml,v >retrieving revision 1.32 >diff -u -r1.32 plugin.xml >--- plugin.xml 8 Apr 2007 03:58:26 -0000 1.32 >+++ plugin.xml 30 Mar 2012 10:26:52 -0000 >@@ -105,6 +105,20 @@ > <operationExtension > id="org.eclipse.wst.common.frameworks.datamodel.tests.extended.H"/> > </extension> >+ <extension >+ point="org.eclipse.wst.common.modulecore.flattenParticipantProvider"> >+ <flattenParticipantProvider >+ class="org.eclipse.wst.common.tests.flatten.ExampleFlattenParticipantProvider" >+ weight="5"> >+ </flattenParticipantProvider> >+ <flattenParticipantProvider >+ class="org.eclipse.wst.common.tests.flatten.ExampleFlattenParticipantProvider2"> >+ </flattenParticipantProvider> >+ <flattenParticipantProvider >+ class="org.eclipse.wst.common.tests.flatten.ExampleFlattenParticipantProvider3" >+ weight="10"> >+ </flattenParticipantProvider> >+ </extension> > > > <!-- Uncomment the below hook to test specific operation extension ids when needed --> >#P org.eclipse.wst.web >Index: static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java,v >retrieving revision 1.10 >diff -u -r1.10 FlatComponentDeployable.java >--- static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java 22 Apr 2011 21:22:45 -0000 1.10 >+++ static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java 30 Mar 2012 10:26:55 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.wst.common.componentcore.ComponentCore; > import org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent; > import org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.FlatComponentTaskModel; >+import org.eclipse.wst.common.componentcore.internal.flat.FlattenParticipantModel; > import org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference; > import org.eclipse.wst.common.componentcore.internal.flat.IFlatFile; > import org.eclipse.wst.common.componentcore.internal.flat.IFlatFolder; >@@ -130,8 +131,44 @@ > * @return > */ > protected IFlattenParticipant[] getParticipants() { >- return new IFlattenParticipant[]{ >- }; >+ // If file exists, load from file >+ >+ >+ // else, get default participants >+ return getDefaultFlattenParticipants(); >+ } >+ >+ /* >+ * Load the default participants >+ */ >+ protected IFlattenParticipant[] getDefaultFlattenParticipants() { >+ ArrayList<IFlattenParticipant> participants = new ArrayList<IFlattenParticipant>(); >+ >+ String[] defaultParticipants = getDefaultFlattenParticipantIDs(); >+ >+ // Null protection >+ defaultParticipants = defaultParticipants == null ? new String[0] : defaultParticipants; >+ >+ IFlattenParticipant tmp; >+ for( int i = 0; i < defaultParticipants.length; i++ ) { >+ tmp = FlattenParticipantModel.getDefault().getParticipant(defaultParticipants[i]); >+ if( tmp != null ) >+ participants.add(tmp); >+ else { >+ // Log? This is an error somehow >+ } >+ } >+ >+ return participants.toArray(new IFlattenParticipant[participants.size()]); >+ } >+ >+ >+ /** >+ * Get a list of participant keys that are default for this project type >+ * @return >+ */ >+ protected String[] getDefaultFlattenParticipantIDs() { >+ return new String[0]; > } > > public boolean isBinary() { >
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 330894
: 213383 |
213598