[107461] removed old DM framework: committed for JL
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF
index 97eefbf..17571b2 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF
@@ -12,7 +12,6 @@
org.eclipse.wst.common.internal.emfworkbench,
org.eclipse.wst.common.internal.emfworkbench.edit,
org.eclipse.wst.common.internal.emfworkbench.integration,
- org.eclipse.wst.common.internal.emfworkbench.operation,
org.eclipse.wst.common.internal.emfworkbench.validateedit
Require-Bundle: org.eclipse.wst.common.frameworks,
org.eclipse.jem.util,
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml b/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml
index 4cb760a..4dc234d 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml
@@ -27,15 +27,6 @@
context="Headless">
</uiContextSensitiveClass>
</extension>
- <extension
- id="Generator"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- class="org.eclipse.wst.common.internal.emfworkbench.operation.DataObjectGeneratorModel">
- </run>
- </application>
- </extension>
<extension
id="emfValidationHandler"
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/DataObjectGenerator.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/DataObjectGenerator.java
deleted file mode 100644
index 1de68d8..0000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/DataObjectGenerator.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.internal.emfworkbench.operation;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory;
-import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.importer.java.builder.JavaEcoreBuilder;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.xsd.XSDPackage;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.ecore.XSDEcoreBuilder;
-
-/**
- * @author delfinoj
- *
- * Generates SDO DataObject classes.
- *
- */
-public class DataObjectGenerator extends WTPOperation {
- protected IProject project;
- protected List xmiPackages;
- protected List javaModels;
- protected XSDEcoreBuilder xsdECoreBuilder;
- protected List ePackages;
-
- /**
- * @param operationDataModel
- */
- public DataObjectGenerator(DataObjectGeneratorModel operationDataModel) {
- super(operationDataModel);
- }
-
- /**
- * Set the nsURI of the <code>ePackage</code> to be in the form
- * "java://{fullyQualifiedPackageInterfaceName}. When this format is used, EMF will attempt to
- * register the static package by loading the interface and calling the eINSTANCE field.
- *
- * @param ePackage
- * @param fullyQualifiedPackageInterfaceName
- */
- public static void setStaticPackageNsURI(EPackage ePackage, String fullyQualifiedPackageInterfaceName) {
- if (ePackage != null && fullyQualifiedPackageInterfaceName != null)
- ePackage.setNsURI("java://" + fullyQualifiedPackageInterfaceName);//$NON-NLS-1$
- }
-
- protected IProject getProject() {
- if (project == null)
- project = (IProject) operationDataModel.getProperty(DataObjectGeneratorModel.PROJECT);
- return project;
- }
-
- protected XSDEcoreBuilder getXSDEcoreBuilder() {
- if (xsdECoreBuilder == null)
- xsdECoreBuilder = new XSDEcoreBuilder();
- return xsdECoreBuilder;
- }
-
- /**
- * @see com.ibm.etools.ctc.ant.task.util.BaseProjectBuilder#generate(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected boolean prepareGenerate() {
- // Collect all generated EPackages
- ePackages = new ArrayList();
- // Packages generated from XSDs
- if (xsdECoreBuilder != null)
- ePackages.addAll(xsdECoreBuilder.getTargetNamespaceToEPackageMap().values());
- // Packages loaded from XMI files
- if (xmiPackages != null)
- ePackages.addAll(xmiPackages);
- if (javaModels != null)
- prepareEPackagesFromJavaModels();
- if (ePackages.isEmpty())
- return false;
- return true;
- }
-
- protected void prepareEPackagesFromJavaModels() {
- // Generate packages from annotated java model files
- JavaEcoreBuilder javaEcoreBuilder = new JavaEcoreBuilder(getProject().getFile(new Path("sdo.genmodel"))) { //$NON-NLS-1$
- public void getAllGenModelFiles(Collection result, IFile file) throws CoreException {
- // Ignore .genmodel files on the buildpath
- return;
- }
- };
- //TODO - Ecore builder api has changed....
- //javaEcoreBuilder.run(new NullProgressMonitor(), false);
- IStatus localStatus = javaEcoreBuilder.getStatus();
- if (localStatus.getSeverity() != IStatus.ERROR) {
- List genPackages = javaEcoreBuilder.getGenModel().getGenPackages();
- processGenPackagesFromJavaModels(genPackages);
- } else
- logProblems(localStatus);
- }
-
- /**
- * @param statusArg
- */
- private void logProblems(IStatus statusArg) {
- Logger logger = Logger.getLogger();
- logger.logError("Problems detected generating SDO objects."); //$NON-NLS-1$
- log(statusArg, logger);
- }
-
- private void log(IStatus statusArg, Logger logger) {
- doLog(statusArg, logger);
- if (statusArg.isMultiStatus()) {
- MultiStatus mStatus = (MultiStatus) statusArg;
- IStatus[] children = mStatus.getChildren();
- for (int i = 0; i < children.length; i++) {
- log(children[i], logger);
- }
- }
- }
-
- private void doLog(IStatus statusArg, Logger logger) {
- switch (statusArg.getSeverity()) {
- case IStatus.ERROR :
- logger.logError(statusArg.getMessage());
- break;
- case IStatus.WARNING :
- logger.logWarning(statusArg.getMessage());
- break;
- case IStatus.INFO :
- logger.log(statusArg.getMessage());
- break;
- }
- }
-
- /**
- * @param genPackages
- */
- protected void processGenPackagesFromJavaModels(List genPackages) {
- if (genPackages.isEmpty())
- return;
- for (Iterator i = genPackages.iterator(); i.hasNext();) {
- GenPackage genPackage = (GenPackage) i.next();
- EPackage ePackage = genPackage.getEcorePackage();
- updateEPackageFromJavaModel(ePackage, genPackage);
- ePackages.add(ePackage);
- }
-
- }
-
- protected void updateEPackageFromJavaModel(EPackage ePackage, GenPackage genPackage) {
- // Fix the ePackage name
- ePackage.setName(ePackage.getNsPrefix());
- setStaticPackageNsURI(ePackage, genPackage);
- }
-
- /**
- * Since we are generating static Packages we need to set the nsURI of each EPackage to be in
- * the form "java://{fully qualified package interface name}. When this format is used, EMF will
- * attempt to register the static package by loading the interface and calling the eINSTANCE
- * field.
- *
- * @param ePackage
- * @param genPackage
- */
- protected void setStaticPackageNsURI(EPackage ePackage, GenPackage genPackage) {
- String interfaceName = genPackage.getPackageInterfaceName();
- if (interfaceName != null) {
- StringBuffer b = new StringBuffer();
- b.append(genPackage.getPackageName()).append('.').append(interfaceName);
- setStaticPackageNsURI(ePackage, b.toString());
- }
- }
-
- /**
- * @see com.ibm.etools.ctc.ant.task.util.BaseProjectBuilder#generate(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void generate(IProgressMonitor progressMonitor) throws CoreException {
- try {
- progressMonitor.beginTask(getProject().getFullPath().toString(), 100);
- // Create a GenModel
- GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
- initializeGenModel(genModel);
- setPackagesOnGenModel(genModel);
- // Validate the GenModel
- IStatus localStatus = genModel.validate();
- if (!localStatus.isOK())
- throw new CoreException(localStatus);
- doGenerate(progressMonitor, genModel);
- progressMonitor.worked(100);
- } finally {
- progressMonitor.done();
- }
- }
-
- /*
- * Generate static code.
- */
- protected void doGenerate(IProgressMonitor progressMonitor, GenModel genModel) {
- try {
- genModel.generate(new SubProgressMonitor(progressMonitor, 50));
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
-
- /*
- * Initialize the GenModel from the EPackages
- */
- protected void setPackagesOnGenModel(GenModel genModel) {
- genModel.initialize(ePackages);
- for (Iterator i = genModel.getGenPackages().iterator(); i.hasNext();) {
- GenPackage genPackage = (GenPackage) i.next();
- genPackage.setLoadInitialization(false);
- String prefix = genPackage.getInterfacePackageName();
- prefix = prefix.substring(prefix.lastIndexOf('.') + 1);
- if (prefix.length() > 1)
- prefix = prefix.substring(0, 1).toUpperCase() + prefix.substring(1);
- else
- prefix = prefix.toUpperCase();
- genPackage.setPrefix(prefix);
- }
- }
-
- /**
- * @param genModel
- */
- protected void initializeGenModel(GenModel genModel) {
- setSDODefaults(genModel);
-
- genModel.setDynamicTemplates(operationDataModel.getBooleanProperty(DataObjectGeneratorModel.DYNAMIC_TEMPLATES));
- genModel.setForceOverwrite(operationDataModel.getBooleanProperty(DataObjectGeneratorModel.FORCE_OVERWRITE));
- genModel.setCanGenerate(operationDataModel.getBooleanProperty(DataObjectGeneratorModel.CAN_GENERATE));
- genModel.setUpdateClasspath(operationDataModel.getBooleanProperty(DataObjectGeneratorModel.UPDATE_CLASSPATH));
- genModel.setGenerateSchema(operationDataModel.getBooleanProperty(DataObjectGeneratorModel.GENERATE_SCHEMA));
- genModel.setNonNLSMarkers(operationDataModel.getBooleanProperty(DataObjectGeneratorModel.NON_NLS_MARKERS));
-
- IFolder modelDir = (IFolder) operationDataModel.getProperty(DataObjectGeneratorModel.MODEL_DIR);
- genModel.setModelDirectory(modelDir.getFullPath().toOSString());
- }
-
- /*
- * Options from SetDefaultSDOOptions, recommended by Ed
- */
- protected void setSDODefaults(GenModel genModel) {
- genModel.setRootExtendsInterface(""); //$NON-NLS-1$
- //TODO why would you expose this internal interface in the generated code, instead of
- // commonj.sdo.DataObject
- genModel.setRootImplementsInterface("org.eclipse.emf.ecore.sdo.InternalEDataObject"); //$NON-NLS-1$
- genModel.setRootExtendsClass("org.eclipse.emf.ecore.sdo.impl.EDataObjectImpl"); //$NON-NLS-1$
- genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); //$NON-NLS-1$
- genModel.setFeatureMapWrapperInternalInterface("org.eclipse.emf.ecore.sdo.util.ESequence"); //$NON-NLS-1$
- genModel.setFeatureMapWrapperClass("org.eclipse.emf.ecore.sdo.util.BasicESequence"); //$NON-NLS-1$
- genModel.setSuppressEMFTypes(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- loadModelFiles(monitor);
- if (prepareGenerate())
- generate(monitor);
- }
-
- /**
- * @param monitor
- */
- protected void loadModelFiles(IProgressMonitor monitor) {
- loadXSDFiles(monitor);
- loadEcoreFiles(monitor);
- //loadWSDLFiles(monitor);
- loadJavaFiles(monitor);
- }
-
- /**
- * Load an XSD and generate the eCore packages for each tracked XSD file.
- *
- * @param monitor
- */
- protected void loadXSDFiles(IProgressMonitor monitor) {
- if (operationDataModel.isSet(DataObjectGeneratorModel.XSD_FILES)) {
- List files = (List) operationDataModel.getProperty(DataObjectGeneratorModel.XSD_FILES);
- IFile file;
- for (int i = 0; i < files.size(); i++) {
- file = (IFile) files.get(i);
- Resource resource = WorkbenchResourceHelperBase.load(file);
- Collection xsdSchemas = EcoreUtil.getObjectsByType(resource.getContents(), XSDPackage.eINSTANCE.getXSDSchema());
- for (Iterator j = xsdSchemas.iterator(); j.hasNext();) {
- getXSDEcoreBuilder().generate((XSDSchema) j.next());
- }
- }
- }
- }
-
- /**
- * Load an Ecore model file and generate the eCore packages for each tracked Ecore file.
- *
- * @param monitor
- */
- protected void loadEcoreFiles(IProgressMonitor monitor) {
- if (operationDataModel.isSet(DataObjectGeneratorModel.ECORE_FILES)) {
- List files = (List) operationDataModel.getProperty(DataObjectGeneratorModel.ECORE_FILES);
- IFile file;
- for (int i = 0; i < files.size(); i++) {
- file = (IFile) files.get(i);
-
- Resource resource = WorkbenchResourceHelperBase.getResource(file, true);
- addXmiPackages(resource.getContents());
- }
- }
- }
-
-
- protected void addXmiPackages(List packages) {
- if (xmiPackages == null)
- xmiPackages = new ArrayList();
- xmiPackages.addAll(packages);
- }
-
- /**
- * Load the XSD files and generate the eCore packages for each tracked WSDL file.
- *
- * @param monitor
- */
- protected void loadWSDLFiles(IProgressMonitor monitor) {
- // if (operationDataModel.isSet(DataObjectGeneratorModel.WSDL_FILES)) {
- // List files = (List) operationDataModel.getProperty(DataObjectGeneratorModel.WSDL_FILES);
- // IFile file;
- // for (int i = 0; i < files.size(); i++) {
- // file = (IFile) files.get(i);
- // //TODO We can't handle WSDL in WSAD 5.1 as the WSDL model is not an EMF 2.0 model
- // // Re-activate this function when we move to 6.0
- // // // Load a WSDL file and collect all the references XSD schemas
- // // Set xsdSchemas=new HashSet();
- // // URI uri = URI.createFileURI(file.getLocation().toString());
- // // Resource resource = WorkbenchResourceHelper.getResource(uri);
- // // for (Iterator i=resource.getAllContents(); i.hasNext(); ) {
- // // Object object=i.next();
- // // if (object instanceof XSDSchemaExtensibilityElement) {
- // // XSDSchemaExtensibilityElement
- // // extensibilityElement=(XSDSchemaExtensibilityElement)object;
- // // XSDSchema xsdSchema=extensibilityElement.getEXSDSchema();
- // // if (xsdSchema!=null)
- // // xsdSchemas.add(xsdSchema);
- // // } else if (object instanceof Part) {
- // // Part part=(Part)object;
- // // XSDNamedComponent xsdComponent=part.getEXSDType();
- // // if (xsdComponent==null)
- // // xsdComponent=part.getEXSDElement();
- // // if (xsdComponent!=null) {
- // // XSDSchema xsdSchema=xsdComponent.getSchema();
- // // if (xsdSchema!=null &&
- // // !XSDUtil.isSchemaForSchemaNamespace(xsdSchema.getTargetNamespace())) {
- // // xsdSchemas.add(xsdSchema);
- // // }
- // // }
- // // }
- // // }
- // //
- // // // Generate Ecore packages from XSDs
- // // for (Iterator i=xsdSchemas.iterator(); i.hasNext(); )
- // // xsdECoreBuilder.generate((XSDSchema)i.next());
- // // }
- // }
- // }
- }
-
- /**
- * Load an Ecore model file and generate the eCore packages for each tracked Ecore file.
- *
- * @param monitor
- */
- protected void loadJavaFiles(IProgressMonitor monitor) {
- javaModels = (List) operationDataModel.getProperty(DataObjectGeneratorModel.JAVA_FILES);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/DataObjectGeneratorModel.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/DataObjectGeneratorModel.java
deleted file mode 100644
index e5ed407..0000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/DataObjectGeneratorModel.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 3, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.internal.emfworkbench.operation;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPlatformRunnable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.codegen.ecore.Generator;
-import org.eclipse.emf.codegen.util.CodeGenUtil.StreamProgressMonitor;
-import org.eclipse.jem.util.plugin.JEMUtilPlugin;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-import sun.tools.jar.Main;
-
-/**
- * @author DABERG
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class DataObjectGeneratorModel extends WTPOperationDataModel implements IPlatformRunnable {
- /**
- * The project that you want this generator to operate upon. (Required)
- *
- * @link org.eclipse.core.resources.IProject
- */
- public static final String PROJECT = "DataObjectGeneratorModel.project"; //$NON-NLS-1$
- /**
- * This is a list of XSD Files that need to be processed. (Optional)
- *
- * @link List
- *
- * @see IFile
- */
- public static final String XSD_FILES = "DataObjectGeneratorModel.xsdFiles"; //$NON-NLS-1$
- /**
- * This is a list of ECORE Files that need to be processed. (Optional)
- *
- * @link List
- *
- * @see IFile
- */
- public static final String ECORE_FILES = "DataObjectGeneratorModel.ecoreFiles"; //$NON-NLS-1$
- /**
- * This is a list of WSDL Files that need to be processed. (Optional)
- *
- * @link List
- *
- * @see IFile
- */
- public static final String WSDL_FILES = "DataObjectGeneratorModel.wsdlFiles"; //$NON-NLS-1$
- /**
- * This is a list of Java model Files that need to be processed. (Optional)
- *
- * @link List
- *
- * @see IFile
- */
- public static final String JAVA_FILES = "DataObjectGeneratorModel.javaFiles"; //$NON-NLS-1$
- /**
- * This is the folder within the project that you want to have the generated output for the data
- * objects to be saved. (Optional - defaults to {project}/gen/src/)
- *
- * @link org.eclipse.core.resources.IFolder
- */
- public static final String MODEL_DIR = "DataObjectGeneratorModel.modelDirectory"; //$NON-NLS-1$
- /**
- * GenModel Dynamic Templates option. (Optional - defaults to false)
- *
- * @link Boolean
- */
- public static final String DYNAMIC_TEMPLATES = "DataObjectGeneratorModel.dynamicTemplates"; //$NON-NLS-1$
- /**
- * GenModel Force Overwrite option. (Optional - defaults to true)
- *
- * @link Boolean
- */
- public static final String FORCE_OVERWRITE = "DataObjectGeneratorModel.forceOverwrite"; //$NON-NLS-1$
- /**
- * GenModel CanGenerate option. (Optional - defaults to true)
- *
- * @link Boolean
- */
- public static final String CAN_GENERATE = "DataObjectGeneratorModel.canGenerate"; //$NON-NLS-1$
- /**
- * GenModel Update Classpath option. (Optional - defaults to false)
- *
- * @link Boolean
- */
- public static final String UPDATE_CLASSPATH = "DataObjectGeneratorModel.updateClasspath"; //$NON-NLS-1$
- /**
- * GenModel Generate Schema option. (Optional - defaults to false)
- *
- * @link Boolean
- */
- public static final String GENERATE_SCHEMA = "DataObjectGeneratorModel.generateSchema"; //$NON-NLS-1$
- /**
- * GenModel NON NLS Markers option. (Optional - defaults to false)
- *
- * @link Boolean
- */
- public static final String NON_NLS_MARKERS = "DataObjectGeneratorModel.nonNLSMarkers"; //$NON-NLS-1$
-
-
- public static void main(String args[]) {
- new DataObjectGeneratorModel().run(args);
- }
-
- public Object run(Object object) {
- try {
-
- final String[] arguments = (String[]) object;
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor progressMonitor) throws CoreException {
- try {
- boolean keepGenerated = false;
- boolean verbose = false;
-
- String ecoreFileName = null;
- String outputJar = null;
- if (arguments.length == 0) {
- printUsage();
- return;
- }
- for (int i = 0; i < arguments.length; i++) {
- if (arguments[i].equalsIgnoreCase("-keepgenerated")) { //$NON-NLS-1$
- keepGenerated = true;
- } else if (arguments[i].equalsIgnoreCase("-ecore")) { //$NON-NLS-1$
- ecoreFileName = arguments[++i];
- } else if (arguments[i].equalsIgnoreCase("-output")) { //$NON-NLS-1$
- outputJar = arguments[++i];
- } else if (arguments[i].equalsIgnoreCase("-verbose")) { //$NON-NLS-1$
- verbose = true;
- }
- }
-
- if ((ecoreFileName == null) || (outputJar == null)) {
- printUsage();
- return;
- }
-
- if (!verbose)
- progressMonitor = new NullProgressMonitor();
-
- DataObjectGeneratorModel g = new DataObjectGeneratorModel();
-
- IProject proj = workspace.getRoot().getProject("TargetProject"); //$NON-NLS-1$
- IFolder srcFolder = proj.getFolder("src"); //$NON-NLS-1$
- g.setProperty(DataObjectGeneratorModel.MODEL_DIR, srcFolder);
-
- if (!proj.exists()) {
- IPath location = proj.getLocation();
- proj = Generator.createEMFProject(srcFolder.getFullPath(), //new
- // Path("/TargetProject/src"),
- location, Collections.EMPTY_LIST, progressMonitor, Generator.EMF_PLUGIN_PROJECT_STYLE);
-
- }
- g.setProperty(DataObjectGeneratorModel.PROJECT, proj);
-
- File ecoreFile = new File(ecoreFileName);
-
- IFile file = proj.getFile("datagraph.ecore"); //$NON-NLS-1$
- if (file.exists()) {
- file.delete(true, progressMonitor);
- }
-
- file.create(new FileInputStream(ecoreFile), true, progressMonitor);
-
- g.addEcoreFile(file);
- WTPOperation op = g.getDefaultOperation();
- op.run(progressMonitor);
-
- // Build the Project
-
- proj.build(IncrementalProjectBuilder.FULL_BUILD, progressMonitor);
-
- // Jar up the files
- sun.tools.jar.Main jartool = new Main(System.out, System.err, "jar"); //$NON-NLS-1$
- String args[] = new String[5];
- args[0] = "cf"; //$NON-NLS-1$
- args[1] = outputJar;
- args[2] = "-C"; //$NON-NLS-1$
- args[3] = proj.getFolder("runtime").getLocation().toString(); //$NON-NLS-1$
- args[4] = "."; //$NON-NLS-1$
- jartool.run(args);
-
- if (keepGenerated) {
- // Add java files
- jartool = new Main(System.out, System.err, "jar"); //$NON-NLS-1$
- args[0] = "uf"; //$NON-NLS-1$
- args[3] = proj.getFolder("src").getLocation().toString(); //$NON-NLS-1$
- jartool.run(args);
- }
-
- // Delete the old project
- proj.delete(true, true, progressMonitor);
-
- } catch (Exception exception) {
- exception.printStackTrace();
- throw new CoreException(new Status(IStatus.ERROR, JEMUtilPlugin.ID, 0, "EMF Workbench Error", exception)); //$NON-NLS-1$
- } finally {
- progressMonitor.done();
- }
- }
- };
- workspace.run(runnable, new StreamProgressMonitor(System.out));
-
- return new Integer(0);
- } catch (Exception exception) {
- exception.printStackTrace();
- return new Integer(1);
- }
- }
-
- public void printUsage() throws Exception {
- System.out.println("Usage arguments:"); //$NON-NLS-1$
- System.out.println(" -ecore <ecore-file>"); //$NON-NLS-1$
- System.out.println(" -output <jar file name>"); //$NON-NLS-1$
- System.out.println(" [-keepGenerated] [-verbose]"); //$NON-NLS-1$
-
- }
-
- /**
- *
- */
- public DataObjectGeneratorModel() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new DataObjectGenerator(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(PROJECT);
- addValidBaseProperty(XSD_FILES);
- addValidBaseProperty(ECORE_FILES);
- addValidBaseProperty(WSDL_FILES);
- addValidBaseProperty(JAVA_FILES);
- addValidBaseProperty(MODEL_DIR);
- addValidBaseProperty(DYNAMIC_TEMPLATES);
- addValidBaseProperty(FORCE_OVERWRITE);
- addValidBaseProperty(CAN_GENERATE);
- addValidBaseProperty(UPDATE_CLASSPATH);
- addValidBaseProperty(GENERATE_SCHEMA);
- addValidBaseProperty(NON_NLS_MARKERS);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(MODEL_DIR))
- return getDefaultModelDirectory();
- if (propertyName.equals(FORCE_OVERWRITE) || propertyName.equals(CAN_GENERATE))
- return Boolean.TRUE;
- if (propertyName.equals(XSD_FILES) || propertyName.equals(ECORE_FILES) || propertyName.equals(WSDL_FILES) || propertyName.equals(JAVA_FILES))
- return Collections.EMPTY_LIST;
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * @return
- */
- protected Object getDefaultModelDirectory() {
- IProject project = (IProject) getProperty(PROJECT);
- if (project == null)
- return null;
- return project.getFolder(new Path("gen/src")); //$NON-NLS-1$
- }
-
- private void addFile(String propertyName, IFile file) {
- if (file != null) {
- List files;
- if (!isSet(propertyName)) {
- files = new ArrayList();
- setProperty(propertyName, files);
- } else
- files = (List) getProperty(propertyName);
- files.add(file);
- }
- }
-
- public void addXSDFile(IFile file) {
- addFile(XSD_FILES, file);
- }
-
- public void addEcoreFile(IFile file) {
- addFile(ECORE_FILES, file);
- }
-
- public void addWSDLFile(IFile file) {
- addFile(WSDL_FILES, file);
- }
-
- public void addJavaFile(IFile file) {
- addFile(JAVA_FILES, file);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/EditModelOperation.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/EditModelOperation.java
deleted file mode 100644
index 53ee9da..0000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/EditModelOperation.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Oct 10, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.internal.emfworkbench.operation;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jem.util.UIContextDetermination;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.wst.common.frameworks.internal.operations.IOperationHandler;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.common.internal.emfworkbench.validateedit.IValidateEditContext;
-
-public abstract class EditModelOperation extends WTPOperation {
- protected EditModel editModel;
- protected EMFWorkbenchContext emfWorkbenchContext;
- private CommandStack commandStack;
-
- public EditModelOperation(EditModelOperationDataModel dataModel) {
- super(dataModel);
- }
-
- public EditModelOperation() {
- //Default constructor
- }
-
- protected final void initialize(IProgressMonitor monitor) {
- EditModelOperationDataModel dataModel = (EditModelOperationDataModel) operationDataModel;
- emfWorkbenchContext = (EMFWorkbenchContext) WorkbenchResourceHelperBase.createEMFContext(dataModel.getTargetProject(), null);
- editModel = emfWorkbenchContext.getEditModelForWrite(dataModel.getStringProperty(EditModelOperationDataModel.EDIT_MODEL_ID), this);
- doInitialize(monitor);
- }
-
- protected void doInitialize(IProgressMonitor monitor) {
- //init
- }
-
- protected final void dispose(IProgressMonitor monitor) {
- try {
- doDispose(monitor);
- } finally {
- saveEditModel(monitor);
- }
- }
-
- private final void saveEditModel(IProgressMonitor monitor) {
- if (null != editModel) {
- if (((EditModelOperationDataModel) operationDataModel).getBooleanProperty(EditModelOperationDataModel.PROMPT_ON_SAVE))
- editModel.saveIfNecessaryWithPrompt(monitor, (IOperationHandler) operationDataModel.getProperty(WTPOperationDataModel.UI_OPERATION_HANLDER), this);
- else
- editModel.saveIfNecessary(monitor, this);
- editModel.releaseAccess(this);
- editModel = null;
- }
- postSaveEditModel(monitor);
- }
-
- /**
- * @param monitor
- */
- protected void postSaveEditModel(IProgressMonitor monitor) {
- // do nothing by default
- }
-
- protected void doDispose(IProgressMonitor monitor) {
- //dispose
- }
-
- /**
- * @return Returns the commandStack.
- */
- public CommandStack getCommandStack() {
- if (commandStack == null && editModel != null)
- commandStack = editModel.getCommandStack();
- return commandStack;
- }
-
- /**
- * @param commandStack
- * The commandStack to set.
- */
- public void setCommandStack(CommandStack commandStack) {
- this.commandStack = commandStack;
- }
-
- /**
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#validateEdit()
- */
- protected boolean validateEdit() {
- IValidateEditContext validator = (IValidateEditContext) UIContextDetermination.createInstance(IValidateEditContext.CLASS_KEY);
- return validator.validateState(editModel).isOK();
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/EditModelOperationDataModel.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/EditModelOperationDataModel.java
deleted file mode 100644
index 2469422..0000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/operation/EditModelOperationDataModel.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Oct 27, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.internal.emfworkbench.operation;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-
-public abstract class EditModelOperationDataModel extends WTPOperationDataModel {
-
- /**
- * Required
- */
- public static final String PROJECT_NAME = "EditModelOperationDataModel.PROJECT_NAME"; //$NON-NLS-1$
- /**
- * Required
- */
- public static final String EDIT_MODEL_ID = "EditModelOperationDataModel.EDIT_MODEL_ID"; //$NON-NLS-1$
- /**
- * Optional, should save with prompt...defaults to false
- */
- public static final String PROMPT_ON_SAVE = "EditModelOperationDataModel.PROMPT_ON_SAVE"; //$NON-NLS-1$
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(PROJECT_NAME);
- addValidBaseProperty(EDIT_MODEL_ID);
- addValidBaseProperty(PROMPT_ON_SAVE);
- }
-
- public IProject getTargetProject() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
- }
-
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(PROMPT_ON_SAVE))
- return Boolean.FALSE;
- return super.getDefaultProperty(propertyName);
- }
-
- public final EditModel getEditModelForRead(Object key) {
- EMFWorkbenchContext emfWorkbenchContext = (EMFWorkbenchContext) WorkbenchResourceHelperBase.createEMFContext(getTargetProject(), null);
- return emfWorkbenchContext.getEditModelForRead(getStringProperty(EDIT_MODEL_ID), key);
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java
index 195f672..3789bd6 100644
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java
+++ b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java
@@ -33,8 +33,6 @@
import org.eclipse.wst.common.frameworks.internal.ui.RunnableOperationWrapper;
import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPWizardSkipPageDataModel;
-
/**
* This class is EXPERIMENTAL and is subject to substantial changes.
@@ -358,12 +356,13 @@
}
public void addPage(IWizardPage page) {
- if (getDataModel().isProperty(WTPWizardSkipPageDataModel.SKIP_PAGES) && null != page.getName()) {
- List pagesToSkip = (List) getDataModel().getProperty(WTPWizardSkipPageDataModel.SKIP_PAGES);
- if (null != pagesToSkip && pagesToSkip.contains(page.getName())) {
- return;
- }
- }
+ //TODO add skip pages fw to data model provider wizard
+// if (getDataModel().isProperty(WTPWizardSkipPageDataModel.SKIP_PAGES) && null != page.getName()) {
+// List pagesToSkip = (List) getDataModel().getProperty(WTPWizardSkipPageDataModel.SKIP_PAGES);
+// if (null != pagesToSkip && pagesToSkip.contains(page.getName())) {
+// return;
+// }
+// }
super.addPage(page);
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IActionWTPOperation.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IActionWTPOperation.java
deleted file mode 100644
index 8970381..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IActionWTPOperation.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 10, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.wst.common.frameworks.internal.operations.NonConflictingRule;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-
-
-/**
- * @author mdelder
- *
- */
-public class IActionWTPOperation extends WTPOperation {
-
- private static final ISchedulingRule nonconflictingRule = new NonConflictingRule();
-
- boolean done;
-
- /**
- *
- */
- public IActionWTPOperation() {
- super();
- }
-
- /**
- * @param operationDataModel
- */
- public IActionWTPOperation(WTPOperationDataModel operationDataModel) {
- super(operationDataModel);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
-
- final IAction action = (IAction) getOperationDataModel().getProperty(IActionWTPOperationDataModel.IACTION);
- if (action == null)
- throw new CoreException(new Status(IStatus.WARNING, WTPUIPlugin.PLUGIN_ID, 0, WTPCommonUIResourceHandler.getString("IActionWTPOperation_UI_0"), null)); //$NON-NLS-1$
-
- final ISelection selection = (IStructuredSelection) getOperationDataModel().getProperty(IActionWTPOperationDataModel.ISTRUCTURED_SELECTION);
- final ISelectionProvider selectionProvider = (ISelectionProvider) getOperationDataModel().getProperty(IActionWTPOperationDataModel.ISELECTION_PROVIDER);
-
- /*
- * if(selectionProvider != null) selection = (selection != null) ? selection :
- * selectionProvider.getSelection();
- */
- Shell shell = (Shell) getOperationDataModel().getProperty(IActionWTPOperationDataModel.SHELL);
- done = false;
-
- Runnable executeAction = new Runnable() {
-
- public void run() {
- try {
- if (action instanceof IActionDelegate) {
- ((IActionDelegate) action).selectionChanged(action, selection);
- ((IActionDelegate) action).run(action);
- } else if (action instanceof IViewActionDelegate) {
- ((IViewActionDelegate) action).selectionChanged(action, selection);
- ((IActionDelegate) action).run(action);
- } /*else if (action instanceof SelectionDispatchAction) {
- ((SelectionDispatchAction) action).update(selection);
- ((SelectionDispatchAction) action).run();
- } */
- else if (action instanceof ISelectionChangedListener) {
- ((ISelectionChangedListener)action).selectionChanged(new SelectionChangedEvent(selectionProvider, selection));
- action.run();
- }
-
-
- } catch (RuntimeException e) {
- e.printStackTrace();
- } finally {
- getOperationDataModel().dispose();
- done = true;
- }
- }
- };
-
- Display current = Display.getCurrent();
- if (current != null) {
- executeAction.run();
- } else {
- shell.getDisplay().asyncExec(executeAction);
- }
-
- while (!done) {
- Thread.sleep(100);
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#getSchedulingRule()
- */
- protected ISchedulingRule getSchedulingRule() {
- return nonconflictingRule;
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IActionWTPOperationDataModel.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IActionWTPOperationDataModel.java
deleted file mode 100644
index eded3bd..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/IActionWTPOperationDataModel.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 10, 2004
- *
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-
-
-/**
- * @author mdelder
- *
- */
-public class IActionWTPOperationDataModel extends WTPOperationDataModel implements IPropertyChangeListener {
-
- public static final String IACTION = "IActionWTPOperationDataModel.IACTION"; //$NON-NLS-1$
- public static final String ISTRUCTURED_SELECTION = "IActionWTPOperationDataModel.ISTRUCTURED_SELECTION"; //$NON-NLS-1$
- public static final String ISELECTION_PROVIDER = "IActionWTPOperationDataModel.ISELECTION_PROVIDER"; //$NON-NLS-1$
- public static final String SHELL = "IActionWTPOperationDataModel.SHELL"; //$NON-NLS-1$
- public static final String ACTION_RAN_SUCCESSFULLY = "IActionWTPOperationDataModel.ACTION_RAN_SUCCESSFULLY"; //$NON-NLS-1$
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(IACTION);
- addValidBaseProperty(ISTRUCTURED_SELECTION);
- addValidBaseProperty(ISELECTION_PROVIDER);
- addValidBaseProperty(SHELL);
- addValidBaseProperty(ACTION_RAN_SUCCESSFULLY);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new IActionWTPOperation(this);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#isResultProperty(java.lang.String)
- */
- protected boolean isResultProperty(String propertyName) {
- if (ACTION_RAN_SUCCESSFULLY.equals(propertyName))
- return true;
- return super.isResultProperty(propertyName);
- }
-
- /**
- * @param action
- * @param selection
- * @param provider
- * @return
- */
- public static WTPOperationDataModel createDataModel(IActionDelegate action, IStructuredSelection selection, ISelectionProvider provider, Shell shell) {
- WTPOperationDataModel dataModel = new IActionWTPOperationDataModel();
- dataModel.setProperty(IACTION, action);
- dataModel.setProperty(ISTRUCTURED_SELECTION, selection);
- dataModel.setProperty(ISELECTION_PROVIDER, provider);
- dataModel.setProperty(SHELL, shell);
- return dataModel;
- }
-
- /**
- * @param action
- * @param selection
- * @param provider
- * @return
- */
- public static WTPOperationDataModel createDataModel(Action action, IStructuredSelection selection, ISelectionProvider provider, Shell shell) {
- WTPOperationDataModel dataModel = new IActionWTPOperationDataModel();
- dataModel.setProperty(IACTION, action);
- dataModel.setProperty(ISTRUCTURED_SELECTION, selection);
- dataModel.setProperty(ISELECTION_PROVIDER, provider);
- dataModel.setProperty(SHELL, shell);
- return dataModel;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doSetProperty(java.lang.String,
- * java.lang.Object)
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
-
-
- if (IACTION.equals(propertyName)) {
-
- IAction oldAction = (IAction) getProperty(IACTION);
- if (oldAction != null)
- oldAction.removePropertyChangeListener(this);
-
- boolean result = super.doSetProperty(propertyName, propertyValue);
-
- IAction newAction = (IAction) getProperty(IACTION);
- if (newAction != null)
- newAction.addPropertyChangeListener(this);
-
- return result;
- }
- return super.doSetProperty(propertyName, propertyValue);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (ACTION_RAN_SUCCESSFULLY.equals(propertyName))
- return Boolean.TRUE;
- return super.getDefaultProperty(propertyName);
- }
-
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#dispose()
- */
- public void dispose() {
- super.dispose();
- IAction action = (IAction) getProperty(IACTION);
- if (action != null)
- action.removePropertyChangeListener(this);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- IAction action = (IAction) getProperty(IACTION);
- if (action == null || action != event.getSource())
- return;
- // TODO MDE Implement this method
- //notifyListeners(event.getProperty(), 0, event.getOldValue(), event.getNewValue());
- if (IAction.RESULT.equals(event.getProperty())) {
- setProperty(ACTION_RAN_SUCCESSFULLY, event.getNewValue());
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/MasterDescriptor.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/MasterDescriptor.java
deleted file mode 100644
index 00ae7a8..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/MasterDescriptor.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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
- **************************************************************************************************/
-/*
- * Created on May 5, 2004
- *
- * TODO To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.internal.ActionExpression;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
-
-public class MasterDescriptor extends SlaveDescriptor {
-
- public static final String MASTER_OPERATION = "masterOperation"; //$NON-NLS-1$
-
- public static final String ATT_EXTENDED_OPERATION_ID = "extendedGenericId"; //$NON-NLS-1$
-
- public static final String SELECTION_ENABLEMENT = "selectionEnablement"; //$NON-NLS-1$
-
- private static final String ATT_POPULATOR_CLASS = "populatorClass"; //$NON-NLS-1$
-
- private static final String ATT_ALWAYS_EXECUTE = "alwaysExecute"; //$NON-NLS-1$
-
- private ActionExpression enablement;
-
- private String extendedOperationId;
-
- private WTPOperationDataModelUICreator creator;
-
- private boolean alwaysExecute;
-
-
- public MasterDescriptor(IConfigurationElement element) {
- super(element);
- init();
- }
-
- private void init() {
- this.extendedOperationId = getElement().getAttribute(ATT_EXTENDED_OPERATION_ID);
- if (null == extendedOperationId)
- Logger.getLogger().log(WTPCommonUIResourceHandler.getString("MasterDescriptor_UI_0", new Object[]{ATT_EXTENDED_OPERATION_ID})); //$NON-NLS-1$
-
-
- if (Boolean.valueOf(getElement().getAttribute(ATT_ALWAYS_EXECUTE)).booleanValue())
- alwaysExecute = true;
-
- IConfigurationElement[] elements = getElement().getChildren(SELECTION_ENABLEMENT);
- if (elements.length == 1)
- this.enablement = new ActionExpression(elements[0]);
- else
- Logger.getLogger().log(WTPCommonUIResourceHandler.getString("MasterDescriptor_ERROR_2")); //$NON-NLS-1$
-
- }
-
- /**
- * @return Returns the extendedOperationId.
- */
- public String getExtendedOperationId() {
- return extendedOperationId;
- }
-
-
- public boolean isEnabledFor(IStructuredSelection selection) {
- if (getEnablement() == null)
- return true;
- boolean result = false;
- for (Iterator itr = selection.iterator(); itr.hasNext();) {
- result = getEnablement().isEnabledFor(itr.next());
- if (result)
- break;
- }
- return result;
- }
-
- public WTPOperationDataModelUICreator getCreator() {
- if (creator == null) {
- try {
- creator = (WTPOperationDataModelUICreator) getElement().createExecutableExtension(ATT_POPULATOR_CLASS);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- return creator;
- }
-
- protected ActionExpression getEnablement() {
- return enablement;
- }
-
-
- /**
- * @return Returns the alwaysExecute.
- */
- public boolean isAlwaysExecute() {
- return alwaysExecute;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PasteActionOperation.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PasteActionOperation.java
deleted file mode 100644
index c09631c..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PasteActionOperation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Aug 27, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-
-/**
- * @author mdelder
- *
- */
-public class PasteActionOperation extends IActionWTPOperation {
-
- public PasteActionOperation() {
- super();
- }
-
- public PasteActionOperation(PasteActionOperationDataModel opMdl) {
- super(opMdl);
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PasteActionOperationDataModel.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PasteActionOperationDataModel.java
deleted file mode 100644
index dc12e79..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PasteActionOperationDataModel.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Aug 26, 2004
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-//TODO This class has code commented out to get compile errors cleanup for Eclipse 3.1 as the internal classes ReorgResult and PasteActions have been removed in 3.1 - VKB
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Style - Code Templates
- *
- */
-public class PasteActionOperationDataModel extends IActionWTPOperationDataModel {
-
- /**
- * Result Property. A java.util.Map of old-types-to-new-types
- */
- public static final String REFACTORED_RESOURCES = "PasteActionOperationDataModel.REFACTORED_RESOURCES"; //$NON-NLS-1$
- public static final String DESTINATION = "PasteActionOperationDataModel.DESTINATION"; //$NON-NLS-1$
- private Map prepasteSnapshot = new HashMap();
- //TODO Needs Clean up of compile errors for Eclipse 3.1 - VKB
- //private ReorgResult cachedResult;
-
- /**
- * @param action
- * @param selection
- * @param provider
- * @return
- */
- public static WTPOperationDataModel createDataModel(IActionDelegate action, IStructuredSelection selection, ISelectionProvider provider, Shell shell) {
- WTPOperationDataModel dataModel = new PasteActionOperationDataModel();
- dataModel.setProperty(IACTION, action);
- dataModel.setProperty(ISTRUCTURED_SELECTION, selection);
- dataModel.setProperty(ISELECTION_PROVIDER, provider);
- dataModel.setProperty(SHELL, shell);
- return dataModel;
- }
-
- /**
- * @param action
- * @param selection
- * @param provider
- * @return
- */
- public static WTPOperationDataModel createDataModel(Action action, IStructuredSelection selection, ISelectionProvider provider, Shell shell) {
- WTPOperationDataModel dataModel = new PasteActionOperationDataModel();
- dataModel.setProperty(IACTION, action);
- dataModel.setProperty(ISTRUCTURED_SELECTION, selection);
- dataModel.setProperty(ISELECTION_PROVIDER, provider);
- dataModel.setProperty(SHELL, shell);
- return dataModel;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.extension.ui.IActionWTPOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(REFACTORED_RESOURCES);
- addValidBaseProperty(DESTINATION);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new PasteActionOperation(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.extension.ui.IActionWTPOperationDataModel#isResultProperty(java.lang.String)
- */
- protected boolean isResultProperty(String propertyName) {
- if (REFACTORED_RESOURCES.equals(propertyName) || DESTINATION.equals(propertyName))
- return true;
- return super.isResultProperty(propertyName);
- }
-
-
- /*
- * (non-Javadoc)
- * TODO Needs Clean up of compile errors for Eclipse 3.1 - VKB
- * @see org.eclipse.wst.common.frameworks.internal.operation.extension.ui.IActionWTPOperationDataModel#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
-// public void propertyChange(PropertyChangeEvent event) {
-// if (PasteAction.PASTE_PRE_NOTIFICATION.equals(event.getProperty())) {
-//
-// ReorgResult result = (ReorgResult) event.getNewValue();
-// updatePrepasteSnapshot(result);
-// } else if (PasteAction.PASTE_RESULT_NOTIFICATION.equals(event.getProperty())) {
-// //System.out.println("Caching result");
-// cachedResult = (ReorgResult) event.getNewValue();
-// } else if (IAction.RESULT.equals(event.getProperty()) && cachedResult != null) {
-// //System.out.println("Applying cached result");
-// fillMapAsNecessary(cachedResult);
-//
-// Map refactorMap = cachedResult.getNameChanges();
-// setProperty(REFACTORED_RESOURCES, refactorMap);
-//
-// Object destination = cachedResult.getDestination();
-// if (cachedResult.getResourcesToCopy().length == 1) {
-// if (cachedResult.getResourcesToCopy()[0].equals(destination))
-// destination = cachedResult.getResourcesToCopy()[0].getParent();
-// } else if (cachedResult.getJavaElementsToCopy().length == 1) {
-// if (cachedResult.getJavaElementsToCopy()[0].equals(destination))
-// destination = cachedResult.getJavaElementsToCopy()[0].getParent();
-// }
-// setProperty(DESTINATION, destination);
-// cachedResult = null;
-//
-// }
-// super.propertyChange(event);
-// }
-
-// TODO Needs Clean up of compile errors for Eclipse 3.1 - VKB
-
-// protected void updatePrepasteSnapshot(ReorgResult result) {
-//
-// resetPrepasteSnapshot();
-//
-// IContainer container = getContainerFromResult(result);
-// if (container == null)
-// return;
-//
-// IResource resourceExisting = null;
-//
-// IResource[] resources = result.getResourcesToCopy();
-// if (resources != null) {
-// for (int i = 0; i < resources.length; i++) {
-// resourceExisting = getCorrespondingFileOrFolder(resources[i], new Path(resources[i].getName()), container);
-// if (resourceExisting.exists())
-// prepasteSnapshot.put(resourceExisting, new Long(resourceExisting.getModificationStamp()));
-// }
-// }
-//
-// IJavaElement[] elements = result.getJavaElementsToCopy();
-// if (elements != null) {
-// for (int i = 0; i < elements.length; i++) {
-// try {
-// resourceExisting = getCorrespondingFileOrFolder(elements[i].getCorrespondingResource(), new Path(elements[i].getCorrespondingResource().getName()), container);
-// if (resourceExisting != null && resourceExisting.exists())
-// prepasteSnapshot.put(resourceExisting, new Long(resourceExisting.getModificationStamp()));
-// } catch (JavaModelException e) {
-// }
-// }
-// }
-// }
-
- /**
- *
- */
- private void resetPrepasteSnapshot() {
- if (prepasteSnapshot == null)
- prepasteSnapshot = new HashMap();
- else
- prepasteSnapshot.clear();
- }
-
-// TODO Needs Clean up of compile errors for Eclipse 3.1 - VKB
-
-// protected void fillMapAsNecessary(ReorgResult result) {
-//
-// IContainer container = getContainerFromResult(result);
-//
-// if (container == null)
-// return;
-//
-// /*
-// * If you Ctrl+C -> Ctrl+V a Project, you get no pre-notification and the prepasteSnapshot
-// * is null
-// */
-// if (prepasteSnapshot == null)
-// prepasteSnapshot = new HashMap();
-//
-// Map nameChanges = result.getNameChanges();
-//
-// IResource resourceExisting = null;
-//
-// IResource[] resources = result.getResourcesToCopy();
-// if (resources != null) {
-// for (int i = 0; i < resources.length; i++) {
-// resourceExisting = getCorrespondingFileOrFolder(resources[i], new Path(resources[i].getName()), container);
-//
-// if (prepasteSnapshot.containsKey(resourceExisting)) {
-// Long timestamp = (Long) prepasteSnapshot.get(resourceExisting);
-// if (timestamp.longValue() != resourceExisting.getModificationStamp())
-// nameChanges.put(resources[i], resourceExisting);
-// } else
-// nameChanges.put(resources[i], resourceExisting);
-// }
-// }
-//
-// IJavaElement[] elements = result.getJavaElementsToCopy();
-// if (elements != null) {
-// for (int i = 0; i < elements.length; i++) {
-// try {
-// resourceExisting = getCorrespondingFileOrFolder(elements[i].getCorrespondingResource(), new Path(elements[i].getCorrespondingResource().getName()), container);
-//
-// if (prepasteSnapshot.containsKey(resourceExisting)) {
-// Long timestamp = (Long) prepasteSnapshot.get(resourceExisting);
-// if (timestamp.longValue() != resourceExisting.getModificationStamp())
-// nameChanges.put(elements[i].getCorrespondingResource(), resourceExisting);
-// } else
-// nameChanges.put(elements[i].getCorrespondingResource(), resourceExisting);
-// } catch (JavaModelException e) {
-// }
-// }
-// }
-// resetPrepasteSnapshot();
-// }
-//
-// private IContainer getContainerFromResult(ReorgResult result) {
-//
-// Object destination = result.getDestination();
-//
-// IContainer container = null;
-// if (result.getDestination() instanceof IContainer) {
-// container = (IContainer) destination;
-// } else if (destination instanceof IJavaElement) {
-// IJavaElement containerElement = (IJavaElement) destination;
-// IPackageFragment fragment = null;
-// IPackageFragmentRoot fragmentRoot = null;
-// switch (containerElement.getElementType()) {
-// case IJavaElement.PACKAGE_FRAGMENT :
-// fragment = (IPackageFragment) containerElement;
-// break;
-// case IJavaElement.PACKAGE_FRAGMENT_ROOT :
-// fragmentRoot = (IPackageFragmentRoot) containerElement;
-// break;
-//
-// }
-// try {
-// if (fragmentRoot == null ^ fragment == null) {
-// container = (fragmentRoot != null) ? (IContainer) fragmentRoot.getCorrespondingResource() : (IContainer) fragment.getCorrespondingResource();
-// }
-// } catch (JavaModelException e1) {
-// }
-// }
-// return container;
-// }
-
- private IResource getCorrespondingFileOrFolder(IResource existing, IPath expectedPath, IContainer container) {
- IResource resourceExisting = null;
- switch (existing.getType()) {
- case IResource.FOLDER :
- resourceExisting = container.getFolder(expectedPath);
- break;
- case IResource.FILE :
- resourceExisting = container.getFile(expectedPath);
- break;
- }
- return resourceExisting;
- }
-
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PostPasteActionOperation.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PostPasteActionOperation.java
deleted file mode 100644
index 644f68e..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/PostPasteActionOperation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Aug 27, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Style - Code Templates
- */
-public class PostPasteActionOperation extends WTPOperation {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- PasteActionOperationDataModel dataMdl = (PasteActionOperationDataModel) getOperationDataModel();
-
- Map refactoredResourcesMap = (Map) dataMdl.getProperty(PasteActionOperationDataModel.REFACTORED_RESOURCES);
- System.out.println(getClass().getName());
- System.out.println("Map:" + refactoredResourcesMap); //$NON-NLS-1$
-
- Object destination = dataMdl.getProperty(PasteActionOperationDataModel.DESTINATION);
- System.out.println("Destination:" + destination); //$NON-NLS-1$
-
-
-
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/SlaveDescriptor.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/SlaveDescriptor.java
deleted file mode 100644
index 6d8ac61..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/SlaveDescriptor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 5, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-/**
- * @author jsholl
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class SlaveDescriptor {
-
- public static final String SLAVE_OPERATION = "slaveOperation"; //$NON-NLS-1$
-
- public static final String ATT_OPERATION_CLASS = "operationClass"; //$NON-NLS-1$
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_OVERRIDE_ID = "overrideId"; //$NON-NLS-1$
- public static final String ATT_NAME = "name"; //$NON-NLS-1$
- public static final String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
-
- private String id;
- private String name;
- private String description;
- private String operationClass;
- private String overrideId;
- private final IConfigurationElement element;
-
- public SlaveDescriptor(IConfigurationElement element) {
- this.element = element;
- init();
- }
-
- private void init() {
- this.id = this.element.getAttribute(ATT_ID);
- this.overrideId = this.element.getAttribute(ATT_OVERRIDE_ID);
- this.name = this.element.getAttribute(ATT_NAME);
- this.description = this.element.getAttribute(ATT_DESCRIPTION);
- this.operationClass = this.element.getAttribute(ATT_OPERATION_CLASS);
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getName() {
- return name;
- }
-
- public WTPOperation createOperation() {
- try {
- return (WTPOperation) this.element.createExecutableExtension(ATT_OPERATION_CLASS);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- return null;
- }
-
- /**
- * @return Returns the element.
- */
- protected IConfigurationElement getElement() {
- return element;
- }
-
- /**
- * @return Returns the operationClass.
- */
- public String getOperationClass() {
- return operationClass;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getClass() + "[name=" + getName() + ", operationClass=" + getOperationClass() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- /**
- * @return Returns the id.
- */
- public String getId() {
- return id;
- }
-
- /**
- * @return Returns the overrideId.
- */
- public String getOverrideId() {
- return overrideId;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/UIOperationExtensionRegistry.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/UIOperationExtensionRegistry.java
deleted file mode 100644
index 96ff3b2..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/UIOperationExtensionRegistry.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 4, 2004
- *
- * TODO To change the template for this generated file go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.common.frameworks.internal.operations.OperationExtensionRegistry;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class UIOperationExtensionRegistry extends RegistryReader {
-
- public static final UIOperationExtensionRegistry INSTANCE = new UIOperationExtensionRegistry();
-
- public static final String EXTENSION_POINT = "wtpuiAction"; //$NON-NLS-1$
-
- private Map slaveDescriptorMap;
-
- private Map masterDescriptorMap;
-
- private HashMap overriddingDescriptorMap;
-
- static {
- INSTANCE.readRegistry();
- }
-
- protected UIOperationExtensionRegistry() {
- super(WTPUIPlugin.PLUGIN_ID, EXTENSION_POINT);
- }
-
- public MasterDescriptor[] getExtendedUIOperations(String extendedOperationId, IStructuredSelection selection) {
- if (selection == null || selection.isEmpty())
- return new MasterDescriptor[0];
- List enabledExtendedOperations = new ArrayList();
- List descs = getMasterDescriptorsById(extendedOperationId);
- MasterDescriptor descriptor = null;
- for (Iterator itr = descs.iterator(); itr.hasNext();) {
- descriptor = (MasterDescriptor) itr.next();
- if (descriptor.isEnabledFor(selection) && !isOverridden(descriptor, selection))
- enabledExtendedOperations.add(descriptor);
- }
- if (enabledExtendedOperations.size() == 0)
- return new MasterDescriptor[0];
- MasterDescriptor[] enabledExtendedOperationsArray = new MasterDescriptor[enabledExtendedOperations.size()];
- enabledExtendedOperations.toArray(enabledExtendedOperationsArray);
- return enabledExtendedOperationsArray;
- }
-
- /**
- * @param descriptor
- * @return
- */
- protected boolean isOverridden(MasterDescriptor descriptor, IStructuredSelection selection) {
- MasterDescriptor overriddingDescriptor = getOverriddingDescriptor(descriptor);
- if (overriddingDescriptor == null)
- return false;
- return overriddingDescriptor.isEnabledFor(selection);
- }
-
- /**
- * @param descriptor
- * @return
- */
- protected MasterDescriptor getOverriddingDescriptor(MasterDescriptor descriptor) {
- return (MasterDescriptor) getOverriddingDescriptorMap().get(descriptor.getId());
- }
-
- /**
- * @return
- */
- protected Map getOverriddingDescriptorMap() {
- if (overriddingDescriptorMap == null)
- overriddingDescriptorMap = new HashMap();
- return overriddingDescriptorMap;
- }
-
- public SlaveDescriptor[] getSlaveDescriptors(String parentOperationClass) {
- String[] slaves = OperationExtensionRegistry.getRegisteredOperations(parentOperationClass);
- List slaveDescriptors = new ArrayList();
- SlaveDescriptor slaveDescriptor = null;
- for (int i = 0; null != slaves && i < slaves.length; i++) {
- slaveDescriptor = getSlaveDescriptor(slaves[i]);
- if (slaveDescriptor != null)
- slaveDescriptors.add(slaveDescriptor);
- }
- SlaveDescriptor[] slaveDescriptorsArray = new SlaveDescriptor[slaveDescriptors.size()];
- slaveDescriptors.toArray(slaveDescriptorsArray);
- return slaveDescriptorsArray;
- }
-
- /**
- * @param string
- * @return
- */
- public SlaveDescriptor getSlaveDescriptor(String operationClass) {
- return (SlaveDescriptor) getSlaveDescriptorMap().get(operationClass);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- public boolean readElement(IConfigurationElement element) {
- if (MasterDescriptor.MASTER_OPERATION.equals(element.getName())) {
- MasterDescriptor md = new MasterDescriptor(element);
- addDescriptor(md);
- if (md.getOverrideId() != null && md.getOverrideId().length() > 0)
- getOverriddingDescriptorMap().put(md.getOverrideId(), md);
- } else if (SlaveDescriptor.SLAVE_OPERATION.equals(element.getName())) {
- addDescriptor(new SlaveDescriptor(element));
- } else {
- return false;
- }
- return true;
- }
-
- /**
- * @param descriptor
- */
- protected void addDescriptor(MasterDescriptor descriptor) {
- getMasterDescriptorsById(descriptor.getExtendedOperationId()).add(descriptor);
- }
-
- /**
- * @param descriptor
- */
- protected void addDescriptor(SlaveDescriptor descriptor) {
- getSlaveDescriptorMap().put(descriptor.getOperationClass(), descriptor);
- }
-
- /**
- * @param string
- * @return
- */
- protected List getMasterDescriptorsById(String extendedOperationId) {
- List descs = (List) getMasterDescriptorMap().get(extendedOperationId);
- if (descs == null) {
- getMasterDescriptorMap().put(extendedOperationId, (descs = new ArrayList()));
- }
- return descs;
- }
-
- /**
- * @return
- */
- protected Map getMasterDescriptorMap() {
- if (masterDescriptorMap == null)
- masterDescriptorMap = new HashMap();
- return masterDescriptorMap;
- }
-
- /**
- * @return Returns the slaveDescriptorMap.
- */
- protected Map getSlaveDescriptorMap() {
- if (slaveDescriptorMap == null)
- slaveDescriptorMap = new HashMap();
- return slaveDescriptorMap;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionContentProvider.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionContentProvider.java
deleted file mode 100644
index 2cd231f..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionContentProvider.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 5, 2004
- *
- * TODO To change the template for this generated file go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class WTPActionContentProvider implements ITreeContentProvider {
-
- /**
- *
- */
- public WTPActionContentProvider() {
- super();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parentElement) {
- IOperationNode[] children = null;
- if (parentElement instanceof IOperationNode)
- children = ((IOperationNode) parentElement).getChildren();
- return (children != null) ? WTPOptionalOperationDataModel.filterRequiredChildren(children) : new Object[0];
- }
-
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element) {
-
- if (element instanceof IOperationNode)
- return ((IOperationNode) element).getParent();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element) {
-
- return getChildren(element).length != 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- IOperationNode[] elements = null;
- if (inputElement != null && inputElement instanceof WTPOptionalOperationDataModel) {
- IOperationNode root = ((WTPOptionalOperationDataModel) inputElement).getOperationTree();
- if (root != null)
- elements = root.getChildren();
- }
- return (elements != null) ? WTPOptionalOperationDataModel.filterRequiredChildren(elements) : new Object[0];
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionDialog.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionDialog.java
deleted file mode 100644
index a973f45..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionDialog.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 4, 2004
- *
- * TODO To change the template for this generated file go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelEvent;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelListener;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
-
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class WTPActionDialog extends Dialog implements WTPOperationDataModelListener {
-
- private ITreeViewerListener actionTreeListener;
-
- private ICheckStateListener checkStateListener;
-
- private ISelectionChangedListener updateDescriptionSelectionListener;
-
- private CheckboxTreeViewer checkboxTreeViewer;
-
- Text descriptionText;
-
- private final WTPOptionalOperationDataModel operationDataModel;
-
- /**
- * This action's id, or <code>null</code> if none.
- */
- private String id;
-
- /**
- * @param arg0
- */
- public WTPActionDialog(Shell arg0, WTPOptionalOperationDataModel operationDataModel) {
- super(arg0);
- this.operationDataModel = operationDataModel;
- this.operationDataModel.addListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- return super.createContents(parent);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- getShell().setText(WTPCommonUIResourceHandler.getString("WTPActionDialog_UI_0")); //$NON-NLS-1$
- Composite superComposite = (Composite) super.createDialogArea(parent);
-
- Composite composite = new Composite(superComposite, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0; //convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = 0; //convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = 0; //convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = 0; //convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- // set infopop based on id if id is set
- if (getId() != null)
- WorkbenchHelp.setHelp(composite, getId());
- Label availableFiltersLabel = new Label(composite, SWT.BOLD);
- GridData availableFiltersLabelGridData = new GridData(GridData.FILL_HORIZONTAL);
- availableFiltersLabelGridData.heightHint = convertHeightInCharsToPixels(1);
- availableFiltersLabel.setLayoutData(availableFiltersLabelGridData);
- availableFiltersLabel.setText(WTPCommonUIResourceHandler.getString("WTPActionDialog_UI_0")); //$NON-NLS-1$
-
- checkboxTreeViewer = new CheckboxTreeViewer(composite, SWT.CHECK | SWT.BORDER);
-
- checkboxTreeViewer.setContentProvider(new WTPActionContentProvider());
- checkboxTreeViewer.setLabelProvider(new WTPActionLabelProvider());
-
- checkboxTreeViewer.setInput(this.operationDataModel);
-
- Tree tree = checkboxTreeViewer.getTree();
- GridLayout treeLayout = new GridLayout();
- treeLayout.marginHeight = 0; //convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- treeLayout.marginWidth = 0; //convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- treeLayout.verticalSpacing = 0; //convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- treeLayout.horizontalSpacing = 0; //convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- treeLayout.numColumns = 1;
- GridData treeGridData = new GridData(GridData.FILL_HORIZONTAL);
- treeGridData.widthHint = convertHorizontalDLUsToPixels(225);
- treeGridData.heightHint = convertVerticalDLUsToPixels(150);
- tree.setLayout(treeLayout);
- tree.setLayoutData(treeGridData);
-
- descriptionText = new Text(composite, SWT.BORDER | SWT.WRAP);
- GridData descriptionTextGridData = new GridData(GridData.FILL_HORIZONTAL);
- descriptionTextGridData.heightHint = convertHeightInCharsToPixels(3);
- descriptionText.setLayoutData(descriptionTextGridData);
- descriptionText.setBackground(superComposite.getBackground());
-
- initListeners();
- updateCheckedItems();
-
- return composite;
- }
-
- /**
- *
- */
- protected void initListeners() {
- checkboxTreeViewer.addCheckStateListener(getCheckStateListener());
- checkboxTreeViewer.addSelectionChangedListener(getSelectionListener());
- checkboxTreeViewer.addTreeListener(getActionTreeListener());
- }
-
- /**
- * @return
- */
- protected ICheckStateListener getCheckStateListener() {
- if (checkStateListener == null)
- checkStateListener = new CheckStateListener();
- return checkStateListener;
- }
-
-
-
- public class CheckStateListener implements ICheckStateListener {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- boolean checked = event.getChecked();
- IOperationNode node = (IOperationNode) event.getElement();
- node.setChecked(checked);
- }
- }
-
- public class TreeViewerListener implements ITreeViewerListener {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
- */
- public void treeCollapsed(TreeExpansionEvent event) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
- */
- public void treeExpanded(TreeExpansionEvent event) {
- }
- }
-
- public class SelectionChangedListener implements ISelectionChangedListener {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
-
- IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection();
- Object element = structuredSelection.getFirstElement();
- String text = ""; //$NON-NLS-1$
- if (element instanceof IOperationNode)
- text = ((IOperationNode) element).getDescription();
- descriptionText.setText(text != null ? text : ""); //$NON-NLS-1$
- }
-
- }
-
- /**
- * @return
- */
- private ISelectionChangedListener getSelectionListener() {
- if (updateDescriptionSelectionListener == null)
- updateDescriptionSelectionListener = new SelectionChangedListener();
- return updateDescriptionSelectionListener;
- }
-
- /**
- * @return
- */
- private ITreeViewerListener getActionTreeListener() {
- if (actionTreeListener == null)
- actionTreeListener = new TreeViewerListener();
- return actionTreeListener;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModelListener#propertyChanged(org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModelEvent)
- */
- public void propertyChanged(WTPOperationDataModelEvent event) {
- switch (event.getFlag()) {
- case WTPOperationDataModelEvent.PROPERTY_CHG :
- if (WTPOptionalOperationDataModel.OPERATION_TREE.equals(event.getPropertyName()))
- updateCheckedItems();
- break;
- }
- }
-
- /**
- *
- */
- private void updateCheckedItems() {
- IOperationNode root = (IOperationNode) this.operationDataModel.getProperty(WTPOptionalOperationDataModel.OPERATION_TREE);
- updateCheckedState(root);
-
- }
-
- /**
- * @param root
- */
- private void updateCheckedState(IOperationNode root) {
- if (root == null)
- return;
-
- IOperationNode[] children = root.getChildren();
- if (children == null)
- return;
- for (int i = 0; i < children.length; i++) {
- checkboxTreeViewer.setChecked(children[i], children[i].isChecked());
- boolean disabled = (children[i].getParent() != null) ? children[i].getParent().isChecked() : false;
- checkboxTreeViewer.setGrayed(children[i], disabled);
- updateCheckedState(children[i]);
- }
- }
-
- /**
- * @return Returns the id.
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- * The id to set.
- */
- public void setId(String id) {
- this.id = id;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionLabelProvider.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionLabelProvider.java
deleted file mode 100644
index 06bfdc4..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPActionLabelProvider.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 5, 2004
- *
- * TODO To change the template for this generated file go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class WTPActionLabelProvider implements ILabelProvider {
-
- /**
- *
- */
- public WTPActionLabelProvider() {
- super();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
- * java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
-
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if (element instanceof IOperationNode)
- return ((IOperationNode) element).getName();
-
- return element.toString();
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPOperationDataModelUICreator.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPOperationDataModelUICreator.java
deleted file mode 100644
index e8109ac..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPOperationDataModelUICreator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 4, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public interface WTPOperationDataModelUICreator {
-
- WTPOperationDataModel createDataModel(String extendedOperationId, String operationClass, IStructuredSelection selection, IWorkbenchSite site);
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPOptionalOperationDataModel.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPOptionalOperationDataModel.java
deleted file mode 100644
index 15e8dbd..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WTPOptionalOperationDataModel.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 5, 2004
- *
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.wst.common.frameworks.internal.operations.ComposedOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
-
-
-/**
- * @author jsholl
- *
- */
-public class WTPOptionalOperationDataModel extends WTPOperationDataModel {
-
-
-
- /**
- * String, this is required along with a STRUCTURED_SELECTION unless MASTER_OPERATION_LIST is
- * set
- */
- public static final String EXTENDED_OPERATION_ID = "WTPOptionalOperationDataModel.EXTENDED_OPERATION_ID"; //$NON-NLS-1$
-
- /**
- * IStructuredSelection, this is required along with a EXTENDED_OPERATION_ID unless
- * MASTER_OPERATION_LIST is set
- */
- public static final String STRUCTURED_SELECTION = "WTPOptionalOperationDataModel.STRUCTURED_SELECTION"; //$NON-NLS-1$
-
- /**
- * List of MasterDescriptor, required unless both EXTENDED_OPERATION_ID and STRUCTURED_SELECTION
- * are set
- */
- public static final String MASTER_OPERATION_LIST = "WTPOptionalOperationDataModel.MASTER_OPERATION_LIST"; //$NON-NLS-1$
-
- /**
- * A root IOperationNode whose operation is null and children are the contents of the
- * MASTER_OPERATION_LIST
- */
- public static final String OPERATION_TREE = "WTPOptionalOperationDataModel.OPERATION_TREE"; //$NON-NLS-1$
-
- /**
- * Optional. Allow the WTPOperationDataModelUICreators access to the workbench site for
- * additional initializations.
- */
- public static final String IWORKBENCH_SITE = "IWORKBENCH_SITE"; //$NON-NLS-1$
-
- public static WTPOptionalOperationDataModel createDataModel(String extendedOperationId, IStructuredSelection selection) {
- WTPOptionalOperationDataModel dataModel = new WTPOptionalOperationDataModel();
- dataModel.setProperty(EXTENDED_OPERATION_ID, extendedOperationId);
- dataModel.setProperty(STRUCTURED_SELECTION, selection);
- return dataModel;
- }
-
- private class OperationNode implements IOperationNode {
-
- private WTPOperationDataModel dataModel = null;
-
- private SlaveDescriptor descriptor = null;
-
- private List children = null;
-
- private OperationNode parent = null;
-
- private boolean checked = false;
-
- public OperationNode(OperationNode parent, SlaveDescriptor descriptor) {
- this.parent = parent;
- this.descriptor = descriptor;
- verifyRoot();
- }
-
- private void verifyRoot() {
- if (null == parent) {
- return;
- }
- IOperationNode root = getOperationTree();
- OperationNode node = this;
- while (node.parent != null) {
- node = node.parent;
- }
- if (node != root) {
- throw new RuntimeException();
- }
- }
-
- public String getName() {
- return descriptor.getName();
- }
-
- public String getDescription() {
- return descriptor.getDescription();
- }
-
- public WTPOperationDataModel getDataModel() {
- IWorkbenchSite site = (IWorkbenchSite) getProperty(IWORKBENCH_SITE);
- if (dataModel == null) {
- IOperationNode root = getOperationTree();
- if (this.parent == root) {
- MasterDescriptor masterDescriptor = (MasterDescriptor) descriptor;
- dataModel = masterDescriptor.getCreator().createDataModel(masterDescriptor.getExtendedOperationId(), masterDescriptor.getOperationClass(), getStructuredSelection(), site);
- } else
- dataModel = parent.getDataModel();
- }
- return dataModel;
- }
-
- public WTPOperation getOperation() {
- WTPOperation operation = descriptor.createOperation();
- WTPOperationDataModel dataModel1 = getDataModel();
- if (dataModel1 != null) {
- if (operation == null)
- operation = dataModel.getDefaultOperation();
- else
- operation.setOperationDataModel(dataModel);
- }
- return operation;
- }
-
- public IOperationNode[] getChildren() {
- verifyRoot();
- return getChildren(true);
- }
-
- public IOperationNode[] getChildren(boolean expandChildren) {
- if (expandChildren && null == children && null != parent) {
- children = new ArrayList();
- SlaveDescriptor[] slaveDescriptors = UIOperationExtensionRegistry.INSTANCE.getSlaveDescriptors(descriptor.getOperationClass());
- for (int i = 0; null != slaveDescriptors && i < slaveDescriptors.length; i++) {
- OperationNode child = new OperationNode(this, slaveDescriptors[i]);
- child.checked = checked;
- addChild(child);
- }
- }
- if (null == children) {
- return null;
- }
- OperationNode[] childNodes = new OperationNode[children.size()];
- children.toArray(childNodes);
- return childNodes;
- }
-
- public void clearChildren() {
- if (null != children) {
- children.clear();
- }
- }
-
- public void addChild(OperationNode childNode) {
- if (null == children) {
- children = new ArrayList();
- }
- children.add(childNode);
- }
-
- public boolean isChecked() {
- verifyRoot();
- if (descriptor instanceof MasterDescriptor && ((MasterDescriptor) descriptor).isAlwaysExecute())
- return true;
- return checked;
- }
-
- public void setChecked(boolean checked) {
- if (descriptor instanceof MasterDescriptor && ((MasterDescriptor) descriptor).isAlwaysExecute())
- return;
- internalSetChecked(checked);
- Object root = getProperty(OPERATION_TREE);
- notifyListeners(OPERATION_TREE);
- }
-
- public IOperationNode getParent() {
- return parent;
- }
-
- protected void internalSetChecked(boolean checked1) {
- this.checked = checked1;
- if (checked) {
- OperationNode[] children1 = (OperationNode[]) getChildren(false);
- for (int i = 0; null != children && i < children1.length; i++)
- children1[i].internalSetChecked(checked);
- } else {
- if (this.parent != null)
- this.parent.internalSetChecked(checked);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.extension.ui.IOperationNode#isAlwaysExecute()
- */
- public boolean isAlwaysExecute() {
- if (descriptor instanceof MasterDescriptor && ((MasterDescriptor) descriptor).isAlwaysExecute())
- return true;
- return false;
- }
- }
-
- protected void init() {
- super.init();
- setProperty(OPERATION_TREE, new OperationNode(null, null));
- }
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(MASTER_OPERATION_LIST);
- addValidBaseProperty(OPERATION_TREE);
- addValidBaseProperty(STRUCTURED_SELECTION);
- addValidBaseProperty(EXTENDED_OPERATION_ID);
- addValidBaseProperty(IWORKBENCH_SITE);
- }
-
- IStructuredSelection getStructuredSelection() {
- return (IStructuredSelection) getProperty(STRUCTURED_SELECTION);
- }
-
- public IOperationNode getOperationTree() {
- return (IOperationNode) getProperty(OPERATION_TREE);
- }
-
- public static IOperationNode[] getOptionalChildren(IOperationNode node) {
- IOperationNode[] children = node.getChildren();
- children = filterRequiredChildren(children);
- return children;
- }
-
- /**
- * @param children
- * @return
- */
- public static IOperationNode[] filterRequiredChildren(IOperationNode[] children) {
- List filteredChildren = new ArrayList(Arrays.asList(children));
- for (int i = 0; i < children.length; i++)
- if (children[i].isAlwaysExecute())
- filteredChildren.remove(children[i]);
- filteredChildren.toArray((children = new IOperationNode[filteredChildren.size()]));
- return children;
- }
-
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean returnVal = super.doSetProperty(propertyName, propertyValue);
- if (propertyName.equals(STRUCTURED_SELECTION) || propertyName.equals(EXTENDED_OPERATION_ID)) {
- String extendedOperationID = getStringProperty(EXTENDED_OPERATION_ID);
- IStructuredSelection selection = (IStructuredSelection) getProperty(STRUCTURED_SELECTION);
- setProperty(MASTER_OPERATION_LIST, UIOperationExtensionRegistry.INSTANCE.getExtendedUIOperations(extendedOperationID, selection));
- }
- if (propertyName.equals(MASTER_OPERATION_LIST)) {
- OperationNode rootNode = (OperationNode) getOperationTree();
- rootNode.clearChildren();
- MasterDescriptor[] descriptors = (MasterDescriptor[]) propertyValue;
- if (null != descriptors) {
- for (int i = 0; i < descriptors.length; i++) {
- OperationNode child = new OperationNode(rootNode, descriptors[i]);
- child.setChecked(true);
- rootNode.addChild(child);
- }
- }
- notifyListeners(OPERATION_TREE);
- }
- return returnVal;
- }
-
- public WTPOperation getDefaultOperation() {
- ComposedOperation operation = new ComposedOperation();
- OperationNode root = (OperationNode) getOperationTree();
- addOperationIfNecessary(operation, root);
- return operation;
- }
-
- private void addOperationIfNecessary(ComposedOperation operation, OperationNode node) {
- if (node.isAlwaysExecute() || node.isChecked()) {
- WTPOperation op = node.getOperation();
- if (op != null)
- operation.addRunnable(op);
- } else {
- IOperationNode[] children = node.getChildren(false);
- for (int i = 0; null != children && i < children.length; i++)
- addOperationIfNecessary(operation, (OperationNode) children[i]);
- }
- }
-
- private boolean hasSelectedNodes(OperationNode node) {
- if (node.isChecked()) {
- return true;
- }
- boolean foundSelection = false;
- OperationNode[] children = (OperationNode[]) node.getChildren(false);
- for (int i = 0; !foundSelection && null != children && i < children.length; i++) {
- foundSelection = hasSelectedNodes(children[i]);
- }
- return foundSelection;
- }
-
- protected IStatus doValidateProperty(String propertyName) {
- if (propertyName.equals(OPERATION_TREE)) {
- OperationNode root = (OperationNode) getOperationTree();
- if (root.isChecked()) {
- return WTPUIPlugin.createErrorStatus(WTPCommonUIResourceHandler.getString("WTPOptionalOperationDataModel_UI_0")); //$NON-NLS-1$
- } else if (!hasSelectedNodes(root)) {
- return WTPUIPlugin.createErrorStatus(WTPCommonUIResourceHandler.getString("WTPOptionalOperationDataModel_UI_1"));} //$NON-NLS-1$
- }
- return super.doValidateProperty(propertyName);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardExtensionFactory.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardExtensionFactory.java
deleted file mode 100644
index 56b0a25..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardExtensionFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operation.extensionui;
-
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.ui.IExtendedPageHandler;
-import org.eclipse.wst.common.frameworks.internal.ui.IExtendedWizardPage;
-
-
-/**
- * This interface is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class WizardExtensionFactory {
-
- public WizardExtensionFactory() {
- super();
- }
-
- public abstract IExtendedWizardPage[] createPageGroup(WTPOperationDataModel dataModel, String pageGroupID);
-
- /*
- * this is optional
- */
- public IExtendedPageHandler createPageHandler(WTPOperationDataModel dataModel, String pageGroupID) {
- return null;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageElement.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageElement.java
deleted file mode 100644
index 9b72220..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageElement.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operation.extensionui;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.AbstractRegistryDescriptor;
-import org.eclipse.wst.common.frameworks.internal.enablement.IdentifiableComparator;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.ui.IExtendedPageHandler;
-import org.eclipse.wst.common.frameworks.internal.ui.IExtendedWizardPage;
-
-public class WizardPageElement extends AbstractRegistryDescriptor implements Comparable {
- /** Type designation for an {@link ExtendedEditorPage} */
- public static final int EXTENDED_EDITOR_PAGE = 0;
- /** Type designation for a nested editor */
- public static final int NESTED_EDITOR = 1;
- static final String[] EMPTY_STRING_ARRAY = new String[0];
- static final String ELEMENT_PAGE_GROUP = "wizardPageGroup"; //$NON-NLS-1$
- static final String ATT_PAGE_ID = "pageGroupID"; //$NON-NLS-1$
- static final String ATT_WIZARD_ID = "wizardID"; //$NON-NLS-1$
- static final String ATT_GROUP_ID = "groupID"; //$NON-NLS-1$
- static final String ATT_ALLOWS_EXTENDED_PAGES_AFTER = "allowsExtendedPagesAfter"; //$NON-NLS-1$
- static final String ATT_PAGE_INSERTION_ID = "pageGroupInsertionID"; //$NON-NLS-1$
- static final String ELEMENT_FACTORY = "factory"; //$NON-NLS-1$
-
- protected WizardPageFactoryElement wizardPageFactoryElement;
- protected String pluginID;
- protected String wizardID;
- public String pageGroupID;
- protected String wizardFactoryElement;
- protected boolean allowsExtendedPagesAfter;
- protected String pageInsertionID;
- private int loadOrder;
- private static int loadOrderCounter;
-
-
- private int type;
-
- public WizardPageElement(IConfigurationElement element1) {
- super(element1);
- pluginID = element1.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier();
- wizardID = element1.getAttribute(ATT_WIZARD_ID);
- pageGroupID = element1.getAttribute(ATT_PAGE_ID);
- readAllowsExtendedPageAfter(element1);
- pageInsertionID = element1.getAttribute(ATT_PAGE_INSERTION_ID);
- readFactory(element1);
- validateSettings();
- loadOrder = loadOrderCounter++;
- }
-
- private void validateSettings() {
- if (wizardID == null || wizardPageFactoryElement == null) {
- Logger.getLogger().logError("Incomplete page extension specification."); //$NON-NLS-1$
- }
- }
-
-
- private void readAllowsExtendedPageAfter(IConfigurationElement element1) {
- String allowsPageAfterValue = element1.getAttribute(ATT_ALLOWS_EXTENDED_PAGES_AFTER);
- allowsExtendedPagesAfter = allowsPageAfterValue == null ? false : Boolean.valueOf(allowsPageAfterValue).booleanValue();
- }
-
- private void readFactory(IConfigurationElement element1) {
- IConfigurationElement[] factories = element1.getChildren(ELEMENT_FACTORY);
- if (factories != null && factories.length > 0) {
- wizardPageFactoryElement = new WizardPageFactoryElement(factories[0], pageGroupID);
- }
- }
-
- public IExtendedPageHandler createPageHandler(WTPOperationDataModel dataModel) {
- if (wizardPageFactoryElement != null)
- return wizardPageFactoryElement.createPageHandler(dataModel);
- return null;
- }
-
- public IExtendedWizardPage[] createPageGroup(WTPOperationDataModel dataModel) {
- if (wizardPageFactoryElement != null)
- return wizardPageFactoryElement.createPageGroup(dataModel);
- return null;
- }
-
-
- public int compareTo(Object o) {
- return IdentifiableComparator.getInstance().compare(this, o);
- /*
- * if (o == null) return GREATER_THAN; WizardPageElement element = (WizardPageElement) o; if
- * (getID() == null && element.getID() == null) return compareLoadOrder(element); if
- * (getID() == null) return GREATER_THAN; else if (element.getID() == null) return
- * LESS_THAN;
- *
- * int priority = getPriority(); int elementPriority =element.getPriority();
- *
- * if (priority == elementPriority) return compareLoadOrder(element); if (priority <
- * elementPriority) return GREATER_THAN; if (priority > elementPriority) return LESS_THAN;
- * return EQUAL;
- */
- }
-
- /**
- * @return
- */
- public boolean allowsExtendedPagesAfter() {
- return allowsExtendedPagesAfter;
- }
-
- /**
- * @return
- */
- public String getPluginID() {
- return pluginID;
- }
-
- /**
- * @return
- */
- public String getPageID() {
- return pageGroupID;
- }
-
- /**
- * @return
- */
- public String getPageInsertionID() {
- return pageInsertionID;
- }
-
- /**
- * @return
- */
- public int getType() {
- return type;
- }
-
- /**
- * @return
- */
- public int getLoadOrder() {
- return loadOrder;
- }
-
-
- /**
- * @return Returns the allowsExtendedPagesAfter.
- */
- public boolean isAllowsExtendedPagesAfter() {
- return allowsExtendedPagesAfter;
- }
-
- /**
- * @param allowsExtendedPagesAfter
- * The allowsExtendedPagesAfter to set.
- */
- public void setAllowsExtendedPagesAfter(boolean allowsExtendedPagesAfter) {
- this.allowsExtendedPagesAfter = allowsExtendedPagesAfter;
- }
-
- /**
- * @return Returns the wizardFactoryElement.
- */
- public String getWizardFactoryElement() {
- return wizardFactoryElement;
- }
-
- /**
- * @param wizardFactoryElement
- * The wizardFactoryElement to set.
- */
- public void setWizardFactoryElement(String wizardFactoryElement) {
- this.wizardFactoryElement = wizardFactoryElement;
- }
-
- /**
- * @return Returns the wizardID.
- */
- public String getWizardID() {
- return wizardID;
- }
-
- /**
- * @param wizardID
- * The wizardID to set.
- */
- public void setWizardID(String wizardID) {
- this.wizardID = wizardID;
- }
-
- /**
- * @return Returns the wizardPageFactoryElement.
- */
- public WizardPageFactoryElement getWizardPageFactoryElement() {
- return wizardPageFactoryElement;
- }
-
- /**
- * @param wizardPageFactoryElement
- * The wizardPageFactoryElement to set.
- */
- public void setWizardPageFactoryElement(WizardPageFactoryElement wizardPageFactoryElement) {
- this.wizardPageFactoryElement = wizardPageFactoryElement;
- }
-
-
- /**
- * @param pageID
- * The pageID to set.
- */
- public void setPageID(String pageID) {
- this.pageGroupID = pageID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.AbstractRegistryDescriptor#getID()
- */
- public String getID() {
- return getPageID();
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageExtensionManager.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageExtensionManager.java
deleted file mode 100644
index 24b4b90..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageExtensionManager.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operation.extensionui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
-
-public class WizardPageExtensionManager {
-
- public static final String ORG_ECLIPSE_UI = "org.eclipse.ui"; //$NON-NLS-1$
-
- protected static WizardPageExtensionManager instance = null;
-
- HashMap wizardPluginIDMap = null;
-
- TreeMap wizardPageElements = null;
-
- //private TreeSet wizardExtPageElements = null;
- List nonSyncedPageElementList = null;
-
- private WizardPageExtensionReader reader = null;
-
- private WizardPageExtensionManager() {
- setupWizardPluginIDMap();
- readFromRegistry();
- postReadFromRegistry();
- }
-
- private void setupWizardPluginIDMap() {
- wizardPluginIDMap = new HashMap();
- // get editor plugin and save it to a hash map
- // Note: editors extension id is different from editor id
-
- IExtensionPoint[] point = new IExtensionPoint[]{Platform.getPluginRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "exportWizards"), //$NON-NLS-1$
- Platform.getPluginRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "importWizards"), //$NON-NLS-1$
- Platform.getPluginRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "newWizards"), //$NON-NLS-1$
- Platform.getPluginRegistry().getExtensionPoint("org.eclipse.wst.common.frameworks.ui", "extendableWizard")}; //$NON-NLS-1$ //$NON-NLS-2$
-
- for (int x = 0; x < point.length; x++) {
- IConfigurationElement[] elements = point[x].getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- String wizardID = elements[i].getAttribute("id"); //$NON-NLS-1$
- String pluginID = elements[i].getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier();
- wizardPluginIDMap.put(wizardID, pluginID);
- }
- }
- }
-
- private void readFromRegistry() {
- wizardPageElements = new TreeMap();
- //wizardExtPageElements = new TreeSet();
- nonSyncedPageElementList = new ArrayList();
- // Read all page extensions into editorPageElements
- reader = new WizardPageExtensionReader();
- reader.readRegistry();
-
- }
-
- protected class WizardPageExtensionReader extends RegistryReader {
-
- public WizardPageExtensionReader() {
- super(CommonUIPluginConstants.PLUGIN_ID, WizardPageElement.ELEMENT_PAGE_GROUP);
- }
-
- public boolean readElement(IConfigurationElement element) {
- if (!WizardPageElement.ELEMENT_PAGE_GROUP.equals(element.getName()))
- return false;
- WizardPageElement newElement = new WizardPageElement(element);
-
- // put the element into a hashmap, wizardID as key,
- // list of page elements as object
- String wizardID = newElement.getWizardID();
- if (!wizardPageElements.containsKey(wizardID)) {
- wizardPageElements.put(wizardID, createPageMapEntry(newElement));
- } else {
- TreeMap pageMap = (TreeMap) wizardPageElements.get(wizardID);
- insertPageElement(pageMap, newElement);
- }
-
- return true;
- }
-
- public void insertPageElement(TreeMap pageMap, WizardPageElement newElement) {
- if (newElement.pageInsertionID == null) {
- pageMap.put(newElement, new TreeSet());
- } else {
- String elementName = newElement.pageInsertionID;
- WizardPageElement parentElement = getPageElement(elementName, pageMap);
- insertExtPageElement(pageMap, parentElement, newElement);
- }
-
- newElement.getPageInsertionID();
-
- }
-
- private void insertExtPageElement(TreeMap pageMap, WizardPageElement parentElement, WizardPageElement newElement) {
- if (parentElement == null) {
- nonSyncedPageElementList.add(newElement);
- return;
- }
- if (!parentElement.allowsExtendedPagesAfter()) {
- Logger.getLogger().logError(WTPCommonUIResourceHandler.getString("WizardPageExtensionManager_UI_0", new Object[]{parentElement.getPageID()})); //$NON-NLS-1$
- Logger.getLogger().logError(WTPCommonUIResourceHandler.getString("WizardPageExtensionManager_UI_1", new Object[]{newElement.getPageID()})); //$NON-NLS-1$
- return;
- }
- TreeSet set = (TreeSet) pageMap.get(parentElement);
- set.add(newElement);
-
- if (newElement.allowsExtendedPagesAfter)
- pageMap.put(newElement, new TreeSet());
-
- if (nonSyncedPageElementList.contains(newElement))
- nonSyncedPageElementList.remove(newElement);
- }
-
- private WizardPageElement getPageElement(String elementName, TreeMap map) {
- Set keySet = map.keySet();
- for (Iterator iter = keySet.iterator(); iter.hasNext();) {
- WizardPageElement element = (WizardPageElement) iter.next();
- if (element.getPageID().equals(elementName))
- return element;
- }
- return null;
-
- }
-
- private TreeMap createPageMapEntry(WizardPageElement newElement) {
- TreeMap pageMap = new TreeMap();
- TreeSet pageExtensionSet = new TreeSet();
- pageMap.put(newElement, pageExtensionSet);
- return pageMap;
-
- }
-
- }
-
- public boolean hasExtensionElements(String wizardID) {
- TreeMap treeMap = (TreeMap) wizardPageElements.get(wizardID);
- return treeMap.isEmpty();
- }
-
- public WizardPageElement[] getPageElements(String wizardID) {
- TreeMap elementMap = (TreeMap) wizardPageElements.get(wizardID);
- if (elementMap == null || elementMap.isEmpty()) {
- return new WizardPageElement[0];
- }
- ArrayList alreadyVistedList = new ArrayList(elementMap.size());
- Set allPageElementsList = elementMap.keySet();
- ArrayList orderedPageList = new ArrayList(elementMap.size());
-
- for (Iterator iter = allPageElementsList.iterator(); iter.hasNext();) {
- WizardPageElement element = (WizardPageElement) iter.next();
- if (alreadyVistedList.contains(element))
- continue;
- if (EnablementManager.INSTANCE.getIdentifier(element.getID(), null).isEnabled()) {
- orderedPageList.add(element);
- TreeSet treeSet = (TreeSet) elementMap.get(element);
- if (treeSet != null && !treeSet.isEmpty())
- flatenTreeSet(treeSet, allPageElementsList, alreadyVistedList, orderedPageList, elementMap);
- }
- }
- return getPageArray(orderedPageList);
-
- }
-
- private WizardPageElement[] getPageArray(ArrayList orderedPageList) {
- WizardPageElement[] pageElements = new WizardPageElement[orderedPageList.size()];
- for (int i = 0; i < orderedPageList.size(); i++) {
- pageElements[i] = (WizardPageElement) orderedPageList.get(i);
- }
- return pageElements;
- }
-
- private void flatenTreeSet(TreeSet treeSet, Set allPageElementsList, ArrayList alreadyVistedList, ArrayList orderedPageList, TreeMap elementMap) {
- for (Iterator iter = treeSet.iterator(); iter.hasNext();) {
- WizardPageElement element = (WizardPageElement) iter.next();
- if (alreadyVistedList.contains(element)) {
- Logger.getLogger().logError(WTPCommonUIResourceHandler.getString("WizardPageExtensionManager_UI_2", new Object[]{element.getPageID(), WizardPageElement.ATT_PAGE_INSERTION_ID})); //$NON-NLS-1$
- return;
- }
- if (allPageElementsList.contains(element)) {
- TreeSet set = (TreeSet) elementMap.get(element);
- orderedPageList.add(element);
- alreadyVistedList.add(element);
- flatenTreeSet(set, allPageElementsList, alreadyVistedList, orderedPageList, elementMap);
- } else {
- orderedPageList.add(element);
- alreadyVistedList.add(element);
- }
-
- }
-
- }
-
- // if child elements are read in before parent element. Do post read.
- protected ArrayList listRemoveObjects;
-
- private void postReadFromRegistry() {
- listRemoveObjects = new ArrayList(nonSyncedPageElementList.size());
- for (int i = 0; i < nonSyncedPageElementList.size(); i++) {
- WizardPageElement element = (WizardPageElement) nonSyncedPageElementList.get(i);
- TreeMap pageMap = (TreeMap) wizardPageElements.get(element.wizardID);
- if (element.pageInsertionID == null) {
- addToFirstAvialiable(pageMap, element);
- } else if (reader != null && pageMap != null)
- reader.insertPageElement(pageMap, element);
- }
- nonSyncedPageElementList.removeAll(listRemoveObjects);
- if (!nonSyncedPageElementList.isEmpty())
- logMissingClassError();
- nonSyncedPageElementList.clear();
-
- }
-
- /**
- * @param pageMap
- * @param element
- */
- private void addToFirstAvialiable(TreeMap pageMap, WizardPageElement newElement) {
- boolean insertNotFound = true;
- for (Iterator iter = pageMap.keySet().iterator(); iter.hasNext();) {
- WizardPageElement element = (WizardPageElement) iter.next();
- if (element.allowsExtendedPagesAfter) {
- TreeSet set = (TreeSet) pageMap.get(element);
- set.add(newElement);
- listRemoveObjects.add(newElement);
- return;
- }
- }
- if (insertNotFound) {
- Logger logger = Logger.getLogger();
- logger.logError(WTPCommonUIResourceHandler.getString("WizardPageExtensionManager_UI_3")); //$NON-NLS-1$
- }
-
- }
-
- private void logMissingClassError() {
- Logger logger = Logger.getLogger();
- for (int i = 0; i < nonSyncedPageElementList.size(); i++) {
- WizardPageElement element = (WizardPageElement) nonSyncedPageElementList.get(i);
- logger.logError(WTPCommonUIResourceHandler.getString("WizardPageExtensionManager_UI_4", new Object[]{element.pageInsertionID, element.getPageID(), element.pluginID})); //$NON-NLS-1$
- }
- nonSyncedPageElementList.clear();
-
- }
-
- /**
- * Gets the instance.
- *
- * @return Returns a EjbPageExtensionRegistry
- */
- public static WizardPageExtensionManager getInstance() {
- if (instance == null) {
- instance = new WizardPageExtensionManager();
- }
- return instance;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageFactoryElement.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageFactoryElement.java
deleted file mode 100644
index 2456dee..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/operation/extensionui/WizardPageFactoryElement.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Oct 20, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.ConfigurationElementWrapper;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.ui.IExtendedPageHandler;
-import org.eclipse.wst.common.frameworks.internal.ui.IExtendedWizardPage;
-
-/**
- * @author schacher
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class WizardPageFactoryElement extends ConfigurationElementWrapper {
-
- static final String ATT_CLASS_NAME = "className"; //$NON-NLS-1$
-
- protected String className;
- protected WizardExtensionFactory wizardPageFactory;
- protected boolean isPageFactoryInitialized;
- protected String pageGroupID;
-
- /**
- * @param element
- */
- public WizardPageFactoryElement(IConfigurationElement element, String pageGroupID) {
- super(element);
- className = element.getAttribute(ATT_CLASS_NAME);
- this.pageGroupID = pageGroupID;
- }
-
- public IExtendedPageHandler createPageHandler(WTPOperationDataModel dataModel) {
- if (!isPageFactoryInitialized)
- initPageFactory();
- if (wizardPageFactory == null)
- return null;
-
- IExtendedPageHandler handler = wizardPageFactory.createPageHandler(dataModel, pageGroupID);
- return handler;
- }
-
- public IExtendedWizardPage[] createPageGroup(WTPOperationDataModel dataModel) {
- if (!isPageFactoryInitialized)
- initPageFactory();
-
- if (wizardPageFactory == null)
- return null;
-
- IExtendedWizardPage[] pages = wizardPageFactory.createPageGroup(dataModel, pageGroupID);
- for (int i = 0; i < pages.length; i++) {
- pages[i].setGroupID(pageGroupID);
- }
- return pages;
- }
-
- private void initPageFactory() {
- try {
- wizardPageFactory = (WizardExtensionFactory) element.createExecutableExtension(ATT_CLASS_NAME);
- } catch (CoreException e) {
- Logger.getLogger().logError("Error getting page factory: " + className); //$NON-NLS-1$
- Logger.getLogger().logError(e);
- } finally {
- isPageFactoryInitialized = true;
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ExtendedWizardPage.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ExtendedWizardPage.java
deleted file mode 100644
index 96ca761..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ExtendedWizardPage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.ui;
-
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-/**
- * This class is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class ExtendedWizardPage extends WTPWizardPage implements IExtendedWizardPage {
-
- private String id;
-
- protected ExtendedWizardPage(WTPOperationDataModel model, String pageName) {
- super(model, pageName);
- }
-
- /**
- * @return Returns the id.
- */
- public final String getGroupID() {
- return id;
- }
-
- /**
- * Will only set the id once. Further invocations will be ignored.
- *
- * @param id
- * The id to set.
- */
- public final void setGroupID(String id) {
- Assert.isTrue(this.id == null, WTPCommonUIResourceHandler.getString("ExtendedWizardPage_ERROR_0")); //$NON-NLS-1$
- Assert.isNotNull(id, WTPCommonUIResourceHandler.getString("ExtendedWizardPage_ERROR_1")); //$NON-NLS-1$
- this.id = id;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/IExtendedWizardPage.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/IExtendedWizardPage.java
deleted file mode 100644
index 6b73103..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/IExtendedWizardPage.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.ui;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-/**
- * This interface is EXPERIMENTAL and is subject to substantial changes.
- */
-public interface IExtendedWizardPage extends IWizardPage {
-
- WTPOperation createOperation();
-
- boolean canPageFinish();
-
- String getGroupID();
-
- void setGroupID(String id);
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPDataModelSynchHelper.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPDataModelSynchHelper.java
deleted file mode 100644
index 8a13020..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPDataModelSynchHelper.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelEvent;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelListener;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPPropertyDescriptor;
-
-/**
- * This class is EXPERIMENTAL and is subject to substantial changes.
- */
-public class WTPDataModelSynchHelper implements WTPOperationDataModelListener {
- protected WTPOperationDataModel dataModel;
- protected Map widgetToPropertyHash;
- protected Map propertyToWidgetHash;
- protected Map widgetToDepControls;
-
- protected String currentProperty;
- protected Widget currentWidget;
- protected Widget currentWidgetFromEvent; //TODO M4 see if this should be set with for listeners
- protected boolean ignoreModifyEvent = false;
-
- private class ModifyTextListener implements ModifyListener {
- public void modifyText(ModifyEvent e) {
- if (ignoreModifyEvent)
- return;
- Text text = (Text) e.getSource();
- if (currentWidget == text)
- return;
- String propertyName = (String) widgetToPropertyHash.get(text);
- setProperty(propertyName, text.getText());
- }
- }
-
- private ModifyTextListener modifyTextListener;
- private TimedModifyListener timedModifyListener;
-
- private class ComboListener implements SelectionListener, ModifyListener {
- public void modifyText(ModifyEvent e) {
- if (ignoreModifyEvent)
- return;
- Combo combo = (Combo) e.getSource();
- if (currentWidget == combo)
- return;
- try {
- currentWidgetFromEvent = combo;
- String propertyName = (String) widgetToPropertyHash.get(combo);
- WTPPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName);
- String description = combo.getText();
- for (int i = 0; i < descriptors.length; i++) {
- if (description.equals(descriptors[i].getPropertyDescription())) {
- setProperty(propertyName, descriptors[i].getPropertyValue());
- return;
- }
- }
- setProperty(propertyName, combo.getText());
- } finally {
- currentWidgetFromEvent = null;
- }
- }
-
- public void widgetSelected(SelectionEvent e) {
- Combo combo = (Combo) e.getSource();
- if (currentWidget == combo)
- return;
- String propertyName = (String) widgetToPropertyHash.get(combo);
- if (combo.getSelectionIndex() >= 0) {
- WTPPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName);
- String description = combo.getItem(combo.getSelectionIndex());
- for (int i = 0; i < descriptors.length; i++) {
- if (description.equals(descriptors[i].getPropertyDescription())) {
- setProperty(propertyName, descriptors[i].getPropertyValue());
- return;
- }
- }
- setProperty(propertyName, combo.getItem(combo.getSelectionIndex()));
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- }
-
- private ComboListener comboListener;
-
- private class CheckboxSelectionListener implements SelectionListener {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.getSource();
- if (currentWidget == button)
- return;
- String propertyName = (String) widgetToPropertyHash.get(button);
- setProperty(propertyName, new Boolean(button.getSelection()));
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- }
-
- private CheckboxSelectionListener checkboxSelectionListener;
-
- public WTPDataModelSynchHelper(WTPOperationDataModel model) {
- this.dataModel = model;
- dataModel.addListener(this);
- }
-
- private CheckBoxViewerListener checkBoxViewerStateListener;
-
- private class CheckBoxViewerListener implements ICheckStateListener {
- public void checkStateChanged(CheckStateChangedEvent event) {
- StructuredViewer viewer = (StructuredViewer) event.getSource();
- CheckboxTableViewer checkBoxTableViewer;
- CheckboxTreeViewer checkBoxTreeViewer;
- Object[] items = null;
- if (viewer instanceof CheckboxTableViewer) {
- checkBoxTableViewer = (CheckboxTableViewer) viewer;
- items = checkBoxTableViewer.getCheckedElements();
- } else if (viewer instanceof CheckboxTreeViewer) {
- checkBoxTreeViewer = (CheckboxTreeViewer) viewer;
- items = checkBoxTreeViewer.getCheckedElements();
- }
- String propertyName = (String) widgetToPropertyHash.get(viewer.getControl());
- setPropertyItems(propertyName, items);
- }
- }
-
- public void propertyChanged(WTPOperationDataModelEvent event) {
- String propertyName = event.getPropertyName();
- int flag = event.getFlag();
- if (flag == WTPOperationDataModelEvent.ENABLE_CHG)
- setEnablement(propertyName, event.isEnabled().booleanValue());
- else
- synchUIWithModel(propertyName, flag);
- }
-
- protected void setProperty(String propertyName, Object value) {
- currentProperty = propertyName;
- try {
- dataModel.setProperty(propertyName, value);
- } finally {
- currentProperty = null;
- }
- }
-
- protected void setPropertyItems(String propertyName, Object[] items) {
- currentProperty = propertyName;
- try {
- dataModel.setProperty(propertyName, items);
- } finally {
- currentProperty = null;
- }
- }
-
- /**
- * Sets the UI to have the property value defined in the model
- *
- * @param propertyName
- * @link WTPOperationDataModelListener for the flag values.
- */
- public void synchUIWithModel(String propertyName, int flag) {
- if (null != propertyToWidgetHash && propertyToWidgetHash.containsKey(propertyName)) {
- try {
- dataModel.setIgnorePropertyChanges(true);
- currentWidget = (Widget) propertyToWidgetHash.get(propertyName);
- if (currentWidget != null && currentWidget != currentWidgetFromEvent) {
- ignoreModifyEvent = true;
- try {
- if (currentWidget instanceof Text)
- setWidgetValue(propertyName, flag, (Text) currentWidget);
- else if (currentWidget instanceof Combo) {
- setWidgetValue(propertyName, flag, (Combo) currentWidget);
- } else if (currentWidget instanceof Button)
- setWidgetValue(propertyName, flag, (Button) currentWidget);
- else if (currentWidget instanceof Label)
- setWidgetValue(propertyName, flag, (Label) currentWidget);
- else if (currentWidget instanceof List)
- setWidgetValue(propertyName, flag, (List) currentWidget);
- else if (currentWidget instanceof Table)
- setWidgetValue(propertyName, flag, (Table) currentWidget);
- else if (currentWidget instanceof Tree)
- setWidgetValue(propertyName, flag, (Tree) currentWidget);
- } finally {
- ignoreModifyEvent = false;
- }
- setEnablement(propertyName);
- }
- } finally {
- currentWidget = null;
- dataModel.setIgnorePropertyChanges(false);
- }
- }
- }
-
- /**
- * @param control
- */
- private void setEnablement(String propertyName) {
- if (currentWidget == null)
- return;
- Boolean enabled = dataModel.isEnabled(propertyName);
- if (enabled != null)
- setEnablement((Control) currentWidget, enabled.booleanValue());
- }
-
- /**
- * @param control
- * @param enabled
- */
- private void setEnablement(Control control, boolean enabled) {
- if (control.isEnabled() != enabled)
- control.setEnabled(enabled);
- setDependentControlEnablement(control, enabled);
- }
-
- private void setEnablement(String propertyName, boolean enabled) {
- if (propertyToWidgetHash != null) {
- Control control = (Control) propertyToWidgetHash.get(propertyName);
- if (control != null) {
- setEnablement(control, enabled);
- }
- }
- }
-
- /**
- * @param control
- * @param enabled
- */
- private void setDependentControlEnablement(Control control, boolean enabled) {
- if (widgetToDepControls != null) {
- Control[] dependents = (Control[]) widgetToDepControls.get(control);
- if (dependents != null) {
- Control dep = null;
- for (int i = 0; i < dependents.length; i++) {
- dep = dependents[i];
- if (dep.isEnabled() != enabled)
- dep.setEnabled(enabled);
- }
- }
- }
- }
-
- protected void setWidgetValue(String propertyName, int flag, Button button) {
- if ((button.getStyle() & SWT.CHECK) == SWT.CHECK || (button.getStyle() & SWT.RADIO) == SWT.RADIO) {
- boolean checked = dataModel.getBooleanProperty(propertyName);
- if (button.getSelection() != checked) {
- button.setSelection(checked);
- }
- }
- }
-
- protected void setWidgetValue(String propertyName, int flag, Combo combo) {
- if (flag == WTPOperationDataModelEvent.VALID_VALUES_CHG || combo.getItemCount() == 0) {
- // Display properties should only fire if the contents change.
- WTPPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName);
- String[] items = new String[descriptors.length];
- for (int i = 0; i < descriptors.length; i++) {
- items[i] = descriptors[i].getPropertyDescription();
- }
- combo.setItems(items);
- }
- String newText = dataModel.getPropertyDescriptor(propertyName).getPropertyDescription();
- int selIndex = combo.getSelectionIndex();
- if (selIndex < 0 || !newText.equals(combo.getItem(selIndex))) {
- String[] items = combo.getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].equals(newText)) {
- combo.select(i);
- return;
- }
- }
- }
- combo.setText(newText);
- }
-
- protected void setWidgetValue(String propertyName, int flag, Text text) {
- String newText = dataModel.getStringProperty(propertyName);
- if (!newText.equals(text.getText())) {
- text.setText(newText);
- }
- }
-
- protected void setWidgetValue(String propertyName, int flag, Table table) {
- Object[] elements = (Object[]) dataModel.getProperty(propertyName);
- if (elements == null || elements.length == 0) {
- setTableItemsChecked(table.getItems(), false);
- return;
- }
- java.util.List elementList = Arrays.asList(elements);
- TableItem[] tableItems = table.getItems();
- for (int i = 0; i < tableItems.length; i++) {
- TableItem item = tableItems[i];
- if (elementList.contains(item.getData()))
- item.setChecked(true);
- else
- item.setChecked(false);
- }
- }
-
- protected void setTableItemsChecked(TableItem[] tableItems, boolean b) {
- for (int i = 0; i < tableItems.length; i++)
- tableItems[i].setChecked(b);
- }
-
- protected void setWidgetValue(String propertyName, int flag, Tree tree) {
- Object[] elements = (Object[]) dataModel.getProperty(propertyName);
- if (elements == null)
- return;
- java.util.List elementList = Arrays.asList(elements);
- TreeItem[] treeItems = tree.getItems();
- if (elementList.size() == 0) {
- setTreeItemsGrey(treeItems, false);
- return;
- }
- if (treeItems.length > 0)
- setTreeItemChecked(treeItems, elementList);
- }
-
- public void setTreeItemsGrey(TreeItem[] treeItems, boolean b) {
- for (int i = 0; i < treeItems.length; i++) {
- TreeItem item = treeItems[i];
- item.setGrayed(b);
- setTreeItemsGrey(treeItems[i].getItems(), b);
- }
- }
-
- protected void setTreeItemChecked(TreeItem[] treeItems, java.util.List items) {
- for (int i = 0; i < treeItems.length; i++) {
- if (items.contains(treeItems[i].getData()))
- treeItems[i].setChecked(true);
- else
- treeItems[i].setGrayed(true);
- TreeItem[] childernItems = treeItems[i].getItems();
- if (childernItems.length > 0) {
- treeItems[i].setExpanded(true);
- setTreeItemChecked(childernItems, items);
- }
- }
- }
-
- protected void setWidgetValue(String propertyName, int flag, Label label) {
- String newText = dataModel.getStringProperty(propertyName);
- if (!newText.equals(label.getText())) {
- label.setText(newText);
- }
- }
-
- protected void setWidgetValue(String propertyName, int flag, List list) {
- Object newContents = dataModel.getProperty(propertyName);
- if (newContents == null) {
- list.setItems(new String[0]);
- return;
- }
- if (newContents instanceof java.util.List) {
- java.util.List modelContents = (java.util.List) newContents;
- String[] items = new String[modelContents.size()];
- for (int i = 0; i < modelContents.size(); i++) {
- items[i] = modelContents.get(i).toString();
- }
- list.setItems(items);
- } else if (newContents instanceof String[]) {
- list.setItems((String[]) newContents);
- }
- }
-
- public void synchAllUIWithModel() {
- if (null != propertyToWidgetHash) {
- Collection keys = propertyToWidgetHash.keySet();
- if (!keys.isEmpty()) {
- Iterator propertyNames = keys.iterator();
- String propertyName = null;
- while (propertyNames.hasNext()) {
- propertyName = (String) propertyNames.next();
- synchUIWithModel(propertyName, WTPOperationDataModelEvent.PROPERTY_CHG);
- }
- }
- }
- }
-
- protected void synchComposite(Widget widget, String propertyName, Control[] depControls) {
- if (null == widgetToPropertyHash)
- widgetToPropertyHash = new HashMap();
- if (propertyToWidgetHash == null)
- propertyToWidgetHash = new HashMap();
- widgetToPropertyHash.put(widget, propertyName);
- propertyToWidgetHash.put(propertyName, widget);
- if (depControls != null) {
- if (widgetToDepControls == null)
- widgetToDepControls = new HashMap();
- widgetToDepControls.put(widget, depControls);
- }
- synchUIWithModel(propertyName, WTPOperationDataModelEvent.PROPERTY_CHG);
- }
-
- public void synchText(Text text, String propertyName, Control[] dependentControls) {
- synchText(text, propertyName, false, dependentControls);
- }
-
- public void synchText(Text text, String propertyName, boolean isTimeModified, Control[] dependentControls) {
- synchComposite(text, propertyName, dependentControls);
- if (isTimeModified)
- text.addModifyListener(getTimedListener());
- else
- text.addModifyListener(getModifyTextListener());
- }
-
- public void synchLabel(Label label, String propertyName, Control[] dependentControls) {
- synchComposite(label, propertyName, dependentControls);
- }
-
- /**
- * Use this to synch the contents of the <code>list</code> to the List elements returned from
- * the <code>propertyName</code>.
- */
- public void synchList(List list, String propertyName, Control[] dependentControls) {
- synchComposite(list, propertyName, dependentControls);
- }
-
- /**
- * Use this to synch the value of the specified Combo with the specified propertyName. The
- * possible values displayed to the user are determined by return of
- * WTPOperationDataModel.getValidPropertyDescriptors(String).
- *
- * @param combo
- * @param propertyName
- * @param dependentControls
- */
- public void synchCombo(Combo combo, String propertyName, Control[] dependentControls) {
- synchComposite(combo, propertyName, dependentControls);
- if (null == comboListener) {
- comboListener = new ComboListener();
- }
- combo.addSelectionListener(comboListener);
- combo.addModifyListener(comboListener);
- }
-
- /**
- * Use this to sync the state of the specified checkbox with the value of the specified
- * propertyName. The specified propertyName must contain a java.lang.Boolean typed Object.
- *
- * @param checkbox
- * @param propertyName
- * @param dependentControls
- */
- public void synchCheckbox(Button checkbox, String propertyName, Control[] dependentControls) {
- synchComposite(checkbox, propertyName, dependentControls);
- if (null == checkboxSelectionListener) {
- checkboxSelectionListener = new CheckboxSelectionListener();
- }
- checkbox.addSelectionListener(checkboxSelectionListener);
- }
-
- public void synchCheckBoxTableViewer(CheckboxTableViewer tableViewer, String propertyName, Control[] dependentControls) {
- synchComposite(tableViewer.getControl(), propertyName, dependentControls);
- if (null == checkBoxViewerStateListener) {
- checkBoxViewerStateListener = new CheckBoxViewerListener();
- }
- tableViewer.addCheckStateListener(checkBoxViewerStateListener);
- }
-
- public void synchCheckBoxTreeViewer(CheckboxTreeViewer treeViewer, String propertyName, Control[] dependentControls) {
- treeViewer.expandAll();
- synchComposite(treeViewer.getControl(), propertyName, dependentControls);
- if (null == checkBoxViewerStateListener) {
- checkBoxViewerStateListener = new CheckBoxViewerListener();
- }
- treeViewer.addCheckStateListener(checkBoxViewerStateListener);
- }
-
- public void synchRadio(Button radio, String propertyName, Control[] dependentControls) {
- // Uses checkbox syncher
- synchCheckbox(radio, propertyName, dependentControls);
- }
-
- private TimedModifyListener getTimedListener() {
- if (timedModifyListener == null)
- timedModifyListener = new TimedModifyListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Widget w = (Widget) e.getSource();
- if (currentWidget == w || w.isDisposed())
- return;
- String propertyName = (String) widgetToPropertyHash.get(w);
- setTextProperty(propertyName, (Text) w);
- }
- }) {
- public void modifyText(ModifyEvent e) {
- if (ignoreModifyEvent)
- return;
- super.modifyText(e);
- }
- };
- return timedModifyListener;
- }
-
- protected void setTextProperty(String propertyName, Text text) {
- setProperty(propertyName, text.getText());
- }
-
- private ModifyTextListener getModifyTextListener() {
- if (null == modifyTextListener)
- modifyTextListener = new ModifyTextListener();
- return modifyTextListener;
- }
-
- public WTPOperationDataModel getDataModel() {
- return dataModel;
- }
-
- public void dispose() {
- dataModel.removeListener(this);
- checkboxSelectionListener = null;
- currentWidget = null;
- modifyTextListener = null;
- propertyToWidgetHash = null;
- timedModifyListener = null;
- widgetToDepControls = null;
- widgetToPropertyHash = null;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPOperationAction.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPOperationAction.java
deleted file mode 100644
index 8c14d3c..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPOperationAction.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Apr 29, 2004
- *
- * TODO To change the template for this generated file go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.ui;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.MasterDescriptor;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.UIOperationExtensionRegistry;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.WTPOptionalOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.ComposedOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class WTPOperationAction extends Action implements IActionDelegate, IViewActionDelegate {
-
- private IStructuredSelection selection;
-
- private IViewPart viewPart;
-
- private IWorkbenchSite workbenchSite;
-
- public WTPOperationAction() {
- }
-
- public WTPOperationAction(String id, String name) {
- super(name);
- init(id, null);
- }
-
- public WTPOperationAction(String id, String name, ImageDescriptor imgDescriptor) {
- super(name, imgDescriptor);
- init(id, null);
- }
-
- public WTPOperationAction(String id, String name, IWorkbenchSite site) {
- super(name);
- init(id, site);
- }
-
- public WTPOperationAction(String id, String name, ImageDescriptor imgDescriptor, IWorkbenchSite site) {
- super(name, imgDescriptor);
- init(id, site);
- }
-
- /**
- * @param id
- * @param site
- */
- private void init(String id, IWorkbenchSite site) {
- this.setId(id);
- this.setWorkbenchSite(site);
- }
-
- /**
- * @param selection
- * @return
- */
- protected boolean updateSelection(IAction action, IStructuredSelection selection1) {
- this.selection = selection1;
- MasterDescriptor[] masters = UIOperationExtensionRegistry.INSTANCE.getExtendedUIOperations(action.getId(), selection);
- action.setEnabled(masters.length > 0);
- return masters.length > 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- run(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public final void run(IAction action) {
-
- if (action == null)
- return;
-
- WTPOptionalOperationDataModel operationDataModel = WTPOptionalOperationDataModel.createDataModel(action.getId(), this.selection);
- operationDataModel.setProperty(WTPOptionalOperationDataModel.IWORKBENCH_SITE, getWorkbenchSite());
-
- executeCompoundOperation(operationDataModel);
- }
-
- /**
- * @return
- */
- public IWorkbenchSite getWorkbenchSite() {
- if (workbenchSite != null)
- return workbenchSite;
- if (viewPart != null)
- return viewPart.getSite();
- return null;
- }
-
- /**
- * @param shell
- * @param operationDataModel
- * @param exec
- */
- protected void executeCompoundOperation(WTPOptionalOperationDataModel operationDataModel) {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- try {
- WTPOperation operation = operationDataModel.getDefaultOperation();
- operationDataModel.setOperationValidationEnabled(true);
- final List runnables = ((ComposedOperation) operation).getRunnables();
- /*
- * PlatformUI.getWorkbench().getProgressService().run(true, false, new
- * IRunnableWithProgress() {
- *
- *
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- *
- * public void run(IProgressMonitor monitor) throws InvocationTargetException,
- * InterruptedException {
- */
- /* monitor.beginTask("Executing compound operation", runnables.size()); */
- SubProgressMonitor submonitor = null;
- for (int i = 0; i < runnables.size(); i++) {
- final WTPOperation op = (WTPOperation) runnables.get(i);
- if (op != null) {
- /* submonitor = new SubProgressMonitor(monitor, 3); */
- op.run(submonitor);
- }
- /* monitor.worked(1); */
- }
- /* monitor.done(); */
- /*
- * } });
- */
- /* operation.run(new NullProgressMonitor()); */
- status = operation.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(shell, WTPCommonUIResourceHandler.getString("WTPOperationAction_UI_0"), WTPCommonUIResourceHandler.getString("WTPOperationAction_UI_1"), status); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- status = new Status(IStatus.ERROR, WTPUIPlugin.PLUGIN_ID, 0, e.toString(), e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection1) {
- if (selection1 instanceof IStructuredSelection)
- setEnabled(updateSelection(action, (IStructuredSelection) selection1));
- else {
- action.setEnabled(false);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
- this.viewPart = view;
- }
-
- /**
- * @param workbenchSite
- * The workbenchSite to set.
- */
- public void setWorkbenchSite(IWorkbenchSite workbenchSite) {
- this.workbenchSite = workbenchSite;
- }
-
- protected IStatus status;
-
- /**
- * @return Returns the status.
- */
- public IStatus getStatus() {
- return status;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPOptionalOperationAction.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPOptionalOperationAction.java
deleted file mode 100644
index a2d36d3..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPOptionalOperationAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Apr 29, 2004
- *
- * TODO To change the template for this generated file go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.ui;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.IOperationNode;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.WTPActionDialog;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.WTPOptionalOperationDataModel;
-
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class WTPOptionalOperationAction extends WTPOperationAction {
-
- public WTPOptionalOperationAction() {
- }
-
-
- public WTPOptionalOperationAction(String id, String name) {
- super(id, name);
- }
-
- public WTPOptionalOperationAction(String id, String name, ImageDescriptor imgDescriptor) {
- super(id, name, imgDescriptor);
- }
-
-
- public WTPOptionalOperationAction(String id, String name, IWorkbenchSite site) {
- super(id, name, site);
- }
-
- public WTPOptionalOperationAction(String id, String name, ImageDescriptor imgDescriptor, IWorkbenchSite site) {
- super(id, name, imgDescriptor, site);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.WTPOperationAction#executeCompoundOperation(org.eclipse.wst.common.frameworks.internal.operation.extension.ui.WTPOptionalOperationDataModel)
- */
- protected void executeCompoundOperation(WTPOptionalOperationDataModel operationDataModel) {
- if (operationDataModel != null) {
- IOperationNode root = (IOperationNode) operationDataModel.getProperty(WTPOptionalOperationDataModel.OPERATION_TREE);
- if (WTPOptionalOperationDataModel.getOptionalChildren(root).length > 0) {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- WTPActionDialog optionalDialog = new WTPActionDialog(shell, operationDataModel);
- optionalDialog.setId(getId());
- if (optionalDialog.open() == Window.OK)
- super.executeCompoundOperation(operationDataModel);
- else
- status = Status.CANCEL_STATUS;
- } else
- super.executeCompoundOperation(operationDataModel);
- }
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizard.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizard.java
deleted file mode 100644
index c41eb98..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizard.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.WizardPageElement;
-import org.eclipse.wst.common.frameworks.internal.operation.extensionui.WizardPageExtensionManager;
-import org.eclipse.wst.common.frameworks.internal.operations.FailSafeComposedOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-
-/**
- * This class is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class WTPWizard extends Wizard {
-
- private IExtendedWizardPage[] extendedPages = null;
- private IExtendedPageHandler[] extendedPageHandlers = null;
-
-
- protected WTPOperationDataModel model;
-
- public WTPWizard(WTPOperationDataModel model) {
- this.model = model;
- }
-
- public WTPWizard() {
- this.model = createDefaultModel();
- }
-
- /**
- * Return a new default WTPOperationDataModel.
- *
- * @return
- */
- protected abstract WTPOperationDataModel createDefaultModel();
-
- /**
- * @return the wizard ID that clients should extend to add to this wizard
- */
- public String getWizardID() {
- return this.getClass().getName();
- }
-
- /**
- * The <code>Wizard</code> implementation of this <code>IWizard</code> method creates all
- * the pages controls using <code>IDialogPage.createControl</code>. Subclasses should
- * reimplement this method if they want to delay creating one or more of the pages lazily. The
- * framework ensures that the contents of a page will be created before attempting to show it.
- */
- public void createPageControls(Composite pageContainer) {
- IWizardPage[] pages = getPages();
- // the default behavior is to create all the pages controls
- for (int i = 0; i < pages.length; i++) {
- if (isExtendedPage(pages[i])) {
- try {
- pages[i].createControl(pageContainer);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- continue;
- }
- } else {
- pages[i].createControl(pageContainer);
- }
- // page is responsible for ensuring the created control is
- // accessable
- // via getControl.
- Assert.isNotNull(pages[i].getControl());
- }
- }
-
- protected boolean isExtendedPage(IWizardPage page) {
- for (int i = 0; null != extendedPages && i < extendedPages.length; i++) {
- if (page == extendedPages[i]) {
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * This is finalized to handle the adding of extended pages. Clients should override
- * doAddPages() to add their pages.
- */
- public final void addPages() {
- doAddPages();
- addExtensionPages();
- }
-
- /**
- * Subclasses should override this method to add pages.
- */
- protected void doAddPages() {
-
- }
-
- private void addExtensionPages() {
- String wizardID = getWizardID();
- WizardPageElement wizElement = null;
- if (wizardID == null)
- return;
- WizardPageElement[] elements = WizardPageExtensionManager.getInstance().getPageElements(getWizardID());
- IExtendedWizardPage[] extendedPagesLocal = null;
- IExtendedPageHandler extendedPageHandler = null;
- List extendedPagesList = new ArrayList();
- List extendedPageHandlerList = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- wizElement = elements[i];
- try {
- extendedPagesLocal = wizElement.createPageGroup(model);
- if (null != extendedPagesLocal) {
- for (int j = 0; j < extendedPagesLocal.length; j++) {
- addPage(extendedPagesLocal[j]);
- extendedPagesList.add(extendedPagesLocal[j]);
- }
- }
- extendedPageHandler = wizElement.createPageHandler(model);
- if (null != extendedPageHandler && !extendedPageHandlerList.contains(extendedPageHandler)) {
- extendedPageHandlerList.add(extendedPageHandler);
- }
- } catch (RuntimeException runtime) {
- Logger.getLogger().logError(WTPCommonUIResourceHandler.getString("ExtendableWizard_UI_0", new Object[]{wizElement.getPluginID(), wizElement.pageGroupID})); //$NON-NLS-1$
- Logger.getLogger().logError(runtime);
- }
- }
- extendedPages = new IExtendedWizardPage[extendedPagesList.size()];
- for (int i = 0; i < extendedPages.length; i++) {
- extendedPages[i] = (IExtendedWizardPage) extendedPagesList.get(i);
- }
- extendedPageHandlers = new IExtendedPageHandler[extendedPageHandlerList.size()];
- for (int i = 0; i < extendedPageHandlers.length; i++) {
- extendedPageHandlers[i] = (IExtendedPageHandler) extendedPageHandlerList.get(i);
- }
-
- }
-
- public IWizardPage getNextPage(IWizardPage page) {
- IWizardPage expectedPage = super.getNextPage(page);
- if (expectedPage instanceof IExtendedWizardPage) {
- IExtendedWizardPage extendedWizardPage = (IExtendedWizardPage) expectedPage;
- if (!EnablementManager.INSTANCE.getIdentifier(extendedWizardPage.getGroupID(), getModel().getTargetProject()).isEnabled())
- return getNextPage(expectedPage);
- }
- String expectedPageName = (null == expectedPage) ? null : expectedPage.getName();
- String nextPageName = null;
- for (int i = 0; null != extendedPageHandlers && i < extendedPageHandlers.length; i++) {
- nextPageName = extendedPageHandlers[i].getNextPage(page.getName(), expectedPageName);
- if (null != nextPageName) {
- if (nextPageName.equals(IExtendedPageHandler.SKIP_PAGE)) {
- return getNextPage(expectedPage);
- } else if (nextPageName.startsWith(IExtendedPageHandler.PAGE_AFTER)) {
- String tempNextPageName = nextPageName.substring(IExtendedPageHandler.PAGE_AFTER.length());
- IWizardPage tempNextPage = getPage(tempNextPageName);
- return null == tempNextPage ? null : super.getNextPage(tempNextPage);
- }
- return getPage(nextPageName);
- }
- }
- return expectedPage;
- }
-
- public IWizardPage getPreviousPage(IWizardPage page) {
- IWizardPage expectedPage = super.getPreviousPage(page);
- String expectedPageName = (null == expectedPage) ? null : expectedPage.getName();
- String previousPageName = null;
- for (int i = 0; null != extendedPageHandlers && i < extendedPageHandlers.length; i++) {
- previousPageName = extendedPageHandlers[i].getPreviousPage(page.getName(), expectedPageName);
- if (null != previousPageName) {
- if (previousPageName.equals(IExtendedPageHandler.SKIP_PAGE)) {
- return getPreviousPage(expectedPage);
- } else if (previousPageName.startsWith(IExtendedPageHandler.PAGE_AFTER)) {
- String tempPreviousPageName = previousPageName.substring(IExtendedPageHandler.PAGE_AFTER.length());
- IWizardPage tempPreviousPage = getPage(tempPreviousPageName);
- return null == tempPreviousPage ? null : super.getPreviousPage(tempPreviousPage);
- }
- return getPage(previousPageName);
- }
- }
- return expectedPage;
- }
-
- public boolean canFinish() {
- if (!super.canFinish() || !model.isValid()) {
- return false;
- }
- for (int i = 0; null != extendedPages && i < extendedPages.length; i++) {
- if (!extendedPages[i].canPageFinish()) {
- return false;
- }
- }
- return true;
- }
-
- protected void resetAfterFinishError() {
- IWizardPage[] pages = getPages();
- for (int i = 0; i < pages.length; i++) {
- WTPWizardPage wtpPage = (WTPWizardPage) pages[i];
- wtpPage.validatePage(true);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public final boolean performFinish() {
- WTPOperation op = null;
- boolean wasSuccessful = false;
- try {
- model.setProperty(WTPOperationDataModel.UI_OPERATION_HANLDER, new UIOperationHandler(getShell()));
- if (prePerformFinish()) {
- storeDefaultSettings();
- op = createOperation();
- if (!model.getBooleanProperty(WTPOperationDataModel.RUN_OPERATION)) {
- model.setProperty(WTPOperationDataModel.CACHED_DELAYED_OPERATION, op);
- wasSuccessful = isSuccessfulFinish(op);
- return wasSuccessful;
- }
- if (op != null) {
- IRunnableWithProgress runnable = WTPUIPlugin.getRunnableWithProgress(op);
- try {
- getContainer().run(runForked(), isCancelable(), runnable);
- postPerformFinish();
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString("WTPWizard_UI_0", new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString("WTPWizard_UI_1", new Object[]{getWindowTitle()}), e, 0, false); //$NON-NLS-1$ //$NON-NLS-2$
- wasSuccessful = false;
- return wasSuccessful;
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- wasSuccessful = false;
- return wasSuccessful;
- }
- }
- }
- wasSuccessful = isSuccessfulFinish(op);
- return wasSuccessful;
- } finally {
- if (!wasSuccessful) {
- resetAfterFinishError();
- }
- }
- }
-
- /**
- * @param op
- * @return
- */
- protected boolean isSuccessfulFinish(WTPOperation op) {
- return op != null;
- }
-
- /**
- * Subclass can override to perform any tasks prior to running the operation. Return true to
- * have the operation run and false to stop the execution of the operation.
- *
- * @return
- */
- protected boolean prePerformFinish() {
- return true;
- }
-
- /**
- * Subclasses should override to perform any actions necessary after performing Finish.
- */
- protected void postPerformFinish() throws InvocationTargetException {
- }
-
- protected void storeDefaultSettings() {
- IWizardPage[] pages = getPages();
- for (int i = 0; i < pages.length; i++)
- storeDefaultSettings(pages[i], i);
- }
-
- /**
- * Subclasses may override if they need to do something special when storing the default
- * settings for a particular page.
- *
- * @param page
- * @param pageIndex
- */
- protected void storeDefaultSettings(IWizardPage page, int pageIndex) {
- if (page instanceof WTPWizardPage)
- ((WTPWizardPage) page).storeDefaultSettings();
- }
-
- /**
- * Subclasses should override if the running operation is allowed to be cancelled. The default
- * is false.
- *
- * @return
- */
- protected boolean isCancelable() {
- return false;
- }
-
- /**
- * Subclasses should override to return false if the running operation cannot be run forked.
- *
- * @return
- */
- protected boolean runForked() {
- return false;
- }
-
-
- /**
- * This is the base operation the wizard will run when finished. If the wizard is extended, then
- * this operation will run first followed by any extensions.
- *
- * @return
- */
- protected WTPOperation createBaseOperation() {
- return model.getDefaultOperation();
- }
-
- /**
- * Returs the operation this wizard is going to run. This is final to handle extended pages;
- * subclasses should override createBaseOperation.
- *
- * @return
- */
- protected final WTPOperation createOperation() {
- WTPOperation baseOperation = createBaseOperation();
- FailSafeComposedOperation composedOperation = null;
- for (int i = 0; null != extendedPages && i < extendedPages.length; i++) {
- WTPOperation op = extendedPages[i].createOperation();
- if (op != null) {
- if (composedOperation == null) {
- composedOperation = new FailSafeComposedOperation();
- composedOperation.append(baseOperation);
- }
- composedOperation.append(op);
- }
- }
- return composedOperation != null ? composedOperation : baseOperation;
- }
-
- /**
- * @return Returns the model.
- */
- public WTPOperationDataModel getModel() {
- return model;
- }
-
- public void dispose() {
- super.dispose();
- if (null != model) {
- model.dispose();
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
-
-
- public void addPage(IWizardPage page) {
- if (model.isProperty(WTPWizardSkipPageDataModel.SKIP_PAGES) && null != page.getName()) {
- List pagesToSkip = (List) model.getProperty(WTPWizardSkipPageDataModel.SKIP_PAGES);
- if (null != pagesToSkip && pagesToSkip.contains(page.getName())) {
- return;
- }
- }
- super.addPage(page);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardPage.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardPage.java
deleted file mode 100644
index 8a8dd4f..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardPage.java
+++ /dev/null
@@ -1,390 +0,0 @@
-package org.eclipse.wst.common.frameworks.internal.ui;
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001, 2002 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelEvent;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelListener;
-
-/**
- * This class is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class WTPWizardPage extends WizardPage implements Listener, WTPOperationDataModelListener {
- protected static final int NEXT = 1;
- protected static final int PREVIOUS = 2;
- protected static final int COMPOSITE_BORDER = SWT.NULL;
- private ValidationStatus status = new ValidationStatus();
- private boolean isValidating = false;
- protected boolean isFirstTimeToPage = true;
- protected WTPOperationDataModel model;
- private Map validationMap;
- private String[] validationPropertyNames;
- protected WTPDataModelSynchHelper synchHelper;
- private String infopopID;
-
- /**
- * J2EEWizardPage constructor comment.
- *
- * @param pageName
- * java.lang.String
- */
- protected WTPWizardPage(WTPOperationDataModel model, String pageName) {
- super(pageName);
- this.model = model;
- model.addListener(this);
- synchHelper = initializeSynchHelper(model);
- }
-
- /**
- * @return
- */
- public WTPDataModelSynchHelper initializeSynchHelper(WTPOperationDataModel dm) {
- return new WTPDataModelSynchHelper(dm);
- }
-
- /**
- * J2EEWizardPage constructor comment.
- *
- * @param pageName
- * java.lang.String
- * @param title
- * java.lang.String
- * @param titleImage
- * org.eclipse.jface.resource.ImageDescriptor
- */
- protected WTPWizardPage(WTPOperationDataModel model, String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- this.model = model;
- model.addListener(this);
- synchHelper = initializeSynchHelper(model);
- }
-
- /**
- * Creates the top level control for this dialog page under the given parent composite. This
- * method has been abstract and it uses the template pattern to get the correct items setup in
- * the correct order. See the set of methods below that are called in this method.
- * <p>
- * Implementors are responsible for ensuring that the created control can be accessed via
- * <code>getControl</code>
- * </p>
- *
- * @param parent
- * the parent composite
- */
- public final void createControl(org.eclipse.swt.widgets.Composite parent) {
- Composite top = createTopLevelComposite(parent);
- setControl(top);
- setupInfopop(top);
- setDefaults();
- addListeners();
- initializeValidationProperties();
- }
-
- private void initializeValidationProperties() {
- validationPropertyNames = getValidationPropertyNames();
- if (validationPropertyNames == null || validationPropertyNames.length == 0)
- validationMap = Collections.EMPTY_MAP;
- else {
- validationMap = new HashMap(validationPropertyNames.length);
- for (int i = 0; i < validationPropertyNames.length; i++)
- validationMap.put(validationPropertyNames[i], new Integer(i));
- }
- }
-
- /**
- * Subclass should return the model property names that need to be validated on this page in the
- * order that they should present their messages.
- *
- * @return
- */
- protected abstract String[] getValidationPropertyNames();
-
- /**
- * Return the top level Composite for this page.
- */
- protected abstract Composite createTopLevelComposite(Composite parent);
-
- /**
- * Set up info pop hooks if set.
- */
- protected void setupInfopop(Control parent) {
- if (getInfopopID() != null)
- WorkbenchHelp.setHelp(parent, getInfopopID());
- }
-
- /**
- * Setup the default values for this page. Subclasses should override to provide appropriate
- * defaults.
- */
- protected void setDefaults() {
- restoreDefaultSettings();
- }
-
- /**
- * Subclasses should implement this method if they have default settings that have been stored
- * and need to be restored.
- *
- * @see storeDefaultSettings()
- */
- protected void restoreDefaultSettings() {
- }
-
- /**
- * Add Listeners to controls at this point to avoid unnecessary events. Subclasses should
- * override to add listeners to its controls.
- */
- protected void addListeners() {
- }
-
- /**
- * The page is being made current and visible. Subclasses may extend.
- */
- protected void enter() {
- try {
- validatePage(showValidationErrorsOnEnter());
- } finally {
- isFirstTimeToPage = false;
- }
- }
-
- /**
- * The default behavior is to return true unless it is the first time entering this page in
- * which case we check to see if there is a previous page and return true if there is not.
- * Subclasses should override if they do not want this default behavior.
- */
- protected boolean showValidationErrorsOnEnter() {
- return !isFirstTimeToPage();
- }
-
- /**
- * The default behavior is to return true unless it is the first time entering this page in
- * which case we check to see if there is a previous page and return true if there is not.
- * Subclasses should override if they do not want this default behavior.
- *
- * @deprecated - use showValidatoinErrorsOnEnter instead
- */
- protected boolean shouldValidateOnEnter() {
- return showValidationErrorsOnEnter();
- }
-
- /**
- * Exiting the page. Subclasses may extend.
- */
- protected void exit() {
- }
-
- protected boolean getStatus(Integer key) {
- return status.hasError(key);
- }
-
- /**
- * Sent when an event that the receiver has registered for occurs. If a subclass overrides this
- * method, it must call super.
- *
- * @param event
- * the event which occurred
- */
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- }
-
- /**
- * Set the error message for this page based on the last error in the ValidationStatus.
- */
- protected void setErrorMessage() {
- String error = status.getLastErrMsg();
- if (error == null) {
- if (getErrorMessage() != null)
- setErrorMessage((String) null);
- String warning = status.getLastWarningMsg();
- if (warning == null) {
- if (getMessage() != null && getMessageType() == IMessageProvider.WARNING)
- setMessage(null, IMessageProvider.WARNING);
- } else if (!warning.equals(getMessage()))
- setMessage(warning, IMessageProvider.WARNING);
- } else if (!error.equals(getErrorMessage()))
- setErrorMessage(error);
- }
-
- protected void setErrorStatus(Integer key, String errorMessage) {
- status.setErrorStatus(key, errorMessage);
- }
-
- protected void setWarningStatus(Integer key, String warningMessage) {
- status.setWarningStatus(key, warningMessage);
- }
-
- protected void setOKStatus(Integer key) {
- status.setOKStatus(key);
- }
-
- /**
- * The <code>DialogPage</code> implementation of this <code>IDialogPage</code> method sets
- * the control to the given visibility state. Subclasses may extend.
- */
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible)
- enter();
- else
- exit();
- }
-
- /**
- * This should be called by the Wizard just prior to running the performFinish operation.
- * Subclasses should override to store their default settings.
- */
- public void storeDefaultSettings() {
- }
-
- /**
- * The page is now being validated. At this time, each control is validated and then the
- * controls are updated based on the results in the ValidationStatus which was updated during
- * <code>validateControls()</code>. Finally, it will display the last error message and it
- * will set the page complete. Subclasses will not typically override this method.
- */
- protected void validatePage() {
- validatePage(true);
- }
-
- protected void validatePage(boolean showMessage) {
- if (!isValidating) {
- isValidating = true;
- try {
- validateControlsBase();
- updateControls();
- if (showMessage)
- setErrorMessage();
- setPageComplete(status.getLastErrMsg() == null);
- } finally {
- isValidating = false;
- }
- }
- }
-
- /**
- * Validate individual controls. Use validation keys to keep track of errors.
- *
- * @see setOKStatus(Integer) and setErrorMessage(Integer, String)
- */
- protected final String validateControlsBase() {
- if (!validationMap.isEmpty()) {
- String propName;
- for (int i = 0; i < validationPropertyNames.length; i++) {
- propName = validationPropertyNames[i];
- Integer valKey = (Integer) validationMap.get(propName);
- if (valKey != null)
- validateProperty(propName, valKey);
- if (!getStatus(valKey))
- return propName;
- }
- }
- return null;
- }
-
- /**
- * @param propertyName
- * @param validationkey
- */
- private void validateProperty(String propertyName, Integer validationKey) {
- setOKStatus(validationKey);
- IStatus status1 = model.validateProperty(propertyName);
- if (!status1.isOK()) {
- String message = status1.isMultiStatus() ? status1.getChildren()[0].getMessage() : status1.getMessage();
- switch (status1.getSeverity()) {
- case IStatus.ERROR :
- setErrorStatus(validationKey, message);
- break;
- case IStatus.WARNING :
- setWarningStatus(validationKey, message);
- break;
- }
- }
- }
-
- /**
- * Update the enablement of controls after validation. Sublcasses should check the status of
- * validation keys to determine enablement.
- */
- protected void updateControls() {
- }
-
- /**
- * Gets the isFirstTimeToPage.
- *
- * @return Returns a boolean
- */
- protected boolean isFirstTimeToPage() {
- return isFirstTimeToPage;
- }
-
- // protected void setJavaStatusMessage(IStatus javaStatus, Integer statusKey, String message) {
- // if (javaStatus.getSeverity() == IStatus.WARNING)
- // setWarningStatus(statusKey, message);
- // else
- // setErrorStatus(statusKey, message);
- // }
-
- /**
- * @param b
- */
- public void setFirstTimeToPage(boolean b) {
- isFirstTimeToPage = b;
- }
-
- /*
- * If a property changes that we want to validate, force validation on this page.
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModelListener#propertyChanged(java.lang.String,
- * java.lang.Object, java.lang.Object)
- */
- public void propertyChanged(WTPOperationDataModelEvent event) {
- String propertyName = event.getPropertyName();
- if (validationPropertyNames != null && (event.getFlag() == WTPOperationDataModelEvent.PROPERTY_CHG || (!isPageComplete() && event.getFlag() == WTPOperationDataModelEvent.VALID_VALUES_CHG))) {
- for (int i = 0; i < validationPropertyNames.length; i++) {
- if (validationPropertyNames[i].equals(propertyName)) {
- validatePage();
- break;
- }
- }
- }
- }
-
- /**
- * @return Returns the model.
- */
- protected WTPOperationDataModel getModel() {
- return model;
- }
-
- public void dispose() {
- super.dispose();
- if (synchHelper != null) {
- synchHelper.dispose();
- synchHelper = null;
- }
- }
-
- protected String getInfopopID() {
- return infopopID;
- }
-
- public void setInfopopID(String infopopID) {
- this.infopopID = infopopID;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardSelectionPage.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardSelectionPage.java
deleted file mode 100644
index 4382c0e..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardSelectionPage.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Jan 27, 2004
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-/**
- * @author DABERG
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public abstract class WTPWizardSelectionPage extends WTPWizardPage {
- /**
- * @param model
- * @param pageName
- */
- public WTPWizardSelectionPage(WTPOperationDataModel model, String pageName) {
- super(model, pageName);
- }
-
- /**
- * @param model
- * @param pageName
- * @param title
- * @param titleImage
- */
- public WTPWizardSelectionPage(WTPOperationDataModel model, String pageName, String title, ImageDescriptor titleImage) {
- super(model, pageName, title, titleImage);
- }
-
- /**
- * The selected node; <code>null</code> if none.
- */
- private IWizardNode selectedNode = null;
-
- /**
- * List of wizard nodes that have cropped up in the past (element type: <code>IWizardNode</code>).
- */
- private List selectedWizardNodes = new ArrayList();
-
- /**
- * Adds the given wizard node to the list of selected nodes if it is not already in the list.
- *
- * @param node
- * the wizard node, or <code>null</code>
- */
- private void addSelectedNode(IWizardNode node) {
- if (node == null)
- return;
-
- if (selectedWizardNodes.contains(node))
- return;
-
- selectedWizardNodes.add(node);
- }
-
- /**
- * The <code>WizardSelectionPage</code> implementation of this <code>IWizardPage</code>
- * method returns <code>true</code> if there is a selected node.
- */
- public boolean canFlipToNextPage() {
- return isPageComplete() && selectedNode != null;
- }
-
- /**
- * The <code>WizardSelectionPage</code> implementation of an <code>IDialogPage</code> method
- * disposes of all nested wizards. Subclasses may extend.
- */
- public void dispose() {
- super.dispose();
- // notify nested wizards
- for (int i = 0; i < selectedWizardNodes.size(); i++) {
- ((IWizardNode) selectedWizardNodes.get(i)).dispose();
- }
- }
-
- /**
- * The <code>WizardSelectionPage</code> implementation of this <code>IWizardPage</code>
- * method returns the first page of the currently selected wizard if there is one.
- */
- public IWizardPage getNextPage() {
- if (selectedNode == null)
- return null;
-
- boolean isCreated = selectedNode.isContentCreated();
-
- IWizard wizard = selectedNode.getWizard();
-
- if (wizard == null) {
- setSelectedNode(null);
- return null;
- }
-
- if (!isCreated)
- // Allow the wizard to create its pages
- wizard.addPages();
-
- return wizard.getStartingPage();
- }
-
- /**
- * Returns the currently selected wizard node within this page.
- *
- * @return the wizard node, or <code>null</code> if no node is selected
- */
- public IWizardNode getSelectedNode() {
- return selectedNode;
- }
-
- /**
- * Sets or clears the currently selected wizard node within this page.
- *
- * @param node
- * the wizard node, or <code>null</code> to clear
- */
- protected void setSelectedNode(IWizardNode node) {
- addSelectedNode(node);
- selectedNode = node;
- if (isCurrentPage())
- getContainer().updateButtons();
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardSkipPageDataModel.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardSkipPageDataModel.java
deleted file mode 100644
index 22532f4..0000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/WTPWizardSkipPageDataModel.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on May 25, 2004
- *
- */
-package org.eclipse.wst.common.frameworks.internal.ui;
-
-import java.util.Collections;
-
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-
-
-/**
- * @author jsholl
- *
- */
-public class WTPWizardSkipPageDataModel extends WTPOperationDataModel {
-
- /**
- * A List of Strings identifying the page id's to skip
- */
- public static final String SKIP_PAGES = "WTPWizardSkipPageDataModel.SKIP_PAGES"; //$NON-NLS-1$
-
- public WTPOperation getDefaultOperation() {
- return null;
- }
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(SKIP_PAGES);
- }
-
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(SKIP_PAGES)) {
- return Collections.EMPTY_LIST;
- }
- return super.getDefaultProperty(propertyName);
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/plugin.xml b/plugins/org.eclipse.wst.common.frameworks/plugin.xml
index c693f73..208b0ec 100644
--- a/plugins/org.eclipse.wst.common.frameworks/plugin.xml
+++ b/plugins/org.eclipse.wst.common.frameworks/plugin.xml
@@ -2,7 +2,6 @@
<?eclipse version="3.0"?>
<plugin>
- <extension-point id="ExtendableOperation" name="Extendable Operation" schema="schema/ExtendableOperation.exsd"/>
<extension-point id="OperationExtension" name="OperationExtension" schema="schema/OperationExtension.exsd"/>
<extension-point id="functionGroup" name="Function Extension Group" schema="schema/functionGroup.exsd"/>
<extension-point id="WTPActivityBridgeHelper" name="WTPActivityBridgeHelper" schema="schema/WTPActivityBridgeHelper.exsd"/>
diff --git a/plugins/org.eclipse.wst.common.frameworks/schema/ExtendableOperation.exsd b/plugins/org.eclipse.wst.common.frameworks/schema/ExtendableOperation.exsd
deleted file mode 100644
index af71234..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/schema/ExtendableOperation.exsd
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="com.ibm.etools.j2ee">
-<annotation>
- <appInfo>
- <meta.schema plugin="com.ibm.etools.j2ee" id="ExtendableOperation" name="ExtendabledOperation"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="extendableOperation"/>
- </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>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="extendableOperation">
- <complexType>
- <sequence>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </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>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ComposedExtendedOperationHolder.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ComposedExtendedOperationHolder.java
deleted file mode 100644
index 8e57fbf..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ComposedExtendedOperationHolder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operations;
-
-import java.util.ArrayList;
-
-
-
-
-
-public class ComposedExtendedOperationHolder {
-
- private ArrayList preOps = null;
- private ArrayList postOps = null;
-
- /**
- *
- */
- protected ComposedExtendedOperationHolder() {
- super();
- }
-
- protected void addPreOperation(WTPOperation preOp) {
- if (preOps == null) {
- preOps = new ArrayList();
- }
- preOps.add(preOp);
- }
-
- protected void addPostOperation(WTPOperation postOp) {
- if (postOps == null) {
- postOps = new ArrayList();
- }
- postOps.add(postOp);
- }
-
- public boolean hasPreOps() {
- return preOps != null;
- }
-
- public boolean hasPostOps() {
- return postOps != null;
- }
-
- public ArrayList getPostOps() {
- return postOps;
- }
-
- public ArrayList getPreOps() {
- return preOps;
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ComposedOperation.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ComposedOperation.java
deleted file mode 100644
index 5bb08f4..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ComposedOperation.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class ComposedOperation extends WTPOperation {
-
- protected List fRunnables;
-
- public ComposedOperation() {
- super();
- }
-
- public ComposedOperation(List nestedRunnablesWithProgress) {
- super();
- fRunnables = nestedRunnablesWithProgress;
- }
-
- public boolean addRunnable(WTPOperation nestedOp) {
- return getRunnables().add(nestedOp);
- }
-
- public WTPOperation append(WTPOperation op) {
- this.addRunnable(op);
- return this;
- }
-
- // TODO MDE Make protected
- public List getRunnables() {
- if (fRunnables == null)
- fRunnables = new ArrayList(3);
- return fRunnables;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.etools.j2ee.operations.IHeadlessRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (fRunnables == null || fRunnables.isEmpty())
- return;
- int size = fRunnables.size();
- monitor.beginTask("", size);//$NON-NLS-1$
-
- OperationStatus composedStatus = null;
- try {
- for (int i = 0; i < fRunnables.size(); i++) {
- WTPOperation op = (WTPOperation) fRunnables.get(i);
- op.run(new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
- if (composedStatus == null)
- composedStatus = new OperationStatus(new IStatus[]{op.getStatus()});
- else
- composedStatus.add(op.getStatus());
- }
- } finally {
- if (composedStatus != null)
- addStatus(composedStatus);
- }
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/DMOperationExtensionRegistry.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/DMOperationExtensionRegistry.java
index d78d213..8ebf25d 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/DMOperationExtensionRegistry.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/DMOperationExtensionRegistry.java
@@ -126,11 +126,11 @@
currentExt = (OperationExtension) opExt[i];
/* Only allow extensions which enabled (null project indicates enabled by activity only) */
if (EnablementManager.INSTANCE.getIdentifier(currentExt.getExtensionId(), null).isEnabled()) {
- preOp = currentExt.getDMPreOperation();
+ preOp = currentExt.getPreOperation();
if (preOp != null) {
extOperationHolder.addPreOperation(preOp);
}
- postOp = currentExt.getDMPostOperation();
+ postOp = currentExt.getPostOperation();
if (postOp != null) {
extOperationHolder.addPostOperation(postOp);
}
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/FailSafeComposedOperation.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/FailSafeComposedOperation.java
deleted file mode 100644
index be0f964..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/FailSafeComposedOperation.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Jan 21, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code Generation - Code and
- * Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-
-/**
- * @author jsholl
- *
- * Same as ComposedOperation except the first Operation must run; all others can fail without
- * effecting the ComposedOperation or any other operation following them in the Composed Operation's
- * list.
- */
-public class FailSafeComposedOperation extends ComposedOperation {
-
- public FailSafeComposedOperation() {
- super();
- }
-
- public FailSafeComposedOperation(List nestedRunnablesWithProgress) {
- super(nestedRunnablesWithProgress);
- }
-
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- int size = fRunnables.size();
- monitor.beginTask("", size); //$NON-NLS-1$
- for (int i = 0; i < fRunnables.size(); i++) {
- WTPOperation op = (WTPOperation) fRunnables.get(i);
- if (i == 0) { //The first one must pass; all others can fail
- op.run(new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
- } else {
- try {
- op.run(new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
- } catch (InterruptedException e) {
- throw e;
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensibilityReader.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensibilityReader.java
deleted file mode 100644
index f40c87d..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensibilityReader.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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
- **************************************************************************************************/
-/*
- * Created on Nov 3, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operations;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-
-public class OperationExtensibilityReader extends RegistryReader {
- static final String ELEMENT_J2EEOPEXT = "extendableOperation"; //$NON-NLS-1$
- static final String OPERATION_ATTRIBUTE = "class"; //$NON-NLS-1$
- static final String OPERATION_ID = "id"; //$NON-NLS-1$
- protected static HashMap extensibleOperations = null;
-
- public OperationExtensibilityReader() {
- super(WTPCommonPlugin.PLUGIN_ID, "ExtendableOperation"); //$NON-NLS-1$
- }
-
- /**
- * readElement() - parse and deal with an extension like: <extendableOperation class =
- * "com.ibm.etools.foo.Operation" id ' "" />
- */
- public boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(ELEMENT_J2EEOPEXT))
- return false;
- String op = element.getAttribute(OPERATION_ATTRIBUTE);
- String id = element.getAttribute(OPERATION_ID);
- addExtendableOperation(op, id);
- return true;
- }
-
- /**
- * Sets the Extendable Operation
- *
- * @param op
- * @param id
- */
- private static void addExtendableOperation(String op, String id) {
- if (extensibleOperations == null)
- extensibleOperations = new HashMap();
- extensibleOperations.put(op, id);
- }
-
- protected static HashMap getExtendableOperations() {
- return extensibleOperations;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtension.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtension.java
index d9c60ba..4f575f3 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtension.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtension.java
@@ -20,12 +20,8 @@
String preOperationClass = null;
- WTPOperation preOperation = null;
-
String postOperationClass = null;
- WTPOperation postOperation = null;
-
private String extensionId;
public OperationExtension(IConfigurationElement element, String id, String preOp, String postOp) {
@@ -55,32 +51,14 @@
return preOperationClass;
}
- public WTPOperation getPostOperation() throws CoreException {
- if (postOperationClass == null)
- return null;
- WTPOperation op = (WTPOperation) baseElement.createExecutableExtension(OperationExtensionReader.ATT_POST_OP);
- if (op != null)
- op.setID(getExtensionId());
- return op;
- }
-
- public WTPOperation getPreOperation() throws CoreException {
- if (preOperationClass == null)
- return null;
- WTPOperation op = (WTPOperation) baseElement.createExecutableExtension(OperationExtensionReader.ATT_PRE_OP);
- if (op != null)
- op.setID(getExtensionId());
- return op;
- }
-
- public IDataModelOperation getDMPostOperation() throws CoreException {
+ public IDataModelOperation getPostOperation() throws CoreException {
if (postOperationClass == null)
return null;
IDataModelOperation op = (IDataModelOperation) baseElement.createExecutableExtension(OperationExtensionReader.ATT_POST_OP);
return op;
}
- public IDataModelOperation getDMPreOperation() throws CoreException {
+ public IDataModelOperation getPreOperation() throws CoreException {
if (preOperationClass == null)
return null;
IDataModelOperation op = (IDataModelOperation) baseElement.createExecutableExtension(OperationExtensionReader.ATT_PRE_OP);
@@ -93,4 +71,8 @@
public String getExtensionId() {
return extensionId;
}
+
+ public IConfigurationElement getBaseElement() {
+ return baseElement;
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionReader.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionReader.java
index 00a3bf5..3f9682d 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionReader.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionReader.java
@@ -25,11 +25,11 @@
public class OperationExtensionReader extends RegistryReader {
protected static HashMap opExtensions = null;
- static final String ELEMENT_J2EEOPEXT = "operationExtension"; //$NON-NLS-1$
- static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ELEMENT_J2EEOPEXT = "operationExtension"; //$NON-NLS-1$
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
//static final String ATT_OP_TYPE = "operationType"; //$NON-NLS-1$
- static final String ATT_PRE_OP = "preOperationClass"; //$NON-NLS-1$
- static final String ATT_POST_OP = "postOperationClass"; //$NON-NLS-1$
+ public static final String ATT_PRE_OP = "preOperationClass"; //$NON-NLS-1$
+ public static final String ATT_POST_OP = "postOperationClass"; //$NON-NLS-1$
public OperationExtensionReader() {
super(WTPCommonPlugin.PLUGIN_ID, "OperationExtension"); //$NON-NLS-1$
@@ -74,8 +74,7 @@
}
}
- protected static HashMap getExtensionPoints() {
+ public static HashMap getExtensionPoints() {
return opExtensions;
}
-
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionRegistry.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionRegistry.java
deleted file mode 100644
index b8022ff..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/OperationExtensionRegistry.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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
- **************************************************************************************************/
-/*
- * Created on Oct 1, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager;
-
-public class OperationExtensionRegistry {
-
- protected static boolean canExtHasRead = false;
-
- protected static boolean extPointHasRead = false;
-
- protected static OperationExtensionRegistry instance = null;
-
- protected static HashMap extensibleOperations = null;
-
- protected static HashMap opExtensions = null;
-
- protected static OperationExtensibilityReader opExtensibilityReader = null;
-
- protected static OperationExtensionReader opExtensionReader = null;
-
- public static String[] getRegisteredOperations(String className) {
- extensibleOperations = getExtensibility();
- if (extensibleOperations != null) {
- String id = (String) extensibleOperations.get(className);
- if (id == null)
- return null;
- if (opExtensions == null)
- opExtensions = getExtensionPoints();
- if (opExtensions != null) {
- Collection ext = (Collection) opExtensions.get(id);
- if (ext != null)
- return getClassNames(ext.toArray());
- }
- }
- return null;
- }
-
- private static String[] getClassNames(Object[] opExt) {
- ArrayList classNames = new ArrayList();
- OperationExtension currentExt = null;
- for (int i = 0; i < opExt.length; i++) {
- currentExt = (OperationExtension) opExt[i];
- /* Only allow extensions which enabled (null project indicates enabled by activity only) */
- if (EnablementManager.INSTANCE.getIdentifier(currentExt.getExtensionId(), null).isEnabled()) {
- String className = currentExt.getPreOperationClass();
- if (null != className) {
- classNames.add(className);
- }
- className = currentExt.getPostOperationClass();
- if (null != className) {
- classNames.add(className);
- }
- }
- }
- String[] array = new String[classNames.size()];
- classNames.toArray(array);
- return array;
- }
-
- public static ComposedExtendedOperationHolder getExtensions(String className) {
- extensibleOperations = getExtensibility();
- if (extensibleOperations != null) {
- String id = (String) extensibleOperations.get(className);
- if (id == null)
- return null;
- if (opExtensions == null)
- opExtensions = getExtensionPoints();
- if (opExtensions != null) {
- Collection ext = (Collection) opExtensions.get(id);
- if (ext != null) {
- try {
- return calculateOperationHolder(ext);
- } catch (CoreException ex) {
- Logger.getLogger().logError(ex);
- }
- }
- }
- }
- return null;
- }
-
- public static ComposedExtendedOperationHolder getExtensions(WTPOperation op) {
- return getExtensions(op.getClass().getName());
- }
-
- protected String getExtendableOperationId(WTPOperation op) {
- return (String) extensibleOperations.get(op.getClass().getName());
- }
-
- private static ComposedExtendedOperationHolder calculateOperationHolder(Collection ext) throws CoreException {
- Object[] opExt = ext.toArray();
- ComposedExtendedOperationHolder extOperationHolder = new ComposedExtendedOperationHolder();
- WTPOperation preOp = null;
- WTPOperation postOp = null;
- OperationExtension currentExt = null;
- for (int i = 0; i < opExt.length; i++) {
- currentExt = (OperationExtension) opExt[i];
- /* Only allow extensions which enabled (null project indicates enabled by activity only) */
- if (EnablementManager.INSTANCE.getIdentifier(currentExt.getExtensionId(), null).isEnabled()) {
- preOp = currentExt.getPreOperation();
- if (preOp != null) {
- extOperationHolder.addPreOperation(preOp);
- }
- postOp = currentExt.getPostOperation();
- if (postOp != null) {
- extOperationHolder.addPostOperation(postOp);
- }
- }
- }
- return extOperationHolder;
- }
-
- private static HashMap getExtensibility() {
- if (!canExtHasRead) {
- opExtensibilityReader = new OperationExtensibilityReader();
- opExtensibilityReader.readRegistry();
- canExtHasRead = true;
- }
- if (opExtensibilityReader == null)
- return null;
- return OperationExtensibilityReader.getExtendableOperations();
- }
-
- private static HashMap getExtensionPoints() {
- if (!extPointHasRead) {
- opExtensionReader = new OperationExtensionReader();
- opExtensionReader.readRegistry();
- extPointHasRead = true;
- }
- if (opExtensionReader == null)
- return null;
- return OperationExtensionReader.getExtensionPoints();
- }
-
- /**
- * Gets the instance.
- *
- * @return Returns a EjbPageExtensionRegistry
- */
- public static OperationExtensionRegistry getInstance() {
- if (instance == null)
- instance = new OperationExtensionRegistry();
- return instance;
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPDataModelBridgeProvider.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPDataModelBridgeProvider.java
deleted file mode 100644
index dfc7fae..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPDataModelBridgeProvider.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 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.frameworks.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-/**
- * <p>
- * This provider acts as wrapper around the old WTPOperationDataModel framework so a exiting
- * WTPOperationDataModel can work with the new IDataModel framework. This class should be used only
- * as a temporary solution while porting to the new framework.
- * </p>
- * <p>
- * This provider only allows the old WTPOperationDataModels to run within the new framework; not
- * vice versa.
- * </p>
- * <p>
- * There are some known limitations:
- * <ul>
- * <li> All property names must be defined up front on the WTPOperationDataModel during the
- * iniitWTPDataModel() method. Any properties added later cause runtime failures. </li>
- * <li>Any model nested under the WTPOperationDataModel must either be nested during
- * initWTPDataModel() or must not add any new property names.</li>
- * <li>Any model nested under the WTPOperationDataModel should not be unnested if doing so will
- * remove property names with respect to the WTPOperationDataModel</li>
- * </ul>
- * </p>
- *
- */
-public abstract class WTPDataModelBridgeProvider extends AbstractDataModelProvider {
-
- /**
- * A property key used to access the underlying data model. This should be used sparingly.
- */
- public static final String WRAPPED_WTP_DATA_MODEL = "WTPDataModelBridgeProvider.WRAPPED_WTP_DATA_MODEL";
-
- protected WTPOperationDataModel wtpDataModel;
-
- /**
- * Subclasses need to return an initiaized WTPOperationDataModel here.
- *
- * @return
- */
- protected abstract WTPOperationDataModel initWTPDataModel();
-
- public void init() {
- }
-
- public String[] getPropertyNames() {
- wtpDataModel = initWTPDataModel();
- wtpDataModel.addListener(new WTPOperationDataModelListener() {
- public void propertyChanged(WTPOperationDataModelEvent event) {
- int flag = event.getFlag();
- String propertyName = event.getPropertyName();
- switch (flag) {
- case WTPOperationDataModelEvent.ENABLE_CHG :
- model.notifyPropertyChange(propertyName, IDataModel.ENABLE_CHG);
- break;
- case WTPOperationDataModelEvent.VALID_VALUES_CHG :
- model.notifyPropertyChange(propertyName, IDataModel.VALID_VALUES_CHG);
- break;
- case WTPOperationDataModelEvent.PROPERTY_CHG :
- if (!wtpDataModel.isSet(propertyName)) {
- if (model.isPropertySet(propertyName)) {
- model.setProperty(propertyName, null);
- }
- model.notifyPropertyChange(propertyName, IDataModel.DEFAULT_CHG);
- } else {
- model.setProperty(propertyName, event.getProperty());
- model.notifyPropertyChange(propertyName, IDataModel.VALUE_CHG);
- }
- break;
- }
- }
- });
- Set validProperties = wtpDataModel.getValidProperties();
- String[] propertyNames = new String[validProperties.size() + 1];
- propertyNames[0] = WRAPPED_WTP_DATA_MODEL;
- Iterator iterator = validProperties.iterator();
- for (int i = 1; i < propertyNames.length; i++) {
- propertyNames[i] = (String) iterator.next();
- }
- return propertyNames;
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (WRAPPED_WTP_DATA_MODEL.equals(propertyName)) {
- throw new RuntimeException();
- }
- wtpDataModel.setProperty(propertyName, propertyValue);
- return true;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (WRAPPED_WTP_DATA_MODEL.equals(propertyName)) {
- return wtpDataModel;
- }
- return wtpDataModel.getDefaultProperty(propertyName);
- }
-
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (WRAPPED_WTP_DATA_MODEL.equals(propertyName)) {
- return null;
- }
- return convert(wtpDataModel.getPropertyDescriptor(propertyName));
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (WRAPPED_WTP_DATA_MODEL.equals(propertyName)) {
- return null;
- }
- return convert(wtpDataModel.getValidPropertyDescriptors(propertyName));
- }
-
- public boolean isPropertyEnabled(String propertyName) {
- if (WRAPPED_WTP_DATA_MODEL.equals(propertyName)) {
- return true;
- }
- Boolean b = wtpDataModel.isEnabled(propertyName);
- return b != null ? b.booleanValue() : true;
- }
-
- public IStatus validate(String name) {
- if (WRAPPED_WTP_DATA_MODEL.equals(name)) {
- return OK_STATUS;
- }
- return wtpDataModel.validateProperty(name);
- }
-
- public List getExtendedContext() {
- return (List) wtpDataModel.getProperty(WTPOperationDataModel.EXTENDED_CONTEXT);
- }
-
- public IDataModelOperation getDefaultOperation() {
- final WTPOperation wtpOperation = wtpDataModel.getDefaultOperation();
- IDataModelOperation op = new AbstractDataModelOperation() {
- public ISchedulingRule getSchedulingRule() {
- return wtpOperation.getSchedulingRule();
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- wtpOperation.run(monitor);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- throw new ExecutionException(e.getMessage(), e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- throw new ExecutionException(e.getMessage(), e);
- }
- return null;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return null;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return null;
- }
- };
-
- op.setID(getID());
- return op;
- }
-
-
- protected DataModelPropertyDescriptor convert(WTPPropertyDescriptor wtpDescriptor) {
- return new DataModelPropertyDescriptor(wtpDescriptor.getPropertyValue(), wtpDescriptor.getPropertyDescription());
- }
-
- protected DataModelPropertyDescriptor[] convert(WTPPropertyDescriptor[] wtpDescriptors) {
- DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[wtpDescriptors.length];
- for (int i = 0; i < descriptors.length; i++) {
- descriptors[i] = convert(wtpDescriptors[i]);
- }
- return descriptors;
- }
-
- public void dispose() {
- wtpDataModel.dispose();
- super.dispose();
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperation.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperation.java
deleted file mode 100644
index 0421046..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperation.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.wst.common.frameworks.internal.AdaptabilityUtility;
-import org.eclipse.wst.common.frameworks.internal.WTPResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementManager;
-import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * replace with {@link org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation}
- * An operation which potentially makes changes to the workspace. All resource modification should
- * be performed using this operation. The primary consequence of using this operation is that events
- * which typically occur as a result of workspace changes (such as the firing of resource deltas,
- * performance of autobuilds, etc.) are deferred until the outermost operation has successfully
- * completed.
- * <p>
- * Subclasses must implement <code>execute</code> to do the work of the operation.
- * </p>
- * This class is EXPERIMENTAL and is subject to substantial changes.
- */
-public abstract class WTPOperation implements IHeadlessRunnableWithProgress {
-
- private static Hashtable threadToExtendedOpControl;
-
- private class ExtendedOpControl {
- private boolean allowExtensions;
- List restrictedExtensions;
-
- public ExtendedOpControl(boolean allowExtensions, List restrictedExtensions) {
- this.allowExtensions = allowExtensions;
- this.restrictedExtensions = restrictedExtensions;
- }
-
- public boolean shouldExecute(String operationID) {
- return allowExtensions && !restrictedExtensions.contains(operationID);
- }
- }
-
- /**
- * The dataModel used to execute this operation
- */
- protected WTPOperationDataModel operationDataModel;
-
- private OperationStatus opStatus;
-
- private String id;
-
- /**
- * Constructor for the operation. Clients should use this constructor instead of the no argument
- * constructor.
- *
- * @param operationDataModel
- */
- public WTPOperation(WTPOperationDataModel operationDataModel) {
- setOperationDataModel(operationDataModel);
- }
-
- /**
- * This no argument constructor should not be used by clients. This is for extended operations.
- *
- * ExtendedOperations
- */
- public WTPOperation() {
- }
-
- // TODO see if this can be made package visible only.
- /**
- * Note: This method is for internal use only. Clients should not call this method.
- *
- * ExtendedOperations
- *
- * @param value
- * the operation's id
- */
- public final void setID(String value) {
- Assert.isTrue(this.id == null, WTPResourceHandler.getString("22")); //$NON-NLS-1$
- Assert.isNotNull(value, WTPResourceHandler.getString("23")); //$NON-NLS-1$
- this.id = value;
- }
-
- // TODO see if this can be removed
- /**
- * Note: This method is for internal use only. Clients should not call this method.
- *
- * ExtendedOperations
- *
- * @return the operation's id
- */
- public final String getID() {
- return this.id;
- }
-
- // TODO see if this can be make package visible only.
- /**
- * Note: This method is for internal use only. Clients should not call this method.
- *
- * @param operationDataModel
- */
- public final void setOperationDataModel(WTPOperationDataModel operationDataModel) {
- this.operationDataModel = operationDataModel;
- }
-
- /**
- * Returns the dataModels used by this operation.
- *
- * @return the dataModels used by this operation.
- */
- public final WTPOperationDataModel getOperationDataModel() {
- return operationDataModel;
- }
-
- /**
- * Returns the result status of this operation. If this operation net been executed, then it
- * will return null.
- *
- * @return he result status of this operation.
- */
- public IStatus getStatus() {
- if (null == opStatus)
- return WTPCommonPlugin.OK_STATUS;
- return opStatus;
- }
-
- /**
- * Performs the steps that are to be treated as a single logical workspace change.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param monitor
- * the progress monitor to use to display progress and field user requests to cancel
- * @exception CoreException
- * if the operation fails due to a CoreException
- * @exception InvocationTargetException
- * if the operation fails due to an exception other than CoreException
- * @exception InterruptedException
- * if the operation detects a request to cancel, using
- * <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- */
- protected abstract void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException;
-
- /**
- * Subclasses should override as necessary to perform any additional initialization before
- * executing.
- *
- * @param monitor
- * the progress monitor
- */
- protected void initialize(IProgressMonitor monitor) {
- // Making sure the status objects are initialized
- // status = null;
- opStatus = null;
- }
-
- private ComposedExtendedOperationHolder initializeExtensionOperations() {
- return OperationExtensionRegistry.getExtensions(this);
- }
-
- /**
- * <p>
- * Subclasses should override as necessary to perform any post executiong cleanup. Subclasses,
- * should not initialize any resources anywhere other than within either the
- * initialize(IProjgressMonitor) or the execute(IProgressMonitor) methods. This method will
- * always be called when an operation is run irregardless of whether the execution is
- * successful.
- * </p>
- * <p>
- * Clients should never need to call this method
- * </p>
- *
- * @param monitor
- * the progress monitor
- */
- protected void dispose(IProgressMonitor monitor) {
- }
-
- // TODO see if this can be removed
- /**
- * Note: This method is for internal use only. Clients should not call this method.
- *
- * @return the workspace
- */
- protected IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- // TODO see if this can be removed
- /**
- * Note: This method is for internal use only. Clients should not call this method.
- *
- * @param op
- * the to append
- * @return A new operation
- */
- public WTPOperation append(WTPOperation op) {
- ComposedOperation composedOp = new ComposedOperation();
- composedOp.addRunnable(this);
- composedOp.addRunnable(op);
- return composedOp;
- }
-
- /**
- * Initiates a batch of changes, by invoking the execute() method as a workspace runnable.
- * Client should always call this method and never call the execute() method.
- *
- * @param monitor
- * the progress monitor to use to display progress
- * @exception InvocationTargetException
- * wraps any CoreException, runtime exception or error thrown by the execute()
- * method
- * @see WorkspaceModifyOperation - this class was directly copied from it
- */
- public synchronized final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final InvocationTargetException[] iteHolder = new InvocationTargetException[1];
- try {
-
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
-
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- doRun(pm);
- if (opStatus != null && !opStatus.isOK()) {
- // TODO do something with the status
- System.out.println(opStatus.getMessage());
- }
- } catch (InvocationTargetException e) {
- // Pass it outside the workspace runnable
- iteHolder[0] = e;
- } catch (InterruptedException e) {
- // Re-throw as OperationCanceledException, which will
- // be
- // caught and re-thrown as InterruptedException below.
- throw new OperationCanceledException(e.getMessage());
- }
- }
- };
- ISchedulingRule rule = getSchedulingRule();
- if (rule == null)
- ResourcesPlugin.getWorkspace().run(workspaceRunnable, monitor);
- else
- ResourcesPlugin.getWorkspace().run(workspaceRunnable, rule, 0, monitor);
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.OPERATION_FAILED)
- throw new WFTWrappedException(e.getStatus().getException(), e.getMessage());
- throw new WFTWrappedException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- }
- // Re-throw the InvocationTargetException, if any occurred
- if (iteHolder[0] != null) {
- throw new WFTWrappedException(iteHolder[0].getTargetException(), iteHolder[0].getMessage());
- }
- }
-
- /**
- * @return
- */
- protected ISchedulingRule getSchedulingRule() {
- return null;
- }
-
- /**
- * Typically clients should call the run(IProgressMonitor) method instead of this method. This
- * may be used by subclassed operations during execution to invoke other operations. This method
- * runs within the same the same WorkspaceRunnable as the calling operation.
- *
- * @param monitor
- * the progress monitor to use to display progress
- * @throws CoreException
- * @throws InvocationTargetException
- * @throws InterruptedException
- */
- public final void doRun(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- if (null == threadToExtendedOpControl) {
- threadToExtendedOpControl = new Hashtable();
- }
- final Thread currentThread = Thread.currentThread();
- final boolean rootOperation = !threadToExtendedOpControl.containsKey(currentThread);
-
- boolean alreadyLocked = operationDataModel == null ? true : operationDataModel.isLocked();
- boolean operationValidationEnabled = operationDataModel == null ? false : operationDataModel.isOperationValidationEnabled();
- try {
- if (rootOperation) {
- boolean allowExtensions = operationDataModel == null ? true : operationDataModel.getBooleanProperty(WTPOperationDataModel.ALLOW_EXTENSIONS);
- List restrictedExtensions = operationDataModel == null ? Collections.EMPTY_LIST : (List) operationDataModel.getProperty(WTPOperationDataModel.RESTRICT_EXTENSIONS);
- ExtendedOpControl extendedOpControl = new ExtendedOpControl(allowExtensions, restrictedExtensions);
- threadToExtendedOpControl.put(currentThread, extendedOpControl);
- }
- if (!alreadyLocked) {
- operationDataModel.setLocked(true);
- }
- if (operationValidationEnabled) {
- operationDataModel.setOperationValidationEnabled(false);
- IStatus status = operationDataModel.validateDataModel();
- if (!status.isOK()) {
- // TODO display something to user and remove System.out
- System.out.println(WTPResourceHandler.getString("24", new Object[]{status.getMessage()})); //$NON-NLS-1$
- Thread.dumpStack();
- return;
- }
- }
- initialize(monitor);
-
- if (!validateEdit())
- return;
- // if (getStatus().isOK()) {
- ComposedExtendedOperationHolder extOpHolder = initializeExtensionOperations();
- IStatus preOpStatus = runPreOps(monitor, extOpHolder);
- execute(monitor);
- IStatus postOpStatus = runPostOps(monitor, extOpHolder);
- if (null != preOpStatus)
- addExtendedStatus(preOpStatus);
- if (null != postOpStatus)
- addExtendedStatus(postOpStatus);
- // }
- } finally {
- dispose(monitor);
- if (rootOperation) {
- threadToExtendedOpControl.remove(currentThread);
- }
- if (!alreadyLocked) {
- operationDataModel.setLocked(false);
- }
- if (operationValidationEnabled) {
- operationDataModel.setOperationValidationEnabled(true);
- }
-
- }
- // CoreException and OperationCanceledException are propagated
- }
-
- /**
- * This method is called when an operation is run after initialize() is called, but before
- * execute(). If this method returns <code>true</code> then operation's execution continues,
- * otherwise, execution is aborted. Subclasses should override this method to provide any final
- * initialization and validation required before execution.
- *
- * @return
- */
- protected boolean validateEdit() {
- return true;
- }
-
- // TODO lock down addStatus so it throws runtime exceptions if not called during execute.
- // TODO make this protected and create a package level accessor for WTPOperationJobAdapter
- /**
- * <p>
- * Adds a status to this opererations status. If this operation currently has no status, then
- * the specified status becomes the operation's status. If the operation already has a status,
- * then that status is converted to a multistatus and the specified status is appendend to it.
- * </p>
- * <p>
- * This method should only be called from the execute() method of subclasses.
- * </p>
- *
- * @param aStatus
- * the status to add.
- */
- public final void addStatus(IStatus aStatus) {
- if (opStatus == null) {
- opStatus = new OperationStatus(aStatus.getMessage(), aStatus.getException());
- opStatus.setSeverity(aStatus.getSeverity());
- opStatus.add(aStatus);
- } else {
- opStatus.add(aStatus);
- }
- }
-
- /**
- * This is to keep track of extended operation stati. If the main status is WARNING, an extended
- * status of ERROR will not make the main status ERROR. If the main status is OK, an extended
- * status of ERROR or WARNING will make the main status WARNING.
- *
- * @param aStatus
- */
- private void addExtendedStatus(IStatus aStatus) {
- if (opStatus == null) {
- opStatus = new OperationStatus(new IStatus[]{WTPCommonPlugin.OK_STATUS});
- }
- opStatus.addExtendedStatus(aStatus);
- }
-
- private IStatus runPostOps(IProgressMonitor pm, ComposedExtendedOperationHolder extOpHolder) {
- IStatus postOpStatus = null;
- if ((extOpHolder != null) && extOpHolder.hasPostOps()) {
- postOpStatus = runExtendedOps(extOpHolder.getPostOps(), pm);
- }
-
- return postOpStatus;
- }
-
- private IStatus runPreOps(IProgressMonitor pm, ComposedExtendedOperationHolder extOpHolder) {
- IStatus preOpStatus = null;
- if ((extOpHolder != null) && extOpHolder.hasPreOps()) {
- preOpStatus = runExtendedOps(extOpHolder.getPreOps(), pm);
- }
- return preOpStatus;
- }
-
- private IStatus runExtendedOps(List opList, IProgressMonitor pm) {
- WTPOperation op = null;
- OperationStatus returnStatus = null;
- IStatus localStatus;
- String opId = null;
- ExtendedOpControl opControl = (ExtendedOpControl) threadToExtendedOpControl.get(Thread.currentThread());
- for (int i = 0; i < opList.size(); i++) {
- op = (WTPOperation) opList.get(i);
- opId = op.getID();
- if (opControl.shouldExecute(op.getClass().getName()) && opControl.shouldExecute(opId)) {
- try {
- boolean shouldExtendedRun = true;
- List extendedContext = (List) operationDataModel.getProperty(WTPOperationDataModel.EXTENDED_CONTEXT);
- for (int contextCount = 0; shouldExtendedRun && contextCount < extendedContext.size(); contextCount++) {
- IProject project = (IProject) AdaptabilityUtility.getAdapter(extendedContext.get(contextCount), IProject.class);
- if (null != project && !IEnablementManager.INSTANCE.getIdentifier(opId, project).isEnabled()) {
- shouldExtendedRun = false;
- }
- }
- if (shouldExtendedRun) {
- op.setOperationDataModel(operationDataModel);
- op.doRun(new SubProgressMonitor(pm, IProgressMonitor.UNKNOWN));
- localStatus = op.getStatus();
- } else
- localStatus = null;
- } catch (Exception e) {
- localStatus = new Status(IStatus.ERROR, WTPCommonPlugin.PLUGIN_ID, 0, WTPResourceHandler.getString("25", new Object[]{op.getClass().getName()}), e); //$NON-NLS-1$
- }
- if (localStatus != null) {
- if (returnStatus == null) {
- returnStatus = new OperationStatus(new IStatus[]{localStatus});
- } else {
- returnStatus.add(localStatus);
- }
- }
- }
- }
- return returnStatus;
- }
-
- // protected WTPOperation getRootExtendedOperation() {
- // if (this.getRootExtendedOperation() == null)
- // return this;
- // return this.getRootExtendedOperation();
- // }
-
- // TODO this should be deleted.
- /**
- * Note: This method is for internal use only. Clients should not call this method.
- */
- protected static final void runNestedDefaultOperation(WTPOperationDataModel model, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- WTPOperation op = model.getDefaultOperation();
- if (op != null)
- op.run(monitor);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java
deleted file mode 100644
index ee59ae6..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModel.java
+++ /dev/null
@@ -1,1153 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.frameworks.internal.WTPResourceHandler;
-
-/**
- * replace with {@link org.eclipse.wst.common.frameworks.datamodel.IDataModel} and
- * {@link org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider} WTPOperationDataModel is
- * an essential piece of both the WTP Operation and WTP Wizard frameworks. WTPOPerationDataModels
- * (DataModels) act as smart property containers used to pass various properties between components.
- * DataModels are smart property containers because they can:
- * <UL>
- * <LI>Compute default values for their properties thus saving clients from needing to populate (or
- * understand) all available properties.</LI>
- * <LI>Modify the computed default values when necessary (e.g. if the default value of property A
- * is based on property B, then A should change when B changes).</LI>
- * <LI>Notify listeners when properties change.</LI>
- * <LI>Check the validity of the of the proptery values (e.g. if a property is supposed to be an
- * Integer < 10)</LI>
- * <LI>Check the validity of the entire property set (e.g if property A is supposed to be an Iteger
- * which is a multiple of the Integer property B).</LI>
- * <LI>Supply an operation to execute.</LI>
- * <LI>Compose and decompose entire DataModels through nesting.</LI>
- * </UL>
- *
- * <B>PropertyNames </B> Clients interact with DataModels by getting and setting properties
- * (Objects) with PropertyNames. A PropertyName is a String Object uniquely identifing a particular
- * property. The recommended practice for defining PropertyNames is to define them as static final
- * Class level Strings and to use the DataModel instance class name appended with the property name
- * as the value (this should ensure uniqueness and gives a readible value when debugging).
- *
- * <A NAME="nestedDataModels"> <!-- --> </A>
- * <p>
- * <B>Nested DataModels </B>
- * <p>
- *
- *
- * The WTP Wizard framework uses DataModels to hold all the properties displayed to the user through
- * UI controls (e.g. textboxes, comboboxes, etc.). The Wizard framework also relies on DataModels
- * for validation, default values, and the operation executed on finish.
- *
- * The WTO Operation framework uses DataModels to pass all parameters for execution. The DataModel
- * validation is used to ensure all the properties are valid prior to operation execution.
- *
- * This class is EXPERIMENTAL and is subject to substantial changes.
- *
- * @link org.eclipse.wst.common.frameworks.ui.WTPWizard for details on the WTP Wizard framework.
- * @link org.eclipse.wst.common.frameworks.operations.WTPOperation for details on the WTP Operation
- * framework.
- */
-public abstract class WTPOperationDataModel implements WTPOperationDataModelListener {
-
- /**
- * A boolean property defaults to Boolean.TRUE. If this is set to Boolean.FALSE no extended
- * operations will be executed
- */
- public static final String ALLOW_EXTENSIONS = "WTPOperationDataModel.ALLOW_EXTENSIONS";
-
- /**
- * A List containing String objects, defautls to an empty List. If this list contains elements
- * and ALLOW_EXTENSIONS is set to Boolean.TRUE, then only extended operations not identified in
- * this list will be executed. These strings should either be the operation id or the fully
- * qualified oeration class name
- */
- public static final String RESTRICT_EXTENSIONS = "WTPOperationDataModel.RESTRICT_EXTENSIONS";
-
- /**
- * This property is used by the extended operation framework. Extended operations run within a
- * context; e.g. they run within the scope of a project, resource, file, etc. The default value
- * for this property is an empty List. Subclasses should configure themselves to return a list
- * Objects. Each Object represents a Context which should be adaptable to IProject.
- */
- protected static final String EXTENDED_CONTEXT = "WTPOperationDataModel.EXTENDED_CONTEXT"; //$NON-NLS-1$
-
- /**
- * An unsettable property used soley to trip validation for nested models. Clients only use this
- * property for validation purposes and never get or set its value. Subclasses can override
- * nested model validation by checking for this property in the doValidate method and not
- * calling super with it.
- */
- public static final String NESTED_MODEL_VALIDATION_HOOK = "WTPOperationDataModel.NESTED_MODEL_VALIDATION_HOOK"; //$NON-NLS-1$
- /**
- * Optional, type boolean This boolean was added for users who wish to delay the operation from
- * being run on a "finish". The operation will be cached in the CACHED_DELAYED_OPERATION which
- * then leaves the user responsible for running this operation when they see fit.
- */
- public static final String RUN_OPERATION = "WTPOperationDataModel.RUN_OPERATION"; //$NON-NLS-1$
- /**
- * Internal, type WTPOperation
- */
- public static final String CACHED_DELAYED_OPERATION = "WTPOperationDataModel.CACHED_DELAYED_OPERATION"; //$NON-NLS-1$
- /**
- * Optional Operation handler to allow user to prompt on save defaults to NullOperationHandler()
- * set to UIOperationHanlder() to add prompt
- */
- public static final String UI_OPERATION_HANLDER = "WTPOperationDataModel.UI_OPERATION_HANLDER"; //$NON-NLS-1$
-
- /**
- * This is a convenience static status for subclasses to return during validation when the
- * validation is OK.
- */
- protected static IStatus OK_STATUS = new Status(IStatus.OK, "org.eclipse.wst.common.frameworks.internal", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
-
- private static final String PROPERTY_NOT_LOCATED_ = WTPResourceHandler.getString("20"); //$NON-NLS-1$
- private static final String NESTED_MODEL_NOT_LOCATED = WTPResourceHandler.getString("21"); //$NON-NLS-1$
- private static final String NESTED_MODEL_DUPLICATE = WTPResourceHandler.getString("33"); //$NON-NLS-1$
-
- private static final WTPPropertyDescriptor[] NO_DESCRIPTORS = new WTPPropertyDescriptor[0];
-
- private Set validProperties = new HashSet();
- private Set validBaseProperties = new HashSet();
- private Map propertyValues = new Hashtable();
- private Map nestedModels;
- private Set nestingModels;
- private List listeners;
- private boolean ignorePropertyChanges = false;
- private boolean notificationEnabled = true;
- private boolean locked = false;
- private boolean operationValidationEnabled = false;
- private boolean hasBeenExecutedAgainst = false;
- private boolean suspendValidation = false;
-
- /**
- * <p>
- * The WTPOperationDataModel constructor. This constructor will first add the base
- * WTPOPerationDataModel properties (RUN_OPERATION, CACHED_DELAYED_OPERATION, and
- * UI_OPERATION_HANLDER). It then invokes the following:
- * </p>
- * <ol>
- * <li><b><code>initValidBaseProperties()</code> </b> subclasses should override this method
- * to add their properties using <code>addValidBaseProperty(String)</code>.</li>
- * <li><b><code>initNestedModels()</code> </b> subclasses should override this method to add
- * their nested models using <code>addNestedModel(String, WTPOperationDataModel)</code>.
- * </li>
- * <li><b><code>init()</code> </b> subclasses should override this method to perform any
- * final initialization.</li>
- * </ol>
- *
- * @see #initValidBaseProperties()
- * @see #initNestedModels()
- * @see #init()
- */
- public WTPOperationDataModel() {
- init_internal();
- }
-
- private final void init_internal() {
- addValidBaseProperty(EXTENDED_CONTEXT);
- addValidBaseProperty(RUN_OPERATION);
- addValidBaseProperty(CACHED_DELAYED_OPERATION);
- addValidBaseProperty(UI_OPERATION_HANLDER);
- addValidBaseProperty(ALLOW_EXTENSIONS);
- addValidBaseProperty(RESTRICT_EXTENSIONS);
- initValidBaseProperties();
- initNestedModels();
- init();
- }
-
- /**
- * Subclasses should use this method within <code>initValidBaseProperties()</code> to add
- * properties.
- *
- * @param propertyName
- * The property name to be added.
- * @see #initValidBaseProperties()
- */
- protected final void addValidBaseProperty(String propertyName) {
- validBaseProperties.add(propertyName);
- validProperties.add(propertyName);
- }
-
- /**
- * Subclasses should override this method to add properties using
- * <code>addValidBaseProperty(String)</code>.
- *
- * @see #addValidBaseProperty(String)
- * @see #WTPOperationDataModel()
- */
- protected void initValidBaseProperties() {
- }
-
- /**
- * Subclasses should override this method to add nested DataModels using
- * <code>addNestedModel(String, WTPOperationDataModel)</code>.
- *
- * @see #addNestedModel(String, WTPOperationDataModel)
- * @see #WTPOperationDataModel()
- */
- protected void initNestedModels() {
- }
-
- /**
- * Subclasses should override this method to perform any final initialization not covered by
- * either <code>initValidBaseProperties()</code> or <code>initNestedModels()</code>.
- *
- * @see #initValidBaseProperties()
- * @see #initNestedModels()
- * @see #WTPOperationDataModel()
- */
- protected void init() {
- }
-
- /**
- * <p>
- * This method is used to nest the specified WTPOperationDataModel within this
- * WTPOperationDataModel. The <code>modelName</code> argument should be a unique String to
- * identify this particular nested DataModel. The same String is required when accessing the
- * nested DataModel using either <code>getNestedModel(String)</code> or
- * <code>removeNestedModel(String)</code>. If this is the first nested DataModel being added,
- * then the <code>NESTED_MODEL_VALIDATION_HOOK</code> will be added to this DataModel .
- * </p>
- * <p>
- * Refer to <A HREF="#nestedDataModels"> <CODE>NestedDataModels</CODE> </A>.
- * </p>
- *
- * @param modelName
- * the name of the WTPOperationDataModel to be nested
- * @param dataModel
- * the WTPOperationDataModel to be nested
- *
- * @see #getNestedModel(String)
- * @see #removeNestedModel(String)
- */
- public final void addNestedModel(String modelName, WTPOperationDataModel dataModel) {
- if (dataModel == null)
- return;
- if (null == nestedModels) {
- validBaseProperties.add(NESTED_MODEL_VALIDATION_HOOK);
- validProperties.add(NESTED_MODEL_VALIDATION_HOOK);
- nestedModels = new Hashtable();
- }
- if (null == dataModel.nestingModels) {
- dataModel.nestingModels = new HashSet();
- }
- if (dataModel.nestingModels.contains(this)) {
- throw new RuntimeException(NESTED_MODEL_DUPLICATE);
- }
- dataModel.nestingModels.add(this);
-
- nestedModels.put(modelName, dataModel);
-
- addNestedProperties(dataModel.validProperties);
- dataModel.addListener(this);
- }
-
- private void addNestedProperties(Set nestedProperties) {
- boolean propertiesAdded = validProperties.addAll(nestedProperties);
- // Pass the new properties up the nesting chain
- if (propertiesAdded && nestingModels != null) {
- Iterator iterator = nestingModels.iterator();
- while (iterator.hasNext()) {
- ((WTPOperationDataModel) iterator.next()).addNestedProperties(nestedProperties);
- }
- }
- }
-
- public Iterator getNestedModels() {
- return nestedModels.values().iterator();
- }
-
- public Iterator getNestingModels() {
- return nestingModels.iterator();
- }
-
- /**
- * Subclasses should override to return a WTPOperation to execute using this DataModel instance.
- * The goal is for clients of to be able to simple create an instance of a particular DataModel,
- * set a few properties on it, and then execute the operation returned by getDefaultOperation()
- *
- * @return an initialized and executable WTPOperation
- */
- public abstract WTPOperation getDefaultOperation();
-
- public WTPOperationDataModel removeNestedModel(String modelName) {
- if (modelName == null || nestedModels == null)
- return null;
- WTPOperationDataModel model = (WTPOperationDataModel) nestedModels.remove(modelName);
- model.nestingModels.remove(this);
- removeNestedProperties(model.validProperties);
- model.removeListener(this);
- if (nestedModels.isEmpty()) {
- nestedModels = null;
- validBaseProperties.remove(NESTED_MODEL_VALIDATION_HOOK);
- validProperties.remove(NESTED_MODEL_VALIDATION_HOOK);
- }
- return model;
- }
-
- private void removeNestedProperties(Set nestedProperties) {
- Iterator iterator = nestedProperties.iterator();
- String property = null;
- boolean keepProperty = false;
- Set nestedPropertiesToRemove = null;
- while (iterator.hasNext()) {
- keepProperty = false;
- property = (String) iterator.next();
- if (validBaseProperties.contains(property)) {
- keepProperty = true;
- }
- if (!keepProperty && nestedModels != null) {
- Iterator nestedModelsIterator = nestedModels.values().iterator();
- while (!keepProperty && nestedModelsIterator.hasNext()) {
- WTPOperationDataModel nestedModel = (WTPOperationDataModel) nestedModelsIterator.next();
- if (nestedModel.isProperty(property)) {
- keepProperty = true;
- }
- }
- }
- if (!keepProperty) {
- if (null == nestedPropertiesToRemove) {
- nestedPropertiesToRemove = new HashSet();
- }
- nestedPropertiesToRemove.add(property);
- }
- }
-
- if (null != nestedPropertiesToRemove) {
- validProperties.removeAll(nestedPropertiesToRemove);
- if (nestingModels != null) {
- Iterator nestingModelsIterator = nestingModels.iterator();
- while (nestingModelsIterator.hasNext()) {
- ((WTPOperationDataModel) nestingModelsIterator.next()).removeNestedProperties(nestedPropertiesToRemove);
- }
- }
- }
- }
-
-
- public final WTPOperationDataModel getNestedModel(String modelName) {
- WTPOperationDataModel dataModel = (WTPOperationDataModel) nestedModels.get(modelName);
- if (null == dataModel) {
- throw new RuntimeException(NESTED_MODEL_NOT_LOCATED + modelName);
- }
- return dataModel;
- }
-
- /**
- * Subclasses can override this method to determine if a given propertyName should be enabled
- * for edit. Returning null indicates that there is no precedence on the enablement. Note that
- * you can override this in an outer model since enablement may be different in the outer model.
- *
- * @param propertyName
- * @return the property's enablment state, null indicates there is no state
- */
- public final Boolean isEnabled(String propertyName) {
- checkValidPropertyName(propertyName);
- return basicIsEnabled(propertyName);
- }
-
- /**
- * Subclasses can override this method to determine if a given propertyName should be enabled
- * for edit. Returning null indicates that there is no precedence on the enablement. Note that
- * you can override this in an outer model since enablement may be different in the outer model.
- *
- * @param propertyName
- * @return
- */
- protected Boolean basicIsEnabled(String propertyName) {
- if (isBaseProperty(propertyName)) {
- return null;
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- return dataModel.isEnabled(propertyName);
- }
- }
- }
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
-
- /**
- * <p>
- * Returns a WTPPropertyDescriptor array consisting of all valid WTPPropertyDescriptors for the
- * specified property. Each WTPPropertyDescriptor {@see WTPPropertyDescriptor for details}
- * contains a value and a human readible description for the value. The set of all values in the
- * returned array are those values which are valid for the DataModel. This value set only makes
- * sense when valid property values conform to a well defined finite set. If no such value set
- * exists for the property, the a 0 length array is returned. <code>null</code> is never
- * returned.
- * </p>
- * <p>
- * As an example, suppose there is a property called <code>SHIRT_SIZE</code> which is an
- * <code>Integer</code> type. Also suppse that valid shirt sizes are only small, medium, or
- * large. However, the actual values representing small, medium, and large are 1, 2, and 3
- * respectively. A call to <code>getValidPropertyDescriptors(SHIRT_SIZE)</code> would return a
- * WTPPropertyDescriptor array where the value, description pairs would be {(1, small), (2,
- * medium), (3, large)}.
- * </p>
- * <p>
- * Subclasses should override {@see #doGetValidPropertyDescriptors(String)}as necessary.
- * </p>
- *
- * @param propertyName
- * @return the array of valid WTPPropertyDescriptors
- * @see #getPropertyDescriptor(String)
- * @see #doGetValidPropertyDescriptors(String)
- */
- public final WTPPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- checkValidPropertyName(propertyName);
- if (isBaseProperty(propertyName)) {
- WTPPropertyDescriptor[] descriptors = doGetValidPropertyDescriptors(propertyName);
- if (null == descriptors) {
- descriptors = NO_DESCRIPTORS;
- }
- return descriptors;
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- return dataModel.getValidPropertyDescriptors(propertyName);
- }
- }
- }
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
-
- /**
- * Subclasses should override this method to return their set of valid WTPPropertyDescriptors.
- * This default implementation returns: <code>new WTPPropertyDescriptor[0];</code>
- *
- * @param propertyName
- * @return
- *
- * @see #getValidPropertyDescriptors(String)
- */
- protected WTPPropertyDescriptor[] doGetValidPropertyDescriptors(String propertyName) {
- return NO_DESCRIPTORS;
- }
-
- /**
- * <p>
- * Returns a WTPPropertyDescriptor for the specified property. The
- * <code>getPropertyValue()</code> method on the returned WTPPropertyDescriptor will be the
- * same value as returned by <code>getPropertyValue(propertyName)</code>.
- * </p>
- * <p>
- * Following the example introduced in {@see #getValidPropertyDescriptors(String)}, suppose the
- * <code>SHIRT_SIZE</code> property is currently set to 1. A call to this method would return
- * a WTPPropertyDescriptor whose <code>getPropertyValue()</code> returns <code>1</code> and
- * whose <code>getPropertyDescription()</code> returns <code>small</code>.
- * </p>
- * <p>
- * Also, note that even if a particular property is not confined to a finite set of values as
- * defined by {@see #getValidPropertyDescriptors(String)}this method will always return a valid
- * WTPPropertyDescriptor.
- * </p>
- * <p>
- * Subclasses should should override {@see #doGetPropertyDescriptor(String)}as necessary.
- * </p>
- *
- * @param propertyName
- * @return the WTPPropertyDescriptor for the specified property
- *
- * @see #doGetValidPropertyDescriptors(String)
- * @see #doGetPropertyDescriptor(String)
- */
- public final WTPPropertyDescriptor getPropertyDescriptor(String propertyName) {
- checkValidPropertyName(propertyName);
- if (isBaseProperty(propertyName)) {
- return doGetPropertyDescriptor(propertyName);
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- return dataModel.doGetPropertyDescriptor(propertyName);
- }
- }
- }
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
-
- /**
- * Subclasses should override this method as necessary. This default implementation returns
- * <code>new WTPPropertyDescriptor(getProperty(propertyName));</code>.
- *
- * @param propertyName
- * @return
- */
- protected WTPPropertyDescriptor doGetPropertyDescriptor(String propertyName) {
- return new WTPPropertyDescriptor(getProperty(propertyName));
- }
-
- /**
- * <p>
- * A convenience method for getting Strings. If the property is set then this method is
- * equavalent to:
- * <p>
- * <code>(String)getProperty(propertyName)</code>
- * <p>
- * If the property is unset, the empty String, <code>""</code>, will be returned.
- *
- * @param propertyName
- * @param value
- * @see #setProperty(String, Object)
- */
- public final String getStringProperty(String propertyName) {
- Object prop = getProperty(propertyName);
- if (prop == null)
- return ""; //$NON-NLS-1$
- return (String) prop;
- }
-
- /**
- * <p>
- * A convenience method for getting booleans. If the property is set then this method is
- * equavalent to:
- * <p>
- * <code>((Boolean)getProperty(propertyName)).booleanValue();</code>
- * <p>
- * If the property is unset, <code>false</code> will be returned.
- *
- * @param propertyName
- * the property name
- * @return the boolean value of the property
- * @see #setProperty(String, Object)
- * @see #setBooleanProperty(String, int)
- */
- public final boolean getBooleanProperty(String propertyName) {
- Object prop = getProperty(propertyName);
- if (prop == null)
- return false;
- return ((Boolean) prop).booleanValue();
- }
-
- /**
- * <p>
- * A convenience method for getting ints. If the property is set then this method is equavalent
- * to:
- * <p>
- * <code>((Integer)getProperty(propertyName)).intValue();</code>
- * <p>
- * If the property is unset, <code>-1</code> will be returned.
- *
- * @param propertyName
- * the property name
- * @return the int value of the property
- * @see #setProperty(String, Object)
- * @see #setIntProperty(String, int)
- */
- public final int getIntProperty(String propertyName) {
- Object prop = getProperty(propertyName);
- if (prop == null)
- return -1;
- return ((Integer) prop).intValue();
- }
-
- /**
- * <p>
- * A convenience method for setting booleans. This method is equavalent to:
- * <p>
- * <code>setProperty(propertyName, (value) ? Boolean.TRUE : Boolean.FALSE);</code>
- * </p>
- *
- * @param propertyName
- * the name of the property
- * @param value
- * the <code>boolean</code> value of the property
- * @see #setProperty(String, Object)
- * @see #getBooleanProperty(String)
- */
- public final void setBooleanProperty(String propertyName, boolean value) {
- setProperty(propertyName, (value) ? Boolean.TRUE : Boolean.FALSE);
- }
-
- /**
- * <p>
- * A convenience method for setting ints. This method is equavalent to:
- * <p>
- * <code>setProperty(propertyName, new Integer(value));</code>
- * </p>
- *
- * @param propertyName
- * the name of the property
- * @param value
- * the <code>int</code> value of the property
- * @see #setProperty(String, Object)
- * @see #getIntProperty(String)
- */
- public void setIntProperty(String propertyName, int value) {
- setProperty(propertyName, new Integer(value));
- }
-
- /**
- * Override this method to compute default property values.
- *
- * @param propertyName
- * @return
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(EXTENDED_CONTEXT)) {
- Object targetProject = getTargetProject(); // TODO delete this block with
- // getTargetProject()
- if (null == targetProject) {
- return Collections.EMPTY_LIST;
- } else {
- List list = new ArrayList();
- list.add(targetProject);
- return list;
- }
- } else if (propertyName.equals(RUN_OPERATION) || propertyName.equals(ALLOW_EXTENSIONS)) {
- return Boolean.TRUE;
- } else if (propertyName.equals(UI_OPERATION_HANLDER)) {
- return new NullOperationHandler();
- } else if (propertyName.equals(RESTRICT_EXTENSIONS)) {
- return Collections.EMPTY_LIST;
- }
- return null;
- }
-
- /**
- * Returns <code>true</code> if the specified propertyName is a valid propertyName for this
- * root DataModel only. Nested DataModels are not checked.
- *
- * @param propertyName
- * @return
- * @see #isProperty(String)
- */
- public final boolean isBaseProperty(String propertyName) {
- if (validBaseProperties != null)
- return validBaseProperties.contains(propertyName);
- return true;
- }
-
- /**
- * Returns <code>true</code> if the specified propertyName is a valid propertyName for this
- * DataModel or any of its (recursively) nested DataModels.
- *
- * @param propertyName
- * @return
- * @see #isBaseProperty(String)
- */
- public final boolean isProperty(String propertyName) {
- return validProperties.contains(propertyName);
- }
-
- private void checkValidPropertyName(String propertyName) {
- if (!validProperties.contains(propertyName)) {
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
- }
-
- /**
- * <p>
- * Returns the property value for the specified propertyName.
- * </p>
- * <p>
- * If the specified propertyName is not a property {@see #isProperty(String)}then a
- * RuntimeException will be thrown.
- * </p>
- * <p>
- * If the specified propertyName is a base property {@see #isBaseProperty(String)}then it will
- * immediatly be set and nested models will not be affected. If it is not a base property (i.e.
- * it is a property for a nested DataModel) then a recursive search through nested DataModels
- * will be conducted. The first nested DataModel having the property will return its value.
- * </p>
- *
- * @param propertyName
- * @return
- *
- * @see #getBooleanProperty(String)
- * @see #getIntProperty(String)
- * @see #getStringProperty(String)
- */
- public final Object getProperty(String propertyName) {
- checkValidPropertyName(propertyName);
- if (isBaseProperty(propertyName)) {
- return doGetProperty(propertyName);
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- return dataModel.getProperty(propertyName);
- }
- }
- }
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
-
- /**
- * <p>
- * Though generally unecessary, implementors may override this method as they see fit.
- * <p>
- *
- * @param propertyName
- * @return
- */
- protected Object doGetProperty(String propertyName) {
- if (propertyValues.containsKey(propertyName)) {
- return propertyValues.get(propertyName);
- }
- return getDefaultProperty(propertyName);
- }
-
- /**
- * <p>
- * Sets the specified propertyName to the specified propertyValue. Subsequent calls to
- * #getProperty(String) will return the same propertyValue.
- * <p>
- * When a propertyValue other than <code>null</code> is set, then the property is considered
- * "set" (see #isSet(String)), conversly, a propertyValue of <code>null</code> is considered
- * "unset".
- * <p>
- * If the specified propertyName is not a property (see#isProperty(String)) then a
- * RuntimeException will be thrown.
- * <p>
- * Attempting to set a propertyName when this DataModel is locked (see #isLocked()) will result
- * in a thrown IllegalStateException. An IllegalStateException will not be thrown, however, if
- * the propertyName is a Result Property, (see #isResultProperty(String)).
- * <p>
- *
- * @param propertyName
- * @param propertyValue
- *
- *
- * @see #getProperty(String)
- * @see #isSet(String)
- * @see #isProperty(String)
- * @see #isResultProperty(String)
- * @see #isLocked()
- *
- * <p>
- * There are also convenience methods for setting properties representing property types of
- * boolean and int.
- * <p>
- * @see #setBooleanProperty(String, boolean)
- * @see #setIntProperty(String, int)
- */
- public final void setProperty(String propertyName, Object propertyValue) {
- if (isLocked() && !isResultProperty(propertyName))
- throw new IllegalStateException(WTPResourceHandler.getString("18", new Object[]{getClass().getName()})); //$NON-NLS-1$
- if (ignorePropertyChanges)
- return; // ignoring property changes
- checkValidPropertyName(propertyName);
- boolean nestedFound = false;
- if (isBaseProperty(propertyName)) {
- internalSetProperty(propertyName, propertyValue);
- return;
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- nestedFound = true;
- dataModel.setProperty(propertyName, propertyValue);
- }
- }
- }
- if (!nestedFound) {
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
- }
-
- private final void internalSetProperty(String propertyName, Object propertyValue) {
- Object oldValue = propertyValues.get(propertyName);
- if (valueChanged(propertyValue, oldValue)) {
- if (doSetProperty(propertyName, propertyValue)) {
- notifyListeners(propertyName, WTPOperationDataModelEvent.PROPERTY_CHG);
- }
- }
- }
-
- /*
- * Return true to notify listeners.
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- if (null != propertyValue)
- propertyValues.put(propertyName, propertyValue);
- else if (propertyValues.containsKey(propertyName))
- propertyValues.remove(propertyName);
- return true;
- }
-
- private boolean valueChanged(Object o1, Object o2) {
- return o1 != o2 && ((o1 != null && !o1.equals(o2)) || !o2.equals(o1));
- }
-
- /**
- * Convenience method to create a WTPOperationDataModelEvent.PROPERTY_CHG event and notify
- * listeners.
- *
- * @param propertyName
- * @see #notifyListeners(WTPOperationDataModelEvent)
- */
- protected void notifyListeners(String propertyName) {
- notifyListeners(propertyName, WTPOperationDataModelEvent.PROPERTY_CHG);
- }
-
- /**
- * Convenience method to create a WTPOperationDataModelEvent event of the specified type and
- * notify listeners.
- *
- * @param propertyName
- * @see WTPOperationDataModelEvent for the list of valid flag values
- */
- protected void notifyListeners(String propertyName, int flag) {
- notifyListeners(new WTPOperationDataModelEvent(this, propertyName, flag));
- }
-
- /**
- * Notifies all registerd WTPOperationDataModelListeners of the specified
- * WTPOperationDataModelEvent.
- *
- * @param event
- */
- protected void notifyListeners(WTPOperationDataModelEvent event) {
- if (notificationEnabled && listeners != null && !listeners.isEmpty()) {
- WTPOperationDataModelListener listener;
- for (int i = 0; i < listeners.size(); i++) {
- listener = (WTPOperationDataModelListener) listeners.get(i);
- if (listener != event.getDataModel()) {
- listener.propertyChanged(event);
- }
- }
- }
- }
-
- public void propertyChanged(WTPOperationDataModelEvent event) {
- notifyListeners(event);
- }
-
- public boolean isSet(String propertyName) {
- checkValidPropertyName(propertyName);
- if (isBaseProperty(propertyName)) {
- return propertyValues.containsKey(propertyName);
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- return dataModel.isSet(propertyName);
- }
- }
- }
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
-
- public final IStatus validateDataModel() {
- return validateDataModel(false);
- }
-
- public final IStatus validateDataModel(boolean stopOnFirstFailure) {
- if (suspendValidation)
- return OK_STATUS;
- IStatus status = null;
- if (validBaseProperties != null && !validBaseProperties.isEmpty()) {
- IStatus propStatus;
- String propName;
- Iterator it = validBaseProperties.iterator();
- while (it.hasNext()) {
- propName = (String) it.next();
- propStatus = validateProperty(propName);
- if (status == null || status.isOK())
- status = propStatus;
- else {
- if (status.isMultiStatus())
- ((MultiStatus) status).merge(propStatus);
- else {
- MultiStatus multi = new MultiStatus("org.eclipse.wst.common.frameworks.internal", 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
- multi.merge(status);
- multi.merge(propStatus);
- status = multi;
- }
- }
- if (stopOnFirstFailure && status != null && !status.isOK() && status.getSeverity() == IStatus.ERROR)
- return status;
- }
- }
- if (status == null)
- return OK_STATUS;
- return status;
- }
-
- public void addListener(WTPOperationDataModelListener listener) {
- if (listener != null) {
- if (listeners == null) {
- listeners = new ArrayList();
- listeners.add(listener);
- } else if (!listeners.contains(listener))
- listeners.add(listener);
- }
- }
-
- public void removeListener(WTPOperationDataModelListener listener) {
- if (listeners != null && listener != null)
- listeners.remove(listener);
- }
-
- /**
- * Return true if the model doesn't have any errors.
- *
- * @return boolean
- */
- public boolean isValid() {
- IStatus status = validateDataModel(true);
- if (status.isOK())
- return true;
- if (status.getSeverity() == IStatus.ERROR)
- return false;
- return true;
- }
-
- /**
- * Use this method when the model should ignore any property set calls. Remember to always reset
- * the value in a finally block.
- *
- * @param aBoolean
- */
- public void setIgnorePropertyChanges(boolean aBoolean) {
- ignorePropertyChanges = aBoolean;
- }
-
- /**
- * Return the status for the validation of a particular property. Subclasses should override
- * when a specific validation is required.
- *
- * @param propertyName
- * @return
- */
- protected IStatus doValidateProperty(String propertyName) {
- if (NESTED_MODEL_VALIDATION_HOOK.equals(propertyName)) {
- if (nestedModels != null && !nestedModels.isEmpty()) {
- IStatus modelStatus;
- WTPOperationDataModel dataModel;
- Iterator it = nestedModels.values().iterator();
- while (it.hasNext()) {
- dataModel = (WTPOperationDataModel) it.next();
- modelStatus = dataModel.validateDataModel(true);
- if (!modelStatus.isOK()) {
- return modelStatus;
- }
- }
- }
- }
- return OK_STATUS;
- }
-
- public final IStatus validateProperty(String propertyName) {
- if (suspendValidation)
- return OK_STATUS;
- checkValidPropertyName(propertyName);
- if (isBaseProperty(propertyName)) {
- return doValidateProperty(propertyName);
- } else if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- boolean propertyFound = false;
- IStatus status = null;
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- if (dataModel.isProperty(propertyName)) {
- propertyFound = true;
- status = dataModel.validateProperty(propertyName);
- if (!status.isOK()) {
- return status;
- }
- }
- }
- if (propertyFound) {
- return OK_STATUS;
- }
- }
- throw new RuntimeException(PROPERTY_NOT_LOCATED_ + propertyName);
- }
-
- // handles for validation enablement for model and nested children
- protected void enableValidation() {
- suspendValidation = false;
- if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- dataModel.enableValidation();
- }
- }
- }
-
- // handles for validation disablement for model and nested children
- protected void disableValidation() {
- suspendValidation = true;
- if (nestedModels != null) {
- WTPOperationDataModel dataModel = null;
- Object[] keys = nestedModels.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- dataModel = (WTPOperationDataModel) nestedModels.get(keys[i]);
- dataModel.disableValidation();
- }
- }
- }
-
- /**
- * This method should be called from doSetProperty(String, Object) when a change to a
- * propertyName will cause default values within the model to change. The passed propertyName is
- * another property that may need to have its default value recomputed. This allows for UIs to
- * refresh.
- *
- * @param propertyName
- */
- public void notifyDefaultChange(String propertyName) {
- if (!isSet(propertyName))
- notifyListeners(propertyName, WTPOperationDataModelEvent.PROPERTY_CHG);
- }
-
- /**
- * This method should be called when the valid values for the given propertyName may need to be
- * recaculated. This allows for UIs to refresh.
- *
- * @param propertyName
- */
- public void notifyValidValuesChange(String propertyName) {
- notifyListeners(propertyName, WTPOperationDataModelEvent.VALID_VALUES_CHG);
- }
-
- protected void notifyEnablementChange(String propertyName) {
- Boolean enable = isEnabled(propertyName);
- if (enable != null) {
- notifyListeners(propertyName, WTPOperationDataModelEvent.ENABLE_CHG);
- }
- }
-
- public void dispose() {
- }
-
- protected boolean isNotificationEnabled() {
- return notificationEnabled;
- }
-
- protected void setNotificationEnabled(boolean notificationEnabled) {
- this.notificationEnabled = notificationEnabled;
- }
-
- /**
- * @return Returns the locked.
- */
- protected final boolean isLocked() {
- return locked;
- }
-
- /**
- * @param locked
- * The locked to set.
- */
- protected final void setLocked(boolean locked) {
- this.locked = locked;
- if (locked)
- hasBeenExecutedAgainst = true;
- }
-
- /**
- * By Overwriting this method, you can change the model when its executing. This is only
- * recommened when you need to set the result of the operation in the model.
- *
- * @param propertyName
- * @return
- */
- protected boolean isResultProperty(String propertyName) {
- return false;
- }
-
-
- public final boolean isOperationValidationEnabled() {
- return operationValidationEnabled;
- }
-
- public final void setOperationValidationEnabled(boolean operationValidationEnabled) {
- this.operationValidationEnabled = operationValidationEnabled;
- }
-
- /**
- * This method is EXPERIMENTAL and is subject to substantial changes.
- *
- * Gets the specified array of properties from the source DataModel and sets them on the
- * destination DataModel.
- *
- * @param source
- * @param destination
- * @param properties
- */
- public static void copyProperties(WTPOperationDataModel source, WTPOperationDataModel destination, String[] properties) {
- for (int i = 0; i < properties.length; i++) {
- destination.setProperty(properties[i], source.getProperty(properties[i]));
- }
- }
-
-
- /**
- * Recursively removes all property values of this DataModel and all nested DataModels.
- */
- public void clearAllValues() {
- if (propertyValues != null)
- propertyValues.clear();
- if (nestedModels != null) {
- Iterator it = nestedModels.values().iterator();
- while (it.hasNext())
- ((WTPOperationDataModel) it.next()).clearAllValues();
- }
- }
-
- /**
- * Use this method to determine if an operation has been run using this data model.
- *
- * @return
- */
- public boolean hasBeenExecutedAgainst() {
- return hasBeenExecutedAgainst;
- }
-
- // TODO delete this
- /**
- * This will be deleted before WTP M4 If this is used for extended operations, see the property
- * EXTENDED_CONTEXT. Otherwise, there is no replacement method.
- *
- * @deprecated see #EXTENDED_CONTEXT
- */
- public IProject getTargetProject() {
- return null;
- }
-
- public Set getValidProperties() {
- return Collections.unmodifiableSet(validProperties);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModelEvent.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModelEvent.java
deleted file mode 100644
index ed70e10..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModelEvent.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operations;
-
-/**
- * replace with {@link org.eclipse.wst.common.frameworks.datamodel.DataModelEvent}
- * This event is used to communicate property changes from WTPOperationDataModels to their
- * WTPOperationDataModelListeners.
- *
- * This class may be instantiated; it is not intended to be subclassed.
- *
- * This class is EXPERIMENTAL and is subject to substantial changes.
- *
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel#addListener(WTPOperationDataModelListener)
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelListener
- */
-public class WTPOperationDataModelEvent {
-
- /**
- * A flag used to specify the property's value has changed.
- *
- * @see WTPOperationDataModel#getProperty(String)
- * @see #getFlag()
- */
- public static final int PROPERTY_CHG = 1;
-
- /**
- * A flag used to specify the property's valid values have changed.
- *
- * @see WTPOperationDataModel#getValidPropertyDescriptors(String)
- * @see #getFlag()
- */
- public static final int VALID_VALUES_CHG = 4;
-
- /**
- * A flag used to specify the property's enablment has changed.
- *
- * @see WTPOperationDataModel#isEnabled(String)
- * @see #getFlag()
- */
- public static final int ENABLE_CHG = 3;
-
- private WTPOperationDataModel dataModel;
- private String propertyName;
- private int flag;
-
- /**
- * Constructor for WTPOperationDataModelEvent
- *
- * @param dataModel
- * the dataModel whose property has changed
- * @param propertyName
- * the name of the changed property
- * @param flag
- * contains a flag specifiying the event type
- */
- public WTPOperationDataModelEvent(WTPOperationDataModel dataModel, String propertyName, int flag) {
- this.dataModel = dataModel;
- this.propertyName = propertyName;
- this.flag = flag;
- }
-
- /**
- * Returns the dataModel whose property has changed.
- *
- * @return the dataModel whose property has changed.
- */
- public WTPOperationDataModel getDataModel() {
- return dataModel;
- }
-
- /**
- * Returns the name of the changed property.
- *
- * @return the name of the changed property.
- */
- public String getPropertyName() {
- return propertyName;
- }
-
- /**
- * Returns the flag indicating the event type. Valid types are:
- * <ul>
- * <li><code>PROPERTY_CHG</code></li>
- * <li><code>VALID_VALUES_CHG</code></li>
- * <li><code>ENABLE_CHG</code></li>
- * </ul>
- *
- * @return the flag indicating the event type.
- */
- public int getFlag() {
- return flag;
- }
-
- /**
- * Convenience method to return the dataModel's property. This is equavalent to:
- * <code>getDataModel().getProperty(getPropertyName())</code>.
- *
- * @return the dataModel's property.
- * @see WTPOperationDataModel#getProperty(String)
- */
- public Object getProperty() {
- return dataModel.getProperty(propertyName);
- }
-
- /**
- * Convenience method to return the dataModel property's enablement state. This is equavalent
- * to: <code>getDataModel().isEnabled(getPropertyName())</code>.
- *
- * @return the dataModel property's enablement state.
- * @see WTPOperationDataModel#isEnabled(String)
- */
- public Boolean isEnabled() {
- return dataModel.isEnabled(propertyName);
- }
-
- /**
- * Convenience method to return the dataModel property's valid property descriptors. This is
- * equavalent to: <code>getDataModel().getValidPropertyDescriptors(getPropertyName())</code>.
- *
- * @return the dataModel property's valid property descriptors.
- * @see WTPOperationDataModel#getValidPropertyDescriptors(String)
- */
- public WTPPropertyDescriptor[] getValidPropertyDescriptors() {
- return dataModel.getValidPropertyDescriptors(propertyName);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModelListener.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModelListener.java
deleted file mode 100644
index db2f61a..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationDataModelListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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.frameworks.internal.operations;
-
-/**
- * replace with {@link org.eclipse.wst.common.frameworks.datamodel.IDataModelListener}
- * Clients wishing to register with a WTPOperationData to receive WTPOperationDataModelEvents need
- * to implement this interface.
- *
- * This class is EXPERIMENTAL and is subject to substantial changes.
- *
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel#addListener(WTPOperationDataModelListener)
- */
-public interface WTPOperationDataModelListener {
- //TODO delete this
- /**
- * This will be deleted before WTP M4. Use WTPOperationDataModelEvent.PROPERTY_CHG instead.
- *
- * @deprecated Use WTPOperationDataModelEvent.PROPERTY_CHG instead.
- */
- final int PROPERTY_CHG = WTPOperationDataModelEvent.PROPERTY_CHG;
-
- //TODO delete this
- /**
- * This will be deleted before WTP M4. Use WTPOperationDataModelEvent.VALID_VALUES_CHG instead.
- *
- * @deprecated Use WTPOperationDataModelEvent.VALID_VALUES_CHG instead.
- */
- final int VALID_VALUES_CHG = WTPOperationDataModelEvent.VALID_VALUES_CHG;
-
- //TODO delete this
- /**
- * This will be deleted before WTP M4. Use WTPOperationDataModelEvent.ENABLE_CHG instead.
- *
- * @deprecated Use WTPOperationDataModelEvent.ENABLE_CHG instead.
- */
- final int ENABLE_CHG = WTPOperationDataModelEvent.ENABLE_CHG;
-
- /**
- * This method is invoked on listening clients when a property changes.
- *
- * @param event
- * the event carrying the notification.
- */
- void propertyChanged(WTPOperationDataModelEvent event);
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationJobAdapter.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationJobAdapter.java
deleted file mode 100644
index 07d540f..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPOperationJobAdapter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 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
- **************************************************************************************************/
-/*
- * Created on Jan 20, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.wst.common.frameworks.internal.operations;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.WTPResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-
-public class WTPOperationJobAdapter extends Job {
-
- private WTPOperation operation = null;
-
- public WTPOperationJobAdapter(WTPOperation operation) {
- super(operation.toString());
- this.operation = operation;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- IStatus result = null;
- try {
- operation.run(monitor);
- result = operation.getStatus(); //new Status(IStatus.OK, WTPCommonPlugin.PLUGIN_ID,
- // IStatus.OK, WTPResourceHandler.getString("26"),
- // null); //$NON-NLS-1$
- } catch (Exception e) {
- operation.addStatus(new Status(IStatus.ERROR, WTPCommonPlugin.PLUGIN_ID, IStatus.ERROR, WTPResourceHandler.getString("27"), e)); //$NON-NLS-1$
- result = operation.getStatus();
- Logger.getLogger().logError(e);
- }
- return result;
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPPropertyDescriptor.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPPropertyDescriptor.java
deleted file mode 100644
index aea4156..0000000
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/WTPPropertyDescriptor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.wst.common.frameworks.internal.operations;
-
-/**
- * replace with {@link org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor}
- * A WTPPropertyDescriptor provides a human readible description for a WTPDataModel propertyValue.
- *
- * This class is EXPERIMENTAL and is subject to substantial changes.
- *
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel#getPropertyDescriptor(String)
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel#getValidPropertyDescriptors(String)
- */
-public class WTPPropertyDescriptor {
-
- /**
- * A convenience method which returns an array of WTPPropertyDescriptors. If <code>values</code>
- * is <code>null</code> then a 0 length array is returned. Otherwise for each
- * <code>values[i]</code> in the array, a new WTPPropertyDescriptor is created using
- * <code>new WTPPropertyDescriptor(values[i]);</code>.
- *
- * @param values
- * the array of property values
- * @return the constructed WTPPropertyDescriptor array
- */
- public static WTPPropertyDescriptor[] createDescriptors(Object[] values) {
- if (null == values) {
- return new WTPPropertyDescriptor[0];
- }
- WTPPropertyDescriptor[] descriptors = new WTPPropertyDescriptor[values.length];
- for (int i = 0; i < descriptors.length; i++) {
- descriptors[i] = new WTPPropertyDescriptor(values[i]);
- }
- return descriptors;
- }
-
- /**
- * A convenience method which returns an array of WTPPropertyDescriptors. If <code>values</code>
- * is <code>null</code> then a 0 length array is returned. Otherwise for each
- * <code>values[i]</code> and <code>descriptions[i]</code> in the arrays, a new
- * WTPPropertyDescriptor is created using
- * <code>new WTPPropertyDescriptor(values[i], descriptions[i]);</code>. Both arrays must be
- * the same length.
- *
- * @param values
- * the array of property values
- * @param descriptions
- * the array of property descriptions cooresponding the values array
- * @return the constructed WTPPropertyDescriptor array
- */
- public static WTPPropertyDescriptor[] createDescriptors(Object[] values, String[] descriptions) {
- if (null == values) {
- return new WTPPropertyDescriptor[0];
- }
- WTPPropertyDescriptor[] descriptors = new WTPPropertyDescriptor[values.length];
- for (int i = 0; i < descriptors.length; i++) {
- descriptors[i] = new WTPPropertyDescriptor(values[i], descriptions[i]);
- }
- return descriptors;
-
- }
-
- private Object propertyValue;
- private String propertyDescription;
-
- /**
- * This is equavalent to calling <code>WTPPropertyDescriptor(propertyValue, null);</code>
- *
- * @param propertyValue
- */
- public WTPPropertyDescriptor(Object propertyValue) {
- this.propertyValue = propertyValue;
- }
-
- /**
- * Creates a new WTPPropertyDescriptor with the specified propertyValue and propertyDescription.
- *
- * @param propertyValue
- * @param propertyDescription
- */
- public WTPPropertyDescriptor(Object propertyValue, String propertyDescription) {
- this.propertyValue = propertyValue;
- this.propertyDescription = propertyDescription;
- }
-
- /**
- * Returns the property value.
- *
- * @return the property value
- */
- public Object getPropertyValue() {
- return propertyValue;
- }
-
- /**
- * Returns a human readible property description. If a non null description has been specified,
- * then it will be returned. Otherwise, the property value's <code>toString()</code> will be
- * returned if it is not null. Otherwise the empty String (<code>""</code>) will be
- * returned. Null will never be returned.
- *
- * @return the human readible property description, never <code>null</code>
- */
- public String getPropertyDescription() {
- if (null != propertyDescription) {
- return propertyDescription;
- }
- String str = (null != propertyValue) ? propertyValue.toString() : null;
- return (null != str) ? str : ""; //$NON-NLS-1$
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ArtifactEditOperation.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ArtifactEditOperation.java
deleted file mode 100644
index f44121d..0000000
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ArtifactEditOperation.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 2005 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.componentcore.internal.operation;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.util.ArtifactEditRegistryReader;
-import org.eclipse.wst.common.componentcore.internal.util.IArtifactEditFactory;
-import org.eclipse.wst.common.componentcore.resources.IFlexibleProject;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-
-public class ArtifactEditOperation extends WTPOperation {
- private ArtifactEdit artifactEdit;
- protected EMFWorkbenchContext emfWorkbenchContext;
- private CommandStack commandStack;
-
- /**
- * @param operationDataModel
- */
- public ArtifactEditOperation(ArtifactEditOperationDataModel operationDataModel) {
- super(operationDataModel);
- }
-
- /**
- * This no argument constructor should not be used by clients. This is for extended operations.
- *
- * ExtendedOperations
- */
- public ArtifactEditOperation() {
- super();
- }
-
- //TODO: move functionality from edit model operation to artifact edit operation
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- // TODO Auto-generated method stub
-
- }
- protected final void initialize(IProgressMonitor monitor) {
- ArtifactEditOperationDataModel dataModel = (ArtifactEditOperationDataModel) operationDataModel;
- emfWorkbenchContext = (EMFWorkbenchContext) WorkbenchResourceHelperBase.createEMFContext(dataModel.getTargetProject(), null);
- artifactEdit = getArtifactEditForComponent(getComponent());
- doInitialize(monitor);
- }
-
- /**
- * @return
- */
- protected ArtifactEdit getArtifactEditForComponent(IVirtualComponent comp) {
- ArtifactEditRegistryReader reader = ArtifactEditRegistryReader.instance();
- IArtifactEditFactory factory = reader.getArtifactEdit(comp.getComponentTypeId());
- return factory.createArtifactEditForWrite(comp);
- }
-
- /**
- * @return
- */
- public WorkbenchComponent getWorkbenchModule() {
- ArtifactEditOperationDataModel dataModel = (ArtifactEditOperationDataModel) operationDataModel;
- StructureEdit moduleCore = null;
- WorkbenchComponent module = null;
- try {
- moduleCore = StructureEdit.getStructureEditForRead(dataModel.getTargetProject());
- module = moduleCore.findComponentByName(dataModel.getStringProperty(ArtifactEditOperationDataModel.MODULE_NAME));
- } finally {
- if (null != moduleCore) {
- moduleCore.dispose();
- }
- }
- return module;
- }
-
- public IVirtualComponent getComponent() {
- IFlexibleProject proj = ComponentCore.createFlexibleProject(((ArtifactEditOperationDataModel)operationDataModel).getTargetProject());
- return proj.getComponent(operationDataModel.getStringProperty(ArtifactEditOperationDataModel.MODULE_NAME));
-
- }
- protected ArtifactEdit getArtifactEdit() {
- return artifactEdit;
- }
-
- protected void doInitialize(IProgressMonitor monitor) {
- //init
- }
- protected final void dispose(IProgressMonitor monitor) {
- try {
- doDispose(monitor);
- } finally {
- saveEditModel(monitor);
- }
- }
-
- private final void saveEditModel(IProgressMonitor monitor) {
- if (null != artifactEdit) {
- if (((ArtifactEditOperationDataModel) operationDataModel).getBooleanProperty(ArtifactEditOperationDataModel.PROMPT_ON_SAVE))
- //TODO: reimplement for Artifact edit
- //artifactEdit.saveIfNecessaryWithPrompt(monitor, (IOperationHandler) operationDataModel.getProperty(WTPOperationDataModel.UI_OPERATION_HANLDER), this);
- artifactEdit.saveIfNecessary(monitor);
- else
- artifactEdit.saveIfNecessary(monitor);
- artifactEdit.dispose();
- artifactEdit = null;
- }
- postSaveEditModel(monitor);
- }
-
- /**
- * @param monitor
- */
- protected void postSaveEditModel(IProgressMonitor monitor) {
- // do nothing by default
- }
-
- protected void doDispose(IProgressMonitor monitor) {
- //dispose
- }
-
- /**
- * @return Returns the commandStack.
- */
- public CommandStack getCommandStack() {
- if (commandStack == null && artifactEdit != null)
- commandStack = artifactEdit.getCommandStack();
- return commandStack;
- }
-
- /**
- * @param commandStack
- * The commandStack to set.
- */
- public void setCommandStack(CommandStack commandStack) {
- this.commandStack = commandStack;
- }
-
- /**
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#validateEdit()
- */
- protected boolean validateEdit() {
- //TODO: reimplement
-// IValidateEditContext validator = (IValidateEditContext) UIContextDetermination.createInstance(IValidateEditContext.CLASS_KEY);
-// return validator.validateState(artifactEdit).isOK();
- return true;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ArtifactEditOperationDataModel.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ArtifactEditOperationDataModel.java
deleted file mode 100644
index f97993d..0000000
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ArtifactEditOperationDataModel.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 2005 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.componentcore.internal.operation;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IFlexibleProject;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-//TODO delete
-/**
- *
- *
- */
-public abstract class ArtifactEditOperationDataModel extends WTPOperationDataModel {
- /**
- * Required
- */
- public static final String PROJECT_NAME = "ArtifactEditOperationDataModel.PROJECT_NAME"; //$NON-NLS-1$
- /**
- * Required
- */
- public static final String MODULE_NAME = "ArtifactEditOperationDataModel.MODULE_NAME"; //$NON-NLS-1$
- /**
- * Optional, should save with prompt...defaults to false
- */
- public static final String PROMPT_ON_SAVE = "ArtifactEditOperationDataModel.PROMPT_ON_SAVE"; //$NON-NLS-1$
- private IVirtualComponent comp = null;
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(PROJECT_NAME);
- addValidBaseProperty(MODULE_NAME);
- addValidBaseProperty(PROMPT_ON_SAVE);
- }
-
- public IProject getTargetProject() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
- }
-
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(PROMPT_ON_SAVE))
- return Boolean.FALSE;
- return super.getDefaultProperty(propertyName);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.frameworks.operations.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new ArtifactEditOperation(this);
- }
-
- public ArtifactEdit getArtifactEditForRead(){
- return ArtifactEdit.getArtifactEditForRead(getComponent());
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.frameworks.operations.WTPOperationDataModel#doSetProperty(java.lang.String, java.lang.Object)
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean status = super.doSetProperty(propertyName, propertyValue);
- if(MODULE_NAME.equals(propertyName)){
- comp = null;
- IProject proj = getComponent().getProject();
- if(proj != null)
- setProperty(PROJECT_NAME, proj.getName());
- }
- return status;
- }
- /**
- * @return
- */
- public IVirtualComponent getComponent() {
-
- if (comp == null) {
- IProject project = getTargetProject();
- if (project.exists() && project.isAccessible()) {
- IFlexibleProject flex = ComponentCore.createFlexibleProject(project);
- if (getProperty(MODULE_NAME) != null)
- comp = flex.getComponent(getStringProperty(MODULE_NAME));
- }
- }
- return comp;
- }
- protected IStatus doValidateProperty(String propertyName) {
- IStatus result = super.doValidateProperty(propertyName);
- if (!result.isOK())
- return result;
- if (propertyName.equals(PROJECT_NAME))
- return validateProjectName();
- else if (propertyName.equals(MODULE_NAME))
- return validateModuleName();
- return result;
- }
-
- protected IStatus validateProjectName() {
- String projectName = getStringProperty(PROJECT_NAME);
- if (projectName == null || projectName.length()==0)
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_NAME_EMPTY));
- return WTPCommonPlugin.OK_STATUS;
- }
-
- protected IStatus validateModuleName() {
- String moduleName = getStringProperty(MODULE_NAME);
- if (moduleName==null || moduleName.length()==0)
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME));
- return WTPCommonPlugin.OK_STATUS;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ModelModifierOperation.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ModelModifierOperation.java
deleted file mode 100644
index a1391c1..0000000
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ModelModifierOperation.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Dec 3, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.componentcore.internal.operation;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier;
-
-/**
- * @author DABERG
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public abstract class ModelModifierOperation extends ArtifactEditOperation {
- protected ModelModifier modifier;
-
- /**
- * @param dataModel
- */
- public ModelModifierOperation(ModelModifierOperationDataModel dataModel) {
- super(dataModel);
- }
-
- /**
- * This no argument constructor should not be used by clients. This is for extended operations.
- *
- * ExtendedOperations
- */
- public ModelModifierOperation() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperation#doInitialize(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void doInitialize(IProgressMonitor monitor) {
- super.doInitialize(monitor);
- EditingDomain domain = null;
- if (operationDataModel.isProperty(ModelModifierOperationDataModel.EDITING_DOMAIN)) { //added
- // so
- // regular
- // EditModelOperations
- // can
- // be
- // used
- domain = (EditingDomain) operationDataModel.getProperty(ModelModifierOperationDataModel.EDITING_DOMAIN);
- }
- if (domain == null) {
- domain = createDefaultEditingDomain();
- }
- modifier = new ModelModifier(domain);
- }
-
- /**
- * @return
- */
- private EditingDomain createDefaultEditingDomain() {
- return new AdapterFactoryEditingDomain(new AdapterFactory() {
- public boolean isFactoryForType(Object type) {
- return false;
- }
-
- public Object adapt(Object object, Object type) {
- return null;
- }
-
- public Adapter adapt(Notifier target, Object type) {
- return null;
- }
-
- public Adapter adaptNew(Notifier target, Object type) {
- return null;
- }
-
- public void adaptAllNew(Notifier notifier) {
- //do nothing
- }
- }, getArtifactEdit().getCommandStack());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected final void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- addHelpers();
- modifier.execute();
- postExecuteCommands(monitor);
- }
-
- /**
- * This is a hook to allow subclasses to perform additional tasks after the commands are
- * executed using the helpers.
- */
- protected void postExecuteCommands(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- //do nothing
- }
-
- /**
- * Add all necessary helpers to the modifier.
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper
- */
- protected abstract void addHelpers() throws CoreException;
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ModelModifierOperationDataModel.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ModelModifierOperationDataModel.java
deleted file mode 100644
index 5394beb..0000000
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/ModelModifierOperationDataModel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Dec 3, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.componentcore.internal.operation;
-
-/**
- * @author DABERG
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public abstract class ModelModifierOperationDataModel extends ArtifactEditOperationDataModel {
- /**
- * Optionally set the EditingDomain that should be used to create generic EMF commands. Type -
- * EditingDomain
- */
- public static final String EDITING_DOMAIN = "ModelModifierOperationDataModel.EDITING_DOMAIN"; //$NON-NLS-1$
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(EDITING_DOMAIN);
- }
-
-}
\ No newline at end of file