Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard')
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java113
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java76
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java81
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java85
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java81
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java248
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java163
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java162
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ClassesImportWizard.java177
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java87
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java93
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java78
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java320
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java130
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java111
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java295
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java107
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java67
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java92
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ImportUtil.java216
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactCreationWizard.java291
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java172
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java227
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizard.java202
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizardPage.java510
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java108
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java76
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java91
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java404
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java282
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java42
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java45
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java102
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java410
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java375
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java95
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/MinimizedFileSystemElement.java131
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java521
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java370
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java681
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewModuleGroup.java224
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/PackageNameResolver.java70
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerEarAndStandaloneGroup.java154
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java76
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java129
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java460
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.java42
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportMainPage.java135
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportPage1.java1417
-rw-r--r--plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties2
50 files changed, 0 insertions, 10626 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java
deleted file mode 100644
index e977b505b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-/*
- * Created on Mar 29, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
-
-/**
- * @author jlanuti
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class AnnotationsStandaloneGroup {
-
- protected Object model;
- protected Object synchHelper;
- protected Button useAnnotations;
- private boolean isForBean;
- private boolean useServletString = false;
- public static final String EJBTAGSET = "ejb"; //$NON-NLS-1$
-
- /**
- * Constructor
- */
- public AnnotationsStandaloneGroup(Composite parent, Object model, boolean forBean) {
- this(parent, model, forBean, false);
- }
-
- /**
- * Constructor
- */
- public AnnotationsStandaloneGroup(Composite parent, Object model, boolean forBean, boolean useServlet) {
- super();
- synchHelper = new DataModelSynchHelper((IDataModel)model);
- this.model = model;
- this.isForBean = forBean;
- this.useServletString = useServlet;
-
- buildComposites(parent);
- }
-
- /**
- * @param parent
- */
- protected void buildComposites(Composite parent) {
- // Add separator
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- separator.setLayoutData(gd);
- // Add spacer
- Label spacer = new Label(parent, SWT.NONE);
- GridData gd1 = new GridData(GridData.FILL_HORIZONTAL);
- gd1.horizontalSpan = 3;
- spacer.setLayoutData(gd1);
- // Add annotations checkbox and label
- useAnnotations = new Button(parent, SWT.CHECK);
- String labelText;
- if (useServletString)
- labelText = J2EEUIMessages.getResourceString(J2EEUIMessages.USE_ANNOTATIONS_SERVLET);
- else if (isForBean)
- labelText = J2EEUIMessages.getResourceString(J2EEUIMessages.USE_ANNOTATIONS);
- else
- labelText = J2EEUIMessages.getResourceString(J2EEUIMessages.ADD_ANNOTATIONS_SUPPORT);
- useAnnotations.setText(labelText);
- ((DataModelSynchHelper)synchHelper).synchCheckbox(useAnnotations, IAnnotationsDataModel.USE_ANNOTATIONS, null);
- GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
- gd2.horizontalSpan = 2;
- useAnnotations.setLayoutData(gd2);
- Dialog.applyDialogFont(parent);
- }
-
- public void dispose() {
- ((IDataModel)model).removeListener((DataModelSynchHelper)synchHelper);
- synchHelper = null;
- model = null;
- }
-
- public void setEnablement(IProject project) {
- //TODO Remove - this is to be handled by the provider of the DataModel.
- }
-
-
-
- public void setUseServlet(boolean aBoolean) {
- useServletString = aBoolean;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java
deleted file mode 100644
index 9fe83e20f..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java
+++ /dev/null
@@ -1,76 +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.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.application.internal.operations.AppClientComponentExportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * <p>
- * Wizard used to export J2EE Application Client module structures from the Eclipse Workbench to a
- * deployable Application Client Archive *.jar file.
- * </p>
- */
-public final class AppClientComponentExportWizard extends J2EEArtifactExportWizard implements IExportWizard {
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public AppClientComponentExportWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public AppClientComponentExportWizard(IDataModel model) {
- super(model);
- }
- protected IDataModelProvider getDefaultProvider() {
- return new AppClientComponentExportDataModelProvider();
- }
-
- /**
- * <p>
- * Adds the following pages:
- * <ul>
- * <li>{@link AppClientExportPage}as the main wizard page ({@link #MAIN_PG})
- * </ul>
- * </p>
- */
- public void doAddPages() {
- addPage(new AppClientExportPage(getDataModel(), MAIN_PG, getSelection()));
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Sets up the default wizard page image.
- * </p>
- */
- protected void doInit() {
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_EXPORT_WIZARD_BANNER));
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java
deleted file mode 100644
index e0c12c951..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class AppClientComponentImportPage extends J2EEModuleImportPage {
- /**
- * @param model
- * @param pageName
- */
- public AppClientComponentImportPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_MAIN_PG_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_MAIN_PG_DESC));
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_IMPORT_WIZARD_BANNER));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileImportLabel()
- */
- protected String getFileImportLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_FILE_LABEL);
- }
-
- protected String getFileNamesStoreID() {
- return "APP_CLIENT"; //$NON-NLS-1$;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
- */
- protected String[] getFilterExpression() {
- return new String[]{"*.jar"}; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
- */
- protected String getProjectImportLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_PROJECT_LABEL);
- }
-
- // protected J2EEComponentCreationDataModel getNewProjectCreationDataModel() {
- // return getAppClientDataModel().getJ2eeArtifactCreationDataModel();
- // }
- //
- // private AppClientModuleImportDataModel getAppClientDataModel() {
- // return (AppClientModuleImportDataModel) model;
- // }
-
- protected Composite createTopLevelComposite(Composite parent) {
- setInfopopID(IJ2EEUIContextIds.IMPORT_APPCLIENT_WIZARD_P1);
- return super.createTopLevelComposite(parent);
- }
-
- protected String getModuleFacetID(){
- return J2EEProjectUtilities.APPLICATION_CLIENT;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java
deleted file mode 100644
index 8ef52ce2b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-/**
- * <p>
- * Wizard used to import J2EE Application Client module structures into the Eclipse Workbench from
- * an existing Application Client *.jar file.
- * </p>
- */
-public final class AppClientComponentImportWizard extends J2EEComponentImportWizard {
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public AppClientComponentImportWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public AppClientComponentImportWizard(IDataModel model) {
- super(model);
- }
-
- /**
- * <p>
- * Adds an {@link AppClientImportPage}as the main wizard page ({@link #MAIN_PG}).
- * </p>
- */
- public void doAddPages() {
- addPage(new AppClientComponentImportPage(getDataModel(), MAIN_PG));
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Sets up the dialog window title and default wizard page image.
- * </p>
- */
- public final void doInit() {
- setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.IMPORT_WIZ_TITLE));
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_IMPORT_WIZARD_BANNER));
- }
-
- protected String[] getModuleValidatorStrings() {
- return new String[]{"org.eclipse.jst.j2ee.internal.validation.UIApplicationClientValidator"}; //$NON-NLS-1$
- }
-
- protected IDataModelProvider getDefaultProvider() {
- return new AppClientComponentImportDataModelProvider();
- }
-
- protected String getFinalPerspectiveID() {
- return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_APPCLIENT);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java
deleted file mode 100644
index bfc6a0ead..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * 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.jst.j2ee.internal.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class AppClientExportPage extends J2EEModuleExportPage {
- /**
- * @param model
- * @param pageName
- */
- public AppClientExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
- super(model, pageName, selection);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_EXPORT_MAIN_PG_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_EXPORT_MAIN_PG_DESC));
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_EXPORT_WIZARD_BANNER));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
- */
- protected String getComponentLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_PROJECT_LABEL);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
- */
- protected String[] getFilterExpression() {
- return new String[]{"*.jar"}; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEExportPage#isMetaTypeSupported(java.lang.Object)
- */
- protected boolean isMetaTypeSupported(Object o) {
- return o instanceof ApplicationClient;
- }
-
- protected String getInfopopID() {
- return IJ2EEUIContextIds.EXPORT_APPCLIENT_WIZARD_P1;
- }
-
- protected String getCompnentID() {
- return "JST_APPCLIENT"; //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java
deleted file mode 100644
index 3bad7b063..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
-import org.eclipse.jst.j2ee.application.internal.operations.ClasspathElement;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.common.frameworks.internal.ui.OverlayIcon;
-
-
-public class AvailableJarsProvider implements org.eclipse.jface.viewers.IStructuredContentProvider, org.eclipse.jface.viewers.ITableLabelProvider {
- protected static Image utilImage;
- protected static Image invalidImage;
- protected static Image ejbImage;
- protected static Image ejbClientImage;
- protected static Image classpathImage;
-
- /**
- * AvailableJarsContentProvider constructor comment.
- */
- public AvailableJarsProvider() {
- super();
- }
-
- /**
- * Adds a listener to this label provider. Has no effect if an identical listener is already
- * registered.
- * <p>
- * Label provider listeners are informed about state changes that affect the rendering of the
- * viewer that uses this label provider.
- * </p>
- *
- * @param listener
- * a label provider listener
- */
- public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
- //do nothing
- }
-
- /**
- * Disposes of this label provider. When a label provider is attached to a viewer, the viewer
- * will automatically call this method when the viewer is being closed. When label providers are
- * used outside of the context of a viewer, it is the client's responsibility to ensure that
- * this method is called when the provider is no longer needed.
- */
- public void dispose() {
- //dispose
- }
-
- /**
- * Returns the label image for the given column of the given element.
- *
- * @param element
- * the object representing the entire row, or <code>null</code> indicating that no
- * input object is set in the viewer
- * @param columnIndex
- * the zero-based index of the column in which the label appears
- */
- public org.eclipse.swt.graphics.Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex > 0)
- return null;
- ClasspathElement cp = (ClasspathElement) element;
- if (!cp.isValid())
- return getInvalidImage();
-
- if (cp.isClasspathEntry()) {
- return getClasspathDependencyImage();
- }
-
- switch (cp.getJarType()) {
- case ClasspathElement.EJB_JAR :
- return getEjbImage();
- case ClasspathElement.EJB_CLIENT_JAR :
- return getEjbClientImage();
- default :
- return getUtilImage();
- }
- }
-
- /**
- * Returns the label text for the given column of the given element.
- *
- * @param element
- * the object representing the entire row, or <code>null</code> indicating that no
- * input object is set in the viewer
- * @param columnIndex
- * the zero-based index of the column in which the label appears
- */
- public String getColumnText(Object element, int columnIndex) {
- String value = null;
- switch (columnIndex) {
- case 0 : {
- value = ((ClasspathElement) element).getText();
- break;
- }
- case 1 :
- value = ((ClasspathElement) element).getProjectName();
- }
- return value == null ? "" : value;//$NON-NLS-1$
- }
-
- protected static Image getEjbImage() {
- if (ejbImage == null)
- ejbImage = getImageDescriptor("EJBJar").createImage();//$NON-NLS-1$
- return ejbImage;
- }
-
- protected static Image getEjbClientImage() {
- if (ejbClientImage == null)
- ejbClientImage = getImageDescriptor("ejbclientjar_obj").createImage();//$NON-NLS-1$
- return ejbClientImage;
- }
-
- protected static Image getClasspathDependencyImage() {
- if (classpathImage == null)
- classpathImage = getImageDescriptor("CPDep").createImage();//$NON-NLS-1$
- return classpathImage;
- }
-
- /**
- * Returns the elements to display in the viewer when its input is set to the given element.
- * These elements can be presented as rows in a table, items in a list, etc. The result is not
- * modified by the viewer.
- *
- * @param inputElement
- * the input element
- * @return the array of elements to display in the viewer
- */
- public java.lang.Object[] getElements(Object inputElement) {
- ClassPathSelection selection = (ClassPathSelection) inputElement;
- return filter(selection, selection.getFilterLevel()).toArray();
- }
-
- /**
- * @param list
- */
- private List filter(ClassPathSelection selection, int filterLevel) {
- List list = selection.getClasspathElements();
- List result = new ArrayList(list.size());
- for (int i = 0; i < list.size(); i++) {
- ClasspathElement element = (ClasspathElement) list.get(i);
- if (!element.isSelected()) {
- switch (filterLevel) {
- case (ClassPathSelection.FILTER_EJB_CLIENT_JARS) :
- if (element.isEJBClientJar())
- continue;
- break;
- case (ClassPathSelection.FILTER_EJB_SERVER_JARS) :
- if (element.isEJBJar() && selection.getOppositeElement(element) != null)
- continue;
- }
- }
- result.add(element);
- }
- return result;
- }
-
- /**
- * This gets a .gif from the icons folder.
- */
- protected static ImageDescriptor getImageDescriptor(String key) {
- ImageDescriptor imageDescriptor = null;
-
- URL gifImageURL = (URL) J2EEPlugin.getPlugin().getImage(key);
- imageDescriptor = ImageDescriptor.createFromURL(gifImageURL);
- return imageDescriptor;
- }
-
- protected static Image getInvalidImage() {
- if (invalidImage == null) {
- ImageDescriptor base = getImageDescriptor("jar_nonexist_obj");//$NON-NLS-1$
- ImageDescriptor overlay = getImageDescriptor("warning_co");//$NON-NLS-1$
- invalidImage = new OverlayIcon(base, new ImageDescriptor[][]{{overlay}}).createImage();
- }
- return invalidImage;
- }
-
- public static Image getUtilImage() {
- if (utilImage == null)
- utilImage = getImageDescriptor("jar_obj").createImage();//$NON-NLS-1$
- return utilImage;
- }
-
- /**
- * Notifies this content provider that the given viewer's input has been switched to a different
- * element.
- * <p>
- * A typical use for this method is registering the content provider as a listener to changes on
- * the new input (using model-specific means), and deregistering the viewer from the old input.
- * In response to these change notifications, the content provider propagates the changes to the
- * viewer.
- * </p>
- *
- * @param viewer
- * the viewer
- * @param oldInput
- * the old input element, or <code>null</code> if the viewer did not previously
- * have an input
- * @param newInput
- * the new input element, or <code>null</code> if the viewer does not have an input
- */
- public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
- //do nothing
- }
-
- /**
- * Returns whether the label would be affected by a change to the given property of the given
- * element. This can be used to optimize a non-structural viewer update. If the property
- * mentioned in the update does not affect the label, then the viewer need not update the label.
- *
- * @param element
- * the element
- * @param property
- * the property
- * @return <code>true</code> if the label would be affected, and <code>false</code> if it
- * would be unaffected
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * Removes a listener to this label provider. Has no affect if an identical listener is not
- * registered.
- *
- * @param listener
- * a label provider listener
- */
- public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
- //do nothing
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java
deleted file mode 100644
index e01a7d799..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Apr 22, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * @author vijayb
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class AvailableUtilJarsAndWebLibProvider implements IStructuredContentProvider, ITableLabelProvider {
-
- public AvailableUtilJarsAndWebLibProvider() {
- //Default constructor
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof ArchiveWrapper){
- ArchiveWrapper wrapper = (ArchiveWrapper)inputElement;
- List <ArchiveWrapper> utilities = wrapper.getEARUtilitiesAndWebLibs();
- List filteredProjects = new ArrayList();
- if (utilities.size() > 0){
- filterEJBClientJars(utilities, wrapper);
- Object [] array = utilities.toArray();
- Arrays.sort(array, new Comparator() {
- public int compare(Object o1, Object o2) {
- return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
- }
- });
- return array;
- }
- else
- return new Object[0];
- }
- return new Object[0];
- }
-
- /**
- * @param array
- * @return
- */
- private void filterEJBClientJars(List <ArchiveWrapper> utilities, ArchiveWrapper earWrapper) {
- List <ArchiveWrapper> modules = earWrapper.getEarModules();
- for(ArchiveWrapper module : modules){
- if(module.isEJBJarFile()){
- ArchiveWrapper clientWrapper = earWrapper.getEJBClientArchiveWrapper(module);
- if(null != clientWrapper){
- boolean removed = false;
- for(int i=0;i<utilities.size() && !removed; i++){
- if(clientWrapper.getUnderLyingArchive() == utilities.get(i).getUnderLyingArchive()){
- utilities.remove(i);
- removed = true;
- }
- }
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return AvailableJarsProvider.getUtilImage();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- ArchiveWrapper wrapper = (ArchiveWrapper)element;
- IPath path = wrapper.getPath();
- if(path.toString().startsWith(ArchiveConstants.WEBAPP_LIB_URI)){
- return wrapper.getParent().getName()+"#"+wrapper.getPath(); //$NON-NLS-1$
- }
- return wrapper.getName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- //Auto-generated method stub
- }
-
- /*
- * (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) {
- //Auto-generated method stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- //Auto-generated method stub
- }
-
- /*
- * (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) {
- //Auto-generated method stub
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java
deleted file mode 100644
index 4629cc77b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java
+++ /dev/null
@@ -1,162 +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
- *******************************************************************************/
-/*
- * Created on Apr 22, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author vijayb
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class AvailableUtilityJarsProvider implements IStructuredContentProvider, ITableLabelProvider {
-
- public AvailableUtilityJarsProvider() {
- //default constructor
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- /*
- * Object[] array = EARImportDataModel.getAllUtilities((EARFile) inputElement).toArray();
- */
- Object[] array = getJarFilesFromDirectory(inputElement);
- Arrays.sort(array, new Comparator() {
-
- public int compare(Object o1, Object o2) {
- return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
- }
-
- });
- return array;
- }
-
- /**
- * @param inputElement
- * @return
- */
- private Object[] getJarFilesFromDirectory(Object inputElement) {
-
- List collectedJars = new ArrayList();
- IDataModel model = null;
- if (inputElement instanceof IDataModel)
- model = (IDataModel) inputElement;
- if (model != null) {
-
- String fileName = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.AVAILABLE_JARS_DIRECTORY);
- File directory = new File(fileName);
- if (directory.exists() && directory.canRead() && directory.isDirectory()) {
- File[] availableFiles = directory.listFiles();
-
- if (availableFiles == null)
- return new File[0];
-
- for (int i = 0; i < availableFiles.length; i++)
- if (availableFiles[i] != null && availableFiles[i].getName().endsWith(".jar"))collectedJars.add(availableFiles[i]); //$NON-NLS-1$
- }
- }
- return collectedJars.toArray();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return AvailableJarsProvider.getUtilImage();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- /*
- * FileImpl file = (FileImpl) element; if
- * (file.getURI().startsWith(ArchiveConstants.WEBAPP_LIB_URI)) { String parentWarFileName =
- * ((WARFile) file.eContainer()).getName(); return parentWarFileName + "#" + file.getURI();
- * //$NON-NLS-1$ } else return file.getName();
- */
- return element.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- //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) {
- //do nothing
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- //do nothing
- }
-
- /*
- * (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) {
- //do nothing
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ClassesImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ClassesImportWizard.java
deleted file mode 100644
index ac07f233f..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ClassesImportWizard.java
+++ /dev/null
@@ -1,177 +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.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.util.CoreUtility;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-
-public class ClassesImportWizard extends Wizard implements IImportWizard {
-
- public WizardClassesImportMainPage mainPage = null;
-
- public WizardClassesImportPage1 page1 = null;
-
- private IWorkbench workbench;
-
- private IStructuredSelection selection;
-
- private IPath importedClassesPath;
-
- private IJavaProject javaProject = null;
-
- private IProject project = null;
-
- protected ArrayList fileNames = null;
-
- public ClassesImportWizard() {
- super();
- }
-
- public ClassesImportWizard(IProject project) {
- super();
- this.project = project;
-
- }
-
- public ClassesImportWizard(IProject project, String fileName, List otherFileNames) {
- this(project);
- this.fileNames = new ArrayList();
- this.fileNames.add(fileName);
- int i = fileName.lastIndexOf(java.io.File.separatorChar);
- String parentDir = fileName.substring(0, i);
- if (otherFileNames != null)
- for (int j = otherFileNames.size() - 1; j >= 0; j--) {
- if (otherFileNames.get(j) != null) {
- int k = ((String) otherFileNames.get(j)).lastIndexOf(java.io.File.separatorChar);
- if (k == i && parentDir.equals(((String) otherFileNames.get(j)).substring(0, k))) {
- fileNames.add(otherFileNames.remove(j));
- }
- }
- }
-
- }
-
- public void setFolderPath(IPath path) {
- importedClassesPath = path;
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- return page1.finish();
- }
-
- public void createImportedClassesFolder(IProject aProject) {
- //Create imported_classes folder selected project
- IContainer container = aProject;
- IFolder folder = container.getFolder(new Path("imported_classes")); //$NON-NLS-1$
- javaProject = getIJavaProject(aProject);
-
- IPath importedFoldersClass = folder.getFullPath();
-
- CPListElement entry = newCPLibraryElement(folder);
- IClasspathEntry newEntry = entry.getClasspathEntry();
-
- IResource res = entry.getResource();
- if ((res instanceof IFolder) && !res.exists()) {
- try {
- CoreUtility.createFolder((IFolder) res, true, true, null);
-
- } catch (CoreException e) {
- //Ignore
- }
- }
-
- try {
- IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[classpathEntries.length + 1];
-
- for (int i = 0; i < classpathEntries.length; i++) {
- newClasspath[i] = classpathEntries[i];
- }
- newClasspath[classpathEntries.length] = newEntry;
-
- javaProject.setRawClasspath(newClasspath, null);
-
- } catch (JavaModelException e) {
- //Ignore
- }
-
- setFolderPath(importedFoldersClass);
- }
-
- private IJavaProject getIJavaProject(IProject projectHandle) {
- IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
- return javaModel.getJavaProject(projectHandle.getName());
- }
-
- private CPListElement newCPLibraryElement(IResource res) {
-
- return new CPListElement(javaProject, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
- */
- public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
- setWindowTitle(J2EEUIMessages.getResourceString("Import_Class_Files_UI")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor("import_class_file_wiz_ban")); //$NON-NLS-1$
-
- workbench = aWorkbench;
- selection = aSelection;
- if (!aSelection.isEmpty() && aSelection.getFirstElement() instanceof IProject)
- project = (IProject) aSelection.getFirstElement();
-
- if (project != null)
- createImportedClassesFolder(project);
- }
-
- public void addPages() {
- try {
- super.addPages();
- mainPage = new WizardClassesImportMainPage("id", fileNames); //$NON-NLS-1$
- mainPage.setWizard(this);
- if (fileNames == null || fileNames.size() == 0)
- addPage(mainPage);
- page1 = new WizardClassesImportPage1(workbench, selection, importedClassesPath, fileNames);
- page1.setWizard(this);
- addPage(page1);
- } catch (Throwable ex) {
- ex.printStackTrace();
- }
-
-
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java
deleted file mode 100644
index 1a31d8aea..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- *******************************************************************************/
-/*
- * Created on Mar 23, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.j2ee.internal.earcreation.DefaultJ2EEComponentCreationDataModelProvider;
-import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
-
-public class DefaultJ2EEComponentCreationWizard extends DataModelWizard {
- private static final String SELECTION_PG = "selection"; //$NON-NLS-1$
-
- /**
- * @param model
- */
- public DefaultJ2EEComponentCreationWizard(IDataModel model) {
- super(model);
- initialize();
- }
-
- /**
- *
- */
- public DefaultJ2EEComponentCreationWizard() {
- super();
- initialize();
- }
-
- /**
- *
- */
- private void initialize() {
- setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_WIZ_TITLE));
- String iconPath = "icons/full/"; //$NON-NLS-1$
- try {
- URL installURL = IDEWorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/new_wiz.png"); //$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- } catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
- setNeedsProgressMonitor(true);
- setForcePreviousAndNextButtons(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- public void doAddPages() {
- addPage(new NewJ2EEComponentSelectionPage(getDataModel(), SELECTION_PG));
- }
-
- public boolean canFinish() {
- if (!super.canFinish()) {
- return false;
- }
- return getDataModel().getBooleanProperty(IDefaultJ2EEComponentCreationDataModelProperties.ENABLED);
- }
-
- protected IDataModelProvider getDefaultProvider() {
- return new DefaultJ2EEComponentCreationDataModelProvider();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java
deleted file mode 100644
index e6e2e7fa8..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * 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.jst.j2ee.internal.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class EARComponentExportPage extends J2EEExportPage {
- /**
- * @param model
- * @param pageName
- */
- public EARComponentExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
- super(model, pageName, selection);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_EXPORT_MAIN_PG_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_EXPORT_MAIN_PG_DESC));
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_EXPORT_WIZARD_BANNER));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
- */
- protected String getComponentLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_PROJECT_FOR_MODULE_CREATION);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
- */
- protected String[] getFilterExpression() {
- return new String[]{"*.ear"}; //$NON-NLS-1$
- }
-
- /**
- * @return
- */
- protected boolean shouldShowProjectFilesCheckbox() {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEExportPage#isMetaTypeSupported(java.lang.Object)
- */
- protected boolean isMetaTypeSupported(Object o) {
- return o instanceof Application;
- }
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IJ2EEComponentExportDataModelProperties.PROJECT_NAME, IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING};
- }
-
- protected String getInfopopID() {
- return IJ2EEUIContextIds.EXPORT_EAR_WIZARD_P1;
- }
-
- protected String getCompnentID() {
- return "JST_EAR"; //$NON-NLS-1$
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java
deleted file mode 100644
index a9b261117..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java
+++ /dev/null
@@ -1,78 +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.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.application.internal.operations.EARComponentExportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * <p>
- * Wizard used to export J2EE Enterprise Application structures from the Eclipse Workbench to a
- * deployable Enterprise Application Archive *.ear file.
- * </p>
- */
-public final class EARComponentExportWizard extends J2EEArtifactExportWizard implements IExportWizard {
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public EARComponentExportWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public EARComponentExportWizard(IDataModel model) {
- super(model);
- }
-
- protected IDataModelProvider getDefaultProvider() {
- return new EARComponentExportDataModelProvider();
- }
-
- /**
- * <p>
- * Adds the following pages:
- * <ul>
- * <li>{@link EARComponentExportPage}as the main wizard page ({@link #MAIN_PG})
- * </ul>
- * </p>
- */
- public void doAddPages() {
- addPage(new EARComponentExportPage(getDataModel(), MAIN_PG, getSelection()));
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Sets up the default wizard page image.
- * </p>
- */
- protected void doInit() {
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_EXPORT_WIZARD_BANNER));
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java
deleted file mode 100644
index 57311d230..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Dec 8, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-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.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-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.internal.datamodel.ui.DataModelWizardPage;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class EARComponentImportOptionsPage extends DataModelWizardPage {
- private Button deselectAllButton;
- private Button selectAllButton;
- private Label moduleProjectLocationLabel;
- protected Button browseButton;
- protected Button useAlternateRootBtn;
- protected Text systemDefaultText;
- protected ArchiveWrapper aWrapper;
- public CheckboxTableViewer availableJARsViewer;
- public boolean utilJarSelectionChanged = false;
-
- /**
- * @param model
- * @param pageName
- */
- public EARComponentImportOptionsPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_DESC));
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- setInfopopID(IJ2EEUIContextIds.IMPORT_EAR_WIZARD_P2);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- createJARsComposite(composite);
- createProjectRootComposite(composite);
-
- return composite;
- }
-
- /*
- * Updates the enable state of the all buttons
- */
- protected void updateButtonEnablements() {
- utilJarSelectionChanged = true;
- }
-
- protected void createAvailableJarsList(Composite listGroup) {
- availableJARsViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData gData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- gData.widthHint = 200;
- gData.heightHint = 80;
- availableJARsViewer.getControl().setLayoutData(gData);
- AvailableUtilJarsAndWebLibProvider availableUtilJARsProvider = new AvailableUtilJarsAndWebLibProvider();
- availableJARsViewer.setContentProvider(availableUtilJARsProvider);
- availableJARsViewer.setLabelProvider(availableUtilJARsProvider);
- availableJARsViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- availableJARCheckStateChanged(event);
- }
- });
- availableJARsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateButtonEnablements();
- }
- });
- TableLayout tableLayout = new TableLayout();
- availableJARsViewer.getTable().setLayout(tableLayout);
- availableJARsViewer.getTable().setHeaderVisible(false);
- availableJARsViewer.getTable().setLinesVisible(false);
-
- model.addListener(new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (event.getPropertyName().equals(IEARComponentImportDataModelProperties.UTILITY_LIST)) {
- availableJARsViewer.setCheckedElements(((List) model.getProperty(IEARComponentImportDataModelProperties.UTILITY_LIST)).toArray());
- }
- }
- });
- }
-
- private void handleDeselectAllButtonPressed() {
- ArrayList emptySelection = new ArrayList(2);
- model.setProperty(IEARComponentImportDataModelProperties.UTILITY_LIST, emptySelection);
- validatePage();
- }
-
- private void handleSelectAllButtonPressed() {
- ArrayList allSelection = new ArrayList(2);
- Object selection = null;
- for (int i = 0; (null != (selection = availableJARsViewer.getElementAt(i))); i++) {
- allSelection.add(selection);
- }
- model.setProperty(IEARComponentImportDataModelProperties.UTILITY_LIST, allSelection);
- validatePage();
- }
-
- /**
- * Open an appropriate directory browser
- */
- protected void handleBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell());
- dialog.setMessage(J2EEUIMessages.getResourceString(J2EEUIMessages.SELECT_DIRECTORY_DLG));
-
- String dirName = getBrowseStartLocation();
-
- if (!isNullOrEmpty(dirName)) {
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null)
- systemDefaultText.setText(selectedDirectory);
-
- }
-
- protected String getBrowseStartLocation() {
- String text = systemDefaultText.getText();
- return text;
- }
-
- protected void createButtonsGroup(Composite parent) {
- Composite buttonGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonGroup.setLayout(layout);
- buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- selectAllButton = new Button(buttonGroup, SWT.PUSH);
- selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_ALL_UTIL_BUTTON));
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- gd.widthHint = 140;
- selectAllButton.setLayoutData(gd);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleSelectAllButtonPressed();
- }
- });
-
- deselectAllButton = new Button(buttonGroup, SWT.PUSH);
- deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON));
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- gd.widthHint = 140;
- deselectAllButton.setLayoutData(gd);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleDeselectAllButtonPressed();
- }
- });
- }
-
- protected void createJARsComposite(Composite parent) {
- Group group = new Group(parent, SWT.NULL);
- group.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_JARS_GROUP));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label description = new Label(group, SWT.NULL);
- description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_UTIL_JARS_TO_BE_PROJECTS));
- GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd2.horizontalSpan = 3;
- description.setLayoutData(gd2);
-
- // create jars check box viewer
- createAvailableJarsList(group);
- createButtonsGroup(group);
- }
-
- protected void createProjectRootComposite(Composite parent) {
- Group group = new Group(parent, SWT.NULL);
- group.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_LOCATIONS_GROUP));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label description = new Label(group, SWT.NULL);
- description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_PROJECT_GROUP_DESCRIPTION));
- GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd2.horizontalSpan = 3;
- description.setLayoutData(gd2);
-
- moduleProjectLocationLabel = new Label(group, SWT.NULL);
- moduleProjectLocationLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.USE_DEFAULT_ROOT_RADIO));
- moduleProjectLocationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- systemDefaultText = new Text(group, SWT.READ_ONLY | SWT.WRAP | SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- systemDefaultText.setLayoutData(gd);
- synchHelper.synchText(systemDefaultText, IEARComponentImportDataModelProperties.NESTED_MODULE_ROOT, null);
-
- browseButton = new Button(group, SWT.PUSH);
- browseButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL));
- gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- browseButton.setLayoutData(gd);
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleBrowseButtonPressed();
- }
- });
- }
-
- private void refreshEARFileIfNecessary() {
- if (isEARFileChanged()) {
- aWrapper = (ArchiveWrapper) model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- refresh();
- }
- }
-
- protected void setJARsCompositeEnabled(boolean enabled) {
- availableJARsViewer.getTable().setEnabled(enabled);
- availableJARsViewer.setAllChecked(false);
- availableJARsViewer.setAllGrayed(!enabled);
- selectAllButton.setEnabled(enabled);
- deselectAllButton.setEnabled(enabled);
- }
-
- private void refresh() {
- availableJARsViewer.setInput(aWrapper);
- }
-
- public boolean isEARFileChanged() {
- return aWrapper != model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- }
-
- protected void enter() {
- super.enter();
- refreshEARFileIfNecessary();
- }
-
- public void availableJARCheckStateChanged(CheckStateChangedEvent event) {
- model.setProperty(IEARComponentImportDataModelProperties.UTILITY_LIST, getJARsForProjects());
- validatePage();
- }
-
- public List getJARsForProjects() {
- refreshEARFileIfNecessary();
- List result = new ArrayList();
- result.addAll(Arrays.asList(availableJARsViewer.getCheckedElements()));
- return result;
- }
-
- protected boolean isNullOrEmpty(String aString) {
- return aString == null || aString.length() == 0;
- }
-
- protected String[] getValidationPropertyNames() {
- return new String[]{};
- }
-
- protected void restoreWidgetValues() {
- // This page doesn't implement...
- }
-
- public void storeDefaultSettings() {
- // This page doesn't implement...
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java
deleted file mode 100644
index a13d1b157..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-/*
- * Created on Dec 8, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModelProvider;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class EARComponentImportPage extends J2EEImportPage {
- protected Combo serverTargetCombo;
-
- /**
- * @param model
- * @param pageName
- */
- public EARComponentImportPage(IDataModel dataModel, String pageName) {
- super(dataModel, pageName);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_DESC));
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- setInfopopID(IJ2EEUIContextIds.IMPORT_EAR_WIZARD_P1);
- GridLayout layout = new GridLayout(3, false);
- composite.setLayout(layout);
- createFileNameComposite(composite);
- createProjectNameComposite(composite);
- createAnnotationsStandaloneGroup(composite);
- restoreWidgetValues();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- protected String getProjectImportLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_PROJECT_LABEL);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileImportLabel()
- */
- protected String getFileImportLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_FILE_LABEL);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
- */
- protected String[] getFilterExpression() {
- return new String[]{"*.ear"}; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEModuleImportPage#createAnnotationsStandaloneGroup(org.eclipse.swt.widgets.Composite)
- */
- protected void createAnnotationsStandaloneGroup(Composite composite) {
- // new AnnotationsStandaloneGroup(composite, model, false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IJ2EEComponentImportDataModelProperties.FILE_NAME,
- IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME,
- EARComponentImportDataModelProvider.EAR_NAME_VALIDATION,
- IFacetProjectCreationDataModelProperties.FACET_RUNTIME,
- IAnnotationsDataModel.USE_ANNOTATIONS,
- J2EEArtifactImportDataModelProvider.FACET_RUNTIME};
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileNamesStoreID()
- */
- protected String getFileNamesStoreID() {
- return "EAR";//$NON-NLS-1$
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java
deleted file mode 100644
index ee5c89671..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-/**
- * <p>
- * Wizard used to import J2EE Application structures into the Eclipse Workbench from an existing
- * Enterprise Application Archive *.ear file.
- * </p>
- */
-public final class EARComponentImportWizard extends J2EEArtifactImportWizard implements IExecutableExtension, IImportWizard {
-
- /**
- * <p>
- * Constant used to identify the key of the Projects page of the Wizard.
- * </p>
- */
- protected static final String PROJECT_PG = "projects"; //$NON-NLS-1$
-
- /**
- * <p>
- * Constant used to identify the key of the Options page of the Wizard.
- * </p>
- */
- protected static final String OPTIONS_PG = "options"; //$NON-NLS-1$
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public EARComponentImportWizard() {
- super();
- setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public EARComponentImportWizard(IDataModel model) {
- super(model);
- setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
- }
-
- /**
- * <p>
- * Adds the following pages:
- * <ul>
- * <li>{@link EARComponentImportPage}as the main wizard page ({@link #MAIN_PG})
- * <li>{@link EARComponentImportOptionsPage}as the options wizard page ({@link #OPTIONS_PG})
- * <li>{@link EARComponentProjectsPage}as the project wizard page ({@link #PROJECT_PG})
- * </ul>
- *
- * </p>
- */
- public void doAddPages() {
- addPage(new EARComponentImportPage(getDataModel(), MAIN_PG));
- addPage(new EARComponentImportOptionsPage(getDataModel(), OPTIONS_PG));
- addPage(new EARComponentProjectsPage(getDataModel(), PROJECT_PG));
- }
-
-
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Sets up the dialog window title and default wizard page image.
- * </p>
- */
- protected void doInit() {
- setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.IMPORT_WIZ_TITLE));
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
-
- }
-
- protected IDataModelProvider getDefaultProvider() {
- return new EARComponentImportDataModelProvider();
- }
-
- protected String getFinalPerspectiveID() {
- return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_EAR);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java
deleted file mode 100644
index 805a3e58a..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Dec 8, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-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.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class EARComponentProjectsPage extends DataModelWizardPage {
-
- private CheckboxTableViewer earFileListViewer;
-
- public static final String INCLUDE_COLUMN = J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_0"); //$NON-NLS-1$
- public static final String FILE_COLUMN = J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_1"); //$NON-NLS-1$
- public static final String PROJECT_COLUMN = J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_2"); //$NON-NLS-1$
-
- /**
- * @param model
- * @param pageName
- */
- public EARComponentProjectsPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_PROJECT_PG_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_PROJECT_PG_DESC));
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- }
-
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- setInfopopID(IJ2EEUIContextIds.IMPORT_EAR_WIZARD_P3);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- createListGroup(composite);
- createButtonsGroup(composite);
-
- return composite;
- }
-
- protected void setColumnEditors() {
- Table t = earFileListViewer.getTable();
- CellEditor[] columnEditors = new CellEditor[t.getColumnCount()];
- columnEditors[1] = new TextCellEditor(t);
-
- earFileListViewer.setCellEditors(columnEditors);
- }
-
- protected void createButtonsGroup(Composite parent) {
- Composite buttonGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- buttonGroup.setLayout(layout);
- buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Button selectNotInWorkspace = new Button(buttonGroup, SWT.PUSH);
- selectNotInWorkspace.setText(J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_3")); //$NON-NLS-1$
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- //gd.horizontalSpan = 1;
- //gd.heightHint = 22;
- gd.widthHint = 140;
- selectNotInWorkspace.setLayoutData(gd);
- selectNotInWorkspace.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- List list = (List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
- List selectedList = (List) model.getProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST);
- List newList = new ArrayList();
- newList.addAll(selectedList);
- IDataModel importDM = null;
- for (int i = 0; i < list.size(); i++) {
- importDM = (IDataModel) list.get(i);
- if (!newList.contains(importDM) && !((IVirtualComponent) importDM.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT)).exists()) {
- newList.add(importDM);
- }
- }
- model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, newList);
- }
- });
-
- Button selectAllButton = new Button(buttonGroup, SWT.PUSH);
- selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_ALL_UTIL_BUTTON));
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- //gd.horizontalSpan = 1;
- //gd.heightHint = 22;
- gd.widthHint = 140;
- selectAllButton.setLayoutData(gd);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- List list = (List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
- List newList = new ArrayList();
- newList.addAll(list);
- model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, newList);
- }
- });
-
- Button deselectAllButton = new Button(buttonGroup, SWT.PUSH);
- deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON));
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- ////gd.horizontalSpan = 1;
- //gd.heightHint = 22;
- gd.widthHint = 140;
- deselectAllButton.setLayoutData(gd);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- List newList = new ArrayList();
- model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, newList);
- }
- });
- }
-
- public void propertyChanged(DataModelEvent event) {
- if (event.getPropertyName().equals(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST)) {
- if(earFileListViewer != null){
- updateGUICheckSelection();
- }
- }
- super.propertyChanged(event);
- }
-
- public void setFileListViewerInput() {
- TableObjects files = new TableObjects();
- Iterator iterator = ((List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST)).iterator();
- while (iterator.hasNext()) {
- files.tableObjectsList.add(iterator.next());
- }
- earFileListViewer.setInput(files);
- updateGUICheckSelection();
- }
-
- private void updateGUICheckSelection() {
- List selectedList = (List) model.getProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST);
- List projectList = (List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
- Object currentElement = null;
- for (int i = 0; i < projectList.size(); i++) {
- currentElement = projectList.get(i);
- earFileListViewer.setChecked(currentElement, selectedList.contains(currentElement));
- }
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.internal.wizard.J2EEWizardPage#enter()
- */
- protected void enter() {
- super.enter();
- setFileListViewerInput();
- validatePage();
- }
-
- /**
- * Creates the import source specification widgets. <b>Subclasses </b> must override this hook
- * method.
- *
- * @param parent
- * a <code>Composite</code> that is to be used as the parent of this group's
- * collection of visual components
- * @see org.eclipse.swt.widgets.Composite
- */
- protected void createListGroup(org.eclipse.swt.widgets.Composite parent) {
- Composite listGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- listGroup.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_BOTH);
- listGroup.setLayoutData(gd);
-
- earFileListViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- EARImportListContentProvider provider = new EARImportListContentProvider();
- earFileListViewer.setContentProvider(provider);
- earFileListViewer.setLabelProvider(provider);
- earFileListViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- IDataModel matchingModel = null;// getEARImportDataModel().getMatchingEJBJarOrClient(aModel);
- if (null != matchingModel) {
- earFileListViewer.setChecked(matchingModel, event.getChecked());
- }
- List result = new ArrayList();
- result.addAll(Arrays.asList(earFileListViewer.getCheckedElements()));
- model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, result);
-
- }
- });
-
- Table earFileListTable = (Table) earFileListViewer.getControl();
- earFileListTable.setHeaderVisible(true);
- earFileListTable.setLinesVisible(true);
- // set up table layout
- TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- tableLayout.addColumnData(new ColumnWeightData(200, true));
- earFileListTable.setLayout(tableLayout);
-
- gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- gd.widthHint = 400;
- earFileListTable.setLayoutData(gd);
-
-
- TableColumn fileNameColumns = new TableColumn(earFileListTable, SWT.NONE);
- fileNameColumns.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_Modules_in_EAR)); //$NON-NLS-1$ = "Modules in EAR"
- fileNameColumns.setResizable(true);
-
- TableColumn importNameColumn = new TableColumn(earFileListTable, SWT.NONE);
- importNameColumn.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_New_Project_Name)); //$NON-NLS-1$ = "New Project Name"
- importNameColumn.setResizable(true);
-
- String[] columnProperties = new String[2];
- columnProperties[0] = FILE_COLUMN;
- columnProperties[1] = PROJECT_COLUMN;
- earFileListViewer.setColumnProperties(columnProperties);
-
- setColumnEditors();
- earFileListViewer.setCellModifier(new ICellModifier() {
- public boolean canModify(Object element, String property) {
- return PROJECT_COLUMN.equals(property);
- }
-
- public Object getValue(Object element, String property) {
- TableItem[] items = earFileListViewer.getTable().getSelection();
- TableItem item = items[0];
- return item.getText(1);
- }
-
- public void modify(Object element, String property, Object value) {
- TableItem elementHolder = (TableItem) element;
- if (property.equals(PROJECT_COLUMN)) {
- elementHolder.setText(1, (String) value);
- ((IDataModel) elementHolder.getData()).setProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME, value);
- }
- }
- });
- }
-
-
- protected void restoreWidgetValues() {
- // This page doesn't implement...
- }
-
- public void storeDefaultSettings() {
- // This page doesn't implement...
- }
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, EARComponentImportDataModelProvider.NESTED_PROJECTS_VALIDATION};
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java
deleted file mode 100644
index ae65f5c61..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-
-/**
- * Insert the type's description here. Creation date: (5/7/2001 11:39:11 AM)
- *
- * @author: Administrator
- */
-public class EARImportListContentProvider extends LabelProvider implements IStructuredContentProvider, ITableLabelProvider {
- /**
- * EARImportListContentProvider constructor comment.
- */
- public EARImportListContentProvider() {
- super();
- }
-
- /**
- * Returns the elements to display in the viewer when its input is set to the given element.
- * These elements can be presented as rows in a table, items in a list, etc. The result is not
- * modified by the viewer.
- *
- * @param inputElement
- * the input element
- * @return the array of elements to display in the viewer
- */
- public java.lang.Object[] getElements(Object inputElement) {
- if (inputElement instanceof TableObjects) {
- Object[] array = ((TableObjects) inputElement).getTableObjects().toArray();
- Arrays.sort(array, new Comparator() {
- public int compare(Object o1, Object o2) {
- return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
- }
- });
- return array;
- }
- return new Object[0]; // should throw exception instead
- }
-
- /**
- * Returns the label image for the given column of the given element.
- *
- * @param element
- * the object representing the entire row, or <code>null</code> indicating that no
- * input object is set in the viewer
- * @param columnIndex
- * the zero-based index of the column in which the label appears
- */
- public org.eclipse.swt.graphics.Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * Returns the label text for the given column of the given element.
- *
- * @param element
- * the object representing the entire row, or <code>null</code> indicating that no
- * input object is set in the viewer
- * @param columnIndex
- * the zero-based index of the column in which the label appears
- */
- public String getColumnText(Object element, int columnIndex) {
- IDataModel dataModel = (IDataModel) element;
- if (columnIndex == 0) {
- ArchiveWrapper wrapper = (ArchiveWrapper) dataModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- if (wrapper.getPath().toString().startsWith(ArchiveConstants.WEBAPP_LIB_URI)) {
- String parentWarFileName = wrapper.getParent().getName();
- return parentWarFileName + "#" + wrapper.getName(); //$NON-NLS-1$
- }
- return wrapper.getPath().toString();
- } else if (columnIndex == 1) {
- return dataModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- }
- return ""; //$NON-NLS-1$
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // dispose
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java
deleted file mode 100644
index f45daeb20..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
-import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer;
-import org.eclipse.osgi.util.NLS;
-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.Text;
-
-public class EARLibrariesContainerPage extends NewElementWizardPage implements IClasspathContainerPage, IClasspathContainerPageExtension {
-
- protected IClasspathEntry entry = null;
-
- public EARLibrariesContainerPage() {
- super("EARLibrariesContainerPage"); //$NON-NLS-1$
- setTitle(EARLibrariesMessages.EARLibrariesContainerPage_0);
- setDescription(EARLibrariesMessages.EARLibrariesContainerPage_1);
- }
-
- public boolean finish() {
- return true;
- }
-
- public IClasspathEntry getSelection() {
- return JavaCore.newContainerEntry(J2EEComponentClasspathContainer.CONTAINER_PATH);
- }
-
- public void setSelection(IClasspathEntry containerEntry) {
- }
-
- public void createControl(Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
-
- final Text text = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
- text.setText(getDescription());
- text.setLayoutData(new GridData(GridData.FILL_BOTH));
- setControl(composite);
- }
-
- public void initialize(IJavaProject project, IClasspathEntry[] currentEntries) {
- }
-
-
- public static class EARLibrariesMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.jst.j2ee.internal.wizard.earlibraries"; //$NON-NLS-1$
-
- public static String EARLibrariesContainerPage_0;
-
- public static String EARLibrariesContainerPage_1;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, EARLibrariesMessages.class);
- }
-
- private EARLibrariesMessages() {
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java
deleted file mode 100644
index 7b3772c15..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java
+++ /dev/null
@@ -1,92 +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.jst.j2ee.internal.wizard;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.validation.UIEarValidator;
-import org.eclipse.wst.common.frameworks.internal.ui.RunnableWithProgressWrapper;
-import org.eclipse.wst.validation.internal.operations.OneValidatorOperation;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-
-public class EARValidationHelper {
-
- /**
- * Constructor for EARValidationHelper.
- */
- private EARValidationHelper() {
- super();
- }
-
- /**
- * Return a list of runnable validation operations for all EAR projects which have auto validate
- * enabled, and are impacted by the list of projects; If the ear project itself is in the list,
- * then it is skipped.
- */
- public static IRunnableWithProgress[] getEARValidationOperations(List modifiedProjects) {
- List earProjects = Arrays.asList(J2EEProjectUtilities.getAllProjectsInWorkspaceOfType(J2EEProjectUtilities.ENTERPRISE_APPLICATION));
- List result = new ArrayList(earProjects.size());
- for (int i = 0; i < earProjects.size(); i++) {
- IProject earProj = (IProject) earProjects.get(i);
- if (willEARProjectNeedValidation(earProj, modifiedProjects)) {
- result.add(createValidationRunnable(earProj));
- }
- }
- return (IRunnableWithProgress[]) result.toArray(new IRunnableWithProgress[result.size()]);
- }
-
- /**
- * Return a list of runnable validation operations for all EAR projects which have auto validate
- * enabled, and are impacted by the j2ee project
- */
- public static IRunnableWithProgress[] getEARValidationOperations(IProject modifiedJ2EEProject) {
- return getEARValidationOperations(Collections.singletonList(modifiedJ2EEProject));
- }
-
- public static boolean isEARValidationAutoEnabled(IProject earProj) {
- return ValidatorManager.getManager().isAutoValidate(earProj) && ValidatorManager.getManager().isEnabled(earProj, UIEarValidator.VALIDATOR_ID);
- }
-
- private static boolean willEARProjectNeedValidation(IProject earProj, List modifiedProjects) {
- if (modifiedProjects.contains(earProj) || !isEARValidationAutoEnabled(earProj))
- return false;
- //TODO migrate to use artifact edits and components
-// Object accessorKey = new Object();
-// EAREditModel editModel = runtime.getEarEditModelForRead(accessorKey);
-// try {
-// for (int i = 0; i < modifiedProjects.size(); i++) {
-// if (editModel.hasMappingToProject((IProject) modifiedProjects.get(i)))
-// return true;
-// }
-// } finally {
-// if (editModel != null)
-// editModel.releaseAccess(accessorKey);
-// }
- return false;
- }
-
- /**
- * Creates a new IRunnableWithProgress which runs a one validator operation on the EAR project
- */
- public static IRunnableWithProgress createValidationRunnable(IProject earProj) {
- OneValidatorOperation op = new OneValidatorOperation(earProj, UIEarValidator.VALIDATOR_ID, true, false);
-
- return new RunnableWithProgressWrapper(op);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ImportUtil.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ImportUtil.java
deleted file mode 100644
index afa712e5e..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ImportUtil.java
+++ /dev/null
@@ -1,216 +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.jst.j2ee.internal.wizard;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ApplicationClientFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EJBJarFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
-
-
-
-/**
- * @author Sachin
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class ImportUtil {
-
- public static final int UNKNOWN = 0;
- public static final int EARFILE = 1;
- public static final int EJBJARFILE = 2;
- public static final int WARFILE = 3;
- public static final int CLIENTJARFILE = 4;
- public static final int RARFILE = 5;
- public static final int IMPORTCLASSTYPE = 6;
- public static final int J2EE14 = 256;
- public static final int J2EE13 = 128;
- public static final int J2EE12 = 64;
- public static final int J2EESpec = J2EE12 + J2EE13 + J2EE14;
- public static final String EAR = "EAR"; //$NON-NLS-1$
- public static final String EJB = "EJB"; //$NON-NLS-1$
- public static final String WAR = "WEB"; //$NON-NLS-1$
- public static final String JAR = "CLIENT"; //$NON-NLS-1$
- public static final String RAR = "RAR"; //$NON-NLS-1$
- public static final String[] SUFFIXES = {"", EAR, EJB, WAR, JAR, RAR, ""}; //$NON-NLS-1$ //$NON-NLS-2$
-
- public static int getFileType(String fileName) {
- Archive anArchive = null;
- try {
- try {
- anArchive = CommonarchiveFactoryImpl.getActiveFactory().openArchive(fileName);
- int archiveType = getArchiveType(anArchive);
- if (archiveType == UNKNOWN && isImportClassType(fileName))
- return IMPORTCLASSTYPE;
- return archiveType;
- } catch (Exception e) {
- if (isImportClassType(fileName))
- return IMPORTCLASSTYPE;
- return UNKNOWN;
- }
- } finally {
- if (anArchive != null && anArchive.isOpen())
- anArchive.close();
- }
- }
-
- //TODO: use new getJ2EEVerions switch statements
- public static int getVersionedFileType(String fileName) {
- Archive anArchive = null;
- try {
- int archiveType = UNKNOWN;
- try {
- anArchive = CommonarchiveFactoryImpl.getActiveFactory().openArchive(fileName);
- try {
- if (anArchive.isEJBJarFile()) {
- archiveType = EJBJARFILE;
- EJBJar ejbJar = ((EJBJarFile) anArchive).getDeploymentDescriptor();
- if (ejbJar.getVersionID() == J2EEVersionConstants.EJB_1_1_ID)
- archiveType |= J2EE12;
- else if (ejbJar.getVersionID() == J2EEVersionConstants.EJB_2_0_ID)
- archiveType |= J2EE13;
- else if (ejbJar.getVersionID() == J2EEVersionConstants.EJB_2_1_ID)
- archiveType |= J2EE14;
- } else if (anArchive.isWARFile()) {
- archiveType = WARFILE;
- WebApp war = ((WARFile) anArchive).getDeploymentDescriptor();
- if (war.getVersionID() == J2EEVersionConstants.WEB_2_2_ID)
- archiveType |= J2EE12;
- else if (war.getVersionID() == J2EEVersionConstants.WEB_2_3_ID)
- archiveType |= J2EE13;
- else if (war.getVersionID() == J2EEVersionConstants.WEB_2_4_ID)
- archiveType |= J2EE14;
- } else if (anArchive.isApplicationClientFile()) {
- archiveType = CLIENTJARFILE;
- ApplicationClient appClient = ((ApplicationClientFile) anArchive).getDeploymentDescriptor();
- if (appClient.getVersionID() == J2EEVersionConstants.J2EE_1_2_ID)
- archiveType |= J2EE12;
- else if (appClient.getVersionID() == J2EEVersionConstants.J2EE_1_3_ID)
- archiveType |= J2EE13;
- else if (appClient.getVersionID() == J2EEVersionConstants.J2EE_1_4_ID)
- archiveType |= J2EE14;
- } else if (anArchive.isRARFile()) {
- archiveType = RARFILE | J2EE13;
- } else if (anArchive.isEARFile()) {
- archiveType = EARFILE;
- Application app = ((EARFile) anArchive).getDeploymentDescriptor();
- if (app.getVersionID() == J2EEVersionConstants.J2EE_1_2_ID)
- archiveType |= J2EE12;
- else if (app.getVersionID() == J2EEVersionConstants.J2EE_1_3_ID)
- archiveType |= J2EE13;
- else if (app.getVersionID() == J2EEVersionConstants.J2EE_1_4_ID)
- archiveType |= J2EE14;
- }
- } catch (Exception e) {
- //Ignore
- }
-
- } catch (Exception e) {
- //Ignore
- }
- if (archiveType == UNKNOWN && isImportClassType(fileName))
- archiveType = IMPORTCLASSTYPE;
- return archiveType;
- } finally {
- if (anArchive != null && anArchive.isOpen())
- anArchive.close();
- }
- }
-
- public static int getArchiveType(Archive anArchive) {
- int type = UNKNOWN;
- try {
- if (anArchive.isEJBJarFile())
- type = EJBJARFILE;
- else if (anArchive.isWARFile())
- type = WARFILE;
- else if (anArchive.isApplicationClientFile())
- type = CLIENTJARFILE;
- else if (anArchive.isRARFile())
- type = RARFILE;
- else if (anArchive.isEARFile())
- type = EARFILE;
- } catch (Exception e) {
- //Ignore
- }
- return type;
- }
-
- public static boolean isImportClassType(String fileName) {
- File file = new File(fileName);
- String fileExtension = getExtension(file);
- if (file.isFile()) {
- if (fileExtension.equalsIgnoreCase("jar") || //$NON-NLS-1$
- fileExtension.equalsIgnoreCase("zip") || //$NON-NLS-1$
- fileExtension.equalsIgnoreCase("class")) //$NON-NLS-1$
- return true;
- } else if (file.isDirectory()) { //disable/enable drag/drop directories
- return false;
- }
- return false;
- }
-
- public static String getExtension(File f) {
- String ext = null;
- String s = f.getName();
- int i = s.lastIndexOf('.');
-
- if (i > 0 && i < s.length() - 1) {
- ext = s.substring(i + 1).toLowerCase();
- }
- return ext;
- }
-
-
- public static String findMatchingProjectName(String projectName) {
- if (projectName.trim().length() > 0) {
- IWorkspaceRoot root = J2EEPlugin.getWorkspace().getRoot();
- IProject[] projects = root.getProjects();
- String lowerCaseName = projectName.toLowerCase();
- // iterate through all projects a compare lowercase names
- if (projectName == null || projectName.length() == 0) {
- if (projects.length == 1)
- return projects[0].getName();
- return null;
- }
- for (int i = 0; i < projects.length; i++) {
- if (projects[i].exists()) {
- if (WTPPlugin.isPlatformCaseSensitive()) {
- if (projects[i].getName().equals(projectName))
- return projects[i].getName();
- } else {
- if (projects[i].getName().toLowerCase().equals(lowerCaseName))
- return projects[i].getName();
- }
- }
- }
- }
- return projectName;
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactCreationWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactCreationWizard.java
deleted file mode 100644
index b2988a130..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactCreationWizard.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IPluginContribution;
-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.IComponentCreationDataModelProperties;
-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.DataModelWizard;
-import org.eclipse.wst.web.internal.DelegateConfigurationElement;
-
-/**
- * <p>
- * Serves as a base class for the Wizards which create J2EE artifact structures. An Artifact can be
- * a J2EE application, module, or utility component.
- * </p>
- * <p>
- * Creation wizards must define the abstract methods from
- * {@link org.eclipse.wst.common.frameworks.ui.ExtendableWizard}which include the following:
- * <ul>
- * <li> {@link org.eclipse.wst.common.frameworks.ui.ExtendableWizard#doAddPages()}
- * <li> {@link org.eclipse.wst.common.frameworks.ui.ExtendableWizard#canFinish()}
- * <li> {@link org.eclipse.wst.common.frameworks.ui.ExtendableWizard#createBaseOperation()}
- * <li>{@link com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard#createDefaultModel()}
- * </ul>
- * </p>
- * <p>
- * And optionally, they can override the following methods:
- * <ul>
- * <li>{@link #getFinalPerspectiveID()}
- * <li>{@link #doInit()}
- * <li>{@link #doDispose()}
- * <li>{@link #doSetInitializeData(IConfigurationElement, String, Object)}
- * </ul>
- *
- * @see org.eclipse.wst.common.frameworks.ui.ExtendableWizard
- */
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public abstract class J2EEArtifactCreationWizard extends DataModelWizard implements INewWizard, IExecutableExtension, IPluginContribution, DoNotUseMeThisWillBeDeletedPost15 {
-
- /**
- * <p>
- * Constant used to identify the key of the main page of the Wizard.
- * </p>
- */
- protected static final String MAIN_PG = "main"; //$NON-NLS-1$
-
- private IStructuredSelection selection;
- private IConfigurationElement configurationElement;
-
- /**
- * <p>
- * Creates a default instance of the wizard with no configuration data, no selection, and no
- * operation data model.
- * </p>
- */
- public J2EEArtifactCreationWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate wizard controls and to collect data from the user. The model
- * will eventually be used to run the operation, if the user does not cancel the Wizard.
- * </p>
- *
- * @param model
- * used to collect information and interface with the WTP Operation
- */
- public J2EEArtifactCreationWizard(IDataModel model) {
- super(model);
- }
-
-
- /**
- * <p>
- * The selection is used to pre-populate values in the Wizard dialog controls.
- * </p>
- *
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
- * org.eclipse.jface.viewers.IStructuredSelection)
- *
- * @param workbench
- * the current workbench parent of the wizard
- * @param aSelection
- * the selection from the view used to start the wizard (if any)
- */
- public final void init(IWorkbench workbench, IStructuredSelection aSelection) {
- setNeedsProgressMonitor(true);
- this.selection = aSelection;
- doInit();
- }
-
- /**
- * <p>
- * Calls {@link #doDispose()}and then nulls out fields that are no longer needed once the
- * wizard completes.
- * </p>
- *
- * @see com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard#dispose()
- */
- public final void dispose() {
- super.dispose();
- doDispose();
- this.selection = 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>
- * Invoked from init(IWorkbench, IStructuredSelection) once the workbench and selection have
- * been safely stored away.
- * </p>
- * <p>
- * No-op by default.
- * </p>
- */
- protected void doInit() {
- // init
- }
-
- /**
- * <p>
- * Invoked from {@link #dispose()}. Should be used to handle any specific Wizard disposal.
- * </p>
- */
- protected void doDispose() {
- // dispose
- }
-
- /**
- * <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>
- * Default return value is <b>null </b>.
- * </p>
- *
- * @return Returns the ID of the Perspective which is preferred by this wizard upon completion.
- */
- protected String getFinalPerspectiveID() {
- return null;
- }
-
- /**
- *
- * <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 {
- super.postPerformFinish();
- if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) {
-
- 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 = getDataModel().getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
- BasicNewResourceWizard.selectAndReveal(ProjectUtilities.getProject(projName), J2EEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow());
- }
-
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.wizard.WizardPage#getDialogSettings()
- * @return Returns the saved settings from the previous use of the Wizard
- */
- public final IDialogSettings getDialogSettings() {
- return J2EEUIPlugin.getDefault().getDialogSettings();
- }
-
- /**
- * @return Returns the selection from the current view used to spawn the wizard
- */
- protected final IStructuredSelection getSelection() {
- return selection;
- }
-
-
- /**
- * <p>
- * Returns the value specified by {@link #getWizardId()}
- * </p>
- *
- * @return Returns the an id component used for Activity filtering.
- */
- public final String getLocalId() {
- return getWizardID();
- }
-
- /**
- * <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.getNamespace() : ""; //$NON-NLS-1$
- }
-
-
-
- protected final IConfigurationElement getConfigurationElement() {
- return configurationElement;
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java
deleted file mode 100644
index f1190ead5..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.internal.plugin.CommonEditorUtility;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
-
-/**
- * <p>
- * Serves as a base class for Wizards which export J2EE artifact structures from Eclipse projects
- * into a deployable form.
- * </p>
- * <p>
- * Subclasses must provide the methods that are required by
- * {@link com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard}.
- * </p>
- * <p>
- * Optionally, subclasses may also override the following methods:
- * <ul>
- * <li>{@link #doInit()()}
- * <li>{@link #doDispose()()}
- * </ul>
- * </p>
- * <p>
- * The base class will ensure that the Wizard is not spawned unless all open editors are in a
- * non-dirty state. Additionally, the selection from the active view which spanwed the wizard will
- * be made available to subclasses via {@link #getSelection()}.
- * </p>
- */
-public abstract class J2EEArtifactExportWizard extends DataModelWizard {
-
- /**
- * <p>
- * Constant used to identify the key of the main page of the Wizard.
- * </p>
- */
- protected static final String MAIN_PG = "main"; //$NON-NLS-1$
-
- private IStructuredSelection currentSelection;
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public J2EEArtifactExportWizard() {
- super();
- setWindowTitle(J2EEUIMessages.getResourceString("67"));//$NON-NLS-1$
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public J2EEArtifactExportWizard(IDataModel model) {
- super(model);
- setWindowTitle(J2EEUIMessages.getResourceString("67"));//$NON-NLS-1$
- }
-
- /**
- * <p>
- * Invoked from init(IWorkbench, IStructuredSelection) once the workbench and selection have
- * been safely stored away.
- * </p>
- * <p>
- * No-op by default.
- * </p>
- */
- protected void doInit() {
- //init
- }
-
- /**
- * <p>
- * Invoked from {@link #dispose()}. Should be used to handle any specific Wizard disposal.
- * </p>
- */
- private void doDispose() {
- //dispose
- }
-
- /**
- * <p>
- * The selection is used to pre-populate values in the Wizard dialog controls.
- * </p>
- *
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
- * org.eclipse.jface.viewers.IStructuredSelection)
- *
- * @param workbench
- * the current workbench parent of the wizard
- * @param aSelection
- * the selection from the view used to start the wizard (if any)
- */
- public final void init(IWorkbench workbench, IStructuredSelection selection) {
- setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EXPORT_WIZ_TITLE));
- this.currentSelection = selection;
-
-//TODO: enable selection defaults
-// if (this.currentSelection.size() > 0) {
-// Object element = this.currentSelection.getFirstElement();
-// IProject project = ProjectUtilities.getProject(element);
-// if (project != null) {
-// IDataModel m = getDataModel();
-// Object originalProjectName = m.getProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME);
-// m.setProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME, project.getName());
-// if (!m.validateProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME).isOK()) {
-// m.setProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME, originalProjectName);
-// }
-// }
-// }
- setNeedsProgressMonitor(true);
- doInit();
- }
-
- /**
- * <p>
- * Calls {@link #doDispose()}and then nulls out fields that are no longer needed once the
- * wizard completes.
- * </p>
- *
- * @see com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard#dispose()
- */
- public final void dispose() {
- super.dispose();
- doDispose();
- this.currentSelection = null;
- }
-
- protected final boolean prePerformFinish() {
- if (!CommonEditorUtility.promptToSaveAllDirtyEditors()) {
- return false;
- }
- if (CommonEditorUtility.getDirtyEditors().length != 0) { // all checkboxes were not selected
- return false;
- }
- return super.prePerformFinish();
- }
-
- /**
- * @return Returns the currentSelection.
- */
- protected final IStructuredSelection getSelection() {
- return currentSelection;
- }
-
- /**
- * @return
- */
- protected final J2EEExportPage getMainPage() {
- return (J2EEExportPage) getPage(MAIN_PG);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java
deleted file mode 100644
index 6812078b5..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-
-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.jst.j2ee.internal.plugin.CommonEditorUtility;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
-import org.eclipse.wst.web.internal.DelegateConfigurationElement;
-
-/**
- * <p>
- * Serves as a base class for Wizards which import J2EE artifact structures into Eclipse projects.
- * </p>
- * <p>
- * Subclasses must provide the methods that are required by
- * {@see org.eclipse.wst.common.frameworks.internal.ui.WTPWizard}.
- * </p>
- * <p>
- * Optionally, subclasses may also override the following methods:
- * <ul>
- * <li>{@link #getFinalPerspectiveID()}
- * <li>{@link #doInit()()}
- * <li>{@link #doDispose()()}
- * </ul>
- * </p>
- * <p>
- * The base class will ensure that the Wizard is not spawned unless all open editors are in a
- * non-dirty state. Additionally, the selection from the active view which spanwed the wizard will
- * be made available to subclasses via {@link #getCurrentSelection()}.
- * </p>
- */
-public abstract class J2EEArtifactImportWizard extends DataModelWizard implements IImportWizard, IExecutableExtension {
-
- /**
- * <p>
- * Constant used to identify the key of the main page of the Wizard.
- * </p>
- */
- protected static final String MAIN_PG = "main"; //$NON-NLS-1$
-
- private IConfigurationElement configurationElement;
- private IStructuredSelection selection;
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public J2EEArtifactImportWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public J2EEArtifactImportWizard(IDataModel model) {
- super(model);
- }
-
- /**
- * <p>
- * The selection is used to pre-populate values in the Wizard dialog controls.
- * </p>
- *
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
- * org.eclipse.jface.viewers.IStructuredSelection)
- *
- * @param workbench
- * the current workbench parent of the wizard
- * @param aSelection
- * the selection from the view used to start the wizard (if any)
- */
- public final void init(IWorkbench workbench, IStructuredSelection aSelection) {
- this.selection = aSelection;
- setNeedsProgressMonitor(true);
- doInit();
- }
-
- /**
- * <p>
- * Calls {@link #doDispose()}and then nulls out fields that are no longer needed once the
- * wizard completes.
- * </p>
- *
- * @see com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard#dispose()
- */
- public final void dispose() {
- super.dispose();
- doDispose();
- this.selection = null;
- this.configurationElement = null;
- }
-
- /**
- * <p>
- * Invoked after the selection has been saved off in
- * {@link #init(IWorkbench, IStructuredSelection)}. Should be used to handle any specific
- * Wizard initialization.
- * </p>
- */
- protected void doInit() {
- // init
- }
-
- /**
- * <p>
- * Invoked from {@link #dispose()}. Should be used to handle any specific Wizard disposal.
- * </p>
- */
- protected void doDispose() {
- // dispose
- }
-
- /**
- * <p>
- * The return value of this method will be used to suggest a final perspective to the user once
- * the wizard completes.
- * </p>
- *
- * @return Returns the J2EE Perpsective ID by default
- */
- protected String getFinalPerspectiveID() {
- return null;
- }
-
- /**
- * <p>
- * Prompts the user to save open, dirty editors.
- * </p>
- *
- * @return true only if all editors are saved
- */
- protected final boolean prePerformFinish() {
- if (!CommonEditorUtility.promptToSaveAllDirtyEditors()) {
- return false;
- }
- //Must have selected to not save, but should close all remaining
- CommonEditorUtility.closeAllEditors();
- return super.prePerformFinish();
- }
-
- /**
- * <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 final void postPerformFinish() throws InvocationTargetException {
- super.postPerformFinish();
- 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);
- }
- };
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- BasicNewProjectResourceWizard.updatePerspective(element);
- }
- });
- } else {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- BasicNewProjectResourceWizard.updatePerspective(configurationElement);
- }
- });
- }
- }
-
- /**
- * {@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 {@see #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 config, String propertyName, Object data) throws CoreException {
- this.configurationElement = config;
- }
-
- /**
- * @return Returns the selection.
- */
- protected final IStructuredSelection getSelection() {
- return selection;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizard.java
deleted file mode 100644
index cd4ee172f..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizard.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-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.IDMPageHandler;
-
-/**
- * <p>
- * Serves as a base class for Wizards which create J2EE module structures in Eclipse projects.
- * </p>
- * <p>
- * The EAR will be pre-populated in the Wizard controls if any selection was provided to the Wizard.
- * </p>
- * <p>
- * Refer to {@link org.eclipse.jst.j2ee.internal.wizard.J2EEArtifactCreationWizard}for information
- * on how to extend this class.
- * </p>
- *
- * @see org.eclipse.jst.j2ee.internal.wizard.J2EEArtifactCreationWizard
- */
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public abstract class J2EEComponentCreationWizard extends J2EEArtifactCreationWizard implements IJ2EEComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15 {
-
- /**
- * <p>
- * Constant used to identify the key of the main page of the Wizard.
- * </p>
- */
- protected static final String MODULE_PG = "module"; //$NON-NLS-1$
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public J2EEComponentCreationWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public J2EEComponentCreationWizard(IDataModel model) {
- super(model);
- }
-
- /**
- * <p>
- * The selection stored in
- * {@link J2EEArtifactCreationWizard#init(org.eclipse.ui.IWorkbench, IStructuredSelection)}is used to
- * pre-populate the EAR project in the Wizard dialog controls.
- * </p>
- *
- * @see J2EEArtifactCreationWizard#init(org.eclipse.ui.IWorkbench, IStructuredSelection)
- * @see J2EEArtifactCreationWizard#doInit()
- */
- protected void doInit() {
- preFillSelectedEARProject();
- }
-
- /**
- * <p>
- * Subclasses which override this method should always call super.addModulesPageIfNecessary()
- * ahead of before their own pages.
- * </p>
- *
- */
- protected void addModulesPageIfNecessary() {
- // TODO: add modules page back for 0.7
- // if (getDataModel().getBooleanProperty(UI_SHOW_EAR_SECTION)) {
- // addPage(new J2EEModulesDependencyPage(getDataModel(), MODULE_PG));
- // }
- }
-
- /**
- * @inheritDoc
- *
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- protected void doAddPages() {
- addModulesPageIfNecessary();
- }
-
- /**
- * <p>
- * Skips the page identified by the MODULE_PG name if
- * {@link J2EEComponentCreationWizard#shouldShowModulesPage()}is false.
- * </p>
- */
- public String getPreviousPage(String currentPageName, String expectedPreviousPageName) {
- if (!shouldShowModulesPage() && expectedPreviousPageName.equals(MODULE_PG)) {
- return IDMPageHandler.PAGE_BEFORE;
- }
- return super.getPreviousPage(currentPageName, expectedPreviousPageName);
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Skips the page identified by the MODULE_PG name if
- * {@link J2EEModuleProjectCreationWizard#shouldShowModulesPage()}is false.
- * </p>
- */
- public String getNextPage(String currentPageName, String expectedNextPageName) {
- if (!shouldShowModulesPage() && (null != expectedNextPageName && expectedNextPageName.equals(MODULE_PG))) {
- return IDMPageHandler.PAGE_AFTER;
- }
- return super.getNextPage(currentPageName, expectedNextPageName);
- }
-
- /**
- * <p>
- * Uses the model to determine if the module page should be shown. The default is to AND the
- * values of model.getBooleanProperty(J2EEModuleCreationDataModel.ADD_TO_EAR) and
- * shouldShowModulesPageForEAR().
- * </p>
- *
- * @return Returns a boolean true if the module page should be shown.
- */
- protected final boolean shouldShowModulesPage() {
- return getDataModel().getBooleanProperty(ADD_TO_EAR) && shouldShowModulesPageForEAR();
- }
-
- /**
- * <p>
- * Uses the model to determine if the module page should be shown for the EAR. If no modules are
- * present in the classpath selection of the model, the method will return false.
- * </p>
- *
- * @return true only if the
- * @see J2EEModuleCreationDataModelOld#getClassPathSelection() is non-empty.
- */
- protected final boolean shouldShowModulesPageForEAR() {
- // TODO is this what we want here?
- return true;
- }
-
- /**
- * @return Returns the EAR module selected in the view used to launch the wizard.
- */
- protected IVirtualComponent getSelectedEARModule() {
- IStructuredSelection selection = getSelection();
- if (null != selection) {
- Object obj = selection.getFirstElement();
- if (obj instanceof EObject) {
- IVirtualComponent comp = ComponentUtilities.findComponent((EObject) obj);
- if (null != comp && J2EEProjectUtilities.isEARProject(comp.getProject())) {
- return comp;
- }
- }
- }
- return null;
- }
-
- protected void preFillSelectedEARProject() {
- IVirtualComponent earComponent = getSelectedEARModule();
- if (earComponent != null) {
- EnterpriseArtifactEdit earEdit = null;
- int j2eeVersion = 0;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForRead(earComponent);
- j2eeVersion = earEdit.getJ2EEVersion();
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- }
- IDataModel dm = getDataModel();
- dm.setIntProperty(COMPONENT_VERSION, j2eeVersion);
- dm.setProperty(EAR_COMPONENT_NAME, earComponent.getName());
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizardPage.java
deleted file mode 100644
index 49e684cc2..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentCreationWizardPage.java
+++ /dev/null
@@ -1,510 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Nov 10, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.io.File;
-
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Cursor;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-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.server.ui.ServerUIUtil;
-
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public abstract class J2EEComponentCreationWizardPage extends DataModelWizardPage implements IJ2EEComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15{
-
- private static final boolean isWindows = SWT.getPlatform().toLowerCase().startsWith("win"); //$NON-NLS-1$
- protected static final String MODULE_VERSION = J2EEUIMessages.MODULE_VERSION_LABEL;
- protected NewModuleGroup projectNameGroup;
- protected Composite advancedComposite;
- protected Button advancedButton;
- protected boolean showAdvanced = false;
- protected AdvancedSizeController advancedController;
- protected boolean advancedControlsBuilt = false;
- protected ServerEarAndStandaloneGroup earGroup;
- protected Combo serverTargetCombo;
- protected Text moduleNameText = null;
- protected Text locationPathField = null;
- protected Button browseButton = null;
- protected Button supportMultipleModules = null;
- protected Combo projectNameCombo = null;
- protected Text sourceFolderNameText = null;
-
- private static final int SIZING_TEXT_FIELD_WIDTH = 305;
-// private static final String NEW_LABEL_UI = J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_THREE_DOTS_E); //$NON-NLS-1$
- private static final String MODULE_NAME_UI = J2EEUIMessages.getResourceString(J2EEUIMessages.NAME_LABEL); //$NON-NLS-1$
- private String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL); //$NON-NLS-1$
- private static final String defDirDialogLabel = "Directory"; //$NON-NLS-1$
-
- /**
- * This type is responsible for setting the Shell size based on the showAdvanced flag. It will
- * track the original size of the Shell even if the user resizes it. One problem that we may
- * face is that the Shell size could change by the framework prior to the Shell being made
- * visible but the page will already get an enter call. This means that we will need to set the
- * Shell size based on the showAdvanced flag when the Shell resize event is called and the Shell
- * is visible.
- */
- private class AdvancedSizeController implements ControlListener {
- private int advancedHeight = -1;
- private Point originalSize;
- private boolean ignoreShellResize = false;
-
- private AdvancedSizeController(Shell aShell) {
- originalSize = aShell.getSize();
- aShell.addControlListener(this);
- }
-
- public void controlMoved(ControlEvent e) {
- //do nothing
- }
-
- public void controlResized(ControlEvent e) {
- if (!ignoreShellResize) {
- Control control = (Control) e.getSource();
- if (control.isVisible()) {
- originalSize = control.getSize();
- if (advancedHeight == -1)
- setShellSizeForAdvanced();
- }
- }
- }
-
- protected void resetOriginalShellSize() {
- setShellSize(originalSize.x, originalSize.y);
- }
-
- private void setShellSize(int x, int y) {
- ignoreShellResize = true;
- try {
- getShell().setSize(x, y);
- } finally {
- ignoreShellResize = false;
- }
- }
-
- protected void setShellSizeForAdvanced() {
- int height = calculateAdvancedShellHeight();
- if (height != -1)
- setShellSize(getShell().getSize().x, height);
- }
-
- private int calculateAdvancedShellHeight() {
- Point advancedCompSize = advancedComposite.getSize();
- if (advancedCompSize.x == 0)
- return -1;
- int height = computeAdvancedHeight();
- if (!showAdvanced && height != -1)
- height = height - advancedComposite.getSize().y;
- return height;
- }
-
- /*
- * Compute the height with the advanced section showing. @return
- */
- private int computeAdvancedHeight() {
- if (advancedHeight == -1) {
- Point controlSize = getControl().getSize();
- if (controlSize.x != 0) {
- Point pageSize = getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int minHeight = originalSize.y - controlSize.y;
- advancedHeight = pageSize.y + minHeight;
- }
- }
- return advancedHeight;
- }
- }
-
- public J2EEComponentCreationWizardPage(IDataModel dataModel, String pageName) {
- super(dataModel, pageName);
- }
-
- protected Composite createTopLevelComposite(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(top, getInfopopID());
- 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);
- createModuleGroup(composite);
- Composite detail = new Composite(top, SWT.NONE);
- detail.setLayout(new GridLayout());
- detail.setData(new GridData(GridData.FILL_BOTH));
- createAdvancedComposite(detail);
- return top;
- }
-
- protected Composite createAdvancedComposite(Composite parent) {
- advancedControlsBuilt = true;
- advancedButton = new Button(parent, SWT.TOGGLE);
- setAdvancedLabelText();
- final Cursor hand = new Cursor(advancedButton.getDisplay(), SWT.CURSOR_HAND);
- advancedButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- hand.dispose();
- }
- });
- advancedComposite = new Composite(parent, SWT.NONE);
- //toggleAdvanced(false);
- GridLayout layout = new GridLayout(3, false);
- GridData data = new GridData();
- advancedComposite.setData(data);
- advancedComposite.setLayout(layout);
- advancedButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- toggleAdvanced(true);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- //do nothing
- }
- });
- advancedButton.addListener(SWT.MouseHover, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.MouseHover)
- advancedButton.setCursor(hand);
- }
- });
- addToAdvancedComposite(advancedComposite);
- return advancedComposite;
- }
-
- protected void createModuleGroup(Composite parent) {
- createProjectNameGroup(parent);
- createProjectLocationGroup(parent);
- }
-
- /**
- *
- */
- private void createProjectNameGroup(Composite parent) {
- // set up project name label
- Label projectNameLabel = new Label(parent, SWT.NONE);
- projectNameLabel.setText(MODULE_NAME_UI);
- GridData data = new GridData();
- projectNameLabel.setLayoutData(data);
- // set up project name entry field
- moduleNameText = new Text(parent, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- moduleNameText.setLayoutData(data);
- new Label(parent, SWT.NONE); // pad
- synchHelper.synchText(moduleNameText, COMPONENT_NAME, new Control[]{projectNameLabel});
- moduleNameText.setFocus();
- }
-
- /**
- *
- */
- private void createProjectLocationGroup(Composite parent) {
- // set up location path label
- Label locationPathLabel = new Label(parent, SWT.NONE);
- locationPathLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_LOC_LBL));
- 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);
- locationPathField.setEditable(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 = getDataModel().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) {
- getDataModel().setProperty(LOCATION, selectedDirectory);
- }
- }
-
- protected void addToAdvancedComposite(Composite advanced) {
- createServerTargetComposite(advanced);
- createVersionComposite(advanced);
- createServerEarAndStandaloneGroup(advanced);
- }
-
-
- protected void createServerTargetComposite(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.TARGET_RUNTIME_LBL));
- serverTargetCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- serverTargetCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button newServerTargetButton = new Button(parent, SWT.NONE);
- newServerTargetButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_THREE_DOTS_E));
- newServerTargetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if(!J2EEComponentCreationWizardPage.launchNewRuntimeWizard(getShell(), model)){
- setErrorMessage(J2EECreationResourceHandler.ServerTargetDataModel_UI_9);
- }
- }
- });
- Control[] deps = new Control[]{label, newServerTargetButton};
- synchHelper.synchCombo(serverTargetCombo, RUNTIME_TARGET_ID, deps);
- if(serverTargetCombo.getSelectionIndex() == -1 && serverTargetCombo.getVisibleItemCount() != 0)
- serverTargetCombo.select(0);
- }
-
- protected void createServerEarAndStandaloneGroup(Composite parent) {
- earGroup = new ServerEarAndStandaloneGroup(parent, getDataModel(), synchHelper);
- }
-
-
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IComponentCreationDataModelProperties.PROJECT_NAME, RUNTIME_TARGET_ID, COMPONENT_VERSION, COMPONENT_NAME, LOCATION, EAR_COMPONENT_NAME, ADD_TO_EAR, JAVASOURCE_FOLDER }; }
-
- protected void createSourceFolderComposite(Composite parent) {
-
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- separator.setLayoutData(gd);
-
- Label label = new Label(parent, SWT.NONE);
- label.setText(getSourceFolderLabel());
- GridData data = new GridData();
- label.setLayoutData(data);
- // set up project name entry field
- sourceFolderNameText = new Text(parent, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- sourceFolderNameText.setLayoutData(data);
- new Label(parent, SWT.NONE); // pad
- synchHelper.synchText(sourceFolderNameText, JAVASOURCE_FOLDER, null);
- }
-
-
- protected void createVersionComposite(Composite parent) {
- createVersionComposite(parent, getVersionLabel(), COMPONENT_VERSION);
- }
-
- protected String getVersionLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.MODULE_VERSION_LABEL);
- }
-
- protected String getSourceFolderLabel() {
- return J2EEUIMessages.getResourceString(J2EEUIMessages.SOURCEFOLDER);
- }
-
- public void dispose() {
- super.dispose();
- if (earGroup != null)
- earGroup.dispose();
- if (projectNameGroup != null)
- projectNameGroup.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#enter()
- */
- protected void enter() {
- if (advancedControlsBuilt) {
- if (isFirstTimeToPage)
- initializeAdvancedController();
- if (isWindows) {
- advancedController.setShellSizeForAdvanced();
- }
- }
- super.enter();
- }
-
- private void initializeAdvancedController() {
- advancedController = new AdvancedSizeController(getShell());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#exit()
- */
- protected void exit() {
- if (advancedControlsBuilt && isWindows && advancedController!=null) {
- advancedController.resetOriginalShellSize();
- }
- super.exit();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#storeDefaultSettings()
- */
- public void storeDefaultSettings() {
- super.storeDefaultSettings();
- if (advancedControlsBuilt) {
- IDialogSettings settings = getDialogSettings();
- if (settings != null)
- settings.put(getShowAdvancedKey(), showAdvanced);
- }
- }
-
- protected String getShowAdvancedKey() {
- return getClass().getName() + "_SHOW_ADVANCED"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#restoreDefaultSettings()
- */
- protected void restoreDefaultSettings() {
- super.restoreDefaultSettings();
- if (advancedControlsBuilt) {
- IDialogSettings settings = getDialogSettings();
- if (settings != null)
- showAdvanced = !settings.getBoolean(getShowAdvancedKey());
- advancedButton.setSelection(!showAdvanced); //set opposite b/c toggleAdvanced(boolean)
- // will flip it
- toggleAdvanced(false);
- }
- }
-
- /**
- * @param advancedLabel
- */
- private void setAdvancedLabelText() {
- if (advancedControlsBuilt) {
- if (showAdvanced)
- advancedButton.setText(J2EEUIMessages.getResourceString("J2EEProjectCreationPage_UI_0")); //$NON-NLS-1$
- else
- advancedButton.setText(J2EEUIMessages.getResourceString("J2EEProjectCreationPage_UI_1")); //$NON-NLS-1$
- }
- }
-
- /**
- * @param advancedLabel
- */
- protected void toggleAdvanced(boolean setSize) {
- if (advancedControlsBuilt) {
- showAdvanced = !showAdvanced;
- advancedComposite.setVisible(showAdvanced);
- setAdvancedLabelText();
- if (setSize && isWindows) {
- if (advancedControlsBuilt) {
- if (advancedController == null)
- initializeAdvancedController();
- if (isWindows) {
- advancedController.setShellSizeForAdvanced();
- }
- }
-// advancedController.setShellSizeForAdvanced();
- }
- }
- }
-
- protected void createVersionComposite(Composite parent, String labelText, String versionProp) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(labelText);
- Combo versionCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 305;
- versionCombo.setLayoutData(gridData);
- Control[] deps = new Control[]{label};
- synchHelper.synchCombo(versionCombo, versionProp, deps);
- if (versionCombo.getSelectionIndex() == -1) {
- String[] items = versionCombo.getItems();
- if (items != null && items.length > 0)
- versionCombo.select(items.length - 1);
- }
- new Label(parent, SWT.NONE); //pad
- }
-
-
-
- public static boolean launchNewRuntimeWizard(Shell shell, IDataModel model) {
- DataModelPropertyDescriptor[] preAdditionDescriptors = model.getValidPropertyDescriptors(RUNTIME_TARGET_ID);
- boolean isOK = ServerUIUtil.showNewRuntimeWizard(shell, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (isOK && model != null) {
-
- DataModelPropertyDescriptor[] postAdditionDescriptors = model.getValidPropertyDescriptors(RUNTIME_TARGET_ID);
- 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 = ProjectUtilities.getNewObject(preAddition, postAddition);
-
- model.notifyPropertyChange(RUNTIME_TARGET_ID, IDataModel.VALID_VALUES_CHG);
- if (newAddition != null)
- model.setProperty(RUNTIME_TARGET_ID, newAddition);
- else
- return false;
- }
- return isOK;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java
deleted file mode 100644
index f79df879b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Nov 10, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.ui.project.facet.EarSelectionPanel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
-
-public abstract class J2EEComponentFacetCreationWizardPage extends DataModelFacetCreationWizardPage implements IFacetProjectCreationDataModelProperties {
-
- private static final String STORE_LABEL = "LASTEARNAME_"; //$NON-NLS-1$
-
- protected EarSelectionPanel earPanel;
-
- public J2EEComponentFacetCreationWizardPage(IDataModel dataModel, String pageName) {
- super(dataModel, pageName);
- }
-
- protected Composite createTopLevelComposite(Composite parent) {
- final Composite top = super.createTopLevelComposite( parent );
- createEarComposite(top);
- return top;
- }
-
- private void createEarComposite(Composite top) {
- FacetDataModelMap map = (FacetDataModelMap) model.getProperty(FACET_DM_MAP);
- IDataModel facetModel = (IDataModel) map.get(getModuleFacetID());
- earPanel = new EarSelectionPanel(facetModel, top);
- }
-
- protected abstract String getModuleFacetID();
-
- protected String getModuleTypeID() {
- return getModuleFacetID();
- }
-
- public void dispose() {
- super.dispose();
- if (earPanel != null)
- earPanel.dispose();
- }
-
- public void storeDefaultSettings() {
- super.storeDefaultSettings();
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- String facetID = getModuleFacetID();
- IDataModel j2eeModel = map.getFacetDataModel(facetID);
- if(j2eeModel.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR)){
- String lastEARName = j2eeModel.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME);
- settings.put(STORE_LABEL, lastEARName);
- }
- }
- }
-
- public void restoreDefaultSettings() {
- super.restoreDefaultSettings();
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String lastEARName = settings.get(STORE_LABEL);
- if (lastEARName != null){
- FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- String facetID = getModuleFacetID();
- IDataModel j2eeModel = map.getFacetDataModel(facetID);
- j2eeModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.LAST_EAR_NAME, lastEARName);
- }
- }
- }
-
- protected IDialogSettings getDialogSettings() {
- return J2EEUIPlugin.getDefault().getDialogSettings();
- }
-
- protected String[] getValidationPropertyNames() {
- String[] superProperties = super.getValidationPropertyNames();
- List list = Arrays.asList(superProperties);
- ArrayList arrayList = new ArrayList();
- arrayList.addAll( list );
- arrayList.add( IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME );
- arrayList.add( IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR );
- return (String[])arrayList.toArray( new String[0] );
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java
deleted file mode 100644
index acd195984..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * <p>
- * Serves as a base class for Wizards which import J2EE module structures into Eclipse projects.
- * </p>
- * <p>
- * Import wizards must define the following methods:
- * <ul>
- * <li>{@link #getImportOperation()}
- * <li>{@link #getModuleValidatorStrings()}
- * </ul>
- * </p>
- * <p>
- * And optionally, they may override the following methods from
- * {@see org.eclipse.jst.j2ee.internal.wizard.J2EEArtifactImportWizard}:
- * <ul>
- * <li>{@link #getFinalPerspectiveID()}
- * <li>{@link #doInit()()}
- * <li>{@link #doDispose()()}
- * </ul>
- */
-public abstract class J2EEComponentImportWizard extends J2EEArtifactImportWizard implements IImportWizard, IExecutableExtension {
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public J2EEComponentImportWizard() {
- super();
- setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public J2EEComponentImportWizard(IDataModel model) {
- super(model);
- setWindowTitle(J2EEUIMessages.getResourceString("38"));//$NON-NLS-1$
- }
-
- /**
- * <p>
- * The Import Wizards can run arbitrary validators once the module has been created. These
- * validators ensure that the structure created by the Import operation and the contents of that
- * structure are valid. Any errors will be announced to the Problems view in Eclipse.
- * </p>
- *
- * @return An array of validator IDs that should be used for this module type
- */
- protected abstract String[] getModuleValidatorStrings();
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java
deleted file mode 100644
index 1bb172e0a..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- *******************************************************************************/
-/*
- * Created on Mar 21, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-
-
-/**
- * @author jialin
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public class J2EEComponentLabelProvider implements ILabelProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if(element instanceof IVirtualComponent){
- IVirtualComponent comp = (IVirtualComponent)element;
- return comp.getProject().getName();
- }
-
- if (element instanceof IProject) {
- IProject handle = (IProject)element;
- return handle.getName();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java
deleted file mode 100644
index 5e0312660..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-/*
- * 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.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-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;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public abstract class J2EEExportPage extends DataModelWizardPage {
-
- public static boolean isWindows = SWT.getPlatform().toLowerCase().startsWith("win"); //$NON-NLS-1$
-
- protected IStructuredSelection currentResourceSelection;
- private static final int SIZING_TEXT_FIELD_WIDTH = 305;
- private static final String STORE_LABEL = "J2EE_EXPORT_"; //$NON-NLS-1$
- private static final String OVERWRITE_LABEL = "OVERWRITE"; //$NON-NLS-1$
- private static final String SOURCE_LABEL = "SOURCE"; //$NON-NLS-1$
- protected static final String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL);
- protected String LABEL_DESTINATION = J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_DESTINATION);
- private Combo resourceNameCombo;
- private Combo destinationNameCombo;
- private Button destinationBrowseButton;
- protected Button overwriteExistingFilesCheckbox;
- private Button sourceFilesCheckbox;
-
- /**
- * @param model
- * @param pageName
- */
- public J2EEExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
- super(model, pageName);
- currentResourceSelection = selection;
- Object element = currentResourceSelection.getFirstElement();
- IProject project = ProjectUtilities.getProject(element);
- if (project != null) {
- String projectName = project.getName();
- DataModelPropertyDescriptor [] validProjectNames = model.getValidPropertyDescriptors(IJ2EEComponentExportDataModelProperties.PROJECT_NAME);
- boolean projectNameSet = false;
- for(int i=0;i<validProjectNames.length && !projectNameSet; i++){
- if(projectName.equals(validProjectNames[i].getPropertyDescription())){
- projectNameSet = true;
- model.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, projectName);
- }
- }
- if(!projectNameSet && validProjectNames.length > 0){
- model.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, validProjectNames[0].getPropertyDescription());
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
- protected String[] getValidationPropertyNames() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
-
- Composite composite = new Composite(parent, SWT.NULL);
- //WorkbenchHelp.setHelp(composite, getInfopopID());
- GridLayout layout = new GridLayout(1, false);
- composite.setLayout(layout);
-
- createSourceAndDestinationGroup(composite);
- createOptionsGroup(composite);
-
- //setupBasedOnInitialSelections();
- setupInfopop(composite);
- restoreWidgetValues();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * @param composite
- */
- private void createSourceAndDestinationGroup(Composite parent) {
-
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(3, false);
- composite.setLayout(layout);
- createExportComponentGroup(composite);
- createDestinationGroup(composite);
-
- }
- /**
- * Creates the export source resource specification widgets.
- *
- * @param parent
- * a <code>Composite</code> that is to be used as the parent of this group's
- * collection of visual components
- * @see org.eclipse.swt.widgets.Composite
- */
- protected void createExportComponentGroup(Composite parent) {
- //Project label
- Label projectLabel = new Label(parent, SWT.NONE);
- projectLabel.setText(getComponentLabel());
- //Project combo
- resourceNameCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- resourceNameCombo.setLayoutData(data);
- synchHelper.synchCombo(resourceNameCombo, IJ2EEComponentExportDataModelProperties.PROJECT_NAME, null);
- new Label(parent, SWT.NONE);//Pad label
- }
-
- /**
- * @return
- */
- protected abstract String getComponentLabel();
-
- protected void createDestinationGroup(org.eclipse.swt.widgets.Composite parent) {
-
- //Destination label
- Label destinationLabel = new Label(parent, SWT.NONE);
- destinationLabel.setText(LABEL_DESTINATION);
- // destination name combo field
- destinationNameCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
- destinationNameCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchCombo(destinationNameCombo, IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, null);
-
- // destination browse button
- destinationBrowseButton = new Button(parent, SWT.PUSH);
- destinationBrowseButton.setText(defBrowseButtonLabel); //$NON-NLS-1$
- destinationBrowseButton.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
- destinationBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleDestinationBrowseButtonPressed();
- }
- });
- destinationBrowseButton.setEnabled(true);
-
- }
-
- /**
- * Create the export options specification widgets.
- *
- * @param parent
- * org.eclipse.swt.widgets.Composite
- */
- protected void createOptionsGroup(Composite parent) {
-
- // options group
- Composite optionsGroup = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(1, false);
- optionsGroup.setLayout(layout);
-
-
- // source files... checkbox
- createSourceFilesCheckbox(optionsGroup);
-
- // overwrite... checkbox
- createOverwriteExistingFilesCheckbox(optionsGroup);
-
- // advanced button
- if (shouldShowProjectFilesCheckbox()) {
- createProjectFilesCheckbox(optionsGroup);
- }
- }
-
- protected void createOverwriteExistingFilesCheckbox(Composite optionsGroup) {
- //Overwrite checkbox
- overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- overwriteExistingFilesCheckbox.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_OVERWRITE_CHECKBOX)); //$NON-NLS-1$ = "Overwrite existing files without warning"
- overwriteExistingFilesCheckbox.setEnabled(true);
- synchHelper.synchCheckbox(overwriteExistingFilesCheckbox, IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING, null);
- }
-
- protected void createSourceFilesCheckbox(Composite optionsGroup) {
- sourceFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- sourceFilesCheckbox.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_SOURCE_CHECKBOX)); //$NON-NLS-1$
- synchHelper.synchCheckbox(sourceFilesCheckbox, IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES, null);
- }
-
- /**
- * @return
- */
- protected boolean shouldShowProjectFilesCheckbox() {
- return false;
- }
-
- protected void createProjectFilesCheckbox(Composite composite) {
- //do nothing
- }
-
- /**
- * Populates the resource name field based upon the currently-selected resources.
- */
- protected void setupBasedOnInitialSelections() {
-
- if (currentResourceSelection.isEmpty() || setupBasedOnRefObjectSelection())
- return; // no setup needed
-
- java.util.List selections = new ArrayList();
- Iterator aenum = currentResourceSelection.iterator();
- while (aenum.hasNext()) {
- IResource currentResource = (IResource) aenum.next();
- // do not add inaccessible elements
- if (currentResource.isAccessible())
- selections.add(currentResource);
- }
- if (selections.isEmpty())
- return; // setup not needed anymore
-
-// int selectedResourceCount = selections.size();
-//TODO: find a way to select an existing component
-// if (selectedResourceCount == 1) {
-// IResource resource = (IResource) selections.get(0);
-// if ((resource instanceof IProject) && checkForNature((IProject) resource)) {
-// resourceNameCombo.setText(resource.getName().toString());
-// }
-// }
- }
-
- /**
- * @return
- */
- protected String getProjectImportLabel() {
- return null;
- }
-
- /**
- *
- */
- protected void handleDestinationBrowseButtonPressed() {
-
- FileDialog dialog = new FileDialog(destinationNameCombo.getShell(), SWT.SAVE);
- String fileName = getDataModel().getStringProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME);
- String[] filters = getFilterExpression();
- if (!isWindows) {
- if (filters.length != 0 && filters[0] != null && filters[0].indexOf('.') != -1) {
- fileName += filters[0].substring(filters[0].indexOf('.'));
- }
- }
- dialog.setFileName(fileName);
- if (isWindows) {
- dialog.setFilterExtensions(filters);
- }
- String filename = dialog.open();
- if (filename != null)
- destinationNameCombo.setText(filename);
- }
-
- protected void restoreWidgetValues() {
-
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
- if (sourceNames == null)
- return; // ie.- no settings stored
- for (int i = 0; i < sourceNames.length; i++) {
- if (sourceNames[i] == null)
- sourceNames[i] = ""; //$NON-NLS-1$
- }
- destinationNameCombo.setItems(sourceNames);
- boolean overwrite = settings.getBoolean(STORE_LABEL + OVERWRITE_LABEL);
- model.setBooleanProperty(IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING, overwrite);
- boolean includeSource = settings.getBoolean(STORE_LABEL + SOURCE_LABEL);
- model.setBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES, includeSource);
- }
- }
-
- public void storeDefaultSettings() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
- if (sourceNames == null) {
- sourceNames = new String[0];
- }
-
- String newName = destinationNameCombo.getText();
-
- //rip out any empty filenames and trim length to 5
- ArrayList newNames = new ArrayList();
- for (int i = 0; i < sourceNames.length && i < 5; i++) {
- if (sourceNames[i].trim().length() > 0 && !newName.equals(sourceNames[i])) {
- newNames.add(sourceNames[i]);
- }
- }
- newNames.add(0, destinationNameCombo.getText());
- sourceNames = new String[newNames.size()];
- newNames.toArray(sourceNames);
-
- settings.put(STORE_LABEL + getFileNamesStoreID(), sourceNames);
- settings.put(STORE_LABEL + OVERWRITE_LABEL, model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING));
- settings.put(STORE_LABEL + SOURCE_LABEL, model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES));
- }
- }
-
- /**
- * @return
- */
- protected String getFileNamesStoreID() {
- return getCompnentID();
- }
- protected abstract String getCompnentID();
-
- /**
- * @return
- */
- protected String[] getFilterExpression() {
- return new String[0];
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#enter()
- */
- protected void enter() {
- super.enter();
- restoreWidgetValues();
- }
-
- /**
- * @return
- */
- //protected abstract String getNatureID();
-
- protected abstract boolean isMetaTypeSupported(Object o);
-
- /**
- * Populates the resource name field based upon the currently-selected resources.
- */
- protected boolean setupBasedOnRefObjectSelection() {
-
- if (currentResourceSelection.size() != 1)
- return false;
-
- Object o = currentResourceSelection.getFirstElement();
- if (!isMetaTypeSupported(o))
- return false;
-
- EObject ref = (EObject) o;
- IResource resource = ProjectUtilities.getProject(ref);
- if (resource != null) {
- resourceNameCombo.setText(resource.getName().toString());
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardPage#getDialogSettings()
- */
- protected IDialogSettings getDialogSettings() {
- return J2EEUIPlugin.getDefault().getDialogSettings();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java
deleted file mode 100644
index d41368eeb..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-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.server.ui.ServerUIUtil;
-import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
-
-public abstract class J2EEImportPage extends DataModelWizardPage {
-
- private Combo componentCombo;
- private Combo fileNameCombo;
- private static final String STORE_LABEL = "J2EE_IMPORT_"; //$NON-NLS-1$
- private static final int SIZING_TEXT_FIELD_WIDTH = 305;
- protected static final String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL);
-
- /**
- * @param model
- * @param pageName
- */
- public J2EEImportPage(IDataModel model, String pageName) {
- super(model, pageName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
- protected String[] getValidationPropertyNames() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(3, false);
- composite.setLayout(layout);
- createFileNameComposite(composite);
- createProjectNameComposite(composite);
- restoreWidgetValues();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * @param composite
- */
- protected void createProjectNameComposite(Composite parent) {
-// if (FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp()) {
-// new NewModuleDataModelGroup(parent, getDataModel(), synchHelper);
-// } else {
- Label componentLabel = new Label(parent, SWT.NONE);
-
- componentLabel.setText(getProjectImportLabel());
- componentLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- // setting up combo
- componentCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- componentCombo.setLayoutData(data);
-
- // // setting up button
- // Button newProjectButton = new Button(parent, SWT.PUSH);
- // newProjectButton.setText(defNewButtonLabel); //$NON-NLS-1$
- // newProjectButton.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
- // newProjectButton.addSelectionListener(new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // // handleNewProjectButtonPressed();
- // }
- // });
- // newProjectButton.setEnabled(true);
- synchHelper.synchCombo(componentCombo, IJ2EEComponentImportDataModelProperties.PROJECT_NAME, new Control[]{componentLabel});
- new Label(parent, SWT.NULL);
- createServerTargetComposite(parent);
- //}
- }
-
-
-
- protected void createServerTargetComposite(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.TARGET_RUNTIME_LBL));
- Combo serverTargetCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- serverTargetCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button newServerTargetButton = new Button(parent, SWT.NONE);
- newServerTargetButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_THREE_DOTS_E));
- newServerTargetButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- newServerTargetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- //FlexibleProjectCreationWizardPage.launchNewRuntimeWizard(getShell(), model);
- launchNewRuntimeWizard(getShell(), model);
- }
- });
- Control[] deps = new Control[]{label, newServerTargetButton};
- synchHelper.synchCombo(serverTargetCombo, IFacetProjectCreationDataModelProperties.FACET_RUNTIME, deps);
- }
-
- protected IDialogSettings getDialogSettings() {
- return J2EEUIPlugin.getDefault().getDialogSettings();
- }
-
- protected String getProjectImportLabel() {
- return null;
- }
-
- /**
- * @param composite
- */
- protected void createFileNameComposite(Composite parent) {
- Label fileLabel = new Label(parent, SWT.NONE);
- fileLabel.setText(getFileImportLabel());
-
- // setup combo
- fileNameCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
- fileNameCombo.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
-
- // setup browse button
- 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) {
- handleFileBrowseButtonPressed();
- }
- });
- browseButton.setEnabled(true);
-
- synchHelper.synchCombo(fileNameCombo, IJ2EEComponentImportDataModelProperties.FILE_NAME, new Control[]{fileLabel, browseButton});
- }
-
- /**
- *
- */
- protected void handleFileBrowseButtonPressed() {
-
- FileDialog dialog = new FileDialog(fileNameCombo.getShell());
- dialog.setFilterExtensions(getFilterExpression());
- String filename = dialog.open();
- if (filename != null)
- model.setProperty(IJ2EEComponentImportDataModelProperties.FILE_NAME, filename);
- }
-
- /**
- * @return
- */
- protected String[] getFilterExpression() {
- return new String[0];
- }
-
- protected void restoreWidgetValues() {
-
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
- if (sourceNames == null)
- return; // ie.- no settings stored
- for (int i = 0; i < sourceNames.length; i++) {
- if (sourceNames[i] == null)
- sourceNames[i] = ""; //$NON-NLS-1$
- }
- fileNameCombo.setItems(sourceNames);
- }
- }
-
- public void storeDefaultSettings() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
- if (sourceNames == null) {
- sourceNames = new String[0];
- }
- // rip out any empty filenames and trim length to 5
- ArrayList newNames = new ArrayList();
- for (int i = 0; i < sourceNames.length && i < 5; i++) {
- if (sourceNames[i].trim().length() > 0) {
- newNames.add(sourceNames[i]);
- }
- }
- String text = fileNameCombo.getText();
- newNames.remove(text);
- newNames.add(0, text);
- sourceNames = new String[newNames.size()];
- newNames.toArray(sourceNames);
-
- // sourceNames = addToHistory(sourceNames,
- // getJ2EEImportDataModel().getStringProperty(J2EEImportDataModel.FILE_NAME));
- settings.put(STORE_LABEL + getFileNamesStoreID(), sourceNames);
-
- DataModelFacetCreationWizardPage.saveRuntimeSettings(settings, model);
- }
- }
-
- public void restoreDefaultSettings() {
- IDialogSettings settings = getDialogSettings();
- DataModelFacetCreationWizardPage.restoreRuntimeSettings(settings, model);
- }
-
- /**
- * @return
- */
- protected String getFileNamesStoreID() {
- return null;
- }
-
- /**
- * Must override
- */
- protected String getFileImportLabel() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#enter()
- */
- protected void enter() {
- super.enter();
- }
-
- private boolean launchNewRuntimeWizard(Shell shell, IDataModel model) {
- DataModelPropertyDescriptor[] preAdditionDescriptors = model.getValidPropertyDescriptors(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
- boolean isOK = ServerUIUtil.showNewRuntimeWizard(shell, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (isOK && model != null) {
- DataModelPropertyDescriptor[] postAdditionDescriptors = model.getValidPropertyDescriptors(IFacetProjectCreationDataModelProperties.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 = ProjectUtilities.getNewObject(preAddition, postAddition);
-
- model.notifyPropertyChange(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, IDataModel.VALID_VALUES_CHG);
- if (newAddition != null)
- model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, newAddition);
- }
- return isOK;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java
deleted file mode 100644
index fa95ee718..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Dec 4, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public abstract class J2EEModuleExportPage extends J2EEExportPage {
- /**
- * @param model
- * @param pageName
- */
- public J2EEModuleExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
- super(model, pageName, selection);
- }
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IJ2EEComponentExportDataModelProperties.PROJECT_NAME, IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING};
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java
deleted file mode 100644
index d10565962..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java
+++ /dev/null
@@ -1,45 +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.jst.j2ee.internal.wizard;
-
-
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.ui.project.facet.EarSelectionPanel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage;
-
-public abstract class J2EEModuleFacetInstallPage extends DataModelFacetInstallPage implements IJ2EEModuleFacetInstallDataModelProperties {
-
- public J2EEModuleFacetInstallPage(String pageName) {
- super(pageName);
- }
-
- protected EarSelectionPanel earPanel;
-
- public void dispose() {
- if (null != earPanel) {
- earPanel.dispose();
- }
- super.dispose();
- }
-
- protected void setupEarControl(final Composite parent) {
- Composite c = new Composite(parent, SWT.NONE);
- c.setLayoutData(gdhfill());
- final GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- c.setLayout(layout);
- this.earPanel = new EarSelectionPanel(model, c);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java
deleted file mode 100644
index 87f44302b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Dec 4, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModelProvider;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.ui.project.facet.EarSelectionPanel;
-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.ui.PlatformUI;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public abstract class J2EEModuleImportPage extends J2EEImportPage {
- /**
- * @param model
- * @param pageName
- */
-
- protected EarSelectionPanel earPanel;
-
- public J2EEModuleImportPage(IDataModel model, String pageName) {
- super(model, pageName);
- }
-
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = super.createTopLevelComposite(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
- createServerEarAndStandaloneGroup(composite);
- createAnnotationsStandaloneGroup(composite);
- return composite;
- }
-
- /**
- * @param composite
- */
- protected void createAnnotationsStandaloneGroup(Composite composite) {
- }
-
- protected abstract String getModuleFacetID();
- /**
- * @param composite
- */
-
- private void createServerEarAndStandaloneGroup(Composite composite) {
- IDataModel creationDM = getDataModel().getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
- FacetDataModelMap map = (FacetDataModelMap) creationDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel facetModel = (IDataModel) map.get(getModuleFacetID());
-
- Composite c = new Composite(composite, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- c.setLayoutData(data);
- final GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- c.setLayout(layout);
- earPanel = new EarSelectionPanel(facetModel, c);
- }
-
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IJ2EEComponentImportDataModelProperties.FILE_NAME,
- IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME,
- IFacetProjectCreationDataModelProperties.FACET_RUNTIME,
- IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME,
- IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR,
- J2EEArtifactImportDataModelProvider.FACET_RUNTIME};
- }
-
- public void dispose() {
- super.dispose();
- if (earPanel != null)
- earPanel.dispose();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java
deleted file mode 100644
index 5090464ca..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-/*
- * Created on Dec 8, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.io.File;
-import java.util.ArrayList;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-
-/**
- * @author mdelder
- */
-public class J2EEUtilityJarImportPageNew extends J2EEImportPage {
-
- private static final String STORE_LABEL = "J2EE_UTILITY_JAR_LIST_IMPORT_"; //$NON-NLS-1$
- // private static final int SIZING_TEXT_FIELD_WIDTH = 305;
-
- private Button deselectAllButton;
-
- private Button selectAllButton;
-
- protected Button browseButton;
-
- protected Button useAlternateRootBtn;
-
- private Button overwriteProjectCheckbox;
-
- protected CheckboxTableViewer availableJARsViewer;
-
- protected boolean utilJarSelectionChanged = false;
-
- private Combo availableJarsCombo;
-
- protected Button linkedPathCheckbox;
-
-
- /**
- * @param model
- * @param pageName
- */
- public J2EEUtilityJarImportPageNew(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_0")); //$NON-NLS-1$
- setDescription(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_1")); //$NON-NLS-1$
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- setInfopopID(IJ2EEUIContextIds.IMPORT_UTILITY_JAR_WIZARD_P1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- createUtilityJarFileNameComposite(composite);
- createLinkedPathVariable(composite);
- createJARsComposite(composite);
- createOverwriteCheckbox(composite);
-
- restoreWidgetValues();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * @param composite
- */
- protected void createUtilityJarFileNameComposite(Composite parent) {
- Group fileNameGroup = new Group(parent, SWT.NULL);
- fileNameGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_2")); //$NON-NLS-1$
- GridLayout layout = new GridLayout(3, false);
- fileNameGroup.setLayout(layout);
- fileNameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label fileLabel = new Label(fileNameGroup, SWT.NONE);
- fileLabel.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_3")); //$NON-NLS-1$
- fileLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- // setup combo
- availableJarsCombo = new Combo(fileNameGroup, SWT.SINGLE | SWT.BORDER);
- availableJarsCombo.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
-
- // setup browse button
- browseButton = new Button(fileNameGroup, SWT.PUSH);
- browseButton.setText(defBrowseButtonLabel);
- browseButton.setLayoutData((new GridData(GridData.HORIZONTAL_ALIGN_END)));
- browseButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- handleBrowseButtonPressed();
- }
- });
- browseButton.setEnabled(true);
-
- synchHelper.synchCombo(availableJarsCombo, IJ2EEUtilityJarListImportDataModelProperties.AVAILABLE_JARS_DIRECTORY, new Control[]{fileLabel, browseButton});
- }
-
- protected void createLinkedPathVariable(Composite parent) {
-
-
- Group linkedPathGroup = new Group(parent, SWT.NULL);
- linkedPathGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_4")); //$NON-NLS-1$
-
- GridLayout layout = new GridLayout(1, true);
- linkedPathGroup.setLayout(layout);
- linkedPathGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite checkboxGroup = new Composite(linkedPathGroup, SWT.NULL);
- GridLayout checkboxLayout = new GridLayout(2, false);
- checkboxGroup.setLayout(checkboxLayout);
- checkboxGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- linkedPathCheckbox = new Button(checkboxGroup, SWT.CHECK);
- linkedPathCheckbox.setText(" "); //$NON-NLS-1$
- final Text linkedPathText = new Text(checkboxGroup, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
- linkedPathText.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_5")); //$NON-NLS-1$
- linkedPathText.setEnabled(getDataModel().isPropertyEnabled(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE));
-
- getDataModel().addListener(new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE.equals(event.getPropertyName())) {
- linkedPathText.setEnabled(getDataModel().isPropertyEnabled(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE));
- }
-
- }
- });
-
- GridData textGridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- textGridData.heightHint = 50;
- textGridData.widthHint = 350;
- linkedPathText.setLayoutData(textGridData);
- linkedPathText.setBackground(checkboxGroup.getBackground());
-
- // setup combo
- Combo availableLinkedPathsCombo = new Combo(linkedPathGroup, SWT.SINGLE | SWT.BORDER);
- availableLinkedPathsCombo.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
-
- synchHelper.synchCombo(availableLinkedPathsCombo, IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE, new Control[]{availableLinkedPathsCombo});
-
- synchHelper.synchCheckbox(linkedPathCheckbox, IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE, new Control[]{availableLinkedPathsCombo});
-
- }
-
- /**
- * Open an appropriate directory browser
- */
- protected void handleBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell());
- dialog.setMessage(J2EEUIMessages.getResourceString(J2EEUIMessages.SELECT_DIRECTORY_DLG));
-
- String dirName = getBrowseStartLocation();
-
- if (!isNullOrEmpty(dirName)) {
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null)
- availableJarsCombo.setText(selectedDirectory);
- }
-
- /**
- * @return
- */
- protected String getBrowseStartLocation() {
- if (availableJarsCombo.getText() != null && availableJarsCombo.getText().length() > 0)
- return availableJarsCombo.getText();
- return null;
- }
-
- protected boolean isNullOrEmpty(String aString) {
- return aString == null || aString.length() == 0;
- }
-
- /*
- * Updates the enable state of the all buttons
- */
- protected void updateButtonEnablements() {
-
- utilJarSelectionChanged = true;
- }
-
- protected void createAvailableJarsList(Composite listGroup) {
- availableJARsViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
-
- GridData gData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- gData.widthHint = 200;
- gData.heightHint = 80;
- availableJARsViewer.getControl().setLayoutData(gData);
- AvailableUtilityJarsProvider availableUtilJARsProvider = new AvailableUtilityJarsProvider();
- availableJARsViewer.setContentProvider(availableUtilJARsProvider);
- availableJARsViewer.setLabelProvider(availableUtilJARsProvider);
-
- availableJARsViewer.getTable().setHeaderVisible(false);
- availableJARsViewer.getTable().setLinesVisible(false);
-
- availableJARsViewer.setInput(model);
-
- /* getModel().addListener(getOperationDataModelListener()); */
- synchHelper.synchCheckBoxTableViewer(availableJARsViewer, IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, null);
-
-
- model.addListener(new IDataModelListener() {
-
- public void propertyChanged(DataModelEvent event) {
- if (IJ2EEUtilityJarListImportDataModelProperties.AVAILABLE_JARS_DIRECTORY.equals(event.getPropertyName()))
- availableJARsViewer.setInput(model);
- }
- });
- }
-
- private void handleDeselectAllButtonPressed() {
- model.setProperty(IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, new Object[0]);
- }
-
- private void handleSelectAllButtonPressed() {
- Object[] selection = new Object[availableJARsViewer.getTable().getItemCount()];
- for (int i = 0; i < selection.length; i++) {
- selection[i] = availableJARsViewer.getElementAt(i);
- }
- model.setProperty(IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, selection);
- }
-
- protected void createButtonsGroup(org.eclipse.swt.widgets.Composite parent) {
- Composite buttonGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- buttonGroup.setLayout(layout);
- buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- selectAllButton = new Button(buttonGroup, SWT.PUSH);
- selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_ALL_UTIL_BUTTON)); //$NON-NLS-1$ = "Select All"
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 1;
- gd.heightHint = 22;
- gd.widthHint = 120;
- selectAllButton.setLayoutData(gd);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- handleSelectAllButtonPressed();
- }
- });
-
- deselectAllButton = new Button(buttonGroup, SWT.PUSH);
- deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON)); //$NON-NLS-1$ = "Deselect All"
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- gd.heightHint = 22;
- gd.widthHint = 120;
- deselectAllButton.setLayoutData(gd);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- handleDeselectAllButtonPressed();
- }
- });
- }
-
- protected void createJARsComposite(Composite parent) {
- Group group = new Group(parent, SWT.NULL);
- group.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_JARS_GROUP));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label description = new Label(group, SWT.NULL);
- description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_UTILITY_JAR_LISTEAR_IMPORT_SELECT_UTIL_JARS_TO_BE_PROJECTS));
- GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd2.horizontalSpan = 2;
- description.setLayoutData(gd2);
-
- // create jars check box viewer
- createAvailableJarsList(group);
- createButtonsGroup(group);
- }
-
- /**
- * @param projectOptionsGroup
- */
- protected void createOverwriteCheckbox(Composite parent) {
-
- overwriteProjectCheckbox = new Button(parent, SWT.CHECK);
- overwriteProjectCheckbox.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_6")); //$NON-NLS-1$
- synchHelper.synchCheckbox(overwriteProjectCheckbox, IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY, null);
- }
-
- protected void setJARsCompositeEnabled(boolean enabled) {
- availableJARsViewer.getTable().setEnabled(enabled);
- availableJARsViewer.setAllChecked(false);
- availableJARsViewer.setAllGrayed(!enabled);
- selectAllButton.setEnabled(enabled);
- deselectAllButton.setEnabled(enabled);
- }
-
- protected String[] getValidationPropertyNames() {
- return new String[]{IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY, IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE};
- }
-
- protected void restoreWidgetValues() {
-
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
- if (sourceNames == null)
- return; // ie.- no settings stored
- for (int i = 0; i < sourceNames.length; i++) {
- if (sourceNames[i] == null)
- sourceNames[i] = ""; //$NON-NLS-1$
- }
- availableJarsCombo.setItems(sourceNames);
- }
- }
-
- public void storeDefaultSettings() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
- if (sourceNames == null) {
- sourceNames = new String[0];
- }
-
- String newName = availableJarsCombo.getText();
-
- // rip out any empty filenames and trim length to 5
- ArrayList newNames = new ArrayList();
- for (int i = 0; i < sourceNames.length && i < 5; i++) {
- if (sourceNames[i].trim().length() > 0 && !newName.equals(sourceNames[i])) {
- newNames.add(sourceNames[i]);
- }
- }
- newNames.add(0, availableJarsCombo.getText());
- sourceNames = new String[newNames.size()];
- newNames.toArray(sourceNames);
-
- settings.put(STORE_LABEL + getFileNamesStoreID(), sourceNames);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileNamesStoreID()
- */
- protected String getFileNamesStoreID() {
- return "UTIL";//$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileImportLabel()
- */
- protected String getFileImportLabel() {
- return J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_7"); //$NON-NLS-1$
- }
-
-
- public void restoreDefaultSettings() {
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java
deleted file mode 100644
index 59d1045fa..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-/*
- * Created on May 13, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-public class J2EEUtilityJarImportTypePageNew extends DataModelWizardPage {
-
- protected static final String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL); //$NON-NLS-1$
-
- private static final int SIZING_TEXT_FIELD_WIDTH = 305;
-
- protected IStructuredSelection currentResourceSelection;
-
- private Combo resourceNameCombo;
-
- private Button copyJarIntoEAR;
-
- private Button linkJarIntoEAR;
-
- private Button createLinkedProjects;
-
- private Button createProjects;
-
- protected Button browseButton;
-
- private Button overrideProjectRootCheckbox;
-
-
- protected Text projectRootLocationText;
-
- private Label moduleProjectLocationLabel;
-
- protected boolean synching;
-
- public static final String TITLE = J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_0"); //$NON-NLS-1$
- public static final String DESCRIPTION = J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_1"); //$NON-NLS-1$
-
- private Group projectRootComposite;
-
-
- /**
- * @param model
- * @param pageName
- * @param title
- * @param titleImage
- */
- public J2EEUtilityJarImportTypePageNew(IDataModel model, String pageName, String title, ImageDescriptor titleImage) {
- super(model, pageName, title, titleImage);
- setTitle(""); //$NON-NLS-1$
- setDescription(""); //$NON-NLS-1$
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- setInfopopID(IJ2EEUIContextIds.IMPORT_UTILITY_JAR_WIZARD_P2);
- }
-
- public J2EEUtilityJarImportTypePageNew(IDataModel model, String pageName, IStructuredSelection selection) {
- super(model, pageName);
- this.currentResourceSelection = selection;
- setTitle(TITLE);
- setDescription(DESCRIPTION);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- }
-
- public J2EEUtilityJarImportTypePageNew(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(TITLE);
- setDescription(DESCRIPTION);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
- protected String[] getValidationPropertyNames() {
- return new String[]{IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME, IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT};
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(1, false);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- createEARProjectGroup(composite);
- createUtilityJarImportTypes(composite);
- // TODO The binary / project location options are not yet (re-) supported by the import operations.
- createProjectCreationOptions(composite);
-
- setupBasedOnInitialSelections();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * @param composite
- */
- protected void createUtilityJarImportTypes(Composite parent) {
- Group typesGroup = new Group(parent, SWT.NULL);
- typesGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_2")); //$NON-NLS-1$
-
- GridLayout layout = new GridLayout(1, false);
- typesGroup.setLayout(layout);
- typesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- createProjects = new Button(typesGroup, SWT.RADIO);
- createProjects.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_3")); //$NON-NLS-1$
- synchHelper.synchRadio(createProjects, IJ2EEUtilityJarListImportDataModelProperties.CREATE_PROJECT, null);
-
- createLinkedProjects = new Button(typesGroup, SWT.RADIO);
- createLinkedProjects.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_4")); //$NON-NLS-1$
- synchHelper.synchRadio(createLinkedProjects, IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PROJECT, null);
-
- copyJarIntoEAR = new Button(typesGroup, SWT.RADIO);
- copyJarIntoEAR.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_5")); //$NON-NLS-1$
- synchHelper.synchRadio(copyJarIntoEAR, IJ2EEUtilityJarListImportDataModelProperties.COPY, null);
-
- linkJarIntoEAR = new Button(typesGroup, SWT.RADIO);
- linkJarIntoEAR.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_6")); //$NON-NLS-1$
- /* linkJarIntoEAR.addSelectionListener(getTypeSelectionListener()); */
- synchHelper.synchRadio(linkJarIntoEAR, IJ2EEUtilityJarListImportDataModelProperties.LINK_IMPORT, null);
-
- }
-
- protected void createProjectCreationOptions(Composite parent) {
-
- Group projectOptionsGroup = new Group(parent, SWT.NULL);
- projectOptionsGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_7")); //$NON-NLS-1$
-
- GridLayout layout = new GridLayout(1, false);
- projectOptionsGroup.setLayout(layout);
- projectOptionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- overrideProjectRootCheckbox = new Button(projectOptionsGroup, SWT.CHECK);
- overrideProjectRootCheckbox.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_11")); //$NON-NLS-1$
- createProjectRootComposite(projectOptionsGroup);
-
- synchHelper.synchCheckbox(overrideProjectRootCheckbox, IJ2EEUtilityJarListImportDataModelProperties.OVERRIDE_PROJECT_ROOT, new Control[]{/*
- * moduleProjectLocationLabel,
- * projectRootLocationText,
- * browseButton
- */});
- }
-
- /**
- *
- * @param parent
- * a <code>Composite</code> that is to be used as the parent of this group's
- * collection of visual components
- * @see org.eclipse.swt.widgets.Composite
- */
- protected void createEARProjectGroup(Composite parent) {
-
- Group earGroup = new Group(parent, SWT.NULL);
- earGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_8")); //$NON-NLS-1$
-
- GridLayout layout = new GridLayout(2, false);
- earGroup.setLayout(layout);
- earGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Project label
- Label projectLabel = new Label(earGroup, SWT.NONE);
- projectLabel.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_9")); //$NON-NLS-1$
- // Project combo
- resourceNameCombo = new Combo(earGroup, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- resourceNameCombo.setLayoutData(data);
- synchHelper.synchCombo(resourceNameCombo, IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME, null);
-
- }
-
- protected void createProjectRootComposite(Composite parent) {
- projectRootComposite = new Group(parent, SWT.NULL);
- projectRootComposite.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_LOCATIONS_GROUP));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectRootComposite.setLayout(layout);
- projectRootComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label description = new Label(projectRootComposite, SWT.NULL);
- description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_PROJECT_GROUP_DESCRIPTION));
- GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd2.horizontalSpan = 3;
- description.setLayoutData(gd2);
-
- moduleProjectLocationLabel = new Label(projectRootComposite, SWT.NULL);
- moduleProjectLocationLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.USE_DEFAULT_ROOT_RADIO));
- moduleProjectLocationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- projectRootLocationText = new Text(projectRootComposite, SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- projectRootLocationText.setLayoutData(gd);
- projectRootLocationText.setText(ResourcesPlugin.getWorkspace().getRoot().getFullPath().toOSString());
- projectRootLocationText.setEnabled(false); /* disabled by default */
-
- browseButton = new Button(projectRootComposite, SWT.PUSH);
- browseButton.setText(defBrowseButtonLabel);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- browseButton.setLayoutData(gd);
- browseButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- handleRootProjectBrowseButtonPressed();
- }
- });
-
- synchHelper.synchText(projectRootLocationText, IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT, new Control[]{moduleProjectLocationLabel, projectRootLocationText, browseButton});
- }
-
-
- /**
- * Open an appropriate directory browser
- */
- protected void handleRootProjectBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell());
- dialog.setMessage(J2EEUIMessages.getResourceString(J2EEUIMessages.SELECT_DIRECTORY_DLG));
-
- String dirName = getBrowseStartLocation();
-
- if (!isNullOrEmpty(dirName)) {
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null)
- projectRootLocationText.setText(selectedDirectory);
-
- }
-
- protected String getBrowseStartLocation() {
- String text = projectRootLocationText.getText();
- return text;
- }
-
-
- protected boolean isNullOrEmpty(String aString) {
- return aString == null || aString.length() == 0;
- }
-
- /**
- * Populates the resource name field based upon the currently-selected resources.
- */
- protected void setupBasedOnInitialSelections() {
-
- if (null == currentResourceSelection || currentResourceSelection.isEmpty() || setupBasedOnRefObjectSelection())
- return; // no
- // setup
- // needed
-
- java.util.List selections = new ArrayList();
- Iterator aenum = currentResourceSelection.iterator();
- while (aenum.hasNext()) {
- IResource currentResource = (IResource) aenum.next();
- // do not add inaccessible elements
- if (currentResource.isAccessible())
- selections.add(currentResource);
- }
- if (selections.isEmpty())
- return; // setup not needed anymore
-
- int selectedResourceCount = selections.size();
- if (selectedResourceCount == 1) {
- IResource resource = (IResource) selections.get(0);
- if (resource instanceof IProject ) {
- resourceNameCombo.setText(resource.getName().toString());
- }
- }
- }
-
- /**
- * Populates the resource name field based upon the currently-selected resources.
- */
- protected boolean setupBasedOnRefObjectSelection() {
-
- if (currentResourceSelection.size() != 1)
- return false;
-
- Object o = currentResourceSelection.getFirstElement();
- if (!isMetaTypeSupported(o))
- return false;
-
- EObject ref = (EObject) o;
- IResource resource = ProjectUtilities.getProject(ref);
- if (resource != null)
- resourceNameCombo.setText(resource.getName().toString());
- return true;
- }
-
- protected boolean isMetaTypeSupported(Object o) {
- return o instanceof EARFile || o instanceof Application;
- }
-
- protected void enableProjectOptions(boolean enabled) {
- overrideProjectRootCheckbox.setEnabled(enabled);
-
- if (overrideProjectRootCheckbox.getSelection() && enabled)
- projectRootLocationText.setEnabled(true);
- else
- projectRootLocationText.setEnabled(false);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
- */
- public boolean isPageComplete() {
- return model.validateProperty(IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME).isOK();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java
deleted file mode 100644
index d16a57a94..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarListImportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-
-/**
- * <p>
- * Used to import Utility Jars into several Eclipse workbench configurations. These can be extracted
- * as editable projects, binary projects, linked resources in the EAR module or actual resources in
- * the EAR module.
- * </p>
- */
-public final class J2EEUtilityJarImportWizardNew extends J2EEArtifactImportWizard implements IImportWizard {
-
- /**
- * <p>
- * Constant used to identify the key of the page of the Wizard which allows users to define the
- * type of import they would like to carry out.
- * </p>
- */
- private static final String IMPORT_TYPE = "IMPORT_TYPE"; //$NON-NLS-1$
-
- /**
- * <p>
- * Constant used to identify the key of the page of the Wizard that allows users to select jar
- * files for import
- * </p>
- */
- private static final String SELECT_JARS = "SELECT_JARS"; //$NON-NLS-1$
-
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public J2EEUtilityJarImportWizardNew() {
- super();
- setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public J2EEUtilityJarImportWizardNew(IDataModel model) {
- super(model);
- setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
- }
-
- /**
- * <p>
- * Adds the following pages:
- * <ul>
- * <li>{@link J2EEUtilityJarImportTypePageNew}as the main wizard page ({@link #IMPORT_TYPE})
- * <li>{@link J2EEUtilityJarImportPageNew}as the main wizard page ({@link #SELECT_JARS})
- * </ul>
- * </p>
- */
- public void doAddPages() {
- this.addPage(new J2EEUtilityJarImportTypePageNew(getDataModel(), IMPORT_TYPE, getSelection()));
- this.addPage(new J2EEUtilityJarImportPageNew(getDataModel(), SELECT_JARS));
- }
-
- protected IDataModelProvider getDefaultProvider() {
- return new J2EEUtilityJarListImportDataModelProvider();
- }
-
- protected String getFinalPerspectiveID() {
- return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_UTILITY);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/MinimizedFileSystemElement.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/MinimizedFileSystemElement.java
deleted file mode 100644
index eb878c0bf..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/MinimizedFileSystemElement.java
+++ /dev/null
@@ -1,131 +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.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.ui.dialogs.FileSystemElement;
-import org.eclipse.ui.model.AdaptableList;
-import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
-
-/**
- * The <code>MinimizedFileSystemElement</code> is a <code>FileSystemElement</code> that knows if
- * it has been populated or not.
- */
-class MinimizedFileSystemElement extends FileSystemElement {
- private boolean populated = false;
- private String packageBaseDirName = null;
-
-
- /**
- * Create a <code>MinimizedFileSystemElement</code> with the supplied name and parent.
- *
- * @param name
- * the name of the file element this represents
- * @param parent
- * the containing parent
- * @param isDirectory
- * indicated if this could have children or not
- */
- MinimizedFileSystemElement(String name, org.eclipse.ui.dialogs.FileSystemElement parent, boolean isDirectory) {
- super(name, parent, isDirectory);
- }
-
- public void setPackageBaseDirName(String s) {
- packageBaseDirName = s;
- }
-
- public void addChild(FileSystemElement child) {
- if (child.isDirectory()) {
- super.addChild(child);
- } else {
- if (child.getFileNameExtension().equals("class")) { //$NON-NLS-1$
- super.addChild(child);
- }
- }
- }
-
- /**
- * Returns a list of the files that are immediate children. Use the supplied provider if it
- * needs to be populated. of this folder.
- */
- public AdaptableList getFiles(IImportStructureProvider provider) {
- if (!populated)
- populate(provider);
-
- return super.getFiles();
-
- }
-
- /**
- * Returns a list of the folders that are immediate children. Use the supplied provider if it
- * needs to be populated. of this folder.
- */
- public AdaptableList getFolders(IImportStructureProvider provider) {
- if (!populated)
- populate(provider);
-
- return super.getFolders();
-
- }
-
- /**
- * Return whether or not population has happened for the receiver.
- */
- boolean isPopulated() {
- return this.populated;
- }
-
- /**
- * Return whether or not population has not happened for the receiver.
- */
- boolean notPopulated() {
- return !this.populated;
- }
-
- /**
- * Populate the files and folders of the receiver using the suppliec structure provider.
- *
- * @param provider
- * org.eclipse.ui.wizards.datatransfer.IImportStructureProvider
- */
- private void populate(IImportStructureProvider provider) {
-
- Object fileSystemObject = getFileSystemObject();
-
- List children = provider.getChildren(fileSystemObject);
- if (children == null)
- children = new ArrayList(1);
- Iterator childrenEnum = children.iterator();
- while (childrenEnum.hasNext()) {
- Object child = childrenEnum.next();
-
- String elementLabel = provider.getLabel(child);
- if (elementLabel.equals(packageBaseDirName) || packageBaseDirName == null) {
- //Create one level below
-
- MinimizedFileSystemElement result = new MinimizedFileSystemElement(elementLabel, this, provider.isFolder(child));
- result.setFileSystemObject(child);
- }
- }
- setPopulated();
-
- }
-
- /**
- * Set whether or not population has happened for the receiver to true.
- */
- void setPopulated() {
- this.populated = true;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
deleted file mode 100644
index fcf8a82c0..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-/*
- * Created on Mar 23, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.activities.WorkbenchActivityHelper;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.wizards.IWizardDescriptor;
-import org.eclipse.ui.wizards.IWizardRegistry;
-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.ui.GenericWizardNode;
-import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
-
-public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implements IDefaultJ2EEComponentCreationDataModelProperties {
- private Button defaultModulesButton;
-
- private Composite defaultModulesComposite;
-
- private Composite newModulesComposite;
-
- private Button appClientRadioButton;
-
- private Button ejbRadioButton;
-
- private Button webRadioButton;
-
- private Button connectorRadioButton;
-
- private GenericWizardNode appClientNode;
-
- private GenericWizardNode ejbNode;
-
- private GenericWizardNode webNode;
-
- private GenericWizardNode connectorNode;
-
- private GenericWizardNode selectedNode;
-
- private StackLayout stackLayout;
-
- /**
- * @param model
- * @param pageName
- */
- protected NewJ2EEComponentSelectionPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_TITLE));
- setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_DESC));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#getValidationPropertyNames()
- */
- protected String[] getValidationPropertyNames() {
- return new String[] { CREATE_APPCLIENT, APPCLIENT_COMPONENT_NAME, CREATE_CONNECTOR, CONNECTOR_COMPONENT_NAME, CREATE_EJB, EJB_COMPONENT_NAME, CREATE_WEB, WEB_COMPONENT_NAME, MODULE_NAME_COLLISIONS_VALIDATION, ENABLED };
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- setInfopopID(IJ2EEUIContextIds.EAR_NEW_MODULE_PROJECTS_PAGE);
- createDefaultCheckBox(composite);
- Composite forStackComposite = new Composite(composite, SWT.NULL);
- layout = new GridLayout();
- forStackComposite.setLayout(layout);
- forStackComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- Composite stackComposite = createStackLayoutComposite(forStackComposite);
- createDefaultModulesComposite(stackComposite);
- createModuleSelectionComposite(stackComposite);
- stackLayout.topControl = defaultModulesComposite;
- setButtonEnablement();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- protected Composite createStackLayoutComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- stackLayout = new StackLayout();
- composite.setLayout(stackLayout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return composite;
- }
-
- private void createDefaultModulesComposite(Composite parent) {
- defaultModulesComposite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- defaultModulesComposite.setLayout(layout);
- defaultModulesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- // Default Module Controls creation
- createAppClientDefaultModuleControl();
- if (J2EEPlugin.isEJBSupportAvailable())
- createEJBDefaultModuleControl();
- createWebDefaultModuleControl();
- if (J2EEPlugin.isEJBSupportAvailable())
- createConnectorDefaultModuleControl();
- }
-
- /**
- * @param parent
- */
- private void createModuleSelectionComposite(Composite parent) {
- newModulesComposite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- newModulesComposite.setLayout(layout);
- newModulesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- appClientRadioButton = new Button(newModulesComposite, SWT.RADIO);
-
- appClientRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.appClient")); //$NON-NLS-1$
- appClientRadioButton.addListener(SWT.Selection, this);
- if (EarModuleManager.getEJBModuleExtension() != null) {
- ejbRadioButton = new Button(newModulesComposite, SWT.RADIO);
- ejbRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.ejb")); //$NON-NLS-1$
- ejbRadioButton.addListener(SWT.Selection, this);
- }
- if (EarModuleManager.getWebModuleExtension() != null) {
- webRadioButton = new Button(newModulesComposite, SWT.RADIO);
- webRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.web")); //$NON-NLS-1$
- webRadioButton.addListener(SWT.Selection, this);
- }
- if (EarModuleManager.getJCAModuleExtension() != null) {
- connectorRadioButton = new Button(newModulesComposite, SWT.RADIO);
- connectorRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.jca")); //$NON-NLS-1$
- connectorRadioButton.addListener(SWT.Selection, this);
- }
- }
-
- /**
- *
- */
- private void createConnectorDefaultModuleControl() {
- if (EarModuleManager.getJCAModuleExtension() != null) {
- String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_JCA_MODULE_LBL);
- createJ2EEComponentControl(label, CREATE_CONNECTOR, CONNECTOR_COMPONENT_NAME);
- }
- }
-
- /**
- *
- */
- private void createWebDefaultModuleControl() {
- if (EarModuleManager.getWebModuleExtension() != null) {
- String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_WEB_MODULE_LBL);
- createJ2EEComponentControl(label, CREATE_WEB, WEB_COMPONENT_NAME);
- }
- }
-
- /**
- *
- */
- private void createEJBDefaultModuleControl() {
- if (EarModuleManager.getEJBModuleExtension() != null) {
- String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_EJB_MODULE_LBL);
- createJ2EEComponentControl(label, CREATE_EJB, EJB_COMPONENT_NAME);
- }
- }
-
- private void createAppClientDefaultModuleControl() {
- String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_APPCLIENT_MODULE_LBL);
- createJ2EEComponentControl(label, CREATE_APPCLIENT, APPCLIENT_COMPONENT_NAME);
- }
-
- private void createJ2EEComponentControl(String label, String createProperty, String projectProperty) {
- final Button checkBox = new Button(defaultModulesComposite, SWT.CHECK);
- checkBox.setSelection(true);
- checkBox.setText(label);
-
- final Text textField = new Text(defaultModulesComposite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- textField.setLayoutData(data);
- synchHelper.synchCheckbox(checkBox, createProperty, null);
- synchHelper.synchText(textField, projectProperty, null);
- }
-
- private void createDefaultCheckBox(Composite composite) {
- Composite checkBoxComposite = new Composite(composite, SWT.NULL);
- GridLayout layout = new GridLayout();
- checkBoxComposite.setLayout(layout);
- checkBoxComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- defaultModulesButton = new Button(checkBoxComposite, SWT.CHECK);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.horizontalIndent = 0;
- defaultModulesButton.setLayoutData(data);
- defaultModulesButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_NEW_MOD_SEL_PG_DEF_BTN));
- defaultModulesButton.setSelection(true);
- defaultModulesButton.addListener(SWT.Selection, this);
- synchHelper.synchCheckbox(defaultModulesButton, ENABLED, null);
- createControlsSeparatorLine(checkBoxComposite);
- }
-
- protected void createControlsSeparatorLine(Composite parent) {
- // add a horizontal line
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- separator.setLayoutData(data);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
- */
- public void handleEvent(Event evt) {
- if (evt.widget == defaultModulesButton)
- handleDefaultModulesButtonPressed();
- else if (!defaultModulesButton.getSelection()) {
- if (evt.widget == appClientRadioButton && appClientRadioButton.getSelection())
- setSelectedNode(getAppClientNode());
- else if (evt.widget == ejbRadioButton && ejbRadioButton.getSelection())
- setSelectedNode(getEjbNode());
- else if (evt.widget == webRadioButton && webRadioButton.getSelection())
- setSelectedNode(getWebNode());
- else if (evt.widget == connectorRadioButton && connectorRadioButton.getSelection())
- setSelectedNode(getConnectorNode());
- validatePage();
- }
- super.handleEvent(evt);
- }
-
- /**
- *
- */
- private void handleDefaultModulesButtonPressed() {
- if (defaultModulesButton.getSelection()) {
- setSelectedNode(null);
- showDefaultModulesComposite();
- setDefaultModulesSelection(true);
- } else {
- setDefaultModulesSelection(false);
- showNewModulesCompsite();
- }
- setButtonEnablement();
- validatePage();
- }
-
- private void setDefaultModulesSelection(boolean selection) {
- getDataModel().setBooleanProperty(CREATE_APPCLIENT, selection);
- getDataModel().setBooleanProperty(CREATE_CONNECTOR, selection);
- getDataModel().setBooleanProperty(CREATE_EJB, selection);
- getDataModel().setBooleanProperty(CREATE_WEB, selection);
- }
-
- private void showDefaultModulesComposite() {
- defaultModulesComposite.setVisible(true);
- newModulesComposite.setVisible(false);
- stackLayout.topControl = defaultModulesComposite;
- }
-
- /**
- * This is done based on the J2EE version. We need to disable Connectors if
- * not j2ee 1.3 or higher.
- */
- private void setButtonEnablement() {
- if (!defaultModulesButton.getSelection() && connectorRadioButton != null) {
- int version = getDataModel().getIntProperty(J2EE_VERSION);
- connectorRadioButton.setEnabled(version > J2EEVersionConstants.J2EE_1_2_ID);
- }
- }
-
- /**
- *
- */
- private void showNewModulesCompsite() {
- defaultModulesComposite.setVisible(false);
- newModulesComposite.setVisible(true);
- if (!isAnyModuleRadioSelected())
- appClientRadioButton.setSelection(true);
- setSelectedNode(getWizardNodeFromSelection());
- stackLayout.topControl = newModulesComposite;
- }
-
- /**
- * @return
- */
- private GenericWizardNode getWizardNodeFromSelection() {
- if (appClientRadioButton.getSelection())
- return getAppClientNode();
- if (connectorRadioButton != null && connectorRadioButton.getSelection())
- return getConnectorNode();
- if (ejbRadioButton != null && ejbRadioButton.getSelection())
- return getEjbNode();
- if (webRadioButton != null && webRadioButton.getSelection())
- return getWebNode();
- return null;
- }
-
- /**
- * @return
- */
- private boolean isAnyModuleRadioSelected() {
- return appClientRadioButton.getSelection() || (connectorRadioButton != null && connectorRadioButton.getSelection()) || (ejbRadioButton != null && ejbRadioButton.getSelection()) || (webRadioButton != null && webRadioButton.getSelection());
- }
-
- /**
- * @return Returns the appClientNode.
- */
- private GenericWizardNode getAppClientNode() {
- if (appClientNode == null) {
- appClientNode = new GenericWizardNode() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
- */
- protected IWizard createWizard() {
- return createChildWizard("org.eclipse.jst.j2ee.ui.project.facet.appclient.AppClientProjectWizard", NESTED_MODEL_CLIENT); //$NON-NLS-1$
- }
- };
- }
- return appClientNode;
- }
-
- /**
- * @return Returns the connectorNode.
- */
- private GenericWizardNode getConnectorNode() {
- if (connectorNode == null) {
- connectorNode = new GenericWizardNode() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
- */
- protected IWizard createWizard() {
- return createChildWizard("org.eclipse.jst.j2ee.jca.ui.internal.wizard.ConnectorProjectWizard", NESTED_MODEL_JCA); //$NON-NLS-1$
- }
- };
- }
- return connectorNode;
- }
-
- /**
- * @return Returns the ejbNode.
- */
- private GenericWizardNode getEjbNode() {
- if (ejbNode == null) {
- ejbNode = new GenericWizardNode() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
- */
- protected IWizard createWizard() {
- return createChildWizard("org.eclipse.jst.ejb.ui.project.facet.EjbProjectWizard", NESTED_MODEL_EJB); //$NON-NLS-1$
- }
- };
- }
- return ejbNode;
- }
-
- /**
- * @return Returns the webNode.
- */
- private GenericWizardNode getWebNode() {
- if (webNode == null) {
- webNode = new GenericWizardNode() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
- */
- protected IWizard createWizard() {
- return createChildWizard("org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard", NESTED_MODEL_WEB); //$NON-NLS-1$
- }
- };
- }
- return webNode;
- }
-
- private IWizard createChildWizard(String id, String parentWizModelName) {
- NewProjectDataModelFacetWizard wizard = null;
- IWizardRegistry newWizardRegistry = WorkbenchPlugin.getDefault().getNewWizardRegistry();
- IWizardDescriptor wizardDescriptor = newWizardRegistry.findWizard(id);
- try {
- // retrieve the model of the parent wizard
- IDataModel parentWizModel = getDataModel().getNestedModel(parentWizModelName);
-
- // create the child wizard and retrieve its model
- wizard = (NewProjectDataModelFacetWizard) wizardDescriptor.createWizard();
- IDataModel childWizModel = wizard.getDataModel();
-
- // copy the properties of the parent wizard's model to the child wizard's model
- Iterator props = parentWizModel.getBaseProperties().iterator();
- while (props.hasNext()) {
- String prop = (String) props.next();
- childWizModel.setProperty(prop, parentWizModel.getProperty(prop));
- }
- int a = 1;
- } catch (CoreException ce) {
- Logger.getLogger().log(ce);
- }
- return wizard;
- }
-
- /**
- * @param selectedNode
- * The selectedNode to set.
- */
- private void setSelectedNode(GenericWizardNode selectedNode) {
- this.selectedNode = selectedNode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- if (!defaultModulesButton.getSelection())
- return selectedNode != null;
- return false;
- }
-
- /**
- * 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;
- IPluginContribution pluginContribution = new IPluginContribution() {
- public String getLocalId() {
- String id = null;
- if (selectedNode == appClientNode) {
- id = "org.eclipse.jst.j2ee.internal.internal.internal.appclientProjectWizard"; //$NON-NLS-1$
- } else if (selectedNode == ejbNode) {
- id = "org.eclipse.jst.j2ee.internal.internal.internal.ejb.ui.util.ejbProjectWizard"; //$NON-NLS-1$
- } else if (selectedNode == connectorNode) {
- id = "org.eclipse.jst.j2ee.internal.internal.internal.jcaProjectWizard"; //$NON-NLS-1$
- } else if (selectedNode == webNode) {
- id = "org.eclipse.jst.j2ee.internal.internal.internal.webProjectWizard"; //$NON-NLS-1$
- }
- return id;
- }
-
- public String getPluginId() {
- return "org.eclipse.jst.j2ee.internal.internal.internal.ui"; //$NON-NLS-1$
- }
- };
-
- if (!WorkbenchActivityHelper.allowUseOf(null,pluginContribution)) {
- 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();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#validatePage()
- */
- protected void validatePage() {
- if (!defaultModulesButton.getSelection()) {
- setPageComplete(false);
- setErrorMessage(null);
- } else
- super.validatePage();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java
deleted file mode 100644
index de910d5ba..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
-import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-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.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-
-/**
- * @author jialin
- *
- * To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-public class NewJavaClassOptionsWizardPage extends DataModelWizardPage {
-
- protected Button publicButton;
- protected Button abstractButton;
- protected Button finalButton;
- protected ListViewer interfaceViewer;
- protected Button addButton;
- protected Button removeButton;
- protected Button inheritButton;
- protected Button constructorButton;
- protected Button mainMethodButton;
-
- /**
- * @param model
- * @param pageName
- */
- public NewJavaClassOptionsWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle) {
- super(model, pageName);
- setDescription(pageDesc);
- this.setTitle(pageTitle);
- setInfopopID(IJ2EEUIContextIds.NEW_JAVA_CLASS_OPTION_WIZARD_P1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
- protected String[] getValidationPropertyNames() {
- return new String[]{INewJavaClassDataModelProperties.MODIFIER_ABSTRACT, INewJavaClassDataModelProperties.MODIFIER_FINAL};
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 300;
- composite.setLayoutData(data);
-
- createModifierControls(composite);
- createInterfaceControls(composite);
-
- // Separator label
- Label seperator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- seperator.setLayoutData(data);
-
- createStubsComposite(composite);
-
- publicButton.setFocus();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Create controls for the modifiers
- */
- protected void createModifierControls(Composite parent) {
- Label modifiersLabel = new Label(parent, SWT.NONE);
- modifiersLabel.setText(J2EEUIMessages.JAVA_CLASS_MODIFIERS_LABEL);
- modifiersLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.makeColumnsEqualWidth = true;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- publicButton = new Button(composite, SWT.CHECK);
- publicButton.setText(J2EEUIMessages.JAVA_CLASS_PUBLIC_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(publicButton, INewJavaClassDataModelProperties.MODIFIER_PUBLIC, null);
-
- abstractButton = new Button(composite, SWT.CHECK);
- abstractButton.setText(J2EEUIMessages.JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(abstractButton, INewJavaClassDataModelProperties.MODIFIER_ABSTRACT, null);
-
- finalButton = new Button(composite, SWT.CHECK);
- finalButton.setText(J2EEUIMessages.JAVA_CLASS_FINAL_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(finalButton, INewJavaClassDataModelProperties.MODIFIER_FINAL, null);
- }
-
- protected void createInterfaceControls(Composite parent) {
- Label interfaceLabel = new Label(parent, SWT.NONE);
- interfaceLabel.setText(J2EEUIMessages.JAVA_CLASS_INTERFACES_LABEL);
- interfaceLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- interfaceViewer = new ListViewer(composite);
- interfaceViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
- interfaceViewer.setContentProvider(getInterfaceContentProvider());
- interfaceViewer.setLabelProvider(getInterfaceLabelProvider());
- interfaceViewer.setInput(model.getProperty(INewJavaClassDataModelProperties.INTERFACES));
-
- Composite buttonCompo = new Composite(composite, SWT.NULL);
- layout = new GridLayout();
- layout.marginHeight = 0;
- buttonCompo.setLayout(layout);
- buttonCompo.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
-
- addButton = new Button(buttonCompo, SWT.PUSH);
- addButton.setText(J2EEUIMessages.ADD_BUTTON_LABEL);
- addButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- addButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleInterfaceAddButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
-
- removeButton = new Button(buttonCompo, SWT.PUSH);
- removeButton.setText(J2EEUIMessages.REMOVE_BUTTON);
- removeButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- removeButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleInterfaceRemoveButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
- removeButton.setEnabled(false);
-
- interfaceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- removeButton.setEnabled(!selection.isEmpty());
- }
- });
-
- }
-
- /**
- * Create the composite with all the stubs
- */
- protected void createStubsComposite(Composite parent) {
- Label stubLabel = new Label(parent, SWT.NONE);
- stubLabel.setText(J2EEUIMessages.JAVA_CLASS_METHOD_STUBS_LABEL);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- stubLabel.setLayoutData(data);
-
- Composite buttonCompo = new Composite(parent, SWT.NULL);
- buttonCompo.setLayout(new GridLayout());
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- data.horizontalIndent = 15;
- buttonCompo.setLayoutData(data);
-
- mainMethodButton = new Button(buttonCompo, SWT.CHECK);
- mainMethodButton.setText(J2EEUIMessages.JAVA_CLASS_MAIN_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(mainMethodButton, INewJavaClassDataModelProperties.MAIN_METHOD, null);
-
- inheritButton = new Button(buttonCompo, SWT.CHECK);
- inheritButton.setText(J2EEUIMessages.JAVA_CLASS_INHERIT_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(inheritButton, INewJavaClassDataModelProperties.ABSTRACT_METHODS, null);
-
- constructorButton = new Button(buttonCompo, SWT.CHECK);
- constructorButton.setText(J2EEUIMessages.JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(constructorButton, INewJavaClassDataModelProperties.CONSTRUCTOR, null);
- }
-
- /**
- * @see IStatefulWizardPage#saveWidgetValues()
- */
- // public void saveWidgetValues() {
- // // TODO: do we want to do this here or in the concrete subclasses???
- // IDialogSettings store = getDialogSettings();
- // if (store != null)
- // store.put(getUniqueKey(""), getUniqueKey("")); //$NON-NLS-1$
- // //$NON-NLS-2$
- // DialogSettingsHelper.saveButton(inheritButton,
- // getUniqueKey(idInheritedAbstractButton), store);
- // DialogSettingsHelper.saveButton(constructorButton,
- // getUniqueKey(idSuperClassConstructorsButton), store);
- // DialogSettingsHelper.saveButton(publicButton,
- // getUniqueKey(idPublicButton), store);
- // DialogSettingsHelper.saveButton(abstractButton,
- // getUniqueKey(idAbstractButton), store);
- // DialogSettingsHelper.saveButton(finalButton, getUniqueKey(idFinalButton),
- // store);
- //
- // }
- /**
- * @see IStatefulWizardPage#restoreWidgetValues()
- */
- // public void restoreWidgetValues() {
- // IDialogSettings store = super.getDialogSettings();
- // if (store != null && store.get(getUniqueKey("")) != null) { //$NON-NLS-1$
- // DialogSettingsHelper.restoreButton(inheritButton,
- // getUniqueKey(idInheritedAbstractButton), store);
- // DialogSettingsHelper.restoreButton(constructorButton,
- // getUniqueKey(idSuperClassConstructorsButton), store);
- // DialogSettingsHelper.restoreButton(publicButton,
- // getUniqueKey(idPublicButton), store);
- // DialogSettingsHelper.restoreButton(abstractButton,
- // getUniqueKey(idAbstractButton), store);
- // DialogSettingsHelper.restoreButton(finalButton,
- // getUniqueKey(idFinalButton), store);
- // }
- // }
- /**
- * Returns the Super Interface Content Provider
- */
- protected IStructuredContentProvider getInterfaceContentProvider() {
- return new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- Object[] ret = new Object[0];
- if (inputElement instanceof ArrayList) {
- ret = ((ArrayList) inputElement).toArray();
- }
- return ret;
- }
- public void dispose() {
- //Do nothing
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- //Default is nothing
- }
- };
- }
-
- /**
- * Returns the Super Interface Label Provider
- */
- protected ILabelProvider getInterfaceLabelProvider() {
- return new ILabelProvider() {
- public Image getImage(Object element) {
- return J2EEUIPlugin.getDefault().getImage("full/obj16/interface_obj"); //$NON-NLS-1$
- }
-
- public String getText(Object element) {
- String ret = J2EEUIMessages.EMPTY_STRING;
- if (element instanceof String)
- ret = (String) element;
- return ret;
- }
-
- public void addListener(ILabelProviderListener listener) {
- //Do nothing
- }
- public void dispose() {
- //Do nothing
- }
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
- public void removeListener(ILabelProviderListener listener) {
- //Do nothing
- }
- };
- }
-
- /**
- * Browse for a new Super Interface Class
- */
- protected void handleInterfaceAddButtonSelected() {
- IProject project = (IProject) model.getProperty(INewJavaClassDataModelProperties.PROJECT);
- IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
- // this eliminates the non-exported classpath entries
- final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(javaProject, true, true);
- FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(),false, context, scope,IJavaSearchConstants.INTERFACE);
- dialog.setTitle(J2EEUIMessages.INTERFACE_SELECTION_DIALOG_TITLE);
- if (dialog.open() == Window.OK) {
- IType type = (IType) dialog.getFirstResult();
- String superclassFullPath = ""; //$NON-NLS-1$
- if (type != null)
- superclassFullPath = type.getFullyQualifiedName();
- interfaceViewer.add(superclassFullPath);
- }
- List valueList = Arrays.asList(interfaceViewer.getList().getItems());
- model.setProperty(INewJavaClassDataModelProperties.INTERFACES, valueList);
- }
-
- /**
- * Remove an interface from the SuperInterface List
- */
- protected void handleInterfaceRemoveButtonSelected() {
- IStructuredSelection selection = (IStructuredSelection) interfaceViewer.getSelection();
- List items = selection.toList();
- if (!items.isEmpty()) {
- Object array[] = interfaceViewer.getList().getItems();
- List valueList = new ArrayList();
-
- for (int i = 0; i < array.length; i++) {
- valueList.add(array[i]);
- }
- for (int i=0; i<items.size(); i++) {
- valueList.remove(items.get(i));
- }
- interfaceViewer.setInput(valueList);
- model.setProperty(INewJavaClassDataModelProperties.INTERFACES, valueList);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
deleted file mode 100644
index 62bdb2cb2..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
+++ /dev/null
@@ -1,681 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
-import org.eclipse.jdt.internal.ui.viewsupport.IViewPartInputProvider;
-import org.eclipse.jdt.ui.JavaElementLabelProvider;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
-import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Cursor;
-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.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-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.plugin.WTPCommonPlugin;
-
-/**
- *
- */
-public class NewJavaClassWizardPage extends DataModelWizardPage {
-
- private Text folderText;
- private Button folderButton;
- protected Text packageText;
- protected Button packageButton;
- protected Label packageLabel;
- protected Text classText;
- protected Label classLabel;
- protected Text superText;
- protected Button superButton;
- protected Label superLabel;
- private Combo projectNameCombo;
- protected String projectType;
- private String projectName;
-
- /**
- * @param model
- * @param pageName
- */
- public NewJavaClassWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle,
- String moduleType) {
- super(model, pageName);
- setDescription(pageDesc);
- this.setTitle(pageTitle);
- setPageComplete(false);
- this.projectType = moduleType;
- this.projectName = null;
- }
-
- /**
- *
- */
- protected String[] getValidationPropertyNames() {
- return new String[]{IArtifactEditOperationDataModelProperties.PROJECT_NAME,
- IArtifactEditOperationDataModelProperties.COMPONENT_NAME,
- INewJavaClassDataModelProperties.SOURCE_FOLDER,
- INewJavaClassDataModelProperties.JAVA_PACKAGE,
- INewJavaClassDataModelProperties.CLASS_NAME,
- INewJavaClassDataModelProperties.SUPERCLASS};
- }
-
- /**
- *
- */
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- composite.setLayoutData(data);
-
- addProjectNameGroup(composite);
- addFolderGroup(composite);
- addSeperator(composite, 3);
- addPackageGroup(composite);
- addClassnameGroup(composite);
- addSuperclassGroup(composite);
-
- folderText.setFocus();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Add project group
- */
- private void addProjectNameGroup(Composite parent) {
- // set up project name label
- Label projectNameLabel = new Label(parent, SWT.NONE);
- projectNameLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.MODULES_DEPENDENCY_PAGE_TABLE_PROJECT)); //$NON-NLS-1$
- GridData data = new GridData();
- projectNameLabel.setLayoutData(data);
- // set up project name entry field
- projectNameCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- data.horizontalSpan = 1;
- projectNameCombo.setLayoutData(data);
- projectNameCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- // update source folder
- if (folderText != null) {
- String sourceFolder = getDefaultJavaSourceFolder(ProjectUtilities.getProject(projectNameCombo.getText())).getFullPath().toOSString();
- if (sourceFolder != null)
- folderText.setText(sourceFolder);
- }
- }
- });
- synchHelper.synchCombo(projectNameCombo, IArtifactEditOperationDataModelProperties.PROJECT_NAME, null);
- initializeProjectList();
- new Label(parent, SWT.NONE);
- }
-
- /**
- *
- **/
- private IFolder getDefaultJavaSourceFolder(IProject project) {
-
- if (project == null)
- return null;
- IPackageFragmentRoot[] sources = J2EEProjectUtilities.getSourceContainers(project);
- // Try and return the first source folder
- if (sources.length > 0) {
- try {
- return (IFolder) sources[0].getCorrespondingResource();
- } catch (Exception e) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * This method is used by the project list initializer. The method checks
- * if the specified project is valid to include it in the project list.
- *
- * <p>Subclasses of this wizard page should override this method to
- * adjust filtering of the projects to their needs. </p>
- *
- * @param project reference to the project to be checked
- *
- * @return <code>true</code> if the project is valid to be included in
- * the project list, <code>false</code> - otherwise.
- */
- protected boolean isProjectValid(IProject project) {
- boolean result;
- try {
- result = project.isAccessible() &&
- project.hasNature(IModuleConstants.MODULE_NATURE_ID) &&
- J2EEProjectUtilities.getJ2EEProjectType(project).equals(projectType);
- } catch (CoreException ce) {
- result = false;
- }
- return result;
- }
-
- /**
- *
- */
- private void initializeProjectList() {
- IProject[] workspaceProjects = ProjectUtilities.getAllProjects();
- List items = new ArrayList();
- for (int i = 0; i < workspaceProjects.length; i++) {
- IProject project = workspaceProjects[i];
- if (isProjectValid(project))
- items.add(project.getName());
- }
- if (items.isEmpty()) return;
- String[] names = new String[items.size()];
- for (int i = 0; i < items.size(); i++) {
- names[i] = (String) items.get(i);
- }
- projectNameCombo.setItems(names);
- IProject selectedProject = null;
- try {
- if (model !=null) {
- String projectNameFromModel = model.getStringProperty(IArtifactEditOperationDataModelProperties.COMPONENT_NAME);
- if (projectNameFromModel!=null && projectNameFromModel.length()>0)
- selectedProject = ProjectUtilities.getProject(projectNameFromModel);
- }
- } catch (Exception e) {};
- try {
- if (selectedProject == null)
- selectedProject = getSelectedProject();
- if (selectedProject != null && selectedProject.isAccessible()
- && selectedProject.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
- projectNameCombo.setText(selectedProject.getName());
- model.setProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME, selectedProject.getName());
- }
- } catch (CoreException ce) {
- // Ignore
- }
- if (projectName == null && names.length > 0)
- projectName = names[0];
-
- if ((projectNameCombo.getText() == null || projectNameCombo.getText().length() == 0) && projectName != null) {
- projectNameCombo.setText(projectName);
- model.setProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME, projectName);
- }
-
- }
-
- /**
- * Add folder group to composite
- */
- private void addFolderGroup(Composite composite) {
- // folder
- Label folderLabel = new Label(composite, SWT.LEFT);
- folderLabel.setText(J2EEUIMessages.FOLDER_LABEL);
- folderLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- folderText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- folderText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchText(folderText, INewJavaClassDataModelProperties.SOURCE_FOLDER, null);
- IPackageFragmentRoot root = getSelectedPackageFragmentRoot();
- if (root != null)
- folderText.setText(root.getPath().toString());
-
- folderButton = new Button(composite, SWT.PUSH);
- folderButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL);
- folderButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- folderButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleFolderButtonPressed();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do nothing
- }
- });
- }
-
- /**
- * Add package group to composite
- */
- private void addPackageGroup(Composite composite) {
- // package
- packageLabel = new Label(composite, SWT.LEFT);
- packageLabel.setText(J2EEUIMessages.JAVA_PACKAGE_LABEL);
- packageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- packageText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- packageText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- IPackageFragment packageFragment = getSelectedPackageFragment();
- if (packageFragment != null && packageFragment.exists()) {
- IPackageFragmentRoot root = getPackageFragmentRoot(packageFragment);
- if (root != null)
- folderText.setText(root.getPath().toString());
- model.setProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE, packageFragment.getElementName());
- }
-
- synchHelper.synchText(packageText, INewJavaClassDataModelProperties.JAVA_PACKAGE, null);
-
- packageButton = new Button(composite, SWT.PUSH);
- packageButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL);
- packageButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- packageButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handlePackageButtonPressed();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do nothing
- }
- });
- }
-
- protected IPackageFragmentRoot getPackageFragmentRoot(IPackageFragment packageFragment) {
- if (packageFragment == null)
- return null;
- else if (packageFragment.getParent() instanceof IPackageFragment)
- return getPackageFragmentRoot((IPackageFragment) packageFragment.getParent());
- else if (packageFragment.getParent() instanceof IPackageFragmentRoot)
- return (IPackageFragmentRoot) packageFragment.getParent();
- else
- return null;
- }
-
- /**
- * Add classname group to composite
- */
- private void addClassnameGroup(Composite composite) {
- // class name
- classLabel = new Label(composite, SWT.LEFT);
- classLabel.setText(J2EEUIMessages.CLASS_NAME_LABEL);
- classLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- classText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- classText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchText(classText, INewJavaClassDataModelProperties.CLASS_NAME, null);
-
- new Label(composite, SWT.LEFT);
- }
-
- /**
- * Add seperator to composite
- */
- protected void addSeperator(Composite composite, int horSpan) {
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- // Separator label
- Label seperator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = horSpan;
- seperator.setLayoutData(data);
- }
-
- /**
- * Add superclass group to the composite
- */
- private void addSuperclassGroup(Composite composite) {
- // superclass
- superLabel = new Label(composite, SWT.LEFT);
- superLabel.setText(J2EEUIMessages.SUPERCLASS_LABEL);
- superLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- superText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- superText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchText(superText, INewJavaClassDataModelProperties.SUPERCLASS, null);
-
- superButton = new Button(composite, SWT.PUSH);
- superButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL);
- superButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- superButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleSuperButtonPressed();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do nothing
- }
- });
- }
-
- /**
- * Browse for a new Destination Folder
- */
- protected void handleFolderButtonPressed() {
- ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
- ViewerFilter filter = getContainerDialogViewerFilter();
- ITreeContentProvider contentProvider = new WorkbenchContentProvider();
- ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench()
- .getDecoratorManager().getLabelDecorator());
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
- dialog.setValidator(validator);
- dialog.setTitle(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
- dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
- dialog.addFilter(filter);
- String projectName = model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME);
- if (projectName==null || projectName.length()==0)
- return;
- IProject project = ProjectUtilities.getProject(projectName);
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
-
- if (project != null)
- dialog.setInitialSelection(project);
- if (dialog.open() == Window.OK) {
- Object element = dialog.getFirstResult();
- try {
- if (element instanceof IContainer) {
- IContainer container = (IContainer) element;
- folderText.setText(container.getFullPath().toString());
- // dealWithSelectedContainerResource(container);
- }
- } catch (Exception ex) {
- // Do nothing
- }
-
- }
- }
-
- protected void handlePackageButtonPressed() {
- IPackageFragmentRoot packRoot = (IPackageFragmentRoot) model.getProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT);
- if (packRoot == null)
- return;
- IJavaElement[] packages = null;
- try {
- packages = packRoot.getChildren();
- } catch (JavaModelException e) {
- // Do nothing
- }
- if (packages == null)
- packages = new IJavaElement[0];
-
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(
- JavaElementLabelProvider.SHOW_DEFAULT));
- dialog.setTitle(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_TITLE);
- dialog.setMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_DESC);
- dialog.setEmptyListMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_MSG_NONE);
- dialog.setElements(packages);
- if (dialog.open() == Window.OK) {
- IPackageFragment fragment = (IPackageFragment) dialog.getFirstResult();
- if (fragment != null) {
- packageText.setText(fragment.getElementName());
- } else {
- packageText.setText(J2EEUIMessages.EMPTY_STRING);
- }
- }
- }
-
- protected void handleSuperButtonPressed() {
- getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
- IPackageFragmentRoot packRoot = (IPackageFragmentRoot) model.getProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT);
- if (packRoot == null)
- return;
-
- // this eliminates the non-exported classpath entries
- final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(packRoot.getJavaProject(), true, true);
-
- // This includes all entries on the classpath. This behavior is
- // identical
- // to the Super Class Browse Button on the Create new Java Class Wizard
- // final IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new
- // IJavaElement[] {root.getJavaProject()} );
- FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(),false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS);
- dialog.setTitle(J2EEUIMessages.SUPERCLASS_SELECTION_DIALOG_TITLE);
- dialog.setMessage(J2EEUIMessages.SUPERCLASS_SELECTION_DIALOG_DESC);
-
- if (dialog.open() == Window.OK) {
- IType type = (IType) dialog.getFirstResult();
- String superclassFullPath = J2EEUIMessages.EMPTY_STRING;
- if (type != null) {
- superclassFullPath = type.getFullyQualifiedName();
- }
- superText.setText(superclassFullPath);
- getControl().setCursor(null);
- return;
- }
- getControl().setCursor(null);
- }
-
- /**
- * Returns a new instance of the Selection validator for the Container
- * Selection Dialog This method can be extended by subclasses, as it does
- * some basic validation.
- */
- protected ISelectionStatusValidator getContainerDialogSelectionValidator() {
- return new ISelectionStatusValidator() {
- public IStatus validate(Object[] selection) {
- if (selection != null && selection[0] != null && !(selection[0] instanceof IProject))
- return WTPCommonPlugin.OK_STATUS;
- return WTPCommonPlugin.createErrorStatus(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG);
- }
- };
- }
-
- /**
- * Returns a new instance of the Selection Listner for the Container
- * Selection Dialog
- */
- protected ViewerFilter getContainerDialogViewerFilter() {
- return new ViewerFilter() {
- public boolean select(Viewer viewer, Object parent, Object element) {
- if (element instanceof IProject) {
- IProject project = (IProject) element;
- return project.getName().equals(model.getProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME));
- } else if (element instanceof IFolder) {
- IFolder folder = (IFolder) element;
- // only show source folders
- IProject project = ProjectUtilities.getProject(model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME));
- IPackageFragmentRoot[] sourceFolders = J2EEProjectUtilities.getSourceContainers(project);
- for (int i = 0; i < sourceFolders.length; i++) {
- if (sourceFolders[i].getResource()!= null && sourceFolders[i].getResource().equals(folder))
- return true;
- }
- }
- return false;
- }
- };
- }
-
-
-
- /**
- * @return
- */
- private IProject getSelectedProject() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- ISelection selection = window.getSelectionService().getSelection();
- if (selection == null)
- return null;
- if (!(selection instanceof IStructuredSelection))
- return null;
- IStructuredSelection stucturedSelection = (IStructuredSelection) selection;
- if (stucturedSelection.getFirstElement() instanceof EObject)
- return ProjectUtilities.getProject(stucturedSelection.getFirstElement());
- IJavaElement element = getInitialJavaElement(selection);
- if (element != null && element.getJavaProject() != null)
- return element.getJavaProject().getProject();
- return getExtendedSelectedProject(stucturedSelection.getFirstElement());
- }
-
- protected IProject getExtendedSelectedProject(Object selection) {
- return null;
- }
-
- /**
- * @return
- */
- private IPackageFragment getSelectedPackageFragment() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- ISelection selection = window.getSelectionService().getSelection();
- if (selection == null)
- return null;
- // StructuredSelection stucturedSelection = (StructuredSelection)
- // selection;
- IJavaElement element = getInitialJavaElement(selection);
- if (element != null) {
- if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT)
- return (IPackageFragment) element;
- else if (element.getElementType() == IJavaElement.TYPE) {
- return ((IType) element).getPackageFragment();
- }
- }
- return null;
- }
-
- private IPackageFragmentRoot getSelectedPackageFragmentRoot() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- ISelection selection = window.getSelectionService().getSelection();
- if (selection == null)
- return null;
- // StructuredSelection stucturedSelection = (StructuredSelection)
- // selection;
- IJavaElement element = getInitialJavaElement(selection);
- if (element != null) {
- if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT)
- return (IPackageFragmentRoot) element;
- }
- return null;
- }
-
- /**
- * Utility method to inspect a selection to find a Java element.
- *
- * @param selection
- * the selection to be inspected
- * @return a Java element to be used as the initial selection, or
- * <code>null</code>, if no Java element exists in the given
- * selection
- */
- protected IJavaElement getInitialJavaElement(ISelection selection) {
- IJavaElement jelem = null;
- if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
- if (selectedElement instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) selectedElement;
-
- jelem = (IJavaElement) adaptable.getAdapter(IJavaElement.class);
- if (jelem == null) {
- IResource resource = (IResource) adaptable.getAdapter(IResource.class);
- if (resource != null && resource.getType() != IResource.ROOT) {
- while (jelem == null && resource.getType() != IResource.PROJECT) {
- resource = resource.getParent();
- jelem = (IJavaElement) resource.getAdapter(IJavaElement.class);
- }
- if (jelem == null) {
- jelem = JavaCore.create(resource); // java project
- }
- }
- }
- }
- }
- if (jelem == null) {
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- IWorkbenchPart part = window.getActivePage().getActivePart();
- if (part instanceof ContentOutline) {
- part = window.getActivePage().getActiveEditor();
- }
-
- if (part instanceof IViewPartInputProvider) {
- Object elem = ((IViewPartInputProvider) part).getViewPartInput();
- if (elem instanceof IJavaElement) {
- jelem = (IJavaElement) elem;
- }
- }
- }
-
- if (jelem == null || jelem.getElementType() == IJavaElement.JAVA_MODEL) {
- try {
- IJavaProject[] projects = JavaCore.create(getWorkspaceRoot()).getJavaProjects();
- if (projects.length == 1) {
- jelem = projects[0];
- }
- } catch (JavaModelException e) {
- JavaPlugin.log(e);
- }
- }
- return jelem;
- }
-
- protected IWorkspaceRoot getWorkspaceRoot() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewModuleGroup.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewModuleGroup.java
deleted file mode 100644
index f2b27f411..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewModuleGroup.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * 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.jst.j2ee.internal.wizard;
-
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-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.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
-
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public class NewModuleGroup implements IJ2EEComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15{
-
- private IDataModel model;
- protected Text moduleNameText = null;
- protected Button newButton = null;
- protected Text serverTargetText;
- private DataModelSynchHelper synchHelper;
-// private Composite parentComposite;
-
- private static final int SIZING_TEXT_FIELD_WIDTH = 305;
-// private static final String NEW_LABEL_UI = J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_THREE_DOTS_E); //$NON-NLS-1$
- private static final String MODULE_NAME_UI = J2EEUIMessages.getResourceString(J2EEUIMessages.MODULE_NAME); //$NON-NLS-1$
-
- /**
- * @param parent
- * @param style
- */
- public NewModuleGroup(Composite parent, int style, IDataModel model, DataModelSynchHelper syncHelper) {
- this.model = model;
-// this.parentComposite = parent;
- synchHelper = syncHelper;
- buildComposites(parent);
- }
-
- /**
- * Create the controls within this composite
- */
- public void buildComposites(Composite parent) {
- //createProjectNameGroup(parent);
- //initializeProjectList();
- createModuleGroup(parent);
- //addSeperator(parent,3);
- //createServerTargetComposite(parent);
- }
-
- /**
- *
- *
- */
-// public void initializeProjectList() {
-// IProject[] workspaceProjects = ProjectUtilities.getAllProjects();
-// List items = new ArrayList();
-// for (int i=0; i<workspaceProjects.length; i++) {
-// IProject project = workspaceProjects[i];
-// try {
-// if (project.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
-// items.add(project.getName());
-// }
-// } catch (CoreException ce) {
-// //Ignore
-// }
-// }
-// String[] names = new String[items.size()];
-// for (int i=0; i<items.size(); i++) {
-// names[i]= (String) items.get(i);
-// }
-// //model.IgnorePropertyChanges(true);
-// projectNameCombo.setItems(names);
-// //model.setIgnorePropertyChanges(false);
-//
-// if (!model.isPropertySet(PROJECT_NAME) || model.getStringProperty(PROJECT_NAME).length()==0) {
-// IProject selectedProject = getSelectedProject();
-// if (selectedProject!=null) {
-// projectNameCombo.setText(selectedProject.getName());
-// model.setProperty(PROJECT_NAME,selectedProject.getName());
-// }
-// else if (names.length>0) {
-// projectNameCombo.setText(names[0]);
-// model.setProperty(PROJECT_NAME,names[0]);
-// }
-// } else {
-// projectNameCombo.add(model.getStringProperty(PROJECT_NAME));
-// projectNameCombo.setText(model.getStringProperty(PROJECT_NAME));
-// }
-// }
-
- /**
- *
- */
-// private void createProjectNameGroup(Composite parent) {
-// // set up project name label
-// Label projectNameLabel = new Label(parent, SWT.NONE);
-// projectNameLabel.setText(PROJECT_NAME_UI);
-// GridData data = new GridData();
-// projectNameLabel.setLayoutData(data);
-// // set up project name entry field
-// projectNameCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
-// data = new GridData(GridData.FILL_HORIZONTAL);
-// data.widthHint = SIZING_TEXT_FIELD_WIDTH;
-// projectNameCombo.setLayoutData(data);
-// projectNameCombo.addSelectionListener(new SelectionAdapter() {
-// public void widgetSelected(SelectionEvent e) {
-// IProject project = ProjectUtilities.getProject(projectNameCombo.getText());
-// IRuntime runtime = ServerCore.getProjectProperties(project).getRuntimeTarget();
-// if (runtime != null)
-// serverTargetText.setText(runtime.getName());
-// }
-// });
-// newButton = new Button(parent, SWT.NONE);
-// newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-// newButton.setText(NEW_LABEL_UI);
-// newButton.addSelectionListener(new SelectionAdapter() {
-// public void widgetSelected(SelectionEvent e) {
-// handleNewProjectSelected();
-// }
-// });
-// synchHelper.synchCombo(projectNameCombo, PROJECT_NAME, new Control[]{projectNameLabel});
-// }
-
-
-
- /**
- *
- * @param parent
- */
- private void createModuleGroup(Composite parent) {
- GridData data = new GridData();
- // Add the module name label
- Label moduleNameLabel = new Label(parent, SWT.NONE);
- moduleNameLabel.setText(MODULE_NAME_UI);
- // Add the module name entry field
- moduleNameText = new Text(parent, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- moduleNameText.setLayoutData(data);
- synchHelper.synchText(moduleNameText,COMPONENT_NAME,new Control[] {});
- new Label(parent,SWT.NONE);
- }
-
- /**
- *
- *
- */
- public void dispose() {
- if (synchHelper != null) {
- if (model != null)
- model.removeListener(synchHelper);
- synchHelper.dispose();
- }
- model = null;
- }
-
- /**
- *
- * @return
- */
-// public String getProjectName() {
-// return projectNameCombo.getText();
-// }
-
- /**
- *
- * @param parent
- * @param hSpan
- */
- public void addSeperator(Composite parent, int hSpan) {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = hSpan;
- separator.setLayoutData(gd);
- }
-
- /**
- *
- * @param parent
- */
- protected void createServerTargetComposite(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.TARGET_RUNTIME_LBL));
- serverTargetText = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
- serverTargetText.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
- new Label(parent, SWT.NONE);
-/* bug 167633 - also note that this class is deprecated and will soon be deleted.
- String projectName = moduleNameText.getText();
- if (projectName!=null && projectName.length()!=0) {
- IProject project = ProjectUtilities.getProject(projectName);
- if (project !=null) {
- IRuntime runtime = ServerCore.getProjectProperties(project).getRuntimeTarget();
- if (runtime != null){
- serverTargetText.setText(runtime.getName());
- synchHelper.synchText(serverTargetText, RUNTIME_TARGET_ID, null);
- }
- }
- }
-*/
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/PackageNameResolver.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/PackageNameResolver.java
deleted file mode 100644
index 46ec179fc..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/PackageNameResolver.java
+++ /dev/null
@@ -1,70 +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.jst.j2ee.internal.wizard;
-
-import java.io.File;
-import java.io.FileInputStream;
-
-/**
- * @author Sachin
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class PackageNameResolver extends ClassLoader {
-
- public PackageNameResolver() {
- super();
- }
-
- public String getClassName(final String classFile) {
- File file = new File(classFile);
- byte[] classbuf = new byte[(int) file.length()];
- try {
- FileInputStream instream = new FileInputStream(file);
- instream.read(classbuf);
- instream.close();
- } catch (Throwable e) {
- return null;
- }
- boolean badclassname = true;
- String classname = classFile.replace(java.io.File.separatorChar, '.');
- int endi;
- if (classname.endsWith(".class")) //$NON-NLS-1$
- endi = classname.lastIndexOf('.');
- else
- endi = classname.length();
- int i = classname.indexOf('.');
- while (i < endi && badclassname == true) {
- badclassname = false;
- try {
- defineClass(classname.substring(i + 1, endi), classbuf, 0, classbuf.length);
- } catch (java.lang.NoClassDefFoundError e) {
- String msg = e.getMessage();
- if (msg == null || msg.indexOf(' ') > 0) {
- badclassname = true;
- }
- } catch (Throwable e) {
- badclassname = true;
- }
- if (badclassname) {
- i = classname.indexOf('.', i + 1);
- if (i == -1)
- i = endi;
- }
- }
- if (badclassname)
- return null;
- return classname.substring(i + 1, endi);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerEarAndStandaloneGroup.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerEarAndStandaloneGroup.java
deleted file mode 100644
index 7f61fa2ea..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerEarAndStandaloneGroup.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.earcreation.IEarFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.EARFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.j2ee.ui.project.facet.EarProjectWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-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.Label;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-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.DataModelSynchHelper;
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public class ServerEarAndStandaloneGroup implements IJ2EEComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15 {
-
- private Button newEAR;
- private Combo earCombo;
- private Label earLabel;
- private Button addToEAR;
- private IDataModel model;
- private DataModelSynchHelper synchHelper;
- private Composite parentComposite;
-
- /**
- *
- */
- public ServerEarAndStandaloneGroup(Composite parent, IDataModel model, DataModelSynchHelper helper) {
- this.model = model;
- this.parentComposite = parent;
- synchHelper = helper;
- buildComposites(parent);
- }
-
- /**
- *
- * @param parent
- */
- public void buildComposites(Composite parent) {
- createEarAndStandaloneComposite(parent);
- }
-
- /**
- * @param parent
- */
- protected void createEarAndStandaloneComposite(Composite parent) {
-
- //if (model.getBooleanProperty(UI_SHOW_EAR_SECTION)) {
-
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- separator.setLayoutData(gd);
-
- new Label(parent, SWT.NONE); //pad
-
- // Create Add to EAR checkbox
- addToEAR = new Button(parent, SWT.CHECK);
- addToEAR.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.LINK_MODULETO_EAR_PROJECT));
- addToEAR.setSelection(true);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- addToEAR.setLayoutData(gd);
- synchHelper.synchCheckbox(addToEAR, ADD_TO_EAR, null);
-
- // Create EAR Group
- earLabel = new Label(parent, SWT.NONE);
- earLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_PROJECT_FOR_MODULE_CREATION));
-
- earCombo = new Combo(parent, SWT.NONE);
- earCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- newEAR = new Button(parent, SWT.NONE);
- newEAR.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_THREE_DOTS_W));
- newEAR.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- newEAR.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleNewEarSelected();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- //do nothing
- }
-
- });
-
- Control[] deps = new Control[]{earLabel, newEAR};
- synchHelper.synchCombo(earCombo, EAR_COMPONENT_NAME, deps);
- //}
- }
-
- /**
- *
- */
- protected void handleNewEarSelected() {
- IDataModel moduleModel = model;
-
- IDataModel earModel = DataModelFactory.createDataModel(new EARFacetProjectCreationDataModelProvider());
-
-
- earModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME,
- moduleModel.getProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_NAME));
-
- FacetDataModelMap map = (FacetDataModelMap) earModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel earFacetDataModel = map.getFacetDataModel(J2EEProjectUtilities.ENTERPRISE_APPLICATION);
- int j2eeVersion = moduleModel.getIntProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION);
- String j2eeVerionText = J2EEVersionUtil.getJ2EETextVersion(j2eeVersion);
- earFacetDataModel.setStringProperty(IEarFacetInstallDataModelProperties.FACET_VERSION_STR,
- j2eeVerionText);
-
-
- EarProjectWizard earWizard = new EarProjectWizard(earModel);
- WizardDialog dialog = new WizardDialog(parentComposite.getShell(), earWizard);
- if (Window.OK == dialog.open()) {
- moduleModel.setProperty(EAR_COMPONENT_NAME, earModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME));
- }
-
- }
-
- public void dispose() {
- model.removeListener(synchHelper);
- model.dispose();
- synchHelper = null;
- model = null;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java
deleted file mode 100644
index d0e6af58a..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java
+++ /dev/null
@@ -1,76 +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
- *******************************************************************************/
-/*
- * Created on Aug 27, 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code
- * and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.internal.ResourceManager;
-
-
-public class ServerTargetComboHelper {
- private List targets;
- public String[] items;
- public static final String defaultId = "com.ibm.etools.websphere.serverTarget.base.v51"; //$NON-NLS-1$
- public static final String defaultExpressId = "com.ibm.etools.websphere.serverTarget.express.v51"; //$NON-NLS-1$
-
- ServerTargetComboHelper(List targets, String[] items) {
- this.targets = targets;
- this.items = items;
- }
-
- public IRuntime getSelectedTarget(int itemIndex) {
- return (IRuntime) targets.get(itemIndex);
- }
-
- /**
- * @param target
- * @return
- */
- public boolean isCompatible(IRuntime target) {
- return targets.contains(target);
- }
-
- public int getDefaultServerTargetIndex() {
- IRuntime v51TargetServer = null;
- if (J2EEPlugin.isEJBSupportAvailable())
- v51TargetServer = ResourceManager.getInstance().getRuntime(defaultId);
- else
- v51TargetServer = ResourceManager.getInstance().getRuntime(defaultExpressId);
- if (v51TargetServer != null && targets.contains(v51TargetServer))
- return targets.indexOf(v51TargetServer) + 1;
- return -1;
- }
-
- public int getServerTargetIndexFromItems(IRuntime serverTarget) {
- if (items != null && items.length > 0) {
- String serverTargetLabel = serverTarget.getName() + " (" + serverTarget.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < items.length; i++) {
- String label = items[i];
- if (label.equals(serverTargetLabel)) {
- return i;
- }
- }
- }
- return -1;
- }
-
- public List getValidTargets() {
- return targets;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java
deleted file mode 100644
index bef30d4d1..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Aug 17, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerUtil;
-
-/**
- * @author vijayb
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class ServerTargetUIHelper {
- /**
- *
- */
- public ServerTargetUIHelper() {
- super();
- }
-
- public static String getSelectedServerTargetString(Combo serverTargetCombo) {
- if (serverTargetCombo.getSelectionIndex() != -1)
- return serverTargetCombo.getItem(serverTargetCombo.getSelectionIndex());
- return null;
- }
-
- /**
- * @return
- */
- public static int getSelectedServerTargetStringIndex(Combo serverTargetCombo) {
- return serverTargetCombo.getSelectionIndex();
- }
-
-// private static void setServerTargetForProject(Shell shell, IProject project, IRuntime runtime) {
-// //ServerTargetHelper.cleanUpNonServerTargetClasspath(project);
-// setServerTarget(shell, project, runtime, null);
-// }
-
- /**
- * @param earProject
- * @param moduleProject
- * @return
- */
- public static boolean setModuleServerTargetIfNecessary(IProject earProject, IProject moduleProject, Shell shell) {
- return true;
- }
-
- // private static String getEARJ2EELevel(IProject earProject) {
- // EARNatureRuntime nature = EARNatureRuntime.getRuntime(earProject);
- // String j2eeLevel = null;
- // int natureID = nature.getJ2EEVersion();
- // switch (natureID) {
- // case (J2EEVersionConstants.J2EE_1_2_ID) :
- // j2eeLevel = J2EEVersionConstants.VERSION_1_2_TEXT;
- // break;
- // case (J2EEVersionConstants.J2EE_1_3_ID) :
- // j2eeLevel = J2EEVersionConstants.VERSION_1_3_TEXT;
- // break;
- // case (J2EEVersionConstants.J2EE_1_4_ID) :
- // j2eeLevel = J2EEVersionConstants.VERSION_1_4_TEXT;
- // break;
- // default :
- // j2eeLevel = J2EEVersionConstants.VERSION_1_4_TEXT;
- // break;
- // }
- // return j2eeLevel;
- // }
-
- public static void setServerTarget(Shell shell, IProject project, IRuntime runtime, IProgressMonitor monitor) {
-// try {
-// ServerCore.getProjectProperties(project).setRuntimeTarget(runtime, monitor);
-// } catch (CoreException e) {
-// Logger.getLogger().logError(e);
-// }
- }
-
-
- public static ServerTargetComboHelper getValidServerTargetComboItems(String j2eeType, String selectedVersion) {
- IRuntime[] validServerTargets = ServerUtil.getRuntimes(j2eeType, selectedVersion);
- String[] serverTargetList = null;
- if (validServerTargets.length>0) {
- int serverTargetListSize = validServerTargets.length;
- serverTargetList = new String[serverTargetListSize];
- for (int i = 0; i < validServerTargets.length; i++) {
- IRuntime runtime = validServerTargets[i];
- serverTargetList[i] = runtime.getName() + " (" + runtime.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return new ServerTargetComboHelper(Arrays.asList(validServerTargets), serverTargetList);
- }
-
- /**
- * @param project
- */
- public static void runEarValidation(IProject project) {
- try {
- IRunnableWithProgress runnable = EARValidationHelper.createValidationRunnable(project);
- runnable.run(null);
- } catch (InterruptedException ie) {
- Logger.getLogger().logError(ie);
- } catch (InvocationTargetException ite) {
- Logger.getLogger().logError(ite);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
deleted file mode 100644
index ec34caa9b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-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.graphics.Image;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author jialin
- *
- * To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Generation - Code and Comments
- */
-public class StringArrayTableWizardSection extends Composite {
-
- protected class StringArrayListContentProvider implements IStructuredContentProvider {
- public boolean isDeleted(Object element) {
- return false;
- }
- public Object[] getElements(Object element) {
- if (element instanceof List) {
- return ((List) element).toArray();
- }
- return new Object[0];
- }
- public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
- //Default nothing
- }
- public void dispose() {
- //Default nothing
- }
- }
- protected class StringArrayListLabelProvider extends LabelProvider {
- public Image getImage(Object element) {
- return labelProviderImage;
- }
- public String getText(Object element) {
- String[] array = (String[]) element;
- String s = array[0];
- return s;
- }
- }
-
- protected class AddStringArrayDialog extends Dialog implements ModifyListener {
- protected String windowTitle;
- protected String[] labelsForTextField;
- protected Text[] texts;
- protected String[] stringArray;
- /**
- * CMPFieldDialog constructor comment.
- */
- public AddStringArrayDialog(Shell shell, String windowTitle, String[] labelsForTextField) {
- super(shell);
- this.windowTitle = windowTitle;
- this.labelsForTextField = labelsForTextField;
- }
- /**
- * CMPFieldDialog constructor comment.
- */
- public Control createDialogArea(Composite parent) {
-
- Composite composite = (Composite) super.createDialogArea(parent);
- getShell().setText(windowTitle);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- composite.setLayoutData(data);
-
- int n = labelsForTextField.length;
- texts = new Text[n];
- for (int i = 0; i < n; i++) {
- Label label = new Label(composite, SWT.LEFT);
- label.setText(labelsForTextField[i]);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- texts[i] = new Text(composite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- texts[i].setLayoutData(data);
- }
-
- // set focus
- texts[0].setFocus();
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- protected Control createContents(Composite parent) {
- Composite composite = (Composite) super.createContents(parent);
-
- for (int i = 0; i < texts.length; i++) {
- texts[i].addModifyListener(this);
- }
-
- updateOKButton();
-
- return composite;
- }
-
- protected void okPressed() {
- stringArray = callback.retrieveResultStrings(texts);
- super.okPressed();
- }
-
- public String[] getStringArray() {
- return stringArray;
- }
-
- public void modifyText(ModifyEvent e) {
- updateOKButton();
- }
-
- private void updateOKButton() {
- getButton(IDialogConstants.OK_ID).setEnabled(callback.validate(texts));
- }
- }
-
- protected class EditStringArrayDialog extends AddStringArrayDialog {
- protected String[] valuesForTextField;
- /**
- * CMPFieldDialog constructor comment.
- */
- public EditStringArrayDialog(Shell shell, String windowTitle, String[] labelsForTextField, String[] valuesForTextField) {
- super(shell, windowTitle, labelsForTextField);
- this.valuesForTextField = valuesForTextField;
- }
- /**
- * CMPFieldDialog constructor comment.
- */
- public Control createDialogArea(Composite parent) {
-
- Composite composite = (Composite) super.createDialogArea(parent);
-
- int n = valuesForTextField.length;
- for (int i = 0; i < n; i++) {
- texts[i].setText(valuesForTextField[i]);
- }
-
- return composite;
- }
- }
-
- /**
- * Callback interface used by the Add/Edit-StringArrayDialog classes.
- */
- public interface StringArrayDialogCallback {
-
- /**
- * Validates the text fields.
- * <p>Used to decide wheather to enable the OK button of the dialog.
- * If the method returns <code>true</code> the OK button is enabled,
- * otherwise the OK button is disabled.</p>
- *
- * @param reference to the text fields in the dialog
- *
- * @return <code>true</code> if the values in the text fields are
- * valid, <code>false</code> otherwise.
- */
- public boolean validate(Text[] texts);
-
- /**
- * Retrieves the strings from the text fields of the dialog.
- * <p>Implementers of the callback can use these method to do some
- * preprocessing (like trimming) of the data in the text fields before
- * using it. The returned values will be the actual data that will be
- * put in the table viewer.</p>
- *
- * @param texts reference to the text fields in the dialog
- *
- * @return the values retreived from the text fields
- */
- public String[] retrieveResultStrings(Text[] texts);
-
- }
-
- /**
- * Default adapter with basic implementation of the
- * <code>StringArrayDialogCallback</code> interface.
- */
- protected class StringArrayDialogCallbackAdapter implements StringArrayDialogCallback {
-
- /**
- * Returns always <code>true</code>.
- */
- public boolean validate(Text[] texts) {
- return true;
- }
-
- /**
- * Just retreives the unmodified values of the text fields as a
- * string array.
- */
- public String[] retrieveResultStrings(Text[] texts) {
- int n = texts.length;
- String[] result = new String[n];
- for (int i = 0; i < n; i++) {
- result[i] = texts[i].getText();
- }
- return result;
- }
-
- }
-
- private TableViewer viewer;
- private Button addButton;
- private Button editButton;
- private Button removeButton;
- private String title;
- private String[] labelsForText;
- private IDataModel model;
- private String propertyName;
- private Image labelProviderImage;
- private StringArrayDialogCallback callback;
-
- public StringArrayTableWizardSection(Composite parent, String title, String addButtonLabel, String removeButtonLabel,
- String[] labelsForText, Image labelProviderImage, IDataModel model, String propertyName) {
- this(parent, title, addButtonLabel, null, removeButtonLabel, labelsForText, labelProviderImage, model, propertyName);
- }
-
- public StringArrayTableWizardSection(Composite parent, String title, String addButtonLabel, String editButtonLabel, String removeButtonLabel,
- String[] labelsForText, Image labelProviderImage, IDataModel model, String propertyName) {
- super(parent, SWT.NONE);
- this.title = title;
- this.labelsForText = labelsForText;
- this.labelProviderImage = labelProviderImage;
- this.model = model;
- this.propertyName = propertyName;
-
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 4;
- layout.marginWidth = 0;
- this.setLayout(layout);
- this.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label titleLabel = new Label(this, SWT.LEFT);
- titleLabel.setText(title);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- titleLabel.setLayoutData(data);
-
- viewer = new TableViewer(this);
- viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
- viewer.setContentProvider(new StringArrayListContentProvider());
- viewer.setLabelProvider(new StringArrayListLabelProvider());
-
- Composite buttonCompo = new Composite(this, SWT.NULL);
- layout = new GridLayout();
- layout.marginHeight = 0;
- buttonCompo.setLayout(layout);
- buttonCompo.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
-
- addButton = new Button(buttonCompo, SWT.PUSH);
- addButton.setText(addButtonLabel);
- addButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- addButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleAddButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
-
- if (editButtonLabel != null) {
- editButton = new Button(buttonCompo, SWT.PUSH);
- editButton.setText(editButtonLabel);
- editButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- editButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleEditButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
- editButton.setEnabled(false);
- }
-
- removeButton = new Button(buttonCompo, SWT.PUSH);
- removeButton.setText(removeButtonLabel);
- removeButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- removeButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleRemoveButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
- removeButton.setEnabled(false);
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (editButton != null) {
- boolean enabled = ((IStructuredSelection) selection).size() == 1;
- editButton.setEnabled(enabled);
- }
- removeButton.setEnabled(!selection.isEmpty());
- }
- });
-
- if (editButton != null) {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleEditButtonSelected();
- }
- });
- }
-
- callback = new StringArrayDialogCallbackAdapter();
- }
-
- private void handleAddButtonSelected() {
- AddStringArrayDialog dialog = new AddStringArrayDialog(getShell(), title, labelsForText);
- dialog.open();
- String[] stringArray = dialog.getStringArray();
- addStringArray(stringArray);
- }
-
- private void handleEditButtonSelected() {
- ISelection s = viewer.getSelection();
- if (!(s instanceof IStructuredSelection))
- return;
- IStructuredSelection selection = (IStructuredSelection) s;
- if (selection.size() != 1)
- return;
-
- Object selectedObj = selection.getFirstElement();
- String[] valuesForText = (String[]) selectedObj;
-
- EditStringArrayDialog dialog = new EditStringArrayDialog(getShell(), title, labelsForText, valuesForText);
- dialog.open();
- String[] stringArray = dialog.getStringArray();
- editStringArray(valuesForText, stringArray);
- }
-
- private void handleRemoveButtonSelected() {
- ISelection selection = viewer.getSelection();
- if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return;
- List selectedObj = ((IStructuredSelection) selection).toList();
- removeStringArrays(selectedObj);
- }
-
- public void addStringArray(String[] stringArray) {
- if (stringArray == null)
- return;
- List valueList = (List) viewer.getInput();
- if (valueList == null)
- valueList = new ArrayList();
- valueList.add(stringArray);
- setInput(valueList);
- }
-
- public void editStringArray(String[] oldStringArray, String[] newStringArray) {
- if (newStringArray == null)
- return;
-
- List valueList = (List) viewer.getInput();
- if (valueList == null)
- valueList = new ArrayList();
-
- int index = valueList.indexOf(oldStringArray);
- if (index == -1) {
- valueList.add(newStringArray);
- } else {
- valueList.set(index, newStringArray);
- }
-
- setInput(valueList);
- }
-
- public void removeStringArray(Object selectedStringArray) {
- List valueList = (List) viewer.getInput();
- valueList.remove(selectedStringArray);
- setInput(valueList);
- }
-
- public void removeStringArrays(Collection selectedStringArrays) {
- List valueList = (List) viewer.getInput();
- valueList.removeAll(selectedStringArrays);
- setInput(valueList);
- }
-
- public void setInput(List input) {
- viewer.setInput(input);
- // Create a new list to trigger property change
- List newInput = new ArrayList();
- newInput.addAll(input);
- model.setProperty(propertyName, newInput);
- }
-
- public TableViewer getTableViewer() {
- return viewer;
- }
-
- public Button getAddButton() {
- return addButton;
- }
-
- public Button getEditButton() {
- return editButton;
- }
-
- public Button getRemoveButton() {
- return removeButton;
- }
-
- /**
- * Set callback for customizing the preprocessing of the user input.
- *
- * @param callback an implementation of the callback interface.
- */
- public void setCallback(StringArrayDialogCallback callback) {
- this.callback = callback;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.java
deleted file mode 100644
index c480d0bd4..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Insert the type's description here. Creation date: (3/19/2001 5:10:14 PM)
- *
- * @author: Administrator
- */
-public class TableObjects {
- public List tableObjectsList;
-
- /**
- * EJBs constructor comment.
- */
- public TableObjects() {
- super();
- tableObjectsList = new ArrayList();
- }
-
- public List getTableObjects() {
- return tableObjectsList;
- }
-
- protected void initList() {
- if (tableObjectsList == null)
- tableObjectsList = new ArrayList();
-
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportMainPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportMainPage.java
deleted file mode 100644
index 235f0130b..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportMainPage.java
+++ /dev/null
@@ -1,135 +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
- *******************************************************************************/
-/*
- * Created on May 1, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.ui.PlatformUI;
-
-
-/**
- * @author Sachin
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class WizardClassesImportMainPage extends WizardPage {
- Composite composite;
-
- protected Button importFromDir;
- protected Button importFromZip;
-
- private List dragAndDropFileNames = null;
-
- /**
- * @param pageName
- */
- public WizardClassesImportMainPage(String pageName) {
- super(pageName);
- setTitle(J2EEUIMessages.getResourceString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(J2EEUIMessages.getResourceString("FileImport.importFileSystem")); //$NON-NLS-1$
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor("import_class_file_wiz_ban")); //$NON-NLS-1$
- }
-
- public WizardClassesImportMainPage(String pageName, List fileNames) {
- super(pageName);
- setTitle(J2EEUIMessages.getResourceString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(J2EEUIMessages.getResourceString("FileImport.importFileSystem")); //$NON-NLS-1$
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor("import_class_file_wiz_ban")); //$NON-NLS-1$
- dragAndDropFileNames = fileNames;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJ2EEUIContextIds.IMPORT_CLASS_WIZARD_P1);
- initializeDialogUnits(parent);
- Composite aComposite = new Composite(parent, SWT.NULL);
- aComposite.setLayout(new GridLayout());
- aComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- aComposite.setSize(aComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- aComposite.setFont(parent.getFont());
- createImportTypeGroup(aComposite);
- setControl(aComposite);
- }
-
- protected void createImportTypeGroup(Composite parent) {
- Composite importTypeGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- importTypeGroup.setLayout(layout);
- importTypeGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
- //importTypeGroup.setText(WorkbenchMessages.getString("WizardExportPage.options"));
- // //$NON-NLS-1$
-
- SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IWizard wiz = getWizard();
- if (((ClassesImportWizard) wiz).page1 != null) {
- ((ClassesImportWizard) wiz).page1.blankPage();
- }
- }
- };
- importFromDir = new Button(importTypeGroup, SWT.RADIO);
- importFromDir.setText(J2EEUIMessages.getResourceString("ClassesImport.fromDir")); //$NON-NLS-1$
- importFromDir.addSelectionListener(selectionListener);
-
- importFromZip = new Button(importTypeGroup, SWT.RADIO);
- importFromZip.setText(J2EEUIMessages.getResourceString("ClassesImport.fromZip")); //$NON-NLS-1$
- importFromZip.addSelectionListener(selectionListener);
-
- IWizard wiz = getWizard();
- String fileName = null;
- if (((ClassesImportWizard) wiz).fileNames != null)
- fileName = ((ClassesImportWizard) wiz).fileNames.get(0).toString();
- if (fileName != null && (fileName.endsWith(".zip") || fileName.endsWith(".jar"))) { //$NON-NLS-1$ //$NON-NLS-2$
- importFromDir.setSelection(false);
- importFromZip.setSelection(true);
- } else {
- importFromDir.setSelection(true);
- importFromZip.setSelection(false);
- }
- }
-
- protected boolean isSetImportFromDir() {
- if (importFromDir != null)
- return importFromDir.getSelection();
-
- String fileName = dragAndDropFileNames.get(0).toString();
- if (fileName != null && (fileName.endsWith(".zip") || fileName.endsWith(".jar"))) { //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- return true;
- }
-}
-
-
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportPage1.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportPage1.java
deleted file mode 100644
index 4667f7261..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/WizardClassesImportPage1.java
+++ /dev/null
@@ -1,1417 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.wizard;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FileSystemElement;
-import org.eclipse.ui.dialogs.WizardResourceImportPage;
-import org.eclipse.ui.internal.ide.dialogs.IElementFilter;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
-
-
-/**
- * Page 1 of the base resource import-from-file-system Wizard
- */
-/* package */
-class WizardClassesImportPage1 extends WizardResourceImportPage implements Listener {
-
- // widgets
- protected Combo sourceNameField;
- protected Button overwriteExistingResourcesCheckbox;
- protected Button createContainerStructureButton;
- protected Button createOnlySelectedButton;
- protected Button sourceBrowseButton;
- //protected Button selectTypesButton;
- protected Button selectAllButton;
- protected Button deselectAllButton;
- //A boolean to indicate if the user has typed anything
- private boolean entryChanged = false;
-
- // dialog store id constants
- private final static String STORE_SOURCE_NAMES_ID = "WizardFileSystemResourceImportPage1.STORE_SOURCE_NAMES_ID"; //$NON-NLS-1$
- //$NON-NLS-1$
- //private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID =
- // "WizardFileSystemResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"; //$NON-NLS-1$
- //$NON-NLS-1$
- //private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID =
- // "WizardFileSystemResourceImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID"; //$NON-NLS-1$
- //$NON-NLS-1$
-
- //private static final String SELECT_TYPES_TITLE = "DataTransfer.selectTypes"; //$NON-NLS-1$
- private static final String SELECT_ALL_TITLE = J2EEUIMessages.getResourceString("DataTransfer.selectAll"); //$NON-NLS-1$
- private static final String DESELECT_ALL_TITLE = J2EEUIMessages.getResourceString("DataTransfer.deselectAll"); //$NON-NLS-1$
- private static final String SELECT_SOURCE_MESSAGE = J2EEUIMessages.getResourceString("FileImport.selectSource"); //$NON-NLS-1$
- protected static final String SOURCE_EMPTY_MESSAGE = J2EEUIMessages.getResourceString("FileImport.sourceEmpty"); //$NON-NLS-1$
-
- private IPath importedClassesPath;
- //protected Button importFromDir;
- //protected Button importFromZip;
-
-
- private ZipFileStructureProvider providerCache;
- ZipFileStructureProvider currentProvider;
-
- private static final String FILE_IMPORT_MASK = "*.jar;*.zip"; //$NON-NLS-1$
-
- private List dragAndDropFileNames = null;
-
- boolean createFullStructure = false;
- private String packageBaseDirName = null;
-
- //private MinimizedFileSystemElement test = null;
-
- //private Composite dummyParent = null;
-
- //private final static int SIZING_SELECTION_WIDGET_WIDTH = 400;
- //private final static int SIZING_SELECTION_WIDGET_HEIGHT = 150;
-
- private String packageDirStruc = null;
-
- /**
- * Creates an instance of this class
- */
- protected WizardClassesImportPage1(String name, IWorkbench aWorkbench, IStructuredSelection selection) {
- super(name, selection);
- }
-
- /**
- * Creates an instance of this class
- *
- * @param aWorkbench
- * IWorkbench
- * @param selection
- * IStructuredSelection
- */
- public WizardClassesImportPage1(IWorkbench aWorkbench, IStructuredSelection selection, IPath importedClassesPath, List fileNames) {
- this("fileSystemImportPage1", aWorkbench, selection); //$NON-NLS-1$
- setTitle(J2EEUIMessages.getResourceString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(J2EEUIMessages.getResourceString("FileImport.importFileSystem")); //$NON-NLS-1$
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor("import_class_file_wiz_ban")); //$NON-NLS-1$
- this.importedClassesPath = importedClassesPath;
- if (fileNames != null && fileNames.size() != 0) {
- dragAndDropFileNames = fileNames;
- }
- }
-
- public void blankPage() {
- if (this.selectionGroup != null)
- this.selectionGroup.setRoot(null);
- if (sourceNameField != null)
- sourceNameField.setText(""); //$NON-NLS-1$
- }
-
-
- /**
- * Creates a new button with the given id.
- * <p>
- * The <code>Dialog</code> implementation of this framework method creates a standard push
- * button, registers for selection events including button presses and registers default buttons
- * with its shell. The button id is stored as the buttons client data. Note that the parent's
- * layout is assumed to be a GridLayout and the number of columns in this layout is incremented.
- * Subclasses may override.
- * </p>
- *
- * @param parent
- * the parent composite
- * @param id
- * the id of the button (see <code>IDialogConstants.*_ID</code> constants for
- * standard dialog button ids)
- * @param label
- * the label from the button
- * @param defaultButton
- * <code>true</code> if the button is to be the default button, and
- * <code>false</code> otherwise
- */
- protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
- // increment the number of columns in the button bar
- ((GridLayout) parent.getLayout()).numColumns++;
-
- Button button = new Button(parent, SWT.PUSH);
-
- GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(buttonData);
-
- button.setData(new Integer(id));
- button.setText(label);
-
- if (defaultButton) {
- Shell shell = parent.getShell();
- if (shell != null) {
- shell.setDefaultButton(button);
- }
- button.setFocus();
- }
- return button;
- }
-
- /**
- * Creates the buttons for selecting specific types or selecting all or none of the elements.
- *
- * @param parent
- * the parent control
- */
- protected final void createButtonsGroup(Composite parent) {
- // top level group
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
-
- layout.makeColumnsEqualWidth = true;
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // types edit button
- // selectTypesButton = createButton(buttonComposite, IDialogConstants.SELECT_TYPES_ID,
- // SELECT_TYPES_TITLE, false);
-
- SelectionListener listener = new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // handleTypesEditButtonPressed();
- // }
- };
- // selectTypesButton.addSelectionListener(listener);
-
- selectAllButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE, false);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setAllSelections(true);
- }
- };
- selectAllButton.addSelectionListener(listener);
-
- deselectAllButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE, false);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setAllSelections(false);
- }
- };
- deselectAllButton.addSelectionListener(listener);
-
- }
-
- /**
- * (non-Javadoc) Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- //super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJ2EEUIContextIds.IMPORT_CLASS_WIZARD_P2);
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- composite.setFont(parent.getFont());
-
- //dummyParent = composite;
-
- createSourceGroup(composite);
-
- //createSpacer(composite);
-
- //createPlainLabel(composite,
- // WorkbenchMessages.getString("WizardImportPage.destinationLabel")); //$NON-NLS-1$
- //createDestinationGroup(composite);
-
- createOptionsGroup(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
-
- setControl(composite);
-
- validateSourceGroup();
- //WorkbenchHelp.setHelp(getControl(),
- // IDataTransferHelpContextIds.FILE_SYSTEM_IMPORT_WIZARD_PAGE);
- }
-
- protected void createOptionsGroup(Composite parent) {
- Composite optionsGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- createOptionsGroupButtons(optionsGroup);
-
- }
-
- /**
- * Create the import options specification widgets.
- */
- protected void createOptionsGroupButtons(Composite optionsGroup) {
-
- // overwrite... checkbox
- overwriteExistingResourcesCheckbox = new Button(optionsGroup, SWT.CHECK);
- overwriteExistingResourcesCheckbox.setText(J2EEUIMessages.getResourceString("FileImport.overwriteExisting")); //$NON-NLS-1$
- }
-
- protected boolean isSetImportFromDir() {
- ClassesImportWizard ciw = (ClassesImportWizard) getWizard();
- return ciw.mainPage.isSetImportFromDir();
- }
-
- public String getClassFileDirectory(String s) {
- int index = s.lastIndexOf(File.separatorChar);
- return s.substring(0, index + 1);
- }
-
- /**
- * Create the group for creating the root directory
- */
- protected void createRootDirectoryGroup(Composite parent) {
- Composite sourceContainerGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- sourceContainerGroup.setLayout(layout);
- sourceContainerGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- new Label(sourceContainerGroup, SWT.NONE).setText(getSourceLabel());
-
- // source name entry field
- sourceNameField = new Combo(sourceContainerGroup, SWT.BORDER);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- sourceNameField.setLayoutData(data);
-
- setSourceNameFieldForDragAndDrop();
-
- sourceNameField.addListener(SWT.Modify, this);
-
- sourceNameField.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateFromSourceField();
-
- }
- });
-
- sourceNameField.addKeyListener(new KeyListener() {
- /*
- * @see KeyListener.keyPressed
- */
- public void keyPressed(KeyEvent e) {
- //If there has been a key pressed then mark as dirty
- entryChanged = true;
-
- }
-
- /*
- * @see KeyListener.keyReleased
- */
- public void keyReleased(KeyEvent e) {
- //do nothing
- }
- });
-
- sourceNameField.addFocusListener(new FocusListener() {
- /*
- * @see FocusListener.focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- //Do nothing when getting focus
- if (dragAndDropFileNames != null) {
- sourceNameField.setEnabled(false);
- }
-
- }
-
- /*
- * @see FocusListener.focusLost(FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- //Clear the flag to prevent constant update
- if (entryChanged) {
-
- entryChanged = false;
- updateFromSourceField();
- }
-
- }
- });
-
- // source browse button
- sourceBrowseButton = new Button(sourceContainerGroup, SWT.PUSH);
- sourceBrowseButton.setText(J2EEUIMessages.getResourceString("DataTransfer.browse")); //$NON-NLS-1$
- sourceBrowseButton.addListener(SWT.Selection, this);
- sourceBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- if (dragAndDropFileNames != null) {
- sourceBrowseButton.setEnabled(false);
- }
-
- }
-
- private void setSourceNameFieldForDragAndDrop() {
- if (dragAndDropFileNames != null) {
- String fileName = (String) (dragAndDropFileNames.get(0));
- sourceNameField.setText(fileName);
- File f = new File(fileName);
- if (f.isFile()) {
- if (ImportUtil.getExtension(f).equals("zip") || ImportUtil.getExtension(f).equals("jar")) { //$NON-NLS-1$ //$NON-NLS-2$
- //importFromZip.setSelection(true);
- //importFromDir.setSelection(false);
- } else if (ImportUtil.getExtension(f).equals("class")) { //$NON-NLS-1$
- sourceNameField.setText(getClassFileDirectory(fileName));
-
- //get com.ibm.abc.ClassName
- PackageNameResolver nameResolver = new PackageNameResolver();
- String qualifiedClassName = nameResolver.getClassName(fileName);
- if (qualifiedClassName != null) {
-
- //get com
- int index = qualifiedClassName.indexOf('.');
- if (index == -1) {
- String textToSet = fileName.substring(0, 1 + fileName.lastIndexOf(File.separatorChar));
- sourceNameField.setText(textToSet);
- return;
- }
- String baseDir = qualifiedClassName.substring(0, index);
-
- //get com.ibm.abc
- index = qualifiedClassName.lastIndexOf('.');
- String packageName = qualifiedClassName.substring(0, index);
- //get com/ibm/abc
- packageDirStruc = packageName.replace('.', File.separatorChar);
-
- //get C:\com
- index = fileName.indexOf(baseDir);
- //if packageDirStuc exists then set the sourceDir to com, else
- //set the directory to the parent directory of the class
- if (fileName.indexOf(packageDirStruc) != -1) {
- int baseDirLength = baseDir.length();
- String textToSet = fileName.substring(0, index + baseDirLength);
- index = packageName.indexOf('.');
- if (index == -1)
- packageBaseDirName = packageName;
- else
- packageBaseDirName = packageName.substring(0, index);
-
- f = new File(textToSet);
- if (f.getParent() != null)
- f = new File(f.getParent());
- textToSet = f.getAbsolutePath(); //want to set the root directory to
- // com's parent
- sourceNameField.setText(textToSet);
- }
- }
-
- }
- }
- }
- }
-
- /**
- * Update the receiver from the source name field.
- */
-
- private void updateFromSourceField() {
-
- setSourceName(sourceNameField.getText());
- //Update enablements when this is selected
- updateWidgetEnablements();
- }
-
- /**
- * Creates and returns a <code>FileSystemElement</code> if the specified file system object
- * merits one. The criteria for this are: Also create the children.
- */
- protected MinimizedFileSystemElement createRootElement(Object fileSystemObject, IImportStructureProvider provider) {
- boolean isContainer = provider.isFolder(fileSystemObject);
- String elementLabel = provider.getLabel(fileSystemObject);
-
- // Use an empty label so that display of the element's full name
- // doesn't include a confusing label
- MinimizedFileSystemElement dummyParent = new MinimizedFileSystemElement("", null, true); //$NON-NLS-1$
- dummyParent.setPopulated();
- MinimizedFileSystemElement result = new MinimizedFileSystemElement(elementLabel, dummyParent, isContainer);
-
- result.setPackageBaseDirName(packageBaseDirName);
- result.setFileSystemObject(fileSystemObject);
-
- //Get the files for the element so as to build the first level
- result.getFiles(provider);
-
- return dummyParent;
- }
-
- /**
- * Create the import source specification widgets
- */
- protected void createSourceGroup(Composite parent) {
- //createImportTypeGroup(parent);
- createRootDirectoryGroup(parent);
- createFileSelectionGroup(parent);
-
- createButtonsGroup(parent);
- }
-
- /**
- * Enable or disable the button group.
- */
- protected void enableButtonGroup(boolean enable) {
- // selectTypesButton.setEnabled(enable);
- selectAllButton.setEnabled(enable);
- deselectAllButton.setEnabled(enable);
- }
-
- /**
- * Answer a boolean indicating whether the specified source currently exists and is valid
- */
- protected boolean ensureSourceIsValid() {
- if (isSetImportFromDir()) {
- if (getSourceDirectory() != null && new File(getSourceDirectoryName()).isDirectory())
- return true;
- displayErrorDialog(getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- return false;
- }
- ZipFile specifiedFile = getSpecifiedSourceFile();
-
- if (specifiedFile == null) {
- displayErrorDialog(getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- return false;
- }
- return closeZipFile(specifiedFile);
- }
-
- /**
- * Execute the passed import operation. Answer a boolean indicating success.
- */
- protected boolean executeImportOperation(ImportOperation op) {
- initializeOperation(op);
- if (createFullStructure) {
- op.setCreateContainerStructure(true);
- } else {
- op.setCreateContainerStructure(false);
- }
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(), getString("FileImport.importProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
- }
-
- // need the following private stuff just because the DataTransferMessages class is not public!
- //private static final String RESOURCE_BUNDLE = "org.eclipse.ui.wizards.datatransfer.messages";
- // //$NON-NLS-1$
- //private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private static String getString(String key) {
- try {
- return J2EEUIMessages.getResourceString(key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * The Finish button was pressed. Try to do the required work now and answer a boolean
- * indicating success. If false is returned then the wizard will not close.
- *
- * @return boolean
- */
- public boolean finish() {
- if (!ensureSourceIsValid())
- return false;
-
- clearProviderCache();
-
- saveWidgetValues();
-
- Iterator resourcesEnum = getSelectedResources().iterator();
- List fileSystemObjects = new ArrayList();
- while (resourcesEnum.hasNext()) {
- fileSystemObjects.add(((FileSystemElement) resourcesEnum.next()).getFileSystemObject());
- }
-
- if (fileSystemObjects.size() > 0) {
- if (getSourceDirectory() != null) {
- return importResources(fileSystemObjects);
- }
- return importResourcesFromZip(fileSystemObjects);
- }
-
- MessageDialog.openInformation(getContainer().getShell(), getString("DataTransfer.information"), //$NON-NLS-1$
- getString("FileImport.noneSelected")); //$NON-NLS-1$
-
- return false;
- }
-
- /**
- * Returns a content provider for <code>FileSystemElement</code> s that returns only files as
- * children.
- */
-
- protected ITreeContentProvider getFileProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- if (currentProvider != null) {
- return element.getFiles(currentProvider).getChildren(element);
- }
- return element.getFiles(FileSystemStructureProvider.INSTANCE).getChildren(element);
- }
- return new Object[0];
- }
-
- public Object[] getElements(Object element) {
- Object[] superObjects = super.getElements(element);
- if (dragAndDropFileNames != null && getSourceDirectory() != null) {
- MinimizedFileSystemElement anElement = null;
- int newObjectsIndex = 0;
- for (int i = 0; i < superObjects.length; i++) {
- anElement = (MinimizedFileSystemElement) superObjects[i];
-
- File file = (File) anElement.getFileSystemObject();
-
- for (int k = 0; k < dragAndDropFileNames.size(); k++) {
- if (file.getAbsolutePath().equals(dragAndDropFileNames.get(k))) {
- newObjectsIndex++;
- }
- }
- }
- if (newObjectsIndex > 0) {
- Object[] newObjects = new Object[newObjectsIndex];
- newObjectsIndex = 0;
-
- for (int i = 0; i < superObjects.length; i++) {
- anElement = (MinimizedFileSystemElement) superObjects[i];
-
- File file = (File) anElement.getFileSystemObject();
-
- for (int k = 0; k < dragAndDropFileNames.size(); k++) {
- if (file.getAbsolutePath().equals(dragAndDropFileNames.get(k))) {
-
- newObjects[newObjectsIndex++] = anElement;
-
- }
- }
-
- }
- return newObjects;
- }
- }
- return superObjects;
- }
- };
- }
-
- /**
- * Answer the root FileSystemElement that represents the contents of the currently-specified
- * source. If this FileSystemElement is not currently defined then create and return it.
- */
- protected MinimizedFileSystemElement getFileSystemTree() {
- if (isSetImportFromDir()) {
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory != null) {
- return selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
- }
- if (sourceNameField.getText().length() > 0) {
- displayErrorDialog(getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- }
- return null;
- }
- ZipFile sourceFile = getSpecifiedSourceFile();
- if (sourceFile == null) {
- //Clear out the provider as well
- this.currentProvider = null;
- if (sourceNameField.getText().length() > 0) {
- displayErrorDialog(getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- }
- return null;
- }
-
- ZipFileStructureProvider provider = getStructureProvider(sourceFile);
- this.currentProvider = provider;
- return selectFiles(provider.getRoot(), provider);
- }
-
- /**
- * Returns a content provider for <code>FileSystemElement</code> s that returns only folders
- * as children.
- */
- protected ITreeContentProvider getFolderProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- if (currentProvider != null) {
- return element.getFolders(currentProvider).getChildren(element);
- }
- return element.getFolders(FileSystemStructureProvider.INSTANCE).getChildren(element);
- }
- return new Object[0];
- }
-
- public boolean hasChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- if (element.isPopulated())
- return getChildren(element).length > 0;
- //If we have not populated then wait until asked
- return true;
- }
- return false;
- }
-
- };
- }
-
- /**
- * Returns a File object representing the currently-named source directory iff it exists as a
- * valid directory, or <code>null</code> otherwise.
- */
- protected File getSourceDirectory() {
- return getSourceDirectory(this.sourceNameField.getText());
- }
-
- /**
- * Returns a File object representing the currently-named source directory iff it exists as a
- * valid directory, or <code>null</code> otherwise.
- *
- * @param path
- * a String not yet formatted for java.io.File compatability
- */
- private File getSourceDirectory(String path) {
- if (isSetImportFromDir()) {
- File sourceDirectory = new File(getSourceDirectoryName(path));
- if (!sourceDirectory.exists() || !sourceDirectory.isDirectory()) {
- return null;
- }
-
- return sourceDirectory;
- }
- return null;
- }
-
- /**
- * Answer the directory name specified as being the import source. Note that if it ends with a
- * separator then the separator is first removed so that java treats it as a proper directory
- */
- private String getSourceDirectoryName() {
- return getSourceDirectoryName(this.sourceNameField.getText());
- }
-
- /**
- * Answer the directory name specified as being the import source. Note that if it ends with a
- * separator then the separator is first removed so that java treats it as a proper directory
- */
- private String getSourceDirectoryName(String sourceName) {
- IPath result = new Path(sourceName.trim());
-
- if (result.getDevice() != null && result.segmentCount() == 0) // something like "c:"
- result = result.addTrailingSeparator();
- else
- result = result.removeTrailingSeparator();
-
- return result.toOSString();
- }
-
- /**
- * Answer the string to display as the label for the source specification field
- */
- protected String getSourceLabel() {
- return J2EEUIMessages.getResourceString("DataTransfer.directory"); //$NON-NLS-1$
- }
-
- /**
- * Handle all events and enablements for widgets in this dialog
- *
- * @param event
- * Event
- */
- public void handleEvent(Event event) {
- if (event.widget == sourceBrowseButton) {
- if (isSetImportFromDir()) {
- handleSourceBrowseButtonPressed();
- } else {
- handleSourceBrowseButtonPressedForZip();
- }
- }
-
- super.handleEvent(event);
-
- }
-
- /**
- * Open an appropriate source browser so that the user can specify a source to import from
- */
- protected void handleSourceBrowseButtonPressed() {
- String currentSource = this.sourceNameField.getText();
- DirectoryDialog dialog = new DirectoryDialog(sourceNameField.getShell(), SWT.SAVE);
- dialog.setMessage(SELECT_SOURCE_MESSAGE);
- dialog.setFilterPath(getSourceDirectoryName(currentSource));
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- //Just quit if the directory is not valid
- if ((getSourceDirectory(selectedDirectory) == null) || selectedDirectory.equals(currentSource))
- return;
- //If it is valid then proceed to populate
- setErrorMessage(null);
- setSourceName(selectedDirectory);
- selectionGroup.setFocus();
- }
- }
-
- /**
- * Open a registered type selection dialog and note the selections in the receivers
- * types-to-export field., Added here so that inner classes can have access
- */
- protected void handleTypesEditButtonPressed() {
-
- super.handleTypesEditButtonPressed();
- }
-
- /**
- * Import the resources with extensions as specified by the user
- */
- protected boolean importResources(List fileSystemObjects) {
- Iterator i = fileSystemObjects.iterator();
- while (i.hasNext()) {
- File f = (File) i.next();
- List singleItemList = new ArrayList();
- singleItemList.add(f);
- String textToSet = getPackageName(f);
- if (textToSet != null) {
- File newSource = new File(textToSet);
- executeImportOperation(new ImportOperation(getContainerFullPath(), newSource, FileSystemStructureProvider.INSTANCE, this, singleItemList));
- } else {
- executeImportOperation(new ImportOperation(getContainerFullPath(), getSourceDirectory(), FileSystemStructureProvider.INSTANCE, this, singleItemList));
-
- }
- }
- return true;
-
- }
-
- protected String getPackageName(File f) {
- if (ImportUtil.getExtension(f).equals("class")) { //$NON-NLS-1$
- String fileName = f.getAbsolutePath();
- //get com.ibm.abc.ClassName
- PackageNameResolver nameResolver = new PackageNameResolver();
- String qualifiedClassName = nameResolver.getClassName(fileName);
- if (qualifiedClassName != null) {
-
- //get com
- int index = qualifiedClassName.indexOf('.');
- if (index == -1) {
- return fileName.substring(0, 1 + fileName.lastIndexOf(File.separatorChar));
- }
- String baseDir = qualifiedClassName.substring(0, index);
-
- //get com.ibm.abc
- index = qualifiedClassName.lastIndexOf('.');
- String packageName = qualifiedClassName.substring(0, index);
-
- //get com/ibm/abc
- packageDirStruc = packageName.replace('.', File.separatorChar);
-
- //get C:\com
- index = fileName.indexOf(baseDir);
- //if packageDirStuc exists then set the sourceDir to com, else
- //set the directory to the parent directory of the class
- if (fileName.indexOf(packageDirStruc) != -1) {
- int baseDirLength = baseDir.length();
- String textToSet = fileName.substring(0, index + baseDirLength);
- index = packageName.indexOf('.');
- if (index == -1)
- packageBaseDirName = packageName;
- else
- packageBaseDirName = packageName.substring(0, index);
-
- f = new File(textToSet);
- if (f.getParent() != null)
- f = new File(f.getParent());
- textToSet = f.getAbsolutePath(); //want to set the root directory to com's
- // parent
- //sourceNameField.setText(textToSet);
- return textToSet;
- }
- }
- }
- return null;
- }
-
- /**
- * Initializes the specified operation appropriately.
- */
- protected void initializeOperation(ImportOperation op) {
-
- /*
- * op.setCreateContainerStructure( createContainerStructureButton.getSelection());
- */
- op.setOverwriteResources(overwriteExistingResourcesCheckbox.getSelection());
- }
-
- /**
- * Returns whether the extension provided is an extension that has been specified for export by
- * the user.
- *
- * @param extension
- * the resource name
- * @return <code>true</code> if the resource name is suitable for export based upon its
- * extension
- */
- protected boolean isExportableExtension(String extension) {
- if (selectedTypes == null) // ie.- all extensions are acceptable
- return true;
-
- Iterator aenum = selectedTypes.iterator();
- while (aenum.hasNext()) {
- if (extension.equalsIgnoreCase((String) aenum.next()))
- return true;
- }
-
- return false;
- }
-
- /**
- * Repopulate the view based on the currently entered directory.
- */
- protected void resetSelection() {
-
- MinimizedFileSystemElement currentRoot = getFileSystemTree();
- this.selectionGroup.setRoot(currentRoot);
- if (dragAndDropFileNames != null) {
-
- if (dragAndDropFileNames.get(0).toString().endsWith(".zip") == false && dragAndDropFileNames.get(0).toString().endsWith(".jar") == false) { //$NON-NLS-1$ //$NON-NLS-2$
- this.selectionGroup.expandAll();
- }
-
- MinimizedFileSystemElement temp = (MinimizedFileSystemElement) currentRoot.getFolders().getChildren()[0];
-
- List dirList = pathToArray();
-
- for (int i = 0; i < dirList.size(); i++) {
- String s = (String) dirList.get(i);
- Object[] folders = temp.getFolders().getChildren();
- for (int k = 0; k < folders.length; k++) {
- if (((File) ((MinimizedFileSystemElement) folders[k]).getFileSystemObject()).getName().equals(s)) {
- temp = (MinimizedFileSystemElement) temp.getFolders().getChildren()[k];
- break;
- }
- }
-
- }
-
- if (dragAndDropFileNames.get(0).toString().endsWith(".zip") == false && dragAndDropFileNames.get(0).toString().endsWith(".jar") == false) { //$NON-NLS-1$ //$NON-NLS-2$
- this.selectionGroup.initialCheckTreeItem(temp);
- }
-
- //If can figure out how to pre-highlight dir, then use following code
- //to check dragged files only. Also need to show all files in tree.
- /*
- * String fileName = null; MinimizedFileSystemElement name = null; int numFiles =
- * temp.getFiles().getChildren().length; Object[] files = temp.getFiles().getChildren();
- * for(int i = 0; i < dragAndDropFileNames.size(); i++) { fileName = (new
- * File((String)dragAndDropFileNames.get(i))).getName(); for(int k = 0; k < numFiles;
- * k++) { if(fileName.equals(((File) ((MinimizedFileSystemElement)
- * files[0]).getFileSystemObject()).getName())) {
- * this.selectionGroup.initialCheckTreeItem(temp); break; } } }
- */
-
- //this.selectionGroup.setAllSelections(true);
- }
- }
-
- private List pathToArray() {
- String s = (String) dragAndDropFileNames.get(0);
-
- PackageNameResolver nameResolver = new PackageNameResolver();
- String qualifiedClassName = nameResolver.getClassName(s);
-
- int slashCounts = 0;
- if (qualifiedClassName != null) {
- int index = qualifiedClassName.indexOf('.');
- if (index == -1) {
- return Collections.EMPTY_LIST;
- }
- String baseDir = qualifiedClassName.substring(0, index);
- for (int i = s.indexOf(baseDir); i < s.lastIndexOf(File.separatorChar); i++) {
- if (s.charAt(i) == File.separatorChar)
- slashCounts++;
- }
- }
-
- List dirNamesArray = new ArrayList(slashCounts);
- if (s.endsWith(".zip") || s.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$
- return dirNamesArray;
- }
- int startIndex = 0;
- int endIndex;
- for (int i = 0; i <= slashCounts; i++) {
- endIndex = qualifiedClassName.indexOf('.', startIndex);
- dirNamesArray.add(qualifiedClassName.substring(startIndex, endIndex));
- startIndex = endIndex + 1;
- }
- return dirNamesArray;
- }
-
- /**
- * Use the dialog store to restore widget values to the values that they held last time this
- * wizard was used to completion
- */
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- return; // ie.- no values stored, so stop
-
- // set filenames history
- for (int i = 0; i < sourceNames.length; i++)
- sourceNameField.add(sourceNames[i]);
- }
- }
-
- /**
- * Since Finish was pressed, write widget values to the dialog store so that they will persist
- * into the next invocation of this wizard page
- */
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- sourceNames = new String[0];
-
- sourceNames = addToHistory(sourceNames, getSourceDirectoryName());
- settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
-
- }
- }
-
- /**
- * Invokes a file selection operation using the specified file system and structure provider. If
- * the user specifies files to be imported then this selection is cached for later retrieval and
- * is returned.
- */
- protected MinimizedFileSystemElement selectFiles(final Object rootFileSystemObject, final IImportStructureProvider structureProvider) {
-
- final MinimizedFileSystemElement[] results = new MinimizedFileSystemElement[1];
-
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- //Create the root element from the supplied file system object
- results[0] = createRootElement(rootFileSystemObject, structureProvider);
- }
- });
-
- return results[0];
- }
-
- /**
- * Set all of the selections in the selection group to value. Implemented here to provide access
- * for inner classes.
- *
- * @param value
- * boolean
- */
- protected void setAllSelections(boolean value) {
- super.setAllSelections(value);
- }
-
- /**
- * Sets the source name of the import to be the supplied path. Adds the name of the path to the
- * list of items in the source combo and selects it.
- *
- * @param path
- * the path to be added
- */
- protected void setSourceName(String path) {
-
- if (path.length() > 0) {
-
- String[] currentItems = this.sourceNameField.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length; i++) {
- if (currentItems[i].equals(path))
- selectionIndex = i;
- }
- if (selectionIndex < 0) {
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = path;
- this.sourceNameField.setItems(newItems);
- selectionIndex = oldLength;
- }
- this.sourceNameField.select(selectionIndex);
-
- resetSelection();
- }
- }
-
- /**
- * Update the tree to only select those elements that match the selected types
- */
- protected void setupSelectionsBasedOnSelectedTypes() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getContainer().getShell());
- final Map selectionMap = new Hashtable();
-
- final IElementFilter filter = new IElementFilter() {
-
- public void filterElements(Collection files, IProgressMonitor monitor) throws InterruptedException {
- if (files == null) {
- throw new InterruptedException();
- }
- Iterator filesList = files.iterator();
- while (filesList.hasNext()) {
- if (monitor.isCanceled())
- throw new InterruptedException();
- checkFile(filesList.next());
- }
- }
-
- public void filterElements(Object[] files, IProgressMonitor monitor) throws InterruptedException {
- if (files == null) {
- throw new InterruptedException();
- }
- for (int i = 0; i < files.length; i++) {
- if (monitor.isCanceled())
- throw new InterruptedException();
- checkFile(files[i]);
- }
- }
-
- private void checkFile(Object fileElement) {
- MinimizedFileSystemElement file = (MinimizedFileSystemElement) fileElement;
- if (isExportableExtension(file.getFileNameExtension())) {
- List elements = new ArrayList();
- FileSystemElement parent = file.getParent();
- if (selectionMap.containsKey(parent))
- elements = (List) selectionMap.get(parent);
- elements.add(file);
- selectionMap.put(parent, elements);
- }
- }
-
- };
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(final IProgressMonitor monitor) throws InterruptedException {
- monitor.beginTask("ImportPage.filterSelections", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- getSelectedResources(filter, monitor);
- }
- };
-
- try {
- dialog.run(true, true, runnable);
- } catch (InvocationTargetException exception) {
- //Couldn't start. Do nothing.
- return;
- } catch (InterruptedException exception) {
- //Got interrupted. Do nothing.
- return;
- }
- // make sure that all paint operations caused by closing the progress
- // dialog get flushed, otherwise extra pixels will remain on the screen until
- // updateSelections is completed
- getShell().update();
- // The updateSelections method accesses SWT widgets so cannot be executed
- // as part of the above progress dialog operation since the operation forks
- // a new process.
- if (selectionMap != null) {
- updateSelections(selectionMap);
- }
- }
-
- /*
- * (non-Javadoc) Method declared on IDialogPage. Set the selection up when it becomes visible.
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- resetSelection();
- if (visible)
- this.sourceNameField.setFocus();
- }
-
- /**
- * Update the selections with those in map . Implemented here to give inner class visibility
- *
- * @param map
- * Map - key tree elements, values Lists of list elements
- */
- protected void updateSelections(Map map) {
- super.updateSelections(map);
- }
-
- /**
- * Check if widgets are enabled or disabled by a change in the dialog. Provided here to give
- * access to inner classes.
- *
- * @param event
- * Event
- */
- protected void updateWidgetEnablements() {
-
- super.updateWidgetEnablements();
- }
-
- /**
- * Answer a boolean indicating whether self's source specification widgets currently all contain
- * valid values.
- */
- protected boolean validateSourceGroup() {
- if (getSourceDirectory() != null) {
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory == null) {
- setMessage(SOURCE_EMPTY_MESSAGE);
- enableButtonGroup(false);
- return false;
- }
-
- if (sourceConflictsWithDestination(new Path(sourceDirectory.getPath()))) {
- setErrorMessage(getSourceConflictMessage()); //$NON-NLS-1$
- enableButtonGroup(false);
- return false;
- }
-
- enableButtonGroup(true);
- return true;
- }
- //If there is nothing being provided to the input then there is a problem
- if (this.currentProvider == null) {
- setMessage(SOURCE_EMPTY_MESSAGE);
- enableButtonGroup(false);
- return false;
- }
- enableButtonGroup(true);
- return true;
- }
-
- /**
- * Returns whether the source location conflicts with the destination resource. This will occur
- * if the source is already under the destination.
- *
- * @param sourcePath
- * the path to check
- * @return <code>true</code> if there is a conflict, <code>false</code> if not
- */
- protected boolean sourceConflictsWithDestination(IPath sourcePath) {
-
- IContainer container = getSpecifiedContainer();
- if (container == null)
- return false;
- return getSpecifiedContainer().getLocation().isPrefixOf(sourcePath);
- }
-
- protected IPath getResourcePath() {
- return importedClassesPath;
- }
-
- //-------------------------------------------------------------------------------------
-
- //makesure to call mainpage.cancel()
- public boolean cancel() {
- clearProviderCache();
- return true;
- }
-
- /**
- * Clears the cached structure provider after first finalizing it properly.
- */
- protected void clearProviderCache() {
- if (providerCache != null) {
- closeZipFile(providerCache.getZipFile());
- providerCache = null;
- }
- }
-
- /**
- * Attempts to close the passed zip file, and answers a boolean indicating success.
- */
- protected boolean closeZipFile(ZipFile file) {
- try {
- file.close();
- } catch (IOException e) {
- //displayErrorDialog(DataTransferMessages.format("ZipImport.couldNotClose", new
- // Object[] { file.getName()})); //$NON-NLS-1$
- return false;
- }
-
- return true;
- }
-
- /**
- * Answer a handle to the zip file currently specified as being the source. Return null if this
- * file does not exist or is not of valid format.
- */
-
- protected ZipFile getSpecifiedSourceFile() {
- return getSpecifiedSourceFile(sourceNameField.getText());
- }
-
- /**
- * Answer a handle to the zip file currently specified as being the source. Return null if this
- * file does not exist or is not of valid format.
- */
-
- private ZipFile getSpecifiedSourceFile(String fileName) {
- if (fileName.length() == 0)
- return null;
-
- try {
- return new ZipFile(fileName);
- } catch (ZipException e) {
- //displayErrorDialog(DataTransferMessages.getString("ZipImport.badFormat"));
- // //$NON-NLS-1$
- } catch (IOException e) {
- //displayErrorDialog(DataTransferMessages.getString("ZipImport.couldNotRead"));
- // //$NON-NLS-1$
- }
-
- sourceNameField.setFocus();
- return null;
- }
-
- /**
- * Returns a structure provider for the specified zip file.
- */
- protected ZipFileStructureProvider getStructureProvider(ZipFile targetZip) {
- if (providerCache == null)
- providerCache = new ZipFileStructureProvider(targetZip);
- else if (!providerCache.getZipFile().getName().equals(targetZip.getName())) {
- clearProviderCache(); // ie.- new value, so finalize&remove old value
- providerCache = new ZipFileStructureProvider(targetZip);
- } else if (!providerCache.getZipFile().equals(targetZip))
- closeZipFile(targetZip); // ie.- duplicate handle to same .zip
-
- return providerCache;
- }
-
- /**
- * Open a FileDialog so that the user can specify the source file to import from
- */
- protected void handleSourceBrowseButtonPressedForZip() {
- String selectedFile = queryZipFileToImport();
- if (selectedFile != null) {
- if (!selectedFile.equals(sourceNameField.getText())) {
- //Be sure it is valid before we go setting any names
- ZipFile sourceFile = getSpecifiedSourceFile(selectedFile);
- if (sourceFile != null) {
- closeZipFile(sourceFile);
- setSourceName(selectedFile);
- selectionGroup.setFocus();
- }
- }
- }
- }
-
- /**
- * Import the resources with extensions as specified by the user
- */
- protected boolean importResourcesFromZip(List fileSystemObjects) {
-
- ZipFile zipFile = getSpecifiedSourceFile();
- ZipFileStructureProvider structureProvider = getStructureProvider(zipFile);
-
- boolean result = executeImportOperation(new ImportOperation(getContainerFullPath(), structureProvider.getRoot(), structureProvider, this, fileSystemObjects));
-
- closeZipFile(zipFile);
-
- return result;
- }
-
- /**
- * Opens a file selection dialog and returns a string representing the selected file, or
- * <code>null</code> if the dialog was canceled.
- */
- protected String queryZipFileToImport() {
- FileDialog dialog = new FileDialog(sourceNameField.getShell(), SWT.OPEN);
- dialog.setFilterExtensions(new String[]{FILE_IMPORT_MASK});
-
- String currentSourceString = sourceNameField.getText();
- int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
- if (lastSeparatorIndex != -1)
- dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex));
-
- return dialog.open();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties
deleted file mode 100644
index 3e9a87b77..000000000
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-EARLibrariesContainerPage_0=EAR Libraries
-EARLibrariesContainerPage_1=The EAR Libraries classpath container dynamically computes the J2EE project's module classpath dependencies using the META-INF/MANIFEST.MF Class-Path entries.

Back to the top