blob: f6847f8a53c171198d4b1d2884f23d9c4f2d9d03 [file] [log] [blame]
/*******************************************************************************
* 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.jst.j2ee.applicationclient.creation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.jst.j2ee.application.operations.FlexibleJ2EEModuleCreationDataModel;
import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.wst.common.frameworks.operations.WTPOperation;
import org.eclipse.wst.common.frameworks.operations.WTPPropertyDescriptor;
/**
* This dataModel is used for to create Application Client Modules.
*
* This class (and all its fields and methods) is likely to change during the WTP 1.0 milestones as
* the new project structures are adopted. Use at your own risk.
*
* @since WTP 1.0
*/
public class FlexibleAppClientCreationDataModel extends FlexibleJ2EEModuleCreationDataModel {
/**
* Boolean, default=true. If this is true and CREATE_DEFAULT_FILES is true, then a default main
* class will be generated during project creation.
*/
public static final String CREATE_DEFAULT_MAIN_CLASS = "FlexibleAppClientCreationDataModel.CREATE_DEFAULT_MAIN_CLASS"; //$NON-NLS-1$
protected void initValidBaseProperties() {
super.initValidBaseProperties();
addValidBaseProperty(CREATE_DEFAULT_MAIN_CLASS);
}
protected Object getDefaultProperty(String propertyName) {
if (propertyName.equals(CREATE_DEFAULT_MAIN_CLASS)) {
return Boolean.TRUE;
}
return super.getDefaultProperty(propertyName);
}
protected Integer getDefaultJ2EEModuleVersion() {
int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
return new Integer(highestJ2EEPref);
}
protected WTPPropertyDescriptor[] getValidJ2EEModuleVersionDescriptors() {
int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
WTPPropertyDescriptor[] descriptors = null;
switch (highestJ2EEPref) {
case J2EEVersionConstants.J2EE_1_2_ID :
descriptors = new WTPPropertyDescriptor[1];
descriptors[0] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_2_ID), J2EEVersionConstants.VERSION_1_2_TEXT);
break;
case J2EEVersionConstants.J2EE_1_3_ID :
descriptors = new WTPPropertyDescriptor[2];
descriptors[0] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_2_ID), J2EEVersionConstants.VERSION_1_2_TEXT);
descriptors[1] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_3_ID), J2EEVersionConstants.VERSION_1_3_TEXT);
break;
case J2EEVersionConstants.J2EE_1_4_ID :
default :
descriptors = new WTPPropertyDescriptor[3];
descriptors[0] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_2_ID), J2EEVersionConstants.VERSION_1_2_TEXT);
descriptors[1] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_3_ID), J2EEVersionConstants.VERSION_1_3_TEXT);
descriptors[2] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_4_ID), J2EEVersionConstants.VERSION_1_4_TEXT);
break;
}
return descriptors;
}
protected int convertModuleVersionToJ2EEVersion(int moduleVersion) {
return moduleVersion;
}
protected EClass getModuleType() {
return CommonarchiveFactoryImpl.getPackage().getApplicationClientFile();
}
protected String getModuleExtension() {
return ".jar"; //$NON-NLS-1$
}
public WTPOperation getDefaultOperation() {
return new FlexibleAppClientModuleCreationOperation(this);
}
}