diff options
author | cbridgha | 2006-05-12 15:12:00 +0000 |
---|---|---|
committer | cbridgha | 2006-05-12 15:12:00 +0000 |
commit | 41a9040fb7930a17621ceacf48fb738fd7033a5d (patch) | |
tree | f49a1b85bc8fe56b203ff6e17bd4f8fc7f3ea824 /plugins/org.eclipse.wst.web.ui/static_web_ui | |
parent | cf4675a4563daa64f5f6b16da2ec499258af474b (diff) | |
download | webtools.javaee-41a9040fb7930a17621ceacf48fb738fd7033a5d.tar.gz webtools.javaee-41a9040fb7930a17621ceacf48fb738fd7033a5d.tar.xz webtools.javaee-41a9040fb7930a17621ceacf48fb738fd7033a5d.zip |
This commit was manufactured by cvs2svn to create tag 'v20060512_N'.v20060512_N
Diffstat (limited to 'plugins/org.eclipse.wst.web.ui/static_web_ui')
13 files changed, 0 insertions, 1503 deletions
diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/Logger.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/Logger.java deleted file mode 100644 index ade4f5ce7..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/Logger.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.web.ui.internal; - - - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.osgi.framework.Bundle; - -/** - * Small convenience class to log messages to plugin's log file and also, if - * desired, the console. This class should only be used by classes in this - * plugin. Other plugins should make their own copy, with appropriate ID. - */ -public class Logger { - private static final String PLUGIN_ID = "org.eclipse.wst.web.ui"; //$NON-NLS-1$ - /** - * true if both platform and this plugin are in debug mode - */ - public static final boolean DEBUG = Platform.inDebugMode() && "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.web.ui/debug")); //$NON-NLS-1$ //$NON-NLS-2$ - - /* - * Keep our own copy in case we want to add other severity levels - */ - public static final int OK = IStatus.OK; - public static final int INFO = IStatus.INFO; - public static final int WARNING = IStatus.WARNING; - public static final int ERROR = IStatus.ERROR; - - /** - * Adds message to log. - * - * @param level - * severity level of the message (OK, INFO, WARNING, ERROR, - * @param message - * text to add to the log - * @param exception - * exception thrown - */ - private static void _log(int level, String message, Throwable exception) { - message = (message != null) ? message : ""; //$NON-NLS-1$ - Status statusObj = new Status(level, PLUGIN_ID, level, message, exception); - Bundle bundle = Platform.getBundle(PLUGIN_ID); - if (bundle != null) - Platform.getLog(bundle).log(statusObj); - } - - /** - * Write a message to the log with the given severity level - * - * @param level - * ERROR, WARNING, INFO, OK - * @param message - * message to add to the log - */ - public static void log(int level, String message) { - _log(level, message, null); - } - - /** - * Writes a message and exception to the log with the given severity level - * - * @param level - * ERROR, WARNING, INFO, OK - * @param message - * message to add to the log - * @param exception - * exception to add to the log - */ - public static void log(int level, String message, Throwable exception) { - _log(level, message, exception); - } - - /** - * Writes the exception as an error in the log along with an accompanying - * message - * - * @param message - * message to add to the log - * @param exception - * exception to add to the log - */ - public static void logException(String message, Throwable exception) { - _log(IStatus.ERROR, message, exception); - } - - /** - * Writes the exception as an error in the log - * - * @param exception - * exception to add to the log - */ - public static void logException(Throwable exception) { - _log(IStatus.ERROR, exception.getMessage(), exception); - } -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/WSTWebPreferences.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/WSTWebPreferences.java deleted file mode 100644 index 84b5514b9..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/WSTWebPreferences.java +++ /dev/null @@ -1,81 +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.web.ui.internal; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; - -public class WSTWebPreferences { - public interface Keys { - final static String STATIC_WEB_CONTENT = "org.eclipse.jst.j2ee.preference.staticWebContentName"; //$NON-NLS-1$ - } - public interface Values { - final static String STATIC_WEB_CONTENT = "WebContent"; //$NON-NLS-1$ - } - public interface Defaults { - final static String STATIC_WEB_CONTENT = Values.STATIC_WEB_CONTENT; - } - private Plugin owner = null; - private Preferences preferences = null; - private boolean persistOnChange = false; - - public WSTWebPreferences(Plugin owner) { - this.owner = owner; - } - protected void initializeDefaultPreferences() { - getPreferences().setDefault(Keys.STATIC_WEB_CONTENT, Defaults.STATIC_WEB_CONTENT); - } - - public String getStaticWebContentFolderName() { - return getPreferences().getString(Keys.STATIC_WEB_CONTENT); - } - - public void setStaticWebContentFolderName(String value) { - getPreferences().setValue(Keys.STATIC_WEB_CONTENT, value); - firePreferenceChanged(); - } - - public void firePreferenceChanged() { - if (isPersistOnChange()) - persist(); - } - - public void persist() { - getOwner().savePluginPreferences(); - } - - /** - * @return Returns the persistOnChange. - */ - public boolean isPersistOnChange() { - return this.persistOnChange; - } - - /** - * @param persistOnChange - * The persistOnChange to set. - */ - public void setPersistOnChange(boolean persistOnChange) { - this.persistOnChange = persistOnChange; - } - - private Preferences getPreferences() { - if (this.preferences == null) - this.preferences = getOwner().getPluginPreferences(); - return this.preferences; - } - - /** - * @return Returns the owner. - */ - private Plugin getOwner() { - return this.owner; - } -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/WSTWebUIPlugin.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/WSTWebUIPlugin.java deleted file mode 100644 index 7f02de4f4..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/WSTWebUIPlugin.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 - **************************************************************************************************/ -package org.eclipse.wst.web.ui.internal; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -/** - * The main plugin class to be used in the desktop. - */ -public class WSTWebUIPlugin extends AbstractUIPlugin { - // The shared instance. - private static WSTWebUIPlugin plugin; - public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$ - "icons/full/ctool16", //$NON-NLS-1$ - "icons/full/wizban", //$NON-NLS-1$ - "icons", //$NON-NLS-1$ - ""}; //$NON-NLS-1$ - - /** - * The constructor. - */ - public WSTWebUIPlugin() { - super(); - plugin = this; - } - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * This gets a .gif from the icons folder. - */ - public ImageDescriptor getImageDescriptor(String key) { - ImageDescriptor imageDescriptor = null; - URL imageURL = getImageURL(key, getBundle()); - if (imageURL==null) - imageURL = getPNGImageURL(key, getBundle()); - if (imageURL != null) - imageDescriptor = ImageDescriptor.createFromURL(imageURL); - return imageDescriptor; - } - /** - * This gets a .gif from the icons folder. - */ - public static URL getImageURL(String key, Bundle bundle) { - String gif = "/" + key + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$ - IPath path = null; - for (int i = 0; i < ICON_DIRS.length; i++) { - path = new Path(ICON_DIRS[i]).append(gif); - if (bundle.getEntry(path.toString()) == null) - continue; - try { - return new URL(bundle.getEntry("/"), path.toString()); //$NON-NLS-1$ - } catch (MalformedURLException exception) { - Logger.log(Logger.WARNING, "Load_Image_Error_", exception); //$NON-NLS-1$ - continue; - } - } - return null; - } - - /** - * This gets a .png from the icons folder. - */ - public static URL getPNGImageURL(String key, Bundle bundle) { - String gif = "/" + key + ".png"; //$NON-NLS-1$ //$NON-NLS-2$ - IPath path = null; - for (int i = 0; i < ICON_DIRS.length; i++) { - path = new Path(ICON_DIRS[i]).append(gif); - if (bundle.getEntry(path.toString()) == null) - continue; - try { - return new URL(bundle.getEntry("/"), path.toString()); //$NON-NLS-1$ - } catch (MalformedURLException exception) { - Logger.log(Logger.WARNING, "Load_Image_Error_", exception); //$NON-NLS-1$ - continue; - } - } - return null; - } - - /** - * Returns the shared instance. - */ - public static WSTWebUIPlugin getDefault() { - return plugin; - } - -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/DataModelFacetCreationWizardPage.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/DataModelFacetCreationWizardPage.java deleted file mode 100644 index b1f8fbebb..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/DataModelFacetCreationWizardPage.java +++ /dev/null @@ -1,207 +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.web.ui.internal.wizards; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew; -import org.eclipse.wst.common.frameworks.internal.ui.NewProjectGroup; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; -import org.eclipse.wst.common.project.facet.ui.AddRemoveFacetsWizard; -import org.eclipse.wst.common.project.facet.ui.PresetSelectionPanel; -import org.eclipse.wst.common.project.facet.ui.internal.AddRemoveFacetsDataModel; -import org.eclipse.wst.server.ui.ServerUIUtil; -import org.eclipse.wst.web.internal.ResourceHandler; - -public class DataModelFacetCreationWizardPage extends DataModelWizardPage implements IFacetProjectCreationDataModelProperties { - - private static final String LAST_RUNTIME_STORE = "LAST_RUNTIME"; //$NON-NLS-1$ - - protected static GridData gdhfill() { - return new GridData(GridData.FILL_HORIZONTAL); - } - - protected static GridData hspan( final GridData gd, - final int span ) - { - gd.horizontalSpan = span; - return gd; - } - - protected Composite createTopLevelComposite(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - PlatformUI.getWorkbench().getHelpSystem().setHelp(top, getInfopopID()); - top.setLayout(new GridLayout()); - top.setLayoutData(new GridData(GridData.FILL_BOTH)); - createProjectGroup(top); - createServerTargetComposite(top); - createPresetPanel(top); - return top; - } - - protected void createPresetPanel(Composite top) { - final AddRemoveFacetsDataModel model - = ( (AddRemoveFacetsWizard) getWizard() ).getModel(); - - final PresetSelectionPanel ppanel - = new PresetSelectionPanel( top, SWT.NONE, model ); - - ppanel.setLayoutData( gdhfill() ); - - ( (AddRemoveFacetsWizard) getWizard() ).syncWithPresetsModel( ppanel.getPresetsCombo() ); - } - - public static boolean launchNewRuntimeWizard(Shell shell, IDataModel model) { - DataModelPropertyDescriptor[] preAdditionDescriptors = model.getValidPropertyDescriptors(FACET_RUNTIME); - boolean isOK = ServerUIUtil.showNewRuntimeWizard(shell, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - if (isOK && model != null) { - - DataModelPropertyDescriptor[] postAdditionDescriptors = model.getValidPropertyDescriptors(FACET_RUNTIME); - Object[] preAddition = new Object[preAdditionDescriptors.length]; - for (int i = 0; i < preAddition.length; i++) { - preAddition[i] = preAdditionDescriptors[i].getPropertyValue(); - } - Object[] postAddition = new Object[postAdditionDescriptors.length]; - for (int i = 0; i < postAddition.length; i++) { - postAddition[i] = postAdditionDescriptors[i].getPropertyValue(); - } - Object newAddition = getNewObject(preAddition, postAddition); - - model.notifyPropertyChange(FACET_RUNTIME, IDataModel.VALID_VALUES_CHG); - if (newAddition != null) - model.setProperty(FACET_RUNTIME, newAddition); - else - return false; - } - return isOK; - } - - protected Combo serverTargetCombo; - protected NewProjectGroup projectNameGroup; - - public DataModelFacetCreationWizardPage(IDataModel dataModel, String pageName) { - super(dataModel, pageName); - } - - protected void createServerTargetComposite(Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setText(ResourceHandler.TargetRuntime); - group.setLayoutData(gdhfill()); - group.setLayout(new GridLayout(2, false)); - serverTargetCombo = new Combo(group, SWT.BORDER | SWT.READ_ONLY); - serverTargetCombo.setLayoutData(gdhfill()); - Button newServerTargetButton = new Button(group, SWT.NONE); - newServerTargetButton.setText(ResourceHandler.NewDotDotDot); - newServerTargetButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - if (!launchNewRuntimeWizard(getShell(), model)) { - //Bugzilla 135288 - //setErrorMessage(ResourceHandler.InvalidServerTarget); - } - } - }); - Control[] deps = new Control[]{newServerTargetButton}; - synchHelper.synchCombo(serverTargetCombo, FACET_RUNTIME, deps); - if (serverTargetCombo.getSelectionIndex() == -1 && serverTargetCombo.getVisibleItemCount() != 0) - serverTargetCombo.select(0); - } - - protected void createProjectGroup(Composite parent) { - IDataModel nestedProjectDM = model.getNestedModel(NESTED_PROJECT_DM); - nestedProjectDM.addListener(this); - projectNameGroup = new NewProjectGroup(parent, nestedProjectDM); - } - - protected String[] getValidationPropertyNames() { - return new String[]{IProjectCreationPropertiesNew.PROJECT_NAME, IProjectCreationPropertiesNew.PROJECT_LOCATION, FACET_RUNTIME}; - } - - public void dispose() { - super.dispose(); - if (projectNameGroup != null) - projectNameGroup.dispose(); - } - - public void storeDefaultSettings() { - IDialogSettings settings = getDialogSettings(); - if (settings != null) { - IRuntime runtime = (IRuntime) model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME); - String runtimeName = runtime == null ? "" : runtime.getName(); //$NON-NLS-1$ - settings.put(LAST_RUNTIME_STORE, runtimeName); - } - } - - public void restoreDefaultSettings() { - IDialogSettings settings = getDialogSettings(); - if (settings != null) { - if (!model.isPropertySet(IFacetProjectCreationDataModelProperties.FACET_RUNTIME)) { - boolean runtimeSet = false; - String lastRuntimeName = settings.get(LAST_RUNTIME_STORE); - DataModelPropertyDescriptor[] descriptors = model.getValidPropertyDescriptors(IFacetProjectCreationDataModelProperties.FACET_RUNTIME); - if (lastRuntimeName != null) { - for (int i = 0; i < descriptors.length && !runtimeSet; i++) { - if (lastRuntimeName.equals(descriptors[i].getPropertyDescription())) { - model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, descriptors[i].getPropertyValue()); - runtimeSet = true; - } - } - } - if (!runtimeSet && descriptors.length > 0) { - model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, descriptors[0].getPropertyValue()); - } - } - } - } - - /** - * Find first newObject that is not in the oldObjects array (using "=="). - * - * @param oldObjects - * @param newObjects - * @return first newObject not found in oldObjects, or <code>null</code> if all found. - * - * @since 1.0.0 - */ - private static Object getNewObject(Object[] oldObjects, Object[] newObjects) { - if (oldObjects != null && newObjects != null && oldObjects.length < newObjects.length) { - for (int i = 0; i < newObjects.length; i++) { - boolean found = false; - Object object = newObjects[i]; - for (int j = 0; j < oldObjects.length; j++) { - if (oldObjects[j] == object) { - found = true; - break; - } - } - if (!found) - return object; - } - } - if (oldObjects == null && newObjects != null && newObjects.length == 1) - return newObjects[0]; - return null; - } -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/DataModelFacetInstallPage.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/DataModelFacetInstallPage.java deleted file mode 100644 index da031f5cc..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/DataModelFacetInstallPage.java +++ /dev/null @@ -1,52 +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.web.ui.internal.wizards; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetInstallDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage; -import org.eclipse.wst.common.project.facet.ui.IWizardContext; - -public abstract class DataModelFacetInstallPage extends DataModelWizardPage implements IFacetWizardPage, IFacetInstallDataModelProperties { - - public DataModelFacetInstallPage(String pageName) { - // TODO figure out a better way to do this without compromising the IDataModelWizard - // framework. - super(DataModelFactory.createDataModel(new AbstractDataModelProvider() { - }), pageName); - } - - protected static GridData gdhfill() { - return new GridData(GridData.FILL_HORIZONTAL); - } - - public void setWizardContext(IWizardContext context) { - // Intentionally empty - } - - public void transferStateToConfig() { - // Intentionally empty - } - - public void setConfig(final Object config) { - model.removeListener(this); - synchHelper.dispose(); - - model = (IDataModel) config; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - } - -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/IWstWebUIContextIds.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/IWstWebUIContextIds.java deleted file mode 100644 index bb98c49c2..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/IWstWebUIContextIds.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.eclipse.wst.web.ui.internal.wizards; - -public interface IWstWebUIContextIds { - - public static final String PLUGIN_WST_WEB_UI = "org.eclipse.wst.web.ui."; //$NON-NLS-1$ - - public static final String NEW_STATIC_WEB_PROJECT_PAGE1 = PLUGIN_WST_WEB_UI + "webw2000"; //$NON-NLS-1$ - public static final String NEW_STATIC_WEB_PROJECT_PAGE2 = PLUGIN_WST_WEB_UI + "webw2100"; //$NON-NLS-1$ - public static final String NEW_STATIC_WEB_PROJECT_PAGE3 = PLUGIN_WST_WEB_UI + "webw2200"; //$NON-NLS-1$ - -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/NewProjectDataModelFacetWizard.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/NewProjectDataModelFacetWizard.java deleted file mode 100644 index 57e52c6c4..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/NewProjectDataModelFacetWizard.java +++ /dev/null @@ -1,443 +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.web.ui.internal.wizards; - -import java.lang.reflect.InvocationTargetException; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; -import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties; -import org.eclipse.wst.common.componentcore.internal.operation.FacetProjectCreationOperation; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; -import org.eclipse.wst.common.project.facet.ui.AddRemoveFacetsWizard; -import org.eclipse.wst.common.project.facet.ui.internal.AbstractDataModel; -import org.eclipse.wst.common.project.facet.ui.internal.ChangeTargetedRuntimesDataModel; -import org.eclipse.wst.web.internal.DelegateConfigurationElement; -import org.eclipse.wst.web.ui.internal.Logger; -import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin; - -public abstract class NewProjectDataModelFacetWizard extends AddRemoveFacetsWizard implements INewWizard, IFacetProjectCreationDataModelProperties { - - protected IDataModel model = null; - private final IFacetedProjectTemplate template; - private IWizardPage[] beginingPages; - private IConfigurationElement configurationElement; - - public NewProjectDataModelFacetWizard(IDataModel model) { - super(null); - this.model = model; - template = getTemplate(); - this.setDefaultPageImageDescriptor(getDefaultPageImageDescriptor()); - } - - public NewProjectDataModelFacetWizard() { - super(null); - model = createDataModel(); - template = getTemplate(); - this.setDefaultPageImageDescriptor(getDefaultPageImageDescriptor()); - } - - public IDataModel getDataModel() { - return model; - } - - protected abstract IDataModel createDataModel(); - - protected abstract ImageDescriptor getDefaultPageImageDescriptor(); - - protected abstract IFacetedProjectTemplate getTemplate(); - - /** - * Returns the first page that shows up before the facets page. If multiple pages are required, - * also override {@link #createBeginingPages()}. - * - * @return - */ - protected abstract IWizardPage createFirstPage(); - - /** - * Subclasses should override to add more than one page before the facets page. If only one page - * is required, then use {@link #createFirstPage()}. The default implementation will return the - * result of {@link #createFirstPage()}. - * - * @return - */ - protected IWizardPage[] createBeginingPages() { - return new IWizardPage[]{createFirstPage()}; - } - - public void addPages() { - beginingPages = createBeginingPages(); - for (int i = 0; i < beginingPages.length; i++) { - addPage(beginingPages[i]); - } - - super.addPages(); - final Set fixed = this.template.getFixedProjectFacets(); - - this.facetsSelectionPage.setFixedProjectFacets(fixed); - - this.facetsSelectionPage.addSelectedFacetsChangedListener(new Listener() { - public void handleEvent(Event event) { - facetSelectionChangedEvent(event); - } - }); - - IRuntime runtime = (IRuntime) model.getProperty(FACET_RUNTIME); - setRuntimeAndDefaultFacets( runtime ); - - synchRuntimes(); - } - - public void createPageControls(Composite container) { - super.createPageControls(container); - /* - * This does not interfere with the rutines selection - */ - Set facetVersions = new HashSet(); - FacetDataModelMap map = (FacetDataModelMap) model.getProperty(FACET_DM_MAP); - for (Iterator iterator = map.values().iterator(); iterator.hasNext();) { - IDataModel facetModel = (IDataModel) iterator.next(); - facetVersions.add(facetModel.getProperty(IFacetDataModelProperties.FACET_VERSION)); - } - - FacetActionMap mapAction = (FacetActionMap) model.getProperty(FACET_ACTION_MAP); - for (Iterator iterator = mapAction.values().iterator(); iterator.hasNext();) { - IFacetedProject.Action action = (IFacetedProject.Action) iterator.next(); - facetVersions.add(action.getProjectFacetVersion()); - } - - facetsSelectionPage.setInitialSelection(facetVersions); - } - - - public IWizardPage[] getPages() { - final IWizardPage[] base = super.getPages(); - final IWizardPage[] pages = new IWizardPage[base.length + beginingPages.length]; - - for (int i = 0; i < beginingPages.length; i++) { - pages[i] = beginingPages[i]; - } - - System.arraycopy(base, 0, pages, beginingPages.length, base.length); - - return pages; - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - } - - protected void synchRuntimes() - { - final ChangeTargetedRuntimesDataModel rdm - = getModel().getTargetedRuntimesDataModel(); - - final Boolean[] suppressBackEvents = { Boolean.FALSE }; - - model.addListener(new IDataModelListener() { - public void propertyChanged(DataModelEvent event) { - if (IDataModel.VALUE_CHG == event.getFlag() || IDataModel.DEFAULT_CHG == event.getFlag()) { - if (FACET_RUNTIME.equals(event.getPropertyName())) { - if( ! suppressBackEvents[ 0 ].booleanValue() ) { - IRuntime runtime = (IRuntime) event.getProperty(); - setRuntimeAndDefaultFacets( runtime ); - } - } - } - } - }); - - rdm.addListener - ( - ChangeTargetedRuntimesDataModel.EVENT_PRIMARY_RUNTIME_CHANGED, - new AbstractDataModel.IDataModelListener() - { - public void handleEvent() - { - suppressBackEvents[ 0 ] = Boolean.TRUE; - model.setProperty(FACET_RUNTIME, rdm.getPrimaryRuntime()); - suppressBackEvents[ 0 ] = Boolean.FALSE; - } - } - ); - } - - private void setRuntimeAndDefaultFacets( final IRuntime runtime ) - { - if( runtime != null ) - { - final Set runtimes = Collections.singleton( runtime ); - getModel().getTargetedRuntimesDataModel().setTargetedRuntimes( runtimes ); - this.facetsSelectionPage.setDefaultFacetsForRuntime( runtime ); - } - } - - public String getProjectName() { - return model.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME); - } - - protected void performFinish(final IProgressMonitor monitor) - - throws CoreException - - { - monitor.beginTask("", 10); - storeDefaultSettings(); - try { - FacetProjectCreationOperation operation = new FacetProjectCreationOperation(model); - this.fproj = operation.createProject(new SubProgressMonitor(monitor, 2)); - - super.performFinish(new SubProgressMonitor(monitor, 8)); - - final Set fixed = this.template.getFixedProjectFacets(); - this.fproj.setFixedProjectFacets(fixed); - } finally { - monitor.done(); - } - } - - public boolean performFinish() { - if (super.performFinish() == false) { - return false; - } - - try { - postPerformFinish(); - } catch (InvocationTargetException e) { - Logger.logException(e); - } - - return true; - } - - /** - * <p> - * Override to return the final perspective ID (if any). The final perspective ID can be - * hardcoded by the subclass or determined programmatically (possibly using the value of a field - * on the Wizard's WTP Operation Data Model). - * </p> - * <p> - * The default implementation returns no perspective id unless overriden by product definition - * via the "wtp.project.final.perspective" property. - * </p> - * - * @return Returns the ID of the Perspective which is preferred by this wizard upon completion. - */ - - protected String getFinalPerspectiveID() { - return null; - } - - /** - * {@inheritDoc} - * - * <p> - * The configuration element is saved to use when the wizard completes in order to change the - * current perspective using either (1) the value specified by {@link #getFinalPerspectiveID()} - * or (2) the value specified by the finalPerspective attribute in the Wizard's configuration - * element. - * </p> - * - * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, - * java.lang.String, java.lang.Object) - */ - public final void setInitializationData(IConfigurationElement aConfigurationElement, String aPropertyName, Object theData) throws CoreException { - configurationElement = aConfigurationElement; - doSetInitializeData(aConfigurationElement, aPropertyName, theData); - - } - - /** - * <p> - * Override method for clients that wish to take advantage of the information provided by - * {@see #setInitializationData(IConfigurationElement, String, Object)}. - * </p> - * - * @param aConfigurationElement - * The configuration element provided from the templated method. - * @param aPropertyName - * The property name provided from the templated method. - * @param theData - * The data provided from the templated method. - */ - protected void doSetInitializeData(IConfigurationElement aConfigurationElement, String aPropertyName, Object theData) { - // Default do nothing - } - - /** - * <p> - * Returns the an id component used for Activity filtering. - * </p> - * - * <p> - * The Plugin ID is determined from the configuration element specified in - * {@see #setInitializationData(IConfigurationElement, String, Object)}. - * </p> - * - * @return Returns the plugin id associated with this wizard - */ - public final String getPluginId() { - return (configurationElement != null) ? configurationElement.getDeclaringExtension().getNamespace() : ""; //$NON-NLS-1$ - } - - /** - * - * <p> - * Invoked after the user has clicked the "Finish" button of the wizard. The default - * implementation will attempt to update the final perspective to the value specified by - * {@link #getFinalPerspectiveID() } - * </p> - * - * @throws InvocationTargetException - * - * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish() - */ - protected void postPerformFinish() throws InvocationTargetException { - if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) { - final IConfigurationElement element = new DelegateConfigurationElement(configurationElement) { - public String getAttribute(String aName) { - if (aName.equals("finalPerspective")) { //$NON-NLS-1$ - return getFinalPerspectiveID(); - } - return super.getAttribute(aName); - } - }; - BasicNewProjectResourceWizard.updatePerspective(element); - } else - BasicNewProjectResourceWizard.updatePerspective(configurationElement); - - String projName = getProjectName(); - BasicNewResourceWizard.selectAndReveal(ResourcesPlugin.getWorkspace().getRoot().getProject(projName), WSTWebUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()); - try { - getFacetProjectNotificationOperation().execute(new NullProgressMonitor(), null); - } catch (ExecutionException e) { - throw new InvocationTargetException(e); - } - } - - protected IDataModelOperation getFacetProjectNotificationOperation() { - return new DataModelPausibleOperationImpl(new AbstractDataModelOperation(this.model) { - public String getID() { - return "org.eclipse.wst.common.componentcore.internal.operation.FacetProjectCreationOperation"; //$NON-NLS-1$ - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - return AbstractDataModelProvider.OK_STATUS; - } - }); - } - - /** - * Need to keep the model in sync with the UI. This method will pickup changes coming from the - * UI and push them into the model - * - * @param event - */ - protected void facetSelectionChangedEvent(Event event) { - Set actions = this.facetsSelectionPage.getActions(); - Iterator iterator = actions.iterator(); - Set activeIds = new HashSet(); - while (iterator.hasNext()) { - IFacetedProject.Action action = (IFacetedProject.Action) iterator.next(); - String id = action.getProjectFacetVersion().getProjectFacet().getId(); - activeIds.add(id); - } - // First handle all the actions tracked by IDataModels - FacetDataModelMap dataModelMap = (FacetDataModelMap) model.getProperty(FACET_DM_MAP); - iterator = dataModelMap.keySet().iterator(); - while (iterator.hasNext()) { - String id = (String) iterator.next(); - IDataModel configDM = (IDataModel) dataModelMap.get(id); - boolean active = activeIds.contains(id); - configDM.setBooleanProperty(IFacetDataModelProperties.SHOULD_EXECUTE, active); - activeIds.remove(id); - } - // Now handle the actions not tracked by IDataModels - FacetActionMap actionMap = (FacetActionMap) model.getProperty(FACET_ACTION_MAP); - actionMap.clear(); - iterator = actions.iterator(); - while (iterator.hasNext()) { - IFacetedProject.Action action = (IFacetedProject.Action) iterator.next(); - String id = action.getProjectFacetVersion().getProjectFacet().getId(); - if (activeIds.contains(id)) { - actionMap.add(action); - } - } - model.notifyPropertyChange(FACET_RUNTIME, IDataModel.VALID_VALUES_CHG); - } - - public Object getConfig(IProjectFacetVersion fv, Type type, String pjname) throws CoreException { - FacetDataModelMap map = (FacetDataModelMap) model.getProperty(FACET_DM_MAP); - IDataModel configDM = (IDataModel) map.get(fv.getProjectFacet().getId()); - if (configDM == null) { - final Object config = fv.createActionConfig(type, pjname); - if (config == null || !(config instanceof IDataModel)) - return null; - configDM = (IDataModel) config; - map.add(configDM); - } - configDM.setProperty(IFacetDataModelProperties.FACET_VERSION, fv); - return configDM; - } - - 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 DataModelWizardPage) - ((DataModelWizardPage) page).storeDefaultSettings(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleContextRootComposite.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleContextRootComposite.java deleted file mode 100644 index 2862831d4..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleContextRootComposite.java +++ /dev/null @@ -1,123 +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.web.ui.internal.wizards; - -import java.util.Vector; - -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.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15; -import org.eclipse.wst.web.internal.ResourceHandler; -import org.eclipse.wst.web.internal.WebPropertiesUtil; - -/** - * This has been slated for removal post WTP 1.5. Do not use this class/interface - * - * @deprecated - */ -public class SimpleContextRootComposite extends Composite implements DoNotUseMeThisWillBeDeletedPost15 { - protected Text contextRootField; - private String errorMessage = null; - - // listeners interested in the event when the context root - // value is modified. - private java.util.List modifyListeners; - - protected Listener contextRootModifyListener = new Listener() { - public void handleEvent(Event e) { - if (contextRootField != null) - contextRootModified(); - } - }; - - public SimpleContextRootComposite(Composite parent) { - super(parent, SWT.NONE); - createControls(); - modifyListeners = new Vector(1); - } - - protected void createControls() { - // container specification group - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginHeight = 0; - layout.marginWidth = 0; - setLayout(layout); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - data.horizontalSpan = 2; - setLayoutData(data); - - // New Context Root Label - Label contextRootLabel = new Label(this, SWT.CHECK); - contextRootLabel.setText(ResourceHandler.StaticContextRootComposite_Context_Root_Label); - - // New Context Root Entryfield - contextRootField = new Text(this, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); - data.grabExcessHorizontalSpace = true; - contextRootField.setLayoutData(data); - - contextRootField.addListener(SWT.Modify, contextRootModifyListener); - - } - - public String getContextRoot() { - return contextRootField.getText(); - } - - public void setEnabled(boolean enabled) { - if (contextRootField != null) - contextRootField.setEnabled(enabled); - } - - protected void contextRootModified() { - errorMessage = WebPropertiesUtil.validateContextRoot(getContextRoot()); - // notify listeners - Event e = new Event(); - e.type = SWT.Modify; - e.widget = contextRootField; - for (int i = 0; i < modifyListeners.size(); i++) { - ((Listener) modifyListeners.get(i)).handleEvent(e); - } - } - - public void setContextRoot(String cr) { - contextRootField.setText(cr); - } - - /** - * There is a default context root validation listener provided by the - * composite, adding external listeners will replace the default listener. - */ - public void addModifyListener(Listener l) { - modifyListeners.add(l); - } - - public void removeModifyListener(Listener l) { - modifyListeners.remove(l); - } - - /** - * validate the context root value and return the error message - */ - public String getErrorMessage() { - return errorMessage; - } - - public boolean setFocus() { - return contextRootField.setFocus(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebFacetInstallPage.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebFacetInstallPage.java deleted file mode 100644 index 6d9f28cad..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebFacetInstallPage.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.wst.web.ui.internal.wizards; - -import org.eclipse.swt.SWT; -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.Text; -import org.eclipse.wst.project.facet.ISimpleWebFacetInstallDataModelProperties; -import org.eclipse.wst.web.internal.ResourceHandler; - -public class SimpleWebFacetInstallPage extends DataModelFacetInstallPage implements ISimpleWebFacetInstallDataModelProperties { - - private Label configFolderLabel; - private Text configFolder; - private Label contextRootLabel; - private Text contextRoot; - - public SimpleWebFacetInstallPage() { - super("simpleweb.facet.install.page"); //$NON-NLS-1$ - setTitle(ResourceHandler.StaticWebProjectWizardBasePage_Page_Title); - setDescription(ResourceHandler.ConfigureSettings); - } - - protected String[] getValidationPropertyNames() { - return new String[]{CONTENT_DIR}; - } - - protected Composite createTopLevelComposite(Composite parent) { - setInfopopID(IWstWebUIContextIds.NEW_STATIC_WEB_PROJECT_PAGE3); - final Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(1, false)); - - this.contextRootLabel = new Label(composite, SWT.NONE); - this.contextRootLabel.setText(ResourceHandler.StaticContextRootComposite_Context_Root_Label); - this.contextRootLabel.setLayoutData(gdhfill()); - - this.contextRoot = new Text(composite, SWT.BORDER); - this.contextRoot.setLayoutData(gdhfill()); - this.contextRoot.setData("label", this.contextRootLabel); //$NON-NLS-1$ - synchHelper.synchText(contextRoot, CONTEXT_ROOT, new Control[]{contextRootLabel}); - - configFolderLabel = new Label(composite, SWT.NONE); - configFolderLabel.setText(ResourceHandler.StaticWebSettingsPropertiesPage_Web_Content_Label); - configFolderLabel.setLayoutData(gdhfill()); - - configFolder = new Text(composite, SWT.BORDER); - configFolder.setLayoutData(gdhfill()); - configFolder.setData("label", configFolderLabel); //$NON-NLS-1$ - synchHelper.synchText(configFolder, CONTENT_DIR, null); - - return composite; - } - -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebModuleCreationWizard.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebModuleCreationWizard.java deleted file mode 100644 index 46b7f07b6..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebModuleCreationWizard.java +++ /dev/null @@ -1,73 +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.web.ui.internal.wizards; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; -import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard; -import org.eclipse.wst.web.internal.ResourceHandler; -import org.eclipse.wst.web.internal.operation.SimpleWebModuleCreationDataModelProvider; -import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin; - -/** - * This has been slated for removal post WTP 1.5. Do not use this class/interface - * - * @deprecated - */ -public class SimpleWebModuleCreationWizard extends DataModelWizard implements IExecutableExtension, INewWizard, DoNotUseMeThisWillBeDeletedPost15 { - - public SimpleWebModuleCreationWizard(IDataModel model) { - super(model); - } - - public SimpleWebModuleCreationWizard() { - super(); - } - - protected IDataModelProvider getDefaultProvider() { - return new SimpleWebModuleCreationDataModelProvider(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ - public void doAddPages() { - addPage(new SimpleWebModuleWizardBasePage(getDataModel(), "page1")); //$NON-NLS-1$ - } - - public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - setWindowTitle(ResourceHandler.StaticWebProjectCreationWizard_Wizard_Title); - setDefaultPageImageDescriptor(WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz")); //$NON-NLS-1$ - } - -// protected void postPerformFinish() throws InvocationTargetException { -// IWizardRegistry newWizardRegistry = WorkbenchPlugin.getDefault().getNewWizardRegistry(); -// -// IWizardDescriptor descriptor = newWizardRegistry.findWizard(getWizardID()); -// -// if(descriptor instanceof WorkbenchWizardElement) -// BasicNewProjectResourceWizard.updatePerspective(((WorkbenchWizardElement)descriptor).getConfigurationElement()); -// IWorkbenchWindow window = WSTWebPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); -// IProject project = ((SimpleWebModuleCreationDataModel) model).getTargetProject(); -// BasicNewResourceWizard.selectAndReveal(project, window); -// } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebModuleWizardBasePage.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebModuleWizardBasePage.java deleted file mode 100644 index b2c905df0..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebModuleWizardBasePage.java +++ /dev/null @@ -1,172 +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.web.ui.internal.wizards; - -import java.io.File; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler; -import org.eclipse.wst.web.internal.ResourceHandler; -import org.eclipse.wst.web.internal.operation.ISimpleWebModuleCreationDataModelProperties; -import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin; - -/** - * This has been slated for removal post WTP 1.5. Do not use this class/interface - * - * @deprecated - */ -class SimpleWebModuleWizardBasePage extends DataModelWizardPage implements ISimpleWebModuleCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15{ - public Text projectNameField = null; - protected Text locationPathField = null; - protected Button browseButton = null; - // constants - private static final int SIZING_TEXT_FIELD_WIDTH = 305; - // default values - private String defProjectNameLabel = WTPCommonUIResourceHandler.Name_; //$NON-NLS-1$ - private String defBrowseButtonLabel = WTPCommonUIResourceHandler.Browse_;//$NON-NLS-1$ - private static final String defDirDialogLabel = "Directory"; //$NON-NLS-1$ - - public SimpleWebModuleWizardBasePage(IDataModel dataModel, String pageName) { - super(dataModel, pageName); - setDescription(ResourceHandler.StaticWebProjectWizardBasePage_Page_Description); - setTitle(ResourceHandler.StaticWebProjectWizardBasePage_Page_Title); - ImageDescriptor desc = WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz"); //$NON-NLS-1$ - setImageDescriptor(desc); - setPageComplete(false); - } - - protected void setSize(Composite composite) { - if (composite != null) { - Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); - composite.setSize(minSize); - // set scrollbar composite's min size so page is expandable but has - // scrollbars when needed - if (composite.getParent() instanceof ScrolledComposite) { - ScrolledComposite sc1 = (ScrolledComposite) composite.getParent(); - sc1.setMinSize(minSize); - sc1.setExpandHorizontal(true); - sc1.setExpandVertical(true); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#getValidationPropertyNames() - */ - protected String[] getValidationPropertyNames() { - return new String[]{PROJECT_NAME}; - } - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite) - */ - protected Composite createTopLevelComposite(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - top.setLayout(new GridLayout()); - top.setData(new GridData(GridData.FILL_BOTH)); - Composite composite = new Composite(top, SWT.NONE); - GridLayout layout = new GridLayout(3, false); - composite.setLayout(layout); - buildComposites(composite); - Composite detail = new Composite(top, SWT.NONE); - detail.setLayout(new GridLayout()); - detail.setData(new GridData(GridData.FILL_BOTH)); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(top, "com.ibm.etools.webtools.wizards.basic.webw1450"); //$NON-NLS-1$ - return top; - } - - /** - * Create the controls within this composite - */ - public void buildComposites(Composite parent) { - createProjectNameGroup(parent); - createProjectLocationGroup(parent); - projectNameField.setFocus(); - } - - private void createProjectLocationGroup(Composite parent) { - // set up location path label - Label locationPathLabel = new Label(parent, SWT.NONE); - locationPathLabel.setText(WTPCommonUIResourceHandler.Project_location_);//$NON-NLS-1$ - GridData data = new GridData(); - locationPathLabel.setLayoutData(data); - // set up location path entry field - locationPathField = new Text(parent, SWT.BORDER | SWT.READ_ONLY); - data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - locationPathField.setLayoutData(data); - // set up browse button - browseButton = new Button(parent, SWT.PUSH); - browseButton.setText(defBrowseButtonLabel); - browseButton.setLayoutData((new GridData(GridData.FILL_HORIZONTAL))); - browseButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleLocationBrowseButtonPressed(); - } - }); - browseButton.setEnabled(true); - synchHelper.synchText(locationPathField, LOCATION, null); - } - - /** - * Open an appropriate directory browser - */ - protected void handleLocationBrowseButtonPressed() { - DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell()); - dialog.setMessage(defDirDialogLabel); - String dirName = model.getStringProperty(LOCATION); - if ((dirName != null) && (dirName.length() != 0)) { - File path = new File(dirName); - if (path.exists()) { - dialog.setFilterPath(dirName); - } - } - String selectedDirectory = dialog.open(); - if (selectedDirectory != null) { - model.setProperty(LOCATION, selectedDirectory); - } - } - - private void createProjectNameGroup(Composite parent) { - // set up project name label - Label projectNameLabel = new Label(parent, SWT.NONE); - projectNameLabel.setText(defProjectNameLabel); - GridData data = new GridData(); - projectNameLabel.setLayoutData(data); - // set up project name entry field - projectNameField = new Text(parent, SWT.BORDER); - data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = SIZING_TEXT_FIELD_WIDTH; - projectNameField.setLayoutData(data); - new Label(parent, SWT.NONE); // pad - synchHelper.synchText(projectNameField, PROJECT_NAME, new Control[]{projectNameLabel}); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebProjectFirstPage.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebProjectFirstPage.java deleted file mode 100644 index fc4306260..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebProjectFirstPage.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.eclipse.wst.web.ui.internal.wizards; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.web.internal.ResourceHandler; -import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin; - -public class SimpleWebProjectFirstPage extends DataModelFacetCreationWizardPage { - - public SimpleWebProjectFirstPage(IDataModel dataModel, String pageName) { - super(dataModel, pageName); - setDescription(ResourceHandler.StaticWebProjectWizardBasePage_Page_Description); - setTitle(ResourceHandler.StaticWebProjectWizardBasePage_Page_Title); - setImageDescriptor(WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz")); //$NON-NLS-1$ - setInfopopID(IWstWebUIContextIds.NEW_STATIC_WEB_PROJECT_PAGE1); - } - -} diff --git a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebProjectWizard.java b/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebProjectWizard.java deleted file mode 100644 index 110289394..000000000 --- a/plugins/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/wizards/SimpleWebProjectWizard.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.wst.web.ui.internal.wizards; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.project.facet.IProductConstants; -import org.eclipse.wst.project.facet.ProductManager; -import org.eclipse.wst.project.facet.SimpleWebFacetProjectCreationDataModelProvider; -import org.eclipse.wst.web.internal.ResourceHandler; -import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin; - -public class SimpleWebProjectWizard extends NewProjectDataModelFacetWizard { - - public SimpleWebProjectWizard(IDataModel model) { - super(model); - setWindowTitle(ResourceHandler.StaticWebProjectCreationWizard_Wizard_Title); - } - - public SimpleWebProjectWizard() { - super(); - setWindowTitle(ResourceHandler.StaticWebProjectCreationWizard_Wizard_Title); - } - - protected IDataModel createDataModel() { - return DataModelFactory.createDataModel(new SimpleWebFacetProjectCreationDataModelProvider()); - } - - protected ImageDescriptor getDefaultPageImageDescriptor() { - return WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz"); //$NON-NLS-1$ - } - - protected IFacetedProjectTemplate getTemplate() { - return ProjectFacetsManager.getTemplate("template.wst.web"); //$NON-NLS-1$ - } - - protected IWizardPage createFirstPage() { - return new SimpleWebProjectFirstPage(model, "first.page"); //$NON-NLS-1$ - } - - protected String getFinalPerspectiveID() { - return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_STATICWEB); - } - -} |