diff options
Diffstat (limited to 'plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel')
9 files changed, 0 insertions, 1747 deletions
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/AddablePageGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/AddablePageGroup.java deleted file mode 100644 index 53c3360b3..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/AddablePageGroup.java +++ /dev/null @@ -1,16 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import org.eclipse.jface.wizard.IWizardPage; - -public interface AddablePageGroup extends IDMPageGroup -{ - public void addPage( IWizardPage page ); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper.java deleted file mode 100644 index f634a6e74..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper.java +++ /dev/null @@ -1,569 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; -import org.eclipse.wst.common.frameworks.internal.ui.TimedModifyListener; - -/** - * This class is EXPERIMENTAL and is subject to substantial changes. - */ -public class DataModelSynchHelper implements IDataModelListener { - protected static final boolean isLinux = System.getProperty("os.name").equals("Linux"); //$NON-NLS-1$ //$NON-NLS-2$ - - protected IDataModel dataModel; - protected Map widgetToPropertyHash; - protected Map propertyToWidgetHash; - protected Map widgetToDepControls; - - protected String currentProperty; - protected Widget currentWidget; - protected Widget currentWidgetFromEvent; // TODO M4 see if this should be set with for - // listeners - protected boolean ignoreModifyEvent = false; - - private class ModifyTextListener implements ModifyListener { - public void modifyText(ModifyEvent e) { - if (ignoreModifyEvent) - return; - Text text = (Text) e.getSource(); - if (currentWidget == text) - return; - String propertyName = (String) widgetToPropertyHash.get(text); - setProperty(propertyName, text.getText()); - } - } - - private ModifyTextListener modifyTextListener; - private TimedModifyListener timedModifyListener; - - private class ComboListener implements SelectionListener, ModifyListener { - - public void modifyText(ModifyEvent e) { - if (ignoreModifyEvent) - return; - Combo combo = (Combo) e.getSource(); - if (currentWidget == combo) - return; - - try { - currentWidgetFromEvent = combo; - String propertyName = (String) widgetToPropertyHash.get(combo); - DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName); - String description = combo.getText(); - // On a combo selection linux fires 2 events; - // the first clears the value which needs to be ignored when the type is not String - // the second sets the new value - if (isLinux && description.length() == 0 && descriptors.length != 0 && !(descriptors[0].getPropertyValue() instanceof String)) { - return; - } - for (int i = 0; i < descriptors.length; i++) { - if (description.equals(descriptors[i].getPropertyDescription())) { - setProperty(propertyName, descriptors[i].getPropertyValue()); - return; - } - } - setProperty(propertyName, combo.getText()); - } finally { - currentWidgetFromEvent = null; - } - } - - public void widgetSelected(SelectionEvent e) { - Combo combo = (Combo) e.getSource(); - if (currentWidget == combo) - return; - String propertyName = (String) widgetToPropertyHash.get(combo); - if (combo.getSelectionIndex() >= 0) { - DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName); - String description = combo.getItem(combo.getSelectionIndex()); - for (int i = 0; i < descriptors.length; i++) { - if (description.equals(descriptors[i].getPropertyDescription())) { - setProperty(propertyName, descriptors[i].getPropertyValue()); - return; - } - } - setProperty(propertyName, combo.getItem(combo.getSelectionIndex())); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - } - - private ComboListener comboListener; - - private class CheckboxSelectionListener implements SelectionListener { - public void widgetSelected(SelectionEvent e) { - Button button = (Button) e.getSource(); - if (currentWidget == button) - return; - String propertyName = (String) widgetToPropertyHash.get(button); - setProperty(propertyName, new Boolean(button.getSelection())); - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - } - - private CheckboxSelectionListener checkboxSelectionListener; - - public DataModelSynchHelper(IDataModel model) { - this.dataModel = model; - dataModel.addListener(this); - } - - private CheckBoxViewerListener checkBoxViewerStateListener; - - private class CheckBoxViewerListener implements ICheckStateListener { - public void checkStateChanged(CheckStateChangedEvent event) { - StructuredViewer viewer = (StructuredViewer) event.getSource(); - CheckboxTableViewer checkBoxTableViewer; - CheckboxTreeViewer checkBoxTreeViewer; - Object[] items = null; - if (viewer instanceof CheckboxTableViewer) { - checkBoxTableViewer = (CheckboxTableViewer) viewer; - items = checkBoxTableViewer.getCheckedElements(); - } else if (viewer instanceof CheckboxTreeViewer) { - checkBoxTreeViewer = (CheckboxTreeViewer) viewer; - items = checkBoxTreeViewer.getCheckedElements(); - } - String propertyName = (String) widgetToPropertyHash.get(viewer.getControl()); - setPropertyItems(propertyName, items); - } - } - - public void propertyChanged(DataModelEvent event) { - String propertyName = event.getPropertyName(); - int flag = event.getFlag(); - if (flag == DataModelEvent.ENABLE_CHG) - setEnablement(propertyName, event.isPropertyEnabled()); - else - synchUIWithModel(propertyName, flag); - } - - protected void setProperty(String propertyName, Object value) { - currentProperty = propertyName; - try { - dataModel.setProperty(propertyName, value); - } finally { - currentProperty = null; - } - } - - protected void setPropertyItems(String propertyName, Object[] items) { - currentProperty = propertyName; - try { - dataModel.setProperty(propertyName, items); - } finally { - currentProperty = null; - } - } - - /** - * Sets the UI to have the property value defined in the model - * - * @param propertyName - * @link IDataModelListener for the flag values. - */ - public void synchUIWithModel(final String propertyName, final int flag) { - if (null != propertyToWidgetHash && propertyToWidgetHash.containsKey(propertyName)) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - try { - currentWidget = (Widget) propertyToWidgetHash.get(propertyName); - if (currentWidget != null && currentWidget != currentWidgetFromEvent) { - //We must hold a copy in a temp variable because setting the widget value - //may trigger an event that will cause this method to be called again. - Widget widget = currentWidget; - try { - ignoreModifyEvent = true; - if (currentWidget instanceof Text) - setWidgetValue(propertyName, flag, (Text) currentWidget); - else if (currentWidget instanceof Combo) { - setWidgetValue(propertyName, flag, (Combo) currentWidget); - } else if (currentWidget instanceof Button) - setWidgetValue(propertyName, flag, (Button) currentWidget); - else if (currentWidget instanceof Label) - setWidgetValue(propertyName, flag, (Label) currentWidget); - else if (currentWidget instanceof List) - setWidgetValue(propertyName, flag, (List) currentWidget); - else if (currentWidget instanceof Table) - setWidgetValue(propertyName, flag, (Table) currentWidget); - else if (currentWidget instanceof Tree) - setWidgetValue(propertyName, flag, (Tree) currentWidget); - } finally { - ignoreModifyEvent = false; - } - //Pass the copy of the currentWidget - setEnablement((Control) widget, dataModel.isPropertyEnabled(propertyName)); - } - } finally { - currentWidget = null; - } - } - }); - } - } - - /** - * @param control - * @param enabled - */ - protected void setEnablement(Control control, boolean enabled) { - if (control.isEnabled() != enabled) - control.setEnabled(enabled); - setDependentControlEnablement(control, enabled); - } - - private void setEnablement(final String propertyName, final boolean enabled) { - if (propertyToWidgetHash != null) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - Control control = (Control) propertyToWidgetHash.get(propertyName); - if (control != null) { - setEnablement(control, enabled); - } - } - }); - } - } - - /** - * @param control - * @param enabled - */ - private void setDependentControlEnablement(Control control, boolean enabled) { - if (widgetToDepControls != null) { - Control[] dependents = (Control[]) widgetToDepControls.get(control); - if (dependents != null) { - Control dep = null; - for (int i = 0; i < dependents.length; i++) { - dep = dependents[i]; - if (dep.isEnabled() != enabled) - dep.setEnabled(enabled); - } - } - } - } - - protected void setWidgetValue(String propertyName, int flag, Button button) { - if ((button.getStyle() & SWT.CHECK) == SWT.CHECK || (button.getStyle() & SWT.RADIO) == SWT.RADIO) { - boolean checked = dataModel.getBooleanProperty(propertyName); - if (button.getSelection() != checked) { - button.setSelection(checked); - } - } - } - - protected void setWidgetValue(String propertyName, int flag, Combo combo) { - if (flag == DataModelEvent.VALID_VALUES_CHG || combo.getItemCount() == 0) { - // Display properties should only fire if the contents change. - DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName); - String[] items = new String[descriptors.length]; - for (int i = 0; i < descriptors.length; i++) { - items[i] = descriptors[i].getPropertyDescription(); - } - combo.setItems(items); - } - String newText = dataModel.getPropertyDescriptor(propertyName).getPropertyDescription(); - int selIndex = combo.getSelectionIndex(); - if (selIndex < 0 || !newText.equals(combo.getItem(selIndex))) { - String[] items = combo.getItems(); - for (int i = 0; i < items.length; i++) { - if (items[i].equals(newText)) { - combo.select(i); - return; - } - } - } - combo.setText(newText); - } - - protected void setWidgetValue(String propertyName, int flag, Text text) { - String newText = dataModel.getStringProperty(propertyName); - if (!newText.equals(text.getText())) { - text.setText(newText); - } - } - - protected void setWidgetValue(String propertyName, int flag, Table table) { - Object[] elements = (Object[]) dataModel.getProperty(propertyName); - if (elements == null || elements.length == 0) { - setTableItemsChecked(table.getItems(), false); - return; - } - java.util.List elementList = Arrays.asList(elements); - TableItem[] tableItems = table.getItems(); - for (int i = 0; i < tableItems.length; i++) { - TableItem item = tableItems[i]; - if (elementList.contains(item.getData())) - item.setChecked(true); - else - item.setChecked(false); - } - } - - protected void setTableItemsChecked(TableItem[] tableItems, boolean b) { - for (int i = 0; i < tableItems.length; i++) - tableItems[i].setChecked(b); - } - - protected void setWidgetValue(String propertyName, int flag, Tree tree) { - Object[] elements = (Object[]) dataModel.getProperty(propertyName); - if (elements == null) - return; - java.util.List elementList = Arrays.asList(elements); - TreeItem[] treeItems = tree.getItems(); - if (elementList.size() == 0) { - setTreeItemsGrey(treeItems, false); - return; - } - if (treeItems.length > 0) - setTreeItemChecked(treeItems, elementList); - } - - public void setTreeItemsGrey(TreeItem[] treeItems, boolean b) { - for (int i = 0; i < treeItems.length; i++) { - TreeItem item = treeItems[i]; - item.setGrayed(b); - setTreeItemsGrey(treeItems[i].getItems(), b); - } - } - - protected void setTreeItemChecked(TreeItem[] treeItems, java.util.List items) { - for (int i = 0; i < treeItems.length; i++) { - if (items.contains(treeItems[i].getData())){ - treeItems[i].setChecked(true); - treeItems[i].setGrayed(false); - }else{ - treeItems[i].setGrayed(true); - } - TreeItem[] childernItems = treeItems[i].getItems(); - if (childernItems.length > 0) { - treeItems[i].setExpanded(true); - setTreeItemChecked(childernItems, items); - } - } - } - - protected void setWidgetValue(String propertyName, int flag, Label label) { - String newText = dataModel.getStringProperty(propertyName); - if (!newText.equals(label.getText())) { - label.setText(newText); - } - } - - protected void setWidgetValue(String propertyName, int flag, List list) { - Object newContents = dataModel.getProperty(propertyName); - if (newContents == null) { - list.setItems(new String[0]); - return; - } - if (newContents instanceof java.util.List) { - java.util.List modelContents = (java.util.List) newContents; - String[] items = new String[modelContents.size()]; - for (int i = 0; i < modelContents.size(); i++) { - items[i] = modelContents.get(i).toString(); - } - list.setItems(items); - } else if (newContents instanceof String[]) { - list.setItems((String[]) newContents); - } - } - - public void synchAllUIWithModel() { - if (null != propertyToWidgetHash) { - Collection keys = propertyToWidgetHash.keySet(); - if (!keys.isEmpty()) { - Iterator propertyNames = keys.iterator(); - String propertyName = null; - while (propertyNames.hasNext()) { - propertyName = (String) propertyNames.next(); - synchUIWithModel(propertyName, DataModelEvent.VALUE_CHG); - } - } - } - } - - protected void synchComposite(Widget widget, String propertyName, Control[] depControls) { - if (null == widgetToPropertyHash) - widgetToPropertyHash = new HashMap(); - if (propertyToWidgetHash == null) - propertyToWidgetHash = new HashMap(); - widgetToPropertyHash.put(widget, propertyName); - propertyToWidgetHash.put(propertyName, widget); - if (depControls != null) { - if (widgetToDepControls == null) - widgetToDepControls = new HashMap(); - widgetToDepControls.put(widget, depControls); - } - synchUIWithModel(propertyName, DataModelEvent.VALUE_CHG); - } - - public void synchText(Text text, String propertyName, Control[] dependentControls) { - synchText(text, propertyName, false, dependentControls); - } - - public void synchText(Text text, String propertyName, boolean isTimeModified, Control[] dependentControls) { - synchComposite(text, propertyName, dependentControls); - if (isTimeModified) - text.addModifyListener(getTimedListener()); - else - text.addModifyListener(getModifyTextListener()); - } - - public void synchLabel(Label label, String propertyName, Control[] dependentControls) { - synchComposite(label, propertyName, dependentControls); - } - - /** - * Use this to synch the contents of the <code>list</code> to the List elements returned from - * the <code>propertyName</code>. - */ - public void synchList(List list, String propertyName, Control[] dependentControls) { - synchComposite(list, propertyName, dependentControls); - } - - /** - * Use this to synch the value of the specified Combo with the specified propertyName. The - * possible values displayed to the user are determined by return of - * IDataModel.getValidPropertyDescriptors(String). - * - * @param combo - * @param propertyName - * @param dependentControls - */ - public void synchCombo(Combo combo, String propertyName, Control[] dependentControls) { - synchComposite(combo, propertyName, dependentControls); - if (null == comboListener) { - comboListener = new ComboListener(); - } - combo.addSelectionListener(comboListener); - combo.addModifyListener(comboListener); - } - - /** - * Use this to sync the state of the specified checkbox with the value of the specified - * propertyName. The specified propertyName must contain a java.lang.Boolean typed Object. - * - * @param checkbox - * @param propertyName - * @param dependentControls - */ - public void synchCheckbox(Button checkbox, String propertyName, Control[] dependentControls) { - synchComposite(checkbox, propertyName, dependentControls); - if (null == checkboxSelectionListener) { - checkboxSelectionListener = new CheckboxSelectionListener(); - } - checkbox.addSelectionListener(checkboxSelectionListener); - } - - public void synchCheckBoxTableViewer(CheckboxTableViewer tableViewer, String propertyName, Control[] dependentControls) { - synchComposite(tableViewer.getControl(), propertyName, dependentControls); - if (null == checkBoxViewerStateListener) { - checkBoxViewerStateListener = new CheckBoxViewerListener(); - } - tableViewer.addCheckStateListener(checkBoxViewerStateListener); - } - - public void synchCheckBoxTreeViewer(CheckboxTreeViewer treeViewer, String propertyName, Control[] dependentControls) { - treeViewer.expandAll(); - synchComposite(treeViewer.getControl(), propertyName, dependentControls); - if (null == checkBoxViewerStateListener) { - checkBoxViewerStateListener = new CheckBoxViewerListener(); - } - treeViewer.addCheckStateListener(checkBoxViewerStateListener); - } - - public void synchRadio(Button radio, String propertyName, Control[] dependentControls) { - // Uses checkbox syncher - synchCheckbox(radio, propertyName, dependentControls); - } - - private TimedModifyListener getTimedListener() { - if (timedModifyListener == null) - timedModifyListener = new TimedModifyListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Widget w = (Widget) e.getSource(); - if (currentWidget == w || w.isDisposed()) - return; - String propertyName = (String) widgetToPropertyHash.get(w); - setTextProperty(propertyName, (Text) w); - } - }) { - public void modifyText(ModifyEvent e) { - if (ignoreModifyEvent) - return; - super.modifyText(e); - } - }; - return timedModifyListener; - } - - protected void setTextProperty(String propertyName, Text text) { - setProperty(propertyName, text.getText()); - } - - private ModifyTextListener getModifyTextListener() { - if (null == modifyTextListener) - modifyTextListener = new ModifyTextListener(); - return modifyTextListener; - } - - public IDataModel getDataModel() { - return dataModel; - } - - public void dispose() { - dataModel.removeListener(this); - checkboxSelectionListener = null; - currentWidget = null; - modifyTextListener = null; - propertyToWidgetHash = null; - timedModifyListener = null; - widgetToDepControls = null; - widgetToPropertyHash = null; - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java deleted file mode 100644 index a8ed8d277..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizard.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; -import org.eclipse.wst.common.frameworks.internal.datamodel.IDataModelPausibleOperation; -import org.eclipse.wst.common.frameworks.internal.dialog.ui.WarningDialog; -import org.eclipse.wst.common.frameworks.internal.eclipse.ui.EclipseEnvironment; -import org.eclipse.wst.common.frameworks.internal.ui.ErrorDialog; -import org.eclipse.wst.common.frameworks.internal.ui.PageGroupManager; -import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler; -import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin; - - -/** - * This class is EXPERIMENTAL and is subject to substantial changes. - */ -public abstract class DataModelWizard extends Wizard implements IDMPageHandler { - private PageGroupManager pageGroupManager; - private IDataModel dataModel; - private AddablePageGroup rootPageGroup; - private IDataModelPausibleOperation rootOperation; - - // private IWizardPage firstpage; - - public DataModelWizard(IDataModel dataModel) { - this.dataModel = dataModel; - } - - public DataModelWizard() { - } - - protected abstract IDataModelProvider getDefaultProvider(); - - /** - * @return the wizard ID that clients should extend to add to this wizard - */ - public final String getWizardID() { - return getDataModel().getID(); - } - - /** - * - * @return returns the root operation for this wizard. - */ - protected IDataModelPausibleOperation getRootOperation() { - return (IDataModelPausibleOperation)getDataModel().getDefaultOperation(); - } - - /** - * This is finalized to handle the adding of extended pages. Clients should override - * doAddPages() to add their pages. - */ - public final void addPages() { - init(); - doAddPages(); - } - - /** - * Subclasses should override this method to add pages. - */ - protected void doAddPages() { - } - - // TODO make this final - public IWizardPage getStartingPage() { - pageGroupManager.reset(); - return getNextPage(null); - } - - /** - * Subclasses wishing to control the page ordering should do so by overriding - * getNextPage(String, String) and getPreviousPage(String, String) - * - * @link #getNextPage(String, String) - * @link #getPreviousPage(String, String) - */ - // TODO make this final - public IWizardPage getNextPage(IWizardPage page) { - - IWizardPage currentPage = pageGroupManager.getCurrentPage(); - - pageGroupManager.moveForwardOnePage(); - - IWizardPage nextPage = pageGroupManager.getCurrentPage(); - - // If an error occured then the current page and the next page will be the same. - if (currentPage != nextPage && nextPage != null) { - nextPage.setWizard(this); - nextPage.setPreviousPage(currentPage); - } - - return currentPage == nextPage ? null : nextPage; - } - - public String getNextPage(String currentPageName, String expectedNextPageName) { - return expectedNextPageName; - } - - /** - * Subclasses wishing to control the page ordering should do so by overriding - * getNextPage(String, String) and getPreviousPage(String, String) - * - * @link #getNextPage(String, String) - * @link #getPreviousPage(String, String) - */ - // TODO make this final - public IWizardPage getPreviousPage(IWizardPage page) { - return page != null ? page.getPreviousPage() : null; - } - - public String getPreviousPage(String currentPageName, String expectedPreviousPageName) { - return expectedPreviousPageName; - } - - public boolean canFinish() { - if (!super.canFinish() || !getDataModel().isValid()) { - return false; - } - - return true; - } - - public PageGroupManager getPageGroupManager() { - return pageGroupManager; - } - - // TODO need to implement this. Perhaps in the PageGroupManager - // - protected void resetAfterFinishError() { - // IWizardPage[] pages = getPages(); - // for (int i = 0; i < pages.length; i++) { - // DataModelWizardPage wtpPage = (DataModelWizardPage) pages[i]; - // wtpPage.validatePage(true); - // } - } - - protected boolean isExecuting() { - return executing; - } - - private boolean executing = false; - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public final boolean performFinish() { - try { - executing = true; - if (prePerformFinish()) { - storeDefaultSettings(); - - final IStatus st = runOperations(); - - if (st.getSeverity() == IStatus.ERROR) { - WTPUIPlugin.log(st); - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), new CoreException(st), 0, false); - } else if(st.getSeverity() == IStatus.WARNING){ - WarningDialog.openWarning(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_2, new Object[]{getWindowTitle()}), st.getMessage(), st, IStatus.WARNING); - } - - postPerformFinish(); - } - } catch (Exception exc) { - WTPUIPlugin.log(exc); - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), exc, 0, false); - } finally { - executing = false; - } - - return true; - } - - private IStatus runOperations() { - final IStatus[] status = new IStatus[1]; - class CatchThrowableRunnableWithProgress implements IRunnableWithProgress { - public Throwable caught = null; - - public void run(IProgressMonitor pm) { - try { - if (rootOperation == null) { - //This will be the typical case because most wizards will - //not initialize the root operation during init. - rootOperation = getRootOperation(); - } - status[0] = rootOperation.execute(pm, null); - } catch (Throwable e) { - caught = e; - } - } - } - CatchThrowableRunnableWithProgress runnable = new CatchThrowableRunnableWithProgress(); - - try { - getContainer().run(runForked(), isCancelable(), runnable); - } catch (Throwable e) { - runnable.caught = e; - } - if (runnable.caught != null) { - Logger.getLogger().logError(runnable.caught); - status[0] = new Status(IStatus.ERROR, "id", 0, runnable.caught.getMessage(), runnable.caught); //$NON-NLS-1$ - ErrorDialog.openError(getShell(), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}), WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}), runnable.caught, 0, false); - } - return status[0]; - } - - public boolean performCancel() { - pageGroupManager.undoAllCurrentOperations(); - - return true; - } - - /** - * Subclass can override to perform any tasks prior to running the operation. Return true to - * have the operation run and false to stop the execution of the operation. - * - * @return - */ - protected boolean prePerformFinish() { - return true; - } - - /** - * Subclasses should override to perform any actions necessary after performing Finish. - */ - protected void postPerformFinish() throws InvocationTargetException { - } - - protected void storeDefaultSettings() { - pageGroupManager.storeDefaultSettings(this); - } - - public void storeDefaultSettings(IWizardPage page) { - if (page instanceof DataModelWizardPage) - ((DataModelWizardPage) page).storeDefaultSettings(); - } - - - /** - * Subclasses may override if they need to do something special when storing the default - * settings for a particular page. - * - * @param page - * @param pageIndex - */ - protected void storeDefaultSettings(IWizardPage page, int pageIndex) { - storeDefaultSettings(page); - } - - /** - * Subclasses should override if the running operation is allowed to be cancelled. The default - * is false. - * - * @return - */ - protected boolean isCancelable() { - return false; - } - - /** - * Subclasses should override to return false if the running operation cannot be run forked. - * - * @return - */ - protected boolean runForked() { - return true; - } - - public void setDataModel(IDataModel model) { - this.dataModel = model; - } - - /** - * @return Returns the model. - */ - public IDataModel getDataModel() { - if (null == dataModel) { - dataModel = DataModelFactory.createDataModel(getDefaultProvider()); - } - - return dataModel; - } - - public void dispose() { - super.dispose(); - if (null != rootPageGroup) { - List pages = rootPageGroup.getPages(dataModel); - for (Iterator it = pages.iterator(); it.hasNext();) - { - Object page = it.next(); - if (page instanceof IWizardPage) - { - ((IWizardPage)page).dispose(); - } - } - } - if (null != dataModel) { - dataModel.dispose(); - } - } - - /** - * The default is to return a SimplePageGroup. Subclasses may want to overrided this method to - * return a different root page group for the wizard. - * - * @return - */ - protected AddablePageGroup createRootPageGroup() { - String id = getWizardID(); - // For the root page group the wizard id and the group id are the same. - SimplePageGroup pageGroup = new SimplePageGroup(id, id); - pageGroup.setPageHandler(this); - return pageGroup; - } - - /** - * Creates the default environment for this wizard. - * - * @return - */ - protected IEnvironment createEnvironment() { - return new EclipseEnvironment(); - } - - public void addPage(IWizardPage page) { - rootPageGroup.addPage(page); - } - - private void init() { - rootPageGroup = createRootPageGroup(); - if (needsToRunOperationsBeforeFinish()) { - rootOperation = getRootOperation(); - pageGroupManager = new PageGroupManager(rootOperation, rootPageGroup); - } else { - pageGroupManager = new PageGroupManager(getDataModel(), rootPageGroup); - } - } - - /** - * Subclasses should override to return true if they require the running - * of the operation during page turning. - * - * @return A boolean defaulted to false. - */ - protected boolean needsToRunOperationsBeforeFinish() { - return false; - } - - public boolean needsPreviousAndNextButtons() { - return super.needsPreviousAndNextButtons() || getPageGroupManager().hasMultiplePages(); - } - -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardFactory.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardFactory.java deleted file mode 100644 index eec76f64d..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.operation.extensionui.DataModelWizardExtensionReader; - -public class DataModelWizardFactory { - - private static DataModelWizardExtensionReader reader; - - /** - * Looks up the appropriate DataModelWizard by the specified id and - * constructs a new DataModelWizard using a new instance of the IDataModel - * looked up with the same id. If the DataModelWizard is not found then a - * RuntimeException is thrown. - * - * @param id - * the id of the DataModelWizard - * @return a new DataModelWizard - */ - public static DataModelWizard createWizard(String id) { - return createWizard(DataModelFactory.createDataModel(id)); - } - - /** - * Looks up the appropriate DataModelWizard using the id retured from - * <code>dataModel.getID()</code>. - * - * @param dataModel - * @return a new DataModelWizard - */ - public static DataModelWizard createWizard(IDataModel dataModel) { - return loadWizard(dataModel); - } - - private static DataModelWizard loadWizard(IDataModel dataModel) { - if (null == reader) { - reader = new DataModelWizardExtensionReader(); - } - return reader.getWizard(dataModel); - } - - /** - * Looks up the appropriate DataModelWizard using the name of the specified - * class as the id. This method is equavalent to - * <code>createWizard(classID.getName())</code>. - * - * @param classID - * the class whose name is the id of the DataModelWizard - * @return a new DataModelWizard - */ - public static DataModelWizard createWizard(Class dataModelProviderID) { - return createWizard(dataModelProviderID.getName()); - } -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardPage.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardPage.java deleted file mode 100644 index 288022dd6..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelWizardPage.java +++ /dev/null @@ -1,463 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.PlatformUI; -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.ui.ValidationStatus; - -/** - * This class is EXPERIMENTAL and is subject to substantial changes. - */ -public abstract class DataModelWizardPage extends WizardPage implements Listener, IDataModelListener { - protected static final int NEXT = 1; - protected static final int PREVIOUS = 2; - protected static final int COMPOSITE_BORDER = SWT.NULL; - private ValidationStatus status = new ValidationStatus(); - private boolean isValidating = false; - protected boolean isFirstTimeToPage = true; - protected IDataModel model; - private Map validationMap; - private String[] validationPropertyNames; - protected DataModelSynchHelper synchHelper; - private String infopopID; - private DataModelWizard wizard; - private IWizardPage previousPage; - - /** - * J2EEWizardPage constructor comment. - * - * @param pageName - * java.lang.String - */ - protected DataModelWizardPage(IDataModel model, String pageName) { - super(pageName); - this.model = model; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - } - - /** - * @return - */ - public DataModelSynchHelper initializeSynchHelper(IDataModel dm) { - return new DataModelSynchHelper(dm); - } - - /** - * J2EEWizardPage constructor comment. - * - * @param pageName - * java.lang.String - * @param title - * java.lang.String - * @param titleImage - * org.eclipse.jface.resource.ImageDescriptor - */ - protected DataModelWizardPage(IDataModel model, String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage) { - super(pageName, title, titleImage); - this.model = model; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - } - - /** - * Creates the top level control for this dialog page under the given parent composite. This - * method has been abstract and it uses the template pattern to get the correct items setup in - * the correct order. See the set of methods below that are called in this method. - * <p> - * Implementors are responsible for ensuring that the created control can be accessed via - * <code>getControl</code> - * </p> - * - * @param parent - * the parent composite - */ - public final void createControl(org.eclipse.swt.widgets.Composite parent) { - Composite top = createTopLevelComposite(parent); - setControl(top); - setupInfopop(top); - setDefaults(); - addListeners(); - initializeValidationProperties(); - } - - private void initializeValidationProperties() { - validationPropertyNames = getValidationPropertyNames(); - if (validationPropertyNames == null || validationPropertyNames.length == 0) - validationMap = Collections.EMPTY_MAP; - else { - validationMap = new HashMap(validationPropertyNames.length); - for (int i = 0; i < validationPropertyNames.length; i++) - validationMap.put(validationPropertyNames[i], new Integer(i)); - } - } - - public boolean canFlipToNextPage() { - // TODO why is that last getNextPage() call here??? - return isPageComplete() && ((null != wizard && wizard.getPageGroupManager().hasNextPage() || null != getNextPage())); - } - - /* - * (non-Javadoc) Method declared on IWizardPage. - */ - public void setWizard(IWizard newWizard) { - super.setWizard(newWizard); - if (newWizard instanceof DataModelWizard) { - wizard = (DataModelWizard) newWizard; - } - } - - public IWizardPage getPreviousPage() { - return previousPage; - } - - public void setPreviousPage(IWizardPage page) { - super.setPreviousPage(page); - previousPage = page; - } - - /** - * Subclass should return the model property names that need to be validated on this page in the - * order that they should present their messages. - * - * @return - */ - protected abstract String[] getValidationPropertyNames(); - - /** - * Return the top level Composite for this page. - */ - protected abstract Composite createTopLevelComposite(Composite parent); - - /** - * Set up info pop hooks if set. - */ - protected void setupInfopop(Control parent) { - if (getInfopopID() != null) - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, getInfopopID()); - } - - /** - * Setup the default values for this page. Subclasses should override to provide appropriate - * defaults. - */ - protected void setDefaults() { - restoreDefaultSettings(); - } - - /** - * Subclasses should implement this method if they have default settings that have been stored - * and need to be restored. - * - * @see storeDefaultSettings() - */ - protected void restoreDefaultSettings() { - } - - /** - * Add Listeners to controls at this point to avoid unnecessary events. Subclasses should - * override to add listeners to its controls. - */ - protected void addListeners() { - } - - /** - * The page is being made current and visible. Subclasses may extend. - */ - protected void enter() { - try { - // Check to see if we are moving back one page. - if (null != wizard && wizard.getPreviousPage(wizard.getPageGroupManager().getCurrentPage()) == this) { - wizard.getPageGroupManager().moveBackOnePage(); - } - - validatePage(showValidationErrorsOnEnter()); - } finally { - isFirstTimeToPage = false; - } - } - - /** - * The default behavior is to return true unless it is the first time entering this page in - * which case we check to see if there is a previous page and return true if there is not. - * Subclasses should override if they do not want this default behavior. - */ - protected boolean showValidationErrorsOnEnter() { - return !isFirstTimeToPage(); - } - - /** - * The default behavior is to return true unless it is the first time entering this page in - * which case we check to see if there is a previous page and return true if there is not. - * Subclasses should override if they do not want this default behavior. - * - * @deprecated - use showValidatoinErrorsOnEnter instead - */ - protected boolean shouldValidateOnEnter() { - return showValidationErrorsOnEnter(); - } - - /** - * Exiting the page. Subclasses may extend. - */ - protected void exit() { - } - - protected boolean getStatus(Integer key) { - return status.hasError(key); - } - - /** - * Sent when an event that the receiver has registered for occurs. If a subclass overrides this - * method, it must call super. - * - * @param event - * the event which occurred - */ - public void handleEvent(org.eclipse.swt.widgets.Event event) { - } - - /** - * Set the error message for this page based on the last error in the ValidationStatus. - */ - protected void setErrorMessage() { - String error = status.getLastErrMsg(); - if (error == null) { - if (getErrorMessage() != null) - setErrorMessage((String) null); - String warning = status.getLastWarningMsg(); - if (warning == null) { - if (getMessage() != null && getMessageType() == IMessageProvider.WARNING) - setMessage(null, IMessageProvider.WARNING); - else { - String info = status.getLastInfoMsg(); - if (info == null) { - if (getMessage() != null && getMessageType() == IMessageProvider.INFORMATION) - setMessage(null, IMessageProvider.INFORMATION); - } else if (!info.equals(getMessage())) { - setMessage(info, IMessageProvider.INFORMATION); - } - } - } else if (!warning.equals(getMessage())) - setMessage(warning, IMessageProvider.WARNING); - } else if (!error.equals(getErrorMessage())) - setErrorMessage(error); - } - - protected void setErrorStatus(Integer key, String errorMessage) { - status.setErrorStatus(key, errorMessage); - } - - protected void setWarningStatus(Integer key, String warningMessage) { - status.setWarningStatus(key, warningMessage); - } - - protected void setInfoStatus(Integer key, String infoMessage) { - status.setInfoStatus(key, infoMessage); - } - - protected void setOKStatus(Integer key) { - status.setOKStatus(key); - } - - /** - * The <code>DialogPage</code> implementation of this <code>IDialogPage</code> method sets - * the control to the given visibility state. Subclasses may extend. - */ - - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - enter(); - } else - exit(); - } - - /** - * This should be called by the Wizard just prior to running the performFinish operation. - * Subclasses should override to store their default settings. - */ - public void storeDefaultSettings() { - } - - /** - * The page is now being validated. At this time, each control is validated and then the - * controls are updated based on the results in the ValidationStatus which was updated during - * <code>validateControls()</code>. Finally, it will display the last error message and it - * will set the page complete. Subclasses will not typically override this method. - */ - protected void validatePage() { - validatePage(true); - } - - protected void validatePage(boolean showMessage) { - if (!isValidating) { - isValidating = true; - try { - validateControlsBase(); - updateControls(); - if (showMessage) - setErrorMessage(); - setPageComplete(status.getLastErrMsg() == null); - } finally { - isValidating = false; - } - } - } - - /** - * Validate individual controls. Use validation keys to keep track of errors. - * - * @see setOKStatus(Integer) and setErrorMessage(Integer, String) - */ - protected final String validateControlsBase() { - if (!validationMap.isEmpty()) { - String propName; - for (int i = 0; i < validationPropertyNames.length; i++) { - propName = validationPropertyNames[i]; - Integer valKey = (Integer) validationMap.get(propName); - if (valKey != null) - validateProperty(propName, valKey); - if (!getStatus(valKey)) - return propName; - } - } - return null; - } - - /** - * @param propertyName - * @param validationkey - */ - private void validateProperty(String propertyName, Integer validationKey) { - setOKStatus(validationKey); - IStatus status1 = model.validateProperty(propertyName); - if (!status1.isOK()) { - String message = status1.isMultiStatus() ? status1.getChildren()[0].getMessage() : status1.getMessage(); - switch (status1.getSeverity()) { - case IStatus.ERROR : - setErrorStatus(validationKey, message); - break; - case IStatus.WARNING : - setWarningStatus(validationKey, message); - break; - case IStatus.INFO : - setInfoStatus(validationKey, message); - break; - } - } - } - - /** - * Update the enablement of controls after validation. Sublcasses should check the status of - * validation keys to determine enablement. - */ - protected void updateControls() { - } - - /** - * Gets the isFirstTimeToPage. - * - * @return Returns a boolean - */ - protected boolean isFirstTimeToPage() { - return isFirstTimeToPage; - } - - // protected void setJavaStatusMessage(IStatus javaStatus, Integer statusKey, String message) { - // if (javaStatus.getSeverity() == IStatus.WARNING) - // setWarningStatus(statusKey, message); - // else - // setErrorStatus(statusKey, message); - // } - - /** - * @param b - */ - public void setFirstTimeToPage(boolean b) { - isFirstTimeToPage = b; - } - - private boolean gotDataModelWizard = false; - private DataModelWizard dataModelWizard = null; - protected DataModelWizard getDataModelWizard(){ - if(!gotDataModelWizard){ - gotDataModelWizard = true; - IWizard wizard = getWizard(); - if(wizard instanceof DataModelWizard){ - dataModelWizard = (DataModelWizard)wizard; - } - } - return dataModelWizard; - } - - - /* - * If a property changes that we want to validate, force validation on this page. - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModelListener#propertyChanged(java.lang.String, - * java.lang.Object, java.lang.Object) - */ - public void propertyChanged(DataModelEvent event) { - DataModelWizard w = getDataModelWizard(); - if(w == null || !w.isExecuting()){ - String propertyName = event.getPropertyName(); - if (validationPropertyNames != null && (event.getFlag() == DataModelEvent.VALUE_CHG || (!isPageComplete() && event.getFlag() == DataModelEvent.VALID_VALUES_CHG))) { - for (int i = 0; i < validationPropertyNames.length; i++) { - if (validationPropertyNames[i].equals(propertyName)) { - validatePage(showValidationErrorsOnEnter()); - break; - } - } - } - } - } - - /** - * @return Returns the model. - */ - protected IDataModel getDataModel() { - return model; - } - - public void dispose() { - super.dispose(); - if (synchHelper != null) { - synchHelper.dispose(); - synchHelper = null; - } - } - - protected String getInfopopID() { - return infopopID; - } - - public void setInfopopID(String infopopID) { - this.infopopID = infopopID; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroup.java deleted file mode 100644 index 8f2f4123c..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroup.java +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import java.util.List; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public interface IDMPageGroup -{ - public String getWizardID(); - - public String getPageGroupID(); - - public String getPageGroupInsertionID(); - - public boolean getAllowsExtendedPages(); - - public String getRequiredDataOperationToRun(); - - public List getPages(IDataModel dataModel); - - public IDMPageHandler getPageHandler( IDataModel dataModel ); - - public IDMPageGroupHandler getPageGroupHandler( IDataModel dataModel ); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroupHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroupHandler.java deleted file mode 100644 index c170e5cdf..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageGroupHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -/** - * - * The wizard framework allows page groups to be inserted after other page group. - * If more than one page group inserts itself after a particular page group it may - * not be deterministic which page group should follow each other. This class - * allows a particular page group to determine the order in which subsequent page - * groups should be ordered. - * - * For example: A page group T has three page groups X, Y, and Z that have registered - * via the wizardPageGroup extension point to follow it. - * The wizard framework will call getNextGroup with: - * - * T.getNextGroup( null, { "X", "Y", "Z" } ) - * - * This method should return either "X", "Y", "Z", or null if no page group - * should follow. If "Y" was returned then a subequent call - * will be made by the framework with: - * - * T.getNextGroup( "Y", { "X", "Y", "Z" } ) - * - * Again this method should return either "X", "Y", "Z", or null if no page - * group should follow this page group "Y". - * - * Note: any page group can have a page group handler associated with it so this method - * call is recursive in nature. For example: the page group Y might have page - * groups Y1, Y2, and Y3 following it. This would result in the following calls: - * - * T.getNextGroup( null, { "X", "Y", "Z" } ) // "Y" is selected using Ts handler. - * Y.getNextGroup( null, { "Y1", "Y2", "Y3" } ) // "Y1" is selected using Ys handler. - * - * For this example Y1 has no page groups following it. - * - * T.getNextGroup( "Y", { "X", "Y", "Z" } ) // null is selected using Ts handler. - * - * For this example, the T handler decided that no page group followed Y not even X or Z. - * - */ -public interface IDMPageGroupHandler -{ - /** - * - * @param currentPageGroupID the current page group ID. This value will be null the first time - * this method is called. - * @param pageGroupIDs a list of page group IDs that follow the page group for this handler. - * @return returns the page group id that should follow currentPageGroupID, or it - * should return null if no page group follows currentPageGroupID. - * - */ - public String getNextPageGroup( String currentPageGroupID, String[] pageGroupIDs ); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageHandler.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageHandler.java deleted file mode 100644 index a4419a315..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/IDMPageHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -/** - * This interface is EXPERIMENTAL and is subject to substantial changes. - */ -public interface IDMPageHandler { - - /** - * return this as the page name if the expectedNextPageName or expectedPreviousPageName should - * be skipped - */ - public static final String SKIP_PAGE = "IDMExtendedPageHandler.SKIP_PAGE"; //$NON-NLS-1$ - - /** - * prefix this string with the name of the page which occurs before the page that should be - * returned. E.G. suppose your page contributions know about pages A, B and C, and you want the - * to skip pages B and C, when going to the next page from A. To do this, return PAGE_AFTER+C. - * The framework will then ask the wizard for the page that normally comes after page C. - * PAGE_BEFORE works similarly. - */ - public static final String PAGE_AFTER = "IDMExtendedPageHandler.PAGE_AFTER"; //$NON-NLS-1$ - - /** - * same as PAGE_AFTER, except for returing the page before. - */ - public static final String PAGE_BEFORE = "IDMExtendedPageHandler.PAGE_BEFORE"; //$NON-NLS-1$ - - /** - * Return the name of the page that should be next - * - * @param currentPageName - * the page the wizard is currently on - * @param expectedNextPageName - * the page that would normally be next - * @return - */ - public String getNextPage(String currentPageName, String expectedNextPageName); - - /** - * Return the name of the page that should be previous - * - * @param currentPageName - * the page the wizard is currently on - * @param expectedNextPageName - * the page that would normally be previous - * @return - */ - public String getPreviousPage(String currentPageName, String expectedPreviousPageName); -} diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/SimplePageGroup.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/SimplePageGroup.java deleted file mode 100644 index 0e936efef..000000000 --- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/datamodel/ui/SimplePageGroup.java +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.wst.common.frameworks.internal.datamodel.ui; - -import java.util.List; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class SimplePageGroup implements AddablePageGroup { - private String groupID; - private String wizardID; - private boolean allowExtendedPages; - private String requiredDataOperation; - private Set dataModelIDs; - - private IDMPageHandler pageHandler; - private IDMPageGroupHandler pageGroupHandler; - private Vector pages; - - public SimplePageGroup(String groupID, String wizardID, boolean allowExtendedPages, String requireDataOperation) { - this.groupID = groupID; - this.wizardID = wizardID; - this.allowExtendedPages = allowExtendedPages; - this.requiredDataOperation = requireDataOperation; - pages = new Vector(); - } - - public SimplePageGroup(String groupID, String wizardID) { - this(groupID, wizardID, true, null); - } - - public void addPage(IWizardPage page) { - pages.add(page); - } - - public void addPages(IWizardPage[] newPages) { - for (int index = 0; index < newPages.length; index++) { - pages.add(newPages[index]); - } - } - - public boolean getAllowsExtendedPages() { - return allowExtendedPages; - } - - public void setPageGroupHandler(IDMPageGroupHandler handler) { - pageGroupHandler = handler; - } - - public IDMPageGroupHandler getPageGroupHandler(IDataModel dataModel) { - return pageGroupHandler; - } - - public void setPageHandler(IDMPageHandler handler) { - pageHandler = handler; - } - - public IDMPageHandler getPageHandler(IDataModel dataModel) { - return pageHandler; - } - - public List getPages(IDataModel dataModel) { - return pages; - } - - public IWizardPage[] getExtendedPages(IDataModel dataModel) { - return (IWizardPage[]) pages.toArray(new IWizardPage[0]); - } - - public String getPageGroupID() { - return groupID; - } - - public String getPageGroupInsertionID() { - return null; - } - - public String getRequiredDataOperationToRun() { - return requiredDataOperation; - } - - public String getWizardID() { - return wizardID; - } - - public Set getDataModelIDs() { - return dataModelIDs; - } - - public void setDataModelIDs(Set dataModelIDs) { - this.dataModelIDs = dataModelIDs; - } -} |