diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow')
147 files changed, 0 insertions, 27385 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/DelegatingZoomManager.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/DelegatingZoomManager.java deleted file mode 100644 index 0a8f33570..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/DelegatingZoomManager.java +++ /dev/null @@ -1,374 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -// import org.eclipse.core.runtime.ListenerList; -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.draw2d.ScalableFigure; -import org.eclipse.draw2d.Viewport; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.editparts.ZoomListener; -import org.eclipse.gef.editparts.ZoomManager; - -/** - * A delegating ZoomManager. - * - */ -public class DelegatingZoomManager extends ZoomManager implements ZoomListener { - /** Default string or double value of zoom level */ - private static final String DEFAULT_ZOOM_LEVEL_STRING = "100%"; //$NON-NLS-1$ - - private static final double DEFAULT_ZOOM_LEVEL = 1; - - /** the current ZoomManager all work is delegated to */ - private ZoomManager currentZoomManager = null; - - /** listeners of zoom */ - private ListenerList zoomListeners = new ListenerList( - ListenerList.IDENTITY); - - /** - * Creates a new DelegatingZoomManager instance. - */ - public DelegatingZoomManager() { - super((ScalableFigure) null, (Viewport) null); - } - - /* - * (non-Javadoc) - * - * @see ZoomListener#zoomChanged(double) - */ - public void zoomChanged(double zoom) { - Object[] listeners = zoomListeners.getListeners(); - for (int i = 0; i < listeners.length; ++i) { - ((ZoomListener) listeners[i]).zoomChanged(zoom); - } - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#addZoomListener(ZoomListener) - */ - public void addZoomListener(ZoomListener listener) { - zoomListeners.add(listener); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#removeZoomListener(oZoomListener) - */ - public void removeZoomListener(ZoomListener listener) { - zoomListeners.remove(listener); - } - - /** - * Sets the ZoomManager all work should be delegated to. - * - * @param zoomManager - */ - public void setCurrentZoomManager(ZoomManager zoomManager) { - if (null != currentZoomManager) { - currentZoomManager.removeZoomListener(this); - } - - currentZoomManager = zoomManager; - if (null != currentZoomManager) { - currentZoomManager.addZoomListener(this); - zoomChanged(currentZoomManager.getZoom()); - } - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#canZoomIn() - */ - public boolean canZoomIn() { - if (null == currentZoomManager) { - return false; - } - - return currentZoomManager.canZoomIn(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#canZoomOut() - */ - public boolean canZoomOut() { - if (null == currentZoomManager) { - return false; - } - - return currentZoomManager.canZoomOut(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getMaxZoom() - */ - public double getMaxZoom() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL; - } - - return currentZoomManager.getMaxZoom(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getMinZoom() - */ - public double getMinZoom() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL; - } - - return currentZoomManager.getMinZoom(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getNextZoomLevel() - */ - public double getNextZoomLevel() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL; - } - - return currentZoomManager.getNextZoomLevel(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getPreviousZoomLevel() - */ - public double getPreviousZoomLevel() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL; - } - - return currentZoomManager.getPreviousZoomLevel(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getScalableFigure() - */ - public ScalableFigure getScalableFigure() { - if (null == currentZoomManager) { - return null; - } - - return currentZoomManager.getScalableFigure(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getUIMultiplier() - */ - public double getUIMultiplier() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL; - } - - return currentZoomManager.getUIMultiplier(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getViewport() - */ - public Viewport getViewport() { - if (null == currentZoomManager) { - return null; - } - - return currentZoomManager.getViewport(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getZoom() - */ - public double getZoom() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL; - } - - return currentZoomManager.getZoom(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getZoomAsText() - */ - public String getZoomAsText() { - if (null == currentZoomManager) { - return DEFAULT_ZOOM_LEVEL_STRING; - } - - return currentZoomManager.getZoomAsText(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getZoomLevels() - */ - public double[] getZoomLevels() { - if (null == currentZoomManager) { - return new double[] { DEFAULT_ZOOM_LEVEL }; - } - - return currentZoomManager.getZoomLevels(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#getZoomLevelsAsText() - */ - public String[] getZoomLevelsAsText() { - if (null == currentZoomManager) { - return new String[] { DEFAULT_ZOOM_LEVEL_STRING }; - } - - return currentZoomManager.getZoomLevelsAsText(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#setUIMultiplier(double) - */ - public void setUIMultiplier(double multiplier) { - if (null == currentZoomManager) { - return; - } - - currentZoomManager.setUIMultiplier(multiplier); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#setViewLocation(Point) - */ - public void setViewLocation(Point p) { - if (null == currentZoomManager) { - return; - } - - currentZoomManager.setViewLocation(p); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#setZoom(double) - */ - public void setZoom(double zoom) { - if (null == currentZoomManager) { - return; - } - currentZoomManager.setZoom(zoom); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#setZoomAnimationStyle(int) - */ - public void setZoomAnimationStyle(int style) { - if (null == currentZoomManager) { - return; - } - currentZoomManager.setZoomAnimationStyle(style); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#setZoomAsText(String) - */ - public void setZoomAsText(String zoomString) { - if (null == currentZoomManager) { - return; - } - currentZoomManager.setZoomAsText(zoomString); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#setZoomLevels(double[]) - */ - public void setZoomLevels(double[] zoomLevels) { - if (null == currentZoomManager) { - return; - } - currentZoomManager.setZoomLevels(zoomLevels); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#zoomIn() - */ - public void zoomIn() { - if (null == currentZoomManager) { - return; - } - currentZoomManager.zoomIn(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#zoomOut() - */ - public void zoomOut() { - if (null == currentZoomManager) { - return; - } - currentZoomManager.zoomOut(); - } - - /* - * (non-Javadoc) - * - * @see ZoomManager#zoomTo(Rectangle) - */ - public void zoomTo(Rectangle rect) { - if (null == currentZoomManager) { - return; - } - currentZoomManager.zoomTo(rect); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowActionBarContributor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowActionBarContributor.java deleted file mode 100644 index 349b69d19..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowActionBarContributor.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.gef.editparts.ZoomManager; -import org.eclipse.gef.ui.actions.ActionBarContributor; -import org.eclipse.gef.ui.actions.AlignmentRetargetAction; -import org.eclipse.gef.ui.actions.DeleteRetargetAction; -import org.eclipse.gef.ui.actions.GEFActionConstants; -import org.eclipse.gef.ui.actions.RedoRetargetAction; -import org.eclipse.gef.ui.actions.UndoRetargetAction; -import org.eclipse.gef.ui.actions.ZoomComboContributionItem; -import org.eclipse.gef.ui.actions.ZoomInRetargetAction; -import org.eclipse.gef.ui.actions.ZoomOutRetargetAction; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jst.jsf.facesconfig.ui.INestedActionContributor; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.actions.ActionFactory; - -/** - * The action bar contributor for the page flow editor - * - */ -public class PageflowActionBarContributor extends ActionBarContributor - implements INestedActionContributor { - - IEditorPart activeEditor; - - /* - * (non-Javadoc) - * - * @see ActionBarContributor#buildActions() - */ - protected void buildActions() { - addRetargetAction(new UndoRetargetAction()); - addRetargetAction(new RedoRetargetAction()); - addRetargetAction(new DeleteRetargetAction()); - addRetargetAction(new ZoomInRetargetAction()); - addRetargetAction(new ZoomOutRetargetAction()); - - addRetargetAction(new AlignmentRetargetAction(PositionConstants.LEFT)); - addRetargetAction(new AlignmentRetargetAction(PositionConstants.CENTER)); - addRetargetAction(new AlignmentRetargetAction(PositionConstants.RIGHT)); - addRetargetAction(new AlignmentRetargetAction(PositionConstants.TOP)); - addRetargetAction(new AlignmentRetargetAction(PositionConstants.MIDDLE)); - addRetargetAction(new AlignmentRetargetAction(PositionConstants.BOTTOM)); - } - - /* - * (non-Javadoc) - * - * @see ActionBarContributor#declareGlobalActionKeys() - */ - public void declareGlobalActionKeys() { - // do nothing - } - - /** - * Update the action keys - */ - public void updateActionKeys() { - declareGlobalActionKeys(); - } - - /* - * (non-Javadoc) - * - * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager) - */ - public void contributeToToolBar(IToolBarManager tbm) { - tbm.add(getAction(ActionFactory.UNDO.getId())); - tbm.add(getAction(ActionFactory.REDO.getId())); - tbm.add(new Separator()); - tbm.add(getAction(GEFActionConstants.ALIGN_LEFT)); - tbm.add(getAction(GEFActionConstants.ALIGN_CENTER)); - tbm.add(getAction(GEFActionConstants.ALIGN_RIGHT)); - tbm.add(new Separator()); - tbm.add(getAction(GEFActionConstants.ALIGN_TOP)); - tbm.add(getAction(GEFActionConstants.ALIGN_MIDDLE)); - tbm.add(getAction(GEFActionConstants.ALIGN_BOTTOM)); - - tbm.add(new Separator()); - String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, - ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH }; - tbm.add(new ZoomComboContributionItem(getPage(), zoomStrings)); - } - - /* - * (non-Javadoc) - * - * @see EditorActionBarContributor#contributeToMenu(IMenuManager) - */ - public void contributeToMenu(IMenuManager menubar) { - super.contributeToMenu(menubar); - MenuManager viewMenu = new MenuManager("View"); //$NON-NLS-1$ - viewMenu.add(getAction(GEFActionConstants.ZOOM_IN)); - viewMenu.add(getAction(GEFActionConstants.ZOOM_OUT)); - menubar.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu); - } - - public void setActiveEditor(IEditorPart editor) { - if (editor instanceof PageflowEditor) { - activeEditor = editor; - // updateActionKeys(); - super.setActiveEditor(editor); - } - } - - public void update() { - if (activeEditor != null) { - ((PageflowEditor) activeEditor).updateActions(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditor.java deleted file mode 100644 index f65230ac2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditor.java +++ /dev/null @@ -1,1225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.ContextMenuProvider; -import org.eclipse.gef.DefaultEditDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.KeyHandler; -import org.eclipse.gef.KeyStroke; -import org.eclipse.gef.RootEditPart; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.gef.commands.CommandStackEvent; -import org.eclipse.gef.commands.CommandStackEventListener; -import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; -import org.eclipse.gef.editparts.ScalableRootEditPart; -import org.eclipse.gef.editparts.ZoomManager; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.gef.ui.actions.DeleteAction; -import org.eclipse.gef.ui.actions.GEFActionConstants; -import org.eclipse.gef.ui.actions.RedoAction; -import org.eclipse.gef.ui.actions.SelectionAction; -import org.eclipse.gef.ui.actions.StackAction; -import org.eclipse.gef.ui.actions.UndoAction; -import org.eclipse.gef.ui.actions.UpdateAction; -import org.eclipse.gef.ui.actions.ZoomInAction; -import org.eclipse.gef.ui.actions.ZoomOutAction; -import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette; -import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; -import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer; -import org.eclipse.gef.ui.parts.SelectionSynchronizer; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.resource.FontRegistry; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.util.TransferDropTargetListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.AlignmentAction; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.OpenEditorAction; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.ShowPropertyViewAction; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.PreExecuteCommandStack; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.ConfigurableRootEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.IConnectionPreference; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.IFigurePreference; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.ILayerPanePreference; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.INodePreference; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowEditPartsFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.FC2PFTransformer; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.EditPartMarkerUtil; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowAnnotationUtil; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowModelManager; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowResourceFactory; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheetPage; - -/** - * This the the main editor page for modifying a complete pageflow. - */ -public class PageflowEditor extends GraphicalEditorWithFlyoutPalette implements - IAdaptable, IPropertyChangeListener, IGotoMarker { - /** log instance */ - private static final Logger log = EditorPlugin - .getLogger(PageflowEditor.class); - - /** pageflow context menu registration ID */ - private static final String PAGEFLOW_CONTEXTMENU_REG_ID = ".pageflow.editor.contextmenu"; //$NON-NLS-1$ - - /** the edit domain */ - private final DefaultEditDomain domain; - - /** the palette root */ - private PaletteRoot paletteRoot = null; - - /** the parent multi-page editor */ - private IEditorPart parentEditor = null; - - /** the graphical viewer */ - private GraphicalViewer viewer = null; - - /** the undoable <code>IPropertySheetPage</code> */ - private PropertySheetPage undoablePropertySheetPage = null; - - /** the editor's action registry */ - private ActionRegistry actionRegistry = null; - - /** - * The id of the editor page - */ - public static final String PAGE_ID = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowEditor"; //$NON-NLS-1$ - - /** the list of action ids that are to EditPart actions */ - private List editPartActionIDs = new ArrayList(); - - /** the selection listener */ - private ISelectionListener selectionListener = new ISelectionListener() { - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - updateActions(); - } - }; - - /** the selection synchronizer for the edit part viewer */ - private SelectionSynchronizer synchronizer = null; - - /** the shared key handler */ - private KeyHandler sharedKeyHandler = null; - - /** pageflow model manager */ - private PageflowModelManager pageflowManager; - - /** the dirty status of this page */ - private boolean isDirty = false; - - /** the command stack of this page */ - private CommandStack commandStack; - - private FC2PFTransformer modelsTransform; - - List stackActions = new ArrayList(); - - /** - * @return the faces-config to pageflow model - */ - public FC2PFTransformer getModelsTransform() { - if (modelsTransform == null) { - modelsTransform = new FC2PFTransformer(); - } - return modelsTransform; - } - - /** - * update the editor actions - */ - public void updateActions() { - updateActions(stackActions); - updateActions(editPartActionIDs); - } - - /** - * This class listens for command stack changes of the page and decides if - * the editor is dirty or not. - * - */ - private class PageCommandStackListener implements CommandStackEventListener { - public void stackChanged(CommandStackEvent event) { - if (((CommandStack) event.getSource()).isDirty()) { - // at least one command stack is dirty, - // so the multi page editor is dirty too - setDirty(true); - } - updateActions(); - } - } - - /** - * This class listens to changes to the file system in the workspace, and - * validate the current pageflow based on web files' status. - */ - private class ResourceTracker implements IResourceChangeListener, - IResourceDeltaVisitor { - /* - * (non-Javadoc) - * - * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - try { - if (delta != null) { - delta.accept(this); - } - } catch (CoreException exception) { - // Pageflow.PageflowEditor.Error.ResourceChange = Failed in the - // resource change. - log.error("Pageflow.PageflowEditor.Error.ResourceChange", //$NON-NLS-1$ - exception); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) - */ - public boolean visit(IResourceDelta delta) { - // if the delta is not a file instance, just return true - if (!(delta.getResource() instanceof IFile)) { - return true; - } - - // web file is changed. - if (WebrootUtil.isValidWebFile(((IFile) delta.getResource()) - .getFullPath())) { - webPageChanged(((IFile) delta.getResource()).getFullPath()); - return false; - } - return false; - } - } - - /** the resource tracker instance */ - private ResourceTracker resourceTracker = null; - - /** - * Returns the resource tracker instance - * - * @return - Returns the resource tracker instance - */ - private ResourceTracker getResourceTracker() { - if (null == resourceTracker) { - resourceTracker = new ResourceTracker(); - } - return resourceTracker; - } - - /** - * Changes the dirty state. - * - * @param dirty - - * dirty state - */ - protected void setDirty(boolean dirty) { - if (isDirty != dirty) { - isDirty = dirty; - } - } - - /** - * Updates the specified actions. - * - * @param actionIds - - * the list of ids of actions to update - */ - protected void updateActions(List actionIds) { - for (Iterator ids = actionIds.iterator(); ids.hasNext();) { - IAction action = getActionRegistry().getAction(ids.next()); - if (null != action && action instanceof UpdateAction) { - ((UpdateAction) action).update(); - } - } - } - - /** - * Creates a new PageflowPage instance. - * <p> - * By design this page uses its own <code>EditDomain</code>. The main - * goal of this approach is that this page has its own undo/redo command - * stack. - * - * @param parent - - * the parent multi page editor - */ - public PageflowEditor(IEditorPart parent) { - domain = new DefaultEditDomain(parent); - domain.setCommandStack(getCommandStack()); - this.setEditDomain(domain); - parentEditor = parent; - } - - /** - * Adds an <code>CommandStack</code> action to this editor. - * <p> - * <code>CommandStack</code> actions are actions that depend and work on - * the <code>CommandStack</code>. - * - * @param action - - * the <code>CommandStack</code> action - */ - protected void addStackAction(StackAction action) { - getActionRegistry().registerAction(action); - stackActions.add(action.getId()); - } - - /** - * Creates different kinds of actions and registers them to the - * ActionRegistry. - */ - protected void createActions() { - // register delete action - addEditPartAction(new DeleteAction((IWorkbenchPart) this)); - // register undo/redo action - addStackAction(new UndoAction(this)); - addStackAction(new RedoAction(this)); - - // Allows opening of JSP files from the pageflow - addEditPartAction(new OpenEditorAction(this)); - - // Allows showing property view for the pageflow - SelectionAction action = new ShowPropertyViewAction(this); - action - .setImageDescriptor(getImageDescriptorForView("org.eclipse.ui.views.PropertySheet")); //$NON-NLS-1$ - addEditPartAction(action); - // Allows showing property view for the pageflow - // addEditPartAction(new ShowPaletteViewAction((IWorkbenchPart) this)); - - // register alignment actions - addEditPartAction(new AlignmentAction((IWorkbenchPart) this, - PositionConstants.LEFT)); - addEditPartAction(new AlignmentAction((IWorkbenchPart) this, - PositionConstants.RIGHT)); - addEditPartAction(new AlignmentAction((IWorkbenchPart) this, - PositionConstants.TOP)); - addEditPartAction(new AlignmentAction((IWorkbenchPart) this, - PositionConstants.BOTTOM)); - addEditPartAction(new AlignmentAction((IWorkbenchPart) this, - PositionConstants.CENTER)); - addEditPartAction(new AlignmentAction((IWorkbenchPart) this, - PositionConstants.MIDDLE)); - - // register zoom in/out action - IAction zoomIn = new ZoomInAction(getZoomManager(getGraphicalViewer())); - IAction zoomOut = new ZoomOutAction( - getZoomManager(getGraphicalViewer())); - addAction(zoomIn); - addAction(zoomOut); - -// getSite().getKeyBindingService().registerAction(zoomIn); -// getSite().getKeyBindingService().registerAction(zoomOut); - } - - /** - * Returns the zoom manager of the specified viewer. - * - * @param viewer_ - - * the viewer to get the zoom manager from - * @return - the zoom manager - */ - private ZoomManager getZoomManager(GraphicalViewer viewer_) { - // get zoom manager from root edit part - RootEditPart rootEditPart = viewer_.getRootEditPart(); - ZoomManager zoomManager = null; - if (rootEditPart instanceof ScalableFreeformRootEditPart) { - zoomManager = ((ScalableFreeformRootEditPart) rootEditPart) - .getZoomManager(); - } else if (rootEditPart instanceof ScalableRootEditPart) { - zoomManager = ((ScalableRootEditPart) rootEditPart) - .getZoomManager(); - } - return zoomManager; - } - - /** - * Adds an action to this editor's <code>ActionRegistry</code>. - * - * @param action - - * the action to add. - */ - protected void addAction(IAction action) { - getActionRegistry().registerAction(action); - } - - /** - * Adds an <code>EditPart</code> action to this editor. - * <p> - * <code>EditPart</code> actions are actions that depend and work on the - * selected <code>EditPart</code>s. - * - * @param action - - * the <code>EditPart</code> action - */ - protected void addEditPartAction(SelectionAction action) { - getActionRegistry().registerAction(action); - editPartActionIDs.add(action.getId()); - } - - /** - * Returns the action registry of this editor. - * - * @return - the action registry - */ - public ActionRegistry getActionRegistry() { - if (null == actionRegistry) { - actionRegistry = new ActionRegistry(); - } - - return actionRegistry; - } - - /** - * Creates the GraphicalViewer on the specified <code>Composite</code>. - * - * @param parent - - * the parent composite - */ - public void createGraphicalViewer(Composite parent) { - viewer = new ScrollingGraphicalViewer(); - viewer.createControl(parent); - - // configure the viewer - viewer.getControl().setBackground(parent.getBackground()); - - viewer.setRootEditPart(new ConfigurableRootEditPart()); - // _viewer.setRootEditPart(new ScalableFreeformRootEditPart()); - viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer)); - - // hook the viewer into the editor - registerEditPartViewer(viewer); - - // configure the viewer with context menu and template drag and drop - configureEditPartViewer(viewer); - - // initialize the viewer with input - viewer.setEditPartFactory(new PageflowEditPartsFactory()); - // viewer.setContents(getPageflow()); - - // support the resource drag&drop - viewer - .addDropTargetListener((TransferDropTargetListener) new ResourceTransferDropTargetListener( - viewer, getParentEditor()) { - protected CreationFactory getFactory(Object obj) { - return getResourceFactory((IResource) obj); - } - }); - - // apply Editor's preferences - // propertyChange(null); - // add listener to Editor's preferences changing - EditorPlugin.getDefault().getPreferenceStore() - .addPropertyChangeListener(this); - } - - private CreationFactory getResourceFactory(IResource resource) { - return new PageflowResourceFactory(resource); - } - - /* - * (non-Javadoc) - * - * @see ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ - public final void doSave(IProgressMonitor monitor) { - // our policy: delegate saving to the parent - getParentEditor().doSave(monitor); - } - - /* - * (non-Javadoc) - * - * @see ISaveablePart#doSaveAs() - */ - public final void doSaveAs() { - // our policy: delegate saving to the parent - getParentEditor().doSaveAs(); - } - - /** - * Saves the pageflow under the specified path. - * @param file - * - * @param progressMonitor - * @throws CoreException - */ - public void doSave(IFile file, IProgressMonitor progressMonitor) - throws CoreException { - if (((FileEditorInput) getEditorInput()).getFile() != file) { - // TODO: save to other page. - } - if (null == progressMonitor) { - progressMonitor = new NullProgressMonitor(); - } - // Pageflow.Label.Saving = Saving - progressMonitor.beginTask(PageflowMessages.Pageflow_Label_Saving + " " //$NON-NLS-1$ - + file.getFullPath(), 2); - - if (null == getPageflowManager()) { - // Pageflow.PageflowEditor.Alert.nullModelManager = No model manager - // found for saving the file. - EditorPlugin.getAlerts().throwCoreException( - "Pageflow.PageflowEditor.Alert.nullModelManager"); //$NON-NLS-1$ - } - - // save pageflow to file - try { - getPageflowManager().save(getPageflowFilePath(file)); - - progressMonitor.worked(1); - file.refreshLocal(IResource.DEPTH_ZERO, new SubProgressMonitor( - progressMonitor, 1)); - progressMonitor.done(); - setDirty(false); - } catch (FileNotFoundException e) { - // Pageflow.PageflowEditor.Alert.errorSaveFileInfo = The current - // pageflow model could not be saved. - EditorPlugin.getAlerts().throwCoreException(e); - } catch (IOException e) { - // Pageflow.PageflowEditor.Alert.errorSaveFileInfo = The current - // pageflow model could not be saved. - EditorPlugin.getAlerts().throwCoreException(e); - } - } - - /* - * (non-Javadoc) - * - * @see IEditorPart#init(org.eclipse.ui.IEditorSite, - * org.eclipse.ui.IEditorInput) - */ - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - setSite(site); - setInput(input); - IFile fileFacesConfig = null; - try { - fileFacesConfig = ((FileEditorInput) input).getFile(); - - // load and validate pageflow - if (null == createPageflow(getPageflowFilePath(fileFacesConfig))) { - // Pageflow.PageflowEditor.Error.invalidPageflowFile = The - // specified input is not a valid pageflow. - log.error("Pageflow.PageflowEditor.Error.invalidPageflowFile"); //$NON-NLS-1$ - throw new PartInitException( - EditorPlugin - .getResourceString("Pageflow.PageflowEditor.Error.invalidPageflowFile")); //$NON-NLS-1$ - } - - } catch (CoreException e) { - // Pageflow.PageflowEditor.Error.invalidPageflowFile = The specified - // input is not a valid pageflow. - log.error("Pageflow.PageflowEditor.Error.invalidPageflowFile", e); //$NON-NLS-1$ - throw new PartInitException(e.getStatus()); - } catch (IOException e) { - // Pageflow.PageflowEditor.Alert.errorSaveFileInfo = The current - // pageflow model could not be saved. - log.error("Pageflow.PageflowEditor.Alert.errorSaveFileInfo", e); //$NON-NLS-1$ - } - - // add selection change listener - getSite().getWorkbenchWindow().getSelectionService() - .addSelectionListener(getSelectionListener()); - - // Add resource change listener - fileFacesConfig.getWorkspace().addResourceChangeListener( - getResourceTracker()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - // remove selection change listener - getModelsTransform().dispose(); - getSite().getWorkbenchWindow().getSelectionService() - .removeSelectionListener(getSelectionListener()); - - // remove listener to Editor's preferences changing - EditorPlugin.getDefault().getPreferenceStore() - .removePropertyChangeListener(this); - - if (getEditorInput() != null) { - IFile file = (IFile) getEditorInput().getAdapter(IResource.class); - if (file != null) { - file.getWorkspace().removeResourceChangeListener( - getResourceTracker()); - } - } - super.dispose(); - } - - /** - * get the pageflow file path based on faces-config.xml file path - * - * @return - */ - private IPath getPageflowFilePath(IFile file) { - IPath pageflowFilePath; - pageflowFilePath = PageflowModelManager.makePageflowPath(file - .getFullPath()); - return pageflowFilePath; - } - - /** - * Returns the pageflow object from the specified file. - * - * @param file - - * the file resource - * @return -the pageflow object from the specified file - * @throws IOException - */ - private Pageflow createPageflow(IPath pathPageflow) throws CoreException, - IOException { - Pageflow pageflow = null; - - try { - getPageflowManager().load(pathPageflow); - } catch (Exception e) { - // Pageflow.PageflowEditor.Error.invalidPageflowFile = The specified - // input is not a valid pageflow. - // _log.error("Pageflow.PageflowEditor.Error.invalidPageflowFile", - // e); - getPageflowManager().createPageflow(pathPageflow); - } - IFile fileFacesConfig = ((FileEditorInput) getEditorInput()).getFile(); - // it should update related config file - if (!fileFacesConfig.getFullPath().toString().trim().equalsIgnoreCase( - getPageflowManager().getModel().getConfigfile())) { - getPageflowManager().getModel().setConfigfile( - fileFacesConfig.getFullPath().toString()); - getPageflowManager().save(pathPageflow); - } - pageflow = getPageflowManager().getModel(); - if (null == pageflow) { - // Pageflow.PageflowEditor.Error.invalidPageflowModel = The model in - // the pageflow file is not a valid pageflow model. - log.error("Pageflow.PageflowEditor.Error.invalidPageflowModel"); //$NON-NLS-1$ - EditorPlugin.getAlerts().throwCoreException( - "Pageflow.PageflowEditor.Error.invalidPageflowModel"); //$NON-NLS-1$ - } - return pageflow; - } - - /** get the pageflow manager for this page - * @return the model manager - */ - public PageflowModelManager getPageflowManager() { - if (pageflowManager == null) { - pageflowManager = new PageflowModelManager(); - } - return pageflowManager; - } - - /* - * (non-Javadoc) - * - * @see ISaveablePart#isDirty() - */ - public final boolean isDirty() { - return isDirty; - } - - /** - * Returns the <code>CommandStack</code> of this editor page. - * - * @return - the <code>CommandStack</code> of this editor page - */ - public final CommandStack getCommandStack() { - if (commandStack == null) { - commandStack = new PreExecuteCommandStack(); - commandStack - .addCommandStackEventListener(new PageCommandStackListener()); - } - return commandStack; - } - - /** - * Returns the default <code>PaletteRoot</code> for this editor and all - * its pages. - * - * @return - the default <code>PaletteRoot</code> - */ - protected PaletteRoot getPaletteRoot() { - if (null == paletteRoot) { - // create root - paletteRoot = new PageflowPaletteRoot(); - } - return paletteRoot; - } - - /* - * (non-Javadoc) - * - * @see ISaveablePart#isSaveAsAllowed() - */ - public final boolean isSaveAsAllowed() { - // our policy: delegate saving to the parent - return getParentEditor().isSaveAsAllowed(); - } - - /* - * (non-Javadoc) - * - * @see IWorkbenchPart#setFocus() - */ - public void setFocus() { - getGraphicalViewer().getControl().setFocus(); - } - - /** - * Returns the multi page pageflow editor this editor page is contained in. - * - * @return - the parent multi page editor - */ - protected final IEditorPart getParentEditor() { - return parentEditor; - } - - /** - * Returns the edit domain this editor page uses. - * - * @return - the edit domain this editor page uses - */ - public final DefaultEditDomain getEditDomain() { - return domain; - } - - /** - * Hooks a <code>EditPartViewer</code> to the rest of the Editor. - * <p> - * By default, the viewer is added to the SelectionSynchronizer, which can - * be used to keep 2 or more EditPartViewers in sync. The viewer is also - * registered as the ISelectionProvider for the Editor's PartSite. - * - * @param viewer_ - - * the viewer to hook into the editor - */ - protected void registerEditPartViewer(EditPartViewer viewer_) { - // register viewer to edit domain - getEditDomain().addViewer(viewer_); - - // the multi page pageflow editor keeps track of synchronizing - getSelectionSynchronizer().addViewer(viewer_); - - // add viewer as selection provider - getSite().setSelectionProvider(viewer_); - } - - /** - * Configures the specified <code>EditPartViewer</code> including context - * menu, key handler, etc. - * - * @param viewer_ - - * the pageflow graphical viewer. - */ - protected void configureEditPartViewer(EditPartViewer viewer_) { - // configure the shared key handler - if (null != viewer_.getKeyHandler()) { - viewer_.getKeyHandler().setParent(getSharedKeyHandler()); - } - // create the ActionRegistry - createActions(); - - // append the parent editor's action registry. - ActionRegistry actionRegistry_ = (ActionRegistry) getParentEditor() - .getAdapter(ActionRegistry.class); - if (actionRegistry_ != null) { - for (Iterator iter = actionRegistry_.getActions(); iter.hasNext();) { - getActionRegistry().registerAction((IAction) iter.next()); - } - } - // configure and register the context menu - ContextMenuProvider provider = new PageflowEditorContextMenuProvider( - viewer_, getActionRegistry()); - viewer_.setContextMenu(provider); - getSite().registerContextMenu( - EditorPlugin.getPluginId() + PAGEFLOW_CONTEXTMENU_REG_ID, - provider, getSite().getSelectionProvider()); - - // enable viewer as drop target for template transfers - viewer_ - .addDropTargetListener((TransferDropTargetListener) new PageflowTemplateTransferDropTargetListener( - viewer_)); - - } - - /** - * Returns the pageflow that is edited. - * - * @return - the pageflow that is edited - */ - public Pageflow getPageflow() { - return getPageflowManager().getModel(); - } - - /* - * (non-Javadoc) - * - * @see AbstractEditorPage#getGraphicalViewerForZoomSupport() - */ - public GraphicalViewer getGraphicalViewer() { - return viewer; - } - - /** - * @param contents - */ - public void setGraphicalViewerContents(Object contents) { - viewer.setContents(contents); - propertyChange(null); - } - - /* - * (non-Javadoc) - * - * @see IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class type) { - if (type == IContentOutlinePage.class) { - return getOutlinePage(); - } else if (type == CommandStack.class) { - return getCommandStack(); - } else if (type == ActionRegistry.class) { - return getActionRegistry(); - } else if (type == IPropertySheetPage.class) { - return getPropertySheetPage(); - } else if (type == ZoomManager.class) { - return getZoomManager(getGraphicalViewer()); - } - return super.getAdapter(type); - } - - /** - * Returns the outline page for the outline view with lazy creation - * - * @return - the outline page - */ - protected PageflowEditorOutlinePage getOutlinePage() { - PageflowEditorOutlinePage outlinePage = new PageflowEditorOutlinePage( - this); - outlinePage.initialize(this); - return outlinePage; - } - - /** - * Returns the undoable <code>PropertySheetPage</code> for this editor. - * - * @return - the undoable <code>PropertySheetPage</code> - */ - protected IPropertySheetPage getPropertySheetPage() { - if (null == undoablePropertySheetPage) { - undoablePropertySheetPage = new PropertySheetPage(); - - /** set the property source for property sheet page */ - undoablePropertySheetPage - .setRootEntry(new org.eclipse.gef.ui.properties.UndoablePropertySheetEntry( - (CommandStack) getAdapter(CommandStack.class))); - - } - - return undoablePropertySheetPage; - } - - /** - * Returns the selection syncronizer object. The synchronizer can be used to - * sync the selection of 2 or more EditPartViewers. - * - * @return - the syncrhonizer - */ - protected SelectionSynchronizer getSelectionSynchronizer() { - if (null == synchronizer) { - synchronizer = new SelectionSynchronizer(); - } - return synchronizer; - } - - /** - * Returns the shared KeyHandler that should be used for all viewers. - * - * @return - the shared KeyHandler - */ - protected KeyHandler getSharedKeyHandler() { - if (null == sharedKeyHandler) { - sharedKeyHandler = new KeyHandler(); - - // configure common keys for all viewers - sharedKeyHandler - .put(KeyStroke.getPressed(SWT.DEL, 127, 0), - getActionRegistry().getAction( - ActionFactory.DELETE.getId())); - sharedKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), - getActionRegistry().getAction( - GEFActionConstants.DIRECT_EDIT)); - } - return sharedKeyHandler; - } - - /** - * Returns the selection listener. - * - * @return - the <code>ISelectionListener</code> - */ - protected ISelectionListener getSelectionListener() { - return selectionListener; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - String property = (event == null) ? null : event.getProperty(); - - propagateProperty(property, viewer.getRootEditPart()); - } - - /** - * propagate property change to children edit part - * - * @param property - - * property's string name - * @param part - - * parent edit part. - */ - private void propagateProperty(String property, EditPart part) { - processPropertyChange(property, part); - - if (part instanceof GraphicalEditPart) { - // get the connections edit part - Iterator iterConns = ((GraphicalEditPart) part) - .getSourceConnections().iterator(); - while (iterConns.hasNext()) { - EditPart child = (EditPart) iterConns.next(); - propagateProperty(property, child); - } - } - Iterator iter = part.getChildren().iterator(); - while (iter.hasNext()) { - EditPart child = (EditPart) iter.next(); - propagateProperty(property, child); - } - } - - /** - * process the property change FIXME: The property change should be category - * to improve the performance. - * - * @param property - - * property's string name - * @param part - */ - private void processPropertyChange(String property, EditPart part) { - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - - if (property != null - && property.equals(GEMPreferences.USE_SYSTEM_COLORS)) { - // reload all properties - it's easiest - property = null; - } - - if (property == null || GEMPreferences.SNAP_TO_GRID.equals(property)) { - boolean bSnapToGrid = store.getBoolean(GEMPreferences.SNAP_TO_GRID); - if (part instanceof ILayerPanePreference) { - ((ILayerPanePreference) part).setGridVisible(bSnapToGrid); - } - } - - if (property == null || GEMPreferences.GRID_WIDTH.equals(property) - || GEMPreferences.GRID_HEIGHT.equals(property)) { - Dimension gridSpacing = new Dimension(store - .getInt(GEMPreferences.GRID_WIDTH), store - .getInt(GEMPreferences.GRID_HEIGHT)); - if (part instanceof ILayerPanePreference) { - ((ILayerPanePreference) part).setGridSpacing(gridSpacing); - } - } - - if (property == null || GEMPreferences.GRID_COLOR.equals(property)) { - Color gridFgColor = GEMPreferences.getColor(store, - GEMPreferences.GRID_COLOR); - if (part instanceof ILayerPanePreference) { - ((ILayerPanePreference) part) - .setGridForegroundColor(gridFgColor); - } - } - - if (property == null || GEMPreferences.CANVAS_COLOR.equals(property)) { - Color containerBgColor = GEMPreferences.getColor(store, - GEMPreferences.CANVAS_COLOR); - if (part instanceof IFigurePreference) { - ((IFigurePreference) part).setBackgroundColor(containerBgColor); - } - } - - if (property == null || GEMPreferences.LINE_WIDTH.equals(property)) { - int linkLineWidth = store.getInt(GEMPreferences.LINE_WIDTH); - - if (part instanceof IConnectionPreference) { - ((IConnectionPreference) part).setLineWidth(linkLineWidth); - } - } - - if (property == null || GEMPreferences.LINE_COLOR.equals(property)) { - Color linkLineColor = GEMPreferences.getColor(store, - GEMPreferences.LINE_COLOR); - if (part instanceof IConnectionPreference) { - ((IConnectionPreference) part) - .setForegroundColor(linkLineColor); - } - } - - if (property == null - || GEMPreferences.SHOW_LINE_LABELS.equals(property)) { - boolean bLinkLabelVisible = store - .getBoolean(GEMPreferences.SHOW_LINE_LABELS); - if (part instanceof IConnectionPreference) { - ((IConnectionPreference) part) - .setLabelVisible(bLinkLabelVisible); - } - } - - if (property == null || GEMPreferences.LINE_LABEL_FONT.equals(property) - || GEMPreferences.LINE_LABEL_FONT_COLOR.equals(property)) { - Font linkLabelFont = getLinkLabelFont(); - Color linkLabelFgColor = GEMPreferences.getColor(store, - GEMPreferences.LINE_LABEL_FONT_COLOR); - if (part instanceof IConnectionPreference) { - ((IConnectionPreference) part).setFont(linkLabelFont); - ((IConnectionPreference) part) - .setLabelForegroundColor(linkLabelFgColor); - } - } - - if (property == null - || GEMPreferences.LINE_LABEL_COLOR.equals(property)) { - Color linkLabelBgColor = GEMPreferences.getColor(store, - GEMPreferences.LINE_LABEL_COLOR); - if (part instanceof IConnectionPreference) { - ((IConnectionPreference) part) - .setLabelBackgroundColor(linkLabelBgColor); - } - } - - if (property == null || GEMPreferences.LINE_ROUTING.equals(property)) { - String connectionStyle = store - .getString(GEMPreferences.LINE_ROUTING); - int style; - if (GEMPreferences.LINE_ROUTING_MANHATTAN.equals(connectionStyle)) { - style = ILayerPanePreference.LINE_ROUTING_MANHATTAN; - } else { - style = ILayerPanePreference.LINE_ROUTING_MANUAL; - } - - if (part instanceof ILayerPanePreference) { - ((ILayerPanePreference) part).setConnectionRouterStyle(style); - } else if (part instanceof IConnectionPreference) { - ((IConnectionPreference) part).setConnectionRouterStyle(style); - } - } - - if (property == null - || GEMPreferences.FIGURE_LABEL_FONT.equals(property) - || GEMPreferences.FIGURE_LABEL_FONT_COLOR.equals(property)) { - Font nodeLabelFont = getNodeLabelFont(); - Color nodeLabelFgColor = GEMPreferences.getColor(store, - GEMPreferences.FIGURE_LABEL_FONT_COLOR); - - if (part instanceof INodePreference) { - ((INodePreference) part).setFont(nodeLabelFont); - ((INodePreference) part).setForegroundColor(nodeLabelFgColor); - } - } - - if (property == null || GEMPreferences.LABEL_PLACEMENT.equals(property)) { - int placement = PositionConstants.SOUTH; - String nodeLabelPlacement = store - .getString(GEMPreferences.LABEL_PLACEMENT); - if (GEMPreferences.LABEL_PLACEMENT_TOP.equals(nodeLabelPlacement)) - placement = PositionConstants.NORTH; - else if (GEMPreferences.LABEL_PLACEMENT_BOTTOM - .equals(nodeLabelPlacement)) - placement = PositionConstants.SOUTH; - else if (GEMPreferences.LABEL_PLACEMENT_LEFT - .equals(nodeLabelPlacement)) - placement = PositionConstants.WEST; - else if (GEMPreferences.LABEL_PLACEMENT_RIGHT - .equals(nodeLabelPlacement)) - placement = PositionConstants.EAST; - if (part instanceof INodePreference) - ((INodePreference) part).setTextPlacement(placement); - } - } - - private Font getLinkLabelFont() { - FontRegistry registry = JFaceResources.getFontRegistry(); - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - FontData fontData = PreferenceConverter.getFontData(store, - GEMPreferences.LINE_LABEL_FONT); - if (!registry.get(fontData.toString()).equals(registry.defaultFont())) - return registry.get(fontData.toString()); - - registry.put(fontData.toString(), new FontData[] {fontData}); - return registry.get(fontData.toString()); - } - - private Font getNodeLabelFont() { - FontRegistry registry = JFaceResources.getFontRegistry(); - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - FontData fontData = PreferenceConverter.getFontData(store, - GEMPreferences.FIGURE_LABEL_FONT); - if (!registry.get(fontData.toString()).equals(registry.defaultFont())) - return registry.get(fontData.toString()); - - registry.put(fontData.toString(), new FontData[] {fontData}); - return registry.get(fontData.toString()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.ide.IGotoMarker#gotoMarker(org.eclipse.core.resources.IMarker) - */ - public void gotoMarker(IMarker marker) { - // The LOCATION attribute in the marker should be the ID string - Object id = null; - try { - id = marker.getAttribute(IMarker.LOCATION); - } catch (CoreException e) { - // Pageflow.PageflowEditor.Error.invalidMarkerAttribute = Unable to - // get marker's attribute - log - .error( - "Pageflow.PageflowEditor.Error.invalidMarkerAttribute", //$NON-NLS-1$ - e); - } - if (id instanceof String) { - GraphicalEditPart part = EditPartMarkerUtil.findEditPart( - (GraphicalEditPart) getGraphicalViewer().getRootEditPart(), - (String) id); - if (part != null) { - getGraphicalViewer().reveal(part); - getGraphicalViewer().select(part); - return; - } - } - - } - - /** - * the related web page is changed in outside editor, the pageflow should be - * revalidated to update the validation icons - * - * @param fullPath - */ - public void webPageChanged(IPath fullPath) { - PageflowPage page = getPageflowManager().foundPage( - WebrootUtil.getWebPath(fullPath)); - - if (page != null && getGraphicalViewer() != null - && getGraphicalViewer().getRootEditPart() != null) { - GraphicalEditPart pagePart = EditPartMarkerUtil.findEditPart( - (GraphicalEditPart) getGraphicalViewer().getRootEditPart(), - page.getId()); - PageflowAnnotationUtil - .validatePage((PageflowNodeEditPart) pagePart); - } - } - - /** - * Get the image desriptor from the view's id. - * - * @param viewid - * @return - */ - private ImageDescriptor getImageDescriptorForView(String viewid) { - IConfigurationElement[] elements = Platform.getExtensionRegistry() - .getConfigurationElementsFor("org.eclipse.ui.views"); //$NON-NLS-1$ - for (int i = 0; i < elements.length; i++) { - String name = elements[i].getName(); - String id = elements[i].getAttribute("id"); //$NON-NLS-1$ - if ("view".equals(name) && viewid.equals(id)) { //$NON-NLS-1$ - String iconPath = elements[i].getAttribute("icon"); //$NON-NLS-1$ - if (iconPath != null) { - return AbstractUIPlugin.imageDescriptorFromPlugin( - elements[i].getDeclaringExtension().getContributor().getName(), - iconPath); - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditorContextMenuProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditorContextMenuProvider.java deleted file mode 100644 index 3e239190d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditorContextMenuProvider.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.gef.ContextMenuProvider; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.gef.ui.actions.GEFActionConstants; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.ShowPropertyViewAction; -import org.eclipse.ui.actions.ActionFactory; - -/** - * This is the context menu provider for pageflow editor. - * - */ -public class PageflowEditorContextMenuProvider extends ContextMenuProvider { - /** the action registry */ - private final ActionRegistry actionRegistry; - - /** - * Creates a new PageflowEditorContextMenuProvider instance. - * - * @param viewer - - * the editor viewer - * @param actionRegistry - - * action registry of the editor - */ - public PageflowEditorContextMenuProvider(EditPartViewer viewer, - ActionRegistry actionRegistry) { - super(viewer); - - this.actionRegistry = actionRegistry; - } - - /* - * (non-Javadoc) - * - * @see ContextMenuProvider#buildContextMenu(IMenuManager) - */ - public void buildContextMenu(IMenuManager menuManager) { - // add GEF menu groups, such as undo, edit, save, etc. - GEFActionConstants.addStandardActionGroups(menuManager); - - // add typical undo/redo commands - appendActionToUndoGroup(menuManager, ActionFactory.UNDO.getId()); - appendActionToUndoGroup(menuManager, ActionFactory.REDO.getId()); - // add edit commands, including copy, paste, delete - appendActionToEditGroup(menuManager, ActionFactory.COPY.getId()); - appendActionToEditGroup(menuManager, ActionFactory.PASTE.getId()); - appendActionToEditGroup(menuManager, ActionFactory.DELETE.getId()); - // Add Open Editor Action - appendActionToEditGroup(menuManager, FacesConfigEditor.EDITOR_ID); - - // append the save submenu - appendActionToSaveGroup(menuManager, ActionFactory.SAVE.getId()); - - // append the alignment submenu, including top, bottom, middle, left, - // right and center. - appendAlignmentSubmenu(menuManager); - - appendShowViewSubmenu(menuManager); - - } - - /** - * Appends the alignment subment. - * - * @param menuManager - * manager of workbench - */ - private void appendShowViewSubmenu(IMenuManager menuManager) { - // Show View Actions - MenuManager submenu = new MenuManager( - PageflowMessages.Pageflow_Contextmenu_ShowView_Label); - - IAction action = getActionRegistry().getAction( - ShowPropertyViewAction.SHOW_PROPERTY_VIEW); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - // action = getActionRegistry().getAction( - // ShowPaletteViewAction.SHOW_PALETTE_VIEW); - // if (null != action && action.isEnabled()) { - // submenu.add(action); - // } - - if (!submenu.isEmpty()) { - menuManager.appendToGroup(GEFActionConstants.GROUP_REST, submenu); - } - } - - /** - * Appends the alignment subment. - * - * @param menuManager - * manager of workbench - */ - private void appendAlignmentSubmenu(IMenuManager menuManager) { - // Alignment Actions - MenuManager submenu = new MenuManager( - PageflowMessages.Pageflow_Contextmenu_Align_Label); - - IAction action = getActionRegistry().getAction( - GEFActionConstants.ALIGN_LEFT); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - action = getActionRegistry().getAction(GEFActionConstants.ALIGN_CENTER); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - action = getActionRegistry().getAction(GEFActionConstants.ALIGN_RIGHT); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - action = getActionRegistry().getAction(GEFActionConstants.ALIGN_TOP); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - action = getActionRegistry().getAction(GEFActionConstants.ALIGN_MIDDLE); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - action = getActionRegistry().getAction(GEFActionConstants.ALIGN_BOTTOM); - if (null != action && action.isEnabled()) { - submenu.add(action); - } - - if (!submenu.isEmpty()) { - menuManager.appendToGroup(GEFActionConstants.GROUP_EDIT, submenu); - } - } - - /** - * Returns the action registry. - * - * @return - the action registry - */ - protected ActionRegistry getActionRegistry() { - return actionRegistry; - } - - /** - * Appends the specified action to the specified menu group - * - * @param menu - - * menu manager - * @param actionId - - * action's ID - * @param menuGroup - - * menu group name - */ - // TODO: dead code -// private void appendActionToMenu(IMenuManager menu, String actionId, -// String menuGroup) { -// IAction action = getActionRegistry().getAction(actionId); -// if (null != action && action.isEnabled()) { -// menu.appendToGroup(menuGroup, action); -// } -// } - - /** - * Appends the specified action to the 'Undo' menu group - * - * @param menu - - * menu manager - * @param actionId - - * action's ID - */ - private void appendActionToUndoGroup(IMenuManager menu, String actionId) { - IAction action = getActionRegistry().getAction(actionId); - if (null != action && action.isEnabled()) { - menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); - } - } - - /** - * Appends the specified action to the 'edit' menu group - * - * @param menu - - * menu manager - * @param actionId - - * action's ID - */ - private void appendActionToEditGroup(IMenuManager menu, String actionId) { - IAction action = getActionRegistry().getAction(actionId); - if (null != action && action.isEnabled()) { - menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); - } - } - - /** - * Appends the specified action to the 'add' menu group - * - * @param menu - - * menu manager - * @param actionId - - * action's ID - */ - // TODO: dead code -// private void appendActionToAddGroup(IMenuManager menu, String actionId) { -// IAction action = getActionRegistry().getAction(actionId); -// if (null != action && action.isEnabled()) { -// menu.appendToGroup(GEFActionConstants.GROUP_ADD, action); -// } -// } - - /** - * Appends the specified action to the 'save' menu group - * - * @param menu - - * menu manager - * @param actionId - - * action's ID - */ - private void appendActionToSaveGroup(IMenuManager menu, String actionId) { - IAction action = getActionRegistry().getAction(actionId); - if (null != action && action.isEnabled()) { - menu.appendToGroup(GEFActionConstants.GROUP_SAVE, action); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditorOutlinePage.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditorOutlinePage.java deleted file mode 100644 index 82ca489ab..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowEditorOutlinePage.java +++ /dev/null @@ -1,545 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LightweightSystem; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Viewport; -import org.eclipse.draw2d.parts.ScrollableThumbnail; -import org.eclipse.gef.ContextMenuProvider; -import org.eclipse.gef.EditDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartListener; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.RootEditPart; -import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; -import org.eclipse.gef.editparts.ScalableRootEditPart; -import org.eclipse.gef.ui.parts.TreeViewer; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowTreePartFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Canvas; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.part.EditorPart; -import org.eclipse.ui.part.Page; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; - -/** - * This is an implementation of an outline page showing an overview figure and - * an tree outline of the main graphical viewer provided by the current active - * page of an multi page editor. - * - */ -public class PageflowEditorOutlinePage extends Page implements - IContentOutlinePage { - /** the pageflow editor */ - private final PageflowEditor editor; - - /** the outlineContent for the tree viewer */ - private PageflowElement outlineContent = null; - - /** the control of the overview */ - private Canvas overview = null; - - /** the root edit part (outlineContent for the thumbnail) */ - private RootEditPart overviewContent = null; - - /** the thumbnail */ - private ScrollableThumbnail thumbnail = null; - - /** the tree viewer */ - private TreeViewer treeViewer = null; - - /** the control of the tree view */ - private Control outline = null; - - /** the pagebook */ - private PageBook pageBook = null; - - /** action for showing the tree page */ - private IAction showOutlineAction = null; - - /** action for showing the overview page */ - private IAction showOverviewAction = null; - - /** the LightweightSystem */ - private LightweightSystem lws = null; - - /** the edit domain */ - private EditDomain editDomain = null; - - /** - * Creates a new PageflowEditorOutlinePage instance. - * - * @param editor - - * Pageflow Editor - */ - public PageflowEditorOutlinePage(EditorPart editor) { - super(); - this.editor = (PageflowEditor) editor; - } - - /* - * (non-Javadoc) - * - * @see ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener) - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - getTreeViewer().addSelectionChangedListener(listener); - } - - /* - * (non-Javadoc) - * - * @see IPage#createControl(Composite) - */ - public void createControl(Composite parent) { - // pagebook - pageBook = new PageBook(parent, SWT.NONE); - - // tree viewer control - outline = getTreeViewer().createControl(pageBook); - configureEditPartViewer(getTreeViewer()); - - // overview canvas - overview = new Canvas(pageBook, SWT.NONE); - lws = new LightweightSystem(overview); - - // create actions - IToolBarManager tbm = getSite().getActionBars().getToolBarManager(); - showOutlineAction = new Action() { - public void run() { - showPage(outline); - } - }; - showOutlineAction.setImageDescriptor(EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/Pageflow_Outline.gif")); //$NON-NLS-1$ - tbm.add(showOutlineAction); - showOverviewAction = new Action() { - public void run() { - showPage(overview); - } - }; - showOverviewAction.setImageDescriptor(EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/Pageflow_Outline_Overview.gif")); //$NON-NLS-1$ - tbm.add(showOverviewAction); - - // initialize outline page - initializeOutlineViewer(); - - // initialize overview - initializeOverview(); - - // initialize pagebook - showPage(outline); - } - - /** - * Configures the outline viewer - */ - private void initializeOutlineViewer() { - if (null != getEditDomain()) { - getEditDomain().addViewer(getTreeViewer()); - } - // getTreeViewer().setEditPartFactory(new PageflowTreePartFactory()); - - // synchronize selections - editor.getSelectionSynchronizer().addViewer(getTreeViewer()); - - // add content - getTreeViewer().setContents(getOutlineContent()); - } - - /** - * Shows the spcified page. - * - * @param id - - * control id of pagebook in outline page. it is can be _outline - * or _overview - */ - protected void showPage(Control id) { - if (id == outline) { - showOutlineAction.setChecked(true); - showOverviewAction.setChecked(false); - pageBook.showPage(outline); - if (thumbnail != null) { - thumbnail.setVisible(false); - } - } else if (id == overview) { - showOutlineAction.setChecked(false); - showOverviewAction.setChecked(true); - pageBook.showPage(overview); - if (thumbnail != null) { - thumbnail.setVisible(true); - } - } - } - - /** - * Returns the current edit domain. - * - * @return - the edit domain - */ - public EditDomain getEditDomain() { - return editDomain; - } - - /* - * (non-Javadoc) - * - * @see IPage#dispose() - */ - public void dispose() { - editor.getSelectionSynchronizer().removeViewer(getTreeViewer()); - - if (null != thumbnail) { - thumbnail.deactivate(); - } - - super.dispose(); - } - - /** - * initialize Overview. - * - */ - private void initializeOverview() { - // check if control was created - if (null == lws) { - return; - } - - // deactivate old thumbnail - if (null != thumbnail) { - thumbnail.deactivate(); - } - - // create empty thumbnail - thumbnail = new ScrollableThumbnail(); - thumbnail.setBorder(new MarginBorder(3)); - lws.setContents(thumbnail); - - // initialize thumbnail - if (null != getOverviewContent()) { - Viewport viewport = null; - IFigure source = null; - if (getOverviewContent() instanceof ScalableFreeformRootEditPart) { - viewport = (Viewport) ((ScalableFreeformRootEditPart) getOverviewContent()) - .getFigure(); - source = ((ScalableFreeformRootEditPart) getOverviewContent()) - .getLayer(LayerConstants.PRINTABLE_LAYERS); - } - if (getOverviewContent() instanceof ScalableRootEditPart) { - viewport = (Viewport) ((ScalableRootEditPart) getOverviewContent()) - .getFigure(); - source = ((ScalableRootEditPart) getOverviewContent()) - .getLayer(LayerConstants.PRINTABLE_LAYERS); - } - - if (null != viewport && null != source) { - thumbnail.setViewport(viewport); - thumbnail.setSource(source); - } - } - } - - /** - * Returns the outlineContent. - * - * @return - the outlineContent - */ - public PageflowElement getOutlineContent() { - return outlineContent; - } - - /* - * (non-Javadoc) - * - * @see IPage#getControl() - */ - public Control getControl() { - return pageBook; - } - - /** - * Returns the root edit part - * - * @return - the root edit part - */ - public RootEditPart getOverviewContent() { - return overviewContent; - } - - /* - * (non-Javadoc) - * - * @see ISelectionProvider#getSelection() - */ - public ISelection getSelection() { - return getTreeViewer().getSelection(); - } - - /** - * Returns the tree viewer. - * - * @return - the tree viewer - */ - public TreeViewer getTreeViewer() { - if (null == treeViewer) { - treeViewer = new TreeViewer(); - treeViewer.setEditPartFactory(new PageflowTreePartFactory()); - } - - return treeViewer; - } - - /* - * (non-Javadoc) - * - * @see ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener) - */ - public void removeSelectionChangedListener( - ISelectionChangedListener listener) { - getTreeViewer().removeSelectionChangedListener(listener); - } - - /** - * Sets the outlineContent. - * - * @param element - - * Pageflow Element - */ - public void setOutlineContent(PageflowElement element) { - if (outlineContent != element) { - outlineContent = element; - - // refresh viewer - if (null != getTreeViewer().getControl()) { - getTreeViewer().setContents(element); - - // bugfix: something is overwriting visibility - if (null != pageBook) { - if (showOverviewAction.isChecked()) { - showPage(outline); - showPage(overview); - } else { - showPage(outline); - } - } - } - } - } - - /* - * (non-Javadoc) - * - * @see IPage#setFocus() - */ - public void setFocus() { - if (getControl() != null) { - getControl().setFocus(); - } - } - - /** - * Sets the root edit part. - * - * @param part - - * root edit part for pageflow model - */ - public void setOverviewContent(RootEditPart part) { - if (overviewContent != part) { - overviewContent = part; - // reinitialize thumbnail - // if (null != thumbnail && thumbnail.isVisible()) - initializeOverview(); - } - } - - /* - * (non-Javadoc) - * - * @see ISelectionProvider#setSelection(ISelection) - */ - public void setSelection(ISelection selection) { - getTreeViewer().setSelection(selection); - } - - /** - * Initializes this outline page from a given editor page. - * - * @param newPage - - * Pageflow EditorPage - */ - public void initialize(PageflowEditor newPage) { - if (null != newPage.getGraphicalViewer()) { - setOverviewContent(newPage.getGraphicalViewer().getRootEditPart()); - EditPart currentContent = newPage.getGraphicalViewer() - .getContents(); - setOutlineContent(null != currentContent ? (PageflowElement) currentContent - .getModel() - : null); - setEditDomain(newPage.getEditDomain()); - getViewerContentListener().setViewer(newPage.getGraphicalViewer()); - } else { - setOverviewContent(null); - setOutlineContent(null); - setEditDomain(null); - } - } - - /** - * Sets the edit domain. - * - * @param domain - - * editor's edit domain - */ - public void setEditDomain(EditDomain domain) { - if (editDomain != domain) { - // refresh viewer - if (null != getTreeViewer()) { - if (null != editDomain) { - editDomain.removeViewer(getTreeViewer()); - } - if (null != domain) { - domain.addViewer(getTreeViewer()); - } - } - editDomain = domain; - } - } - - /** - * the current viewer content listener - */ - private final ViewerContentListener viewerContentListener = new ViewerContentListener(); - - /** - * This class listens for changes of the content of an EditPartViewer. If - * the content changed, it will update the outline viewer. - * <p> - * Important: this class has to be disposed with - * <code>setViewer(null)</code>. - * - * @author Gunnar Wagenknecht - */ - private class ViewerContentListener implements EditPartListener { - /* the viewer */ - private EditPartViewer _viewer; - - /** - * Sets a new viewer. <code>null</code> is allowed to dispose. - * - * @param viewer - */ - public void setViewer(EditPartViewer viewer) { - if (null != this._viewer) - this._viewer.getRootEditPart().removeEditPartListener(this); - - this._viewer = viewer; - - if (null != this._viewer) - this._viewer.getRootEditPart().addEditPartListener(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartListener#childAdded(org.eclipse.gef.EditPart, - * int) - */ - public void childAdded(EditPart child, int index) { - // this is out event, update the viewers - if (child.getModel() instanceof PageflowElement) - setOutlineContent((PageflowElement) child.getModel()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartListener#partActivated(org.eclipse.gef.EditPart) - */ - public void partActivated(EditPart editpart) { - // do nothing - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartListener#partDeactivated(org.eclipse.gef.EditPart) - */ - public void partDeactivated(EditPart editpart) { - // do nothing - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartListener#removingChild(org.eclipse.gef.EditPart, - * int) - */ - public void removingChild(EditPart child, int index) { - // do nothing - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.EditPartListener#selectedStateChanged(org.eclipse.gef.EditPart) - */ - public void selectedStateChanged(EditPart editpart) { - // do nothing - } - } - - /** - * Returns the viewer content listener. - * - * @return the viewer content listener - */ - private ViewerContentListener getViewerContentListener() { - return viewerContentListener; - } - - /** - * Configures the specified <code>EditPartViewer</code>. - * - * @param viewer - */ - protected void configureEditPartViewer(EditPartViewer viewer) { - // configure the shared key handler - if (viewer.getKeyHandler() != null) { - viewer.getKeyHandler().setParent(editor.getSharedKeyHandler()); - } - - // configure the context menu - ContextMenuProvider provider = new PageflowEditorContextMenuProvider( - viewer, editor.getActionRegistry()); - viewer.setContextMenu(provider); - getSite().registerContextMenu( - EditorPlugin.getPluginId() - + ".pageflow.editor.outlineview.contextmenu", provider, //$NON-NLS-1$ - getSite().getSelectionProvider()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowMessages.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowMessages.java deleted file mode 100644 index a64b442d9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowMessages.java +++ /dev/null @@ -1,483 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.osgi.util.NLS; - -/** - * Pageflow message bundle - * - */ -public final class PageflowMessages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages"; //$NON-NLS-1$ - - private PageflowMessages() { - // Do not instantiate - } - - static { - NLS.initializeMessages(BUNDLE_NAME, PageflowMessages.class); - } - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Label_True; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Label_False; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Label_Saving; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Dialog_Label_CreateFileTitle; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Dialog_Label_FileNotExistedPart1; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Dialog_Label_FileNotExistedPart2; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_OpenEditor_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_OpenEditor_ToolTip; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_ShowPropertyView_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_ShowPropertyView_ToolTip; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_ShowPaletteView_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_ShowPaletteView_ToolTip; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_SyncWithFacesConfig_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_SyncWithFacesConfig_ToolTip; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_UpdateFacesConfig_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Action_UpdateFacesConfig_ToolTip; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Group_Controls; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Select_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Select_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Marquee_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Marquee_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Link_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Link_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Group_Nodes; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Begin_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Begin_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_End_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_End_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Action_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Action_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Page_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_PaletteTool_Page_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Contextmenu_Align_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Contextmenu_ShowView_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_AddNodeCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_CreateNodeCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_DeleteNodeCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_ConnectionCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_CreateBendpointCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_MoveBendpointCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_DeleteBendpointCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_OpenEditorCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_OrphanChildCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_UpdatePageflowCommand_Label; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Title; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Description; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_comment; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_name; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_largeicon; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_smallicon; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_action; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_path; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_begin; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_end; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_configfile; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_source; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_target; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_outcome; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_redirect; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_fromaction; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Attributes_referenceLink; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Items_Pageflow; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Items_PFPage; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Model_Items_PFLink; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_Choice; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_Title; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_JSPName; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Title; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTableWithJSP_Title; - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Component; - - /** - * see PageFlowMessages.properties - */ - public static String PageflowLinkPropertySource_Title; - /** - * see PageFlowMessages.properties - */ - public static String ProjectWebPageSelectionDialog_Description; - /** - * see PageFlowMessages.properties - */ - public static String PageflowLinkPropertySource_Text; - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Action; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Property_Action_OutcomeSelectionDialog_Outcome; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_UndefinedOutcome; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_NotExistedSourcePage; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_MissingSourcePage; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_InvalidWebPage; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_NotExitedWebPage; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_MissingWebPage; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_MissingManagedBean; - - /** - * see PageFlowMessages.properties - */ - public static String Pageflow_Validation_MissingAction; - - /** - * see PageFlowMessages.properties - */ - public static String ExistingPagePathDialogCellEdito_LabelText; - - /** - * see PageFlowMessages.properties - */ - public static String PageflowLinkEditPart_FromAction; - - /** - * see PageFlowMessages.properties - */ - public static String PageflowLinkEditPart_FromOutcome; - - /** - * see PageFlowMessages.properties - */ - public static String PageflowContainerEditPolicy_OrphanLabel; - - /** - * see PageFlowMessages.properties - */ - public static String PageflowNode_NoRecursiveContainment; - - /** - * see PageFlowMessages.properties - */ - public static String PageflowXYLayoutEditPolicy_Add; - - /** - * see PageFlowMessages.properties - */ - public static String SetConstraintCommand_Resize; - - /** - * see PageFlowMessages.properties - */ - public static String SetConstraintCommand_Location; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowMessages.properties b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowMessages.properties deleted file mode 100644 index 29b93615d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowMessages.properties +++ /dev/null @@ -1,155 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 Oracle 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: -# Oracle Corporation - initial API and implementation -############################################################################### -#################################################### -# Generic Strings for UI -#################################################### -Pageflow_Label_True=true -Pageflow_Label_False=false - -Pageflow_Label_Saving=Saving - -Pageflow_Dialog_Label_CreateFileTitle=Create File -Pageflow_Dialog_Label_FileNotExistedPart1=The file -Pageflow_Dialog_Label_FileNotExistedPart2=doesn't exist. Click OK to create it. - -#################################################### -# Generic Strings for Action and PaletteTool -#################################################### -Pageflow_Action_OpenEditor_Label=Open -Pageflow_Action_OpenEditor_ToolTip=Open Page or Action component - -Pageflow_Action_ShowPropertyView_Label=Properties -Pageflow_Action_ShowPropertyView_ToolTip=Show Properties View - -Pageflow_Action_ShowPaletteView_Label=Palette -Pageflow_Action_ShowPaletteView_ToolTip=Show Palette View - -Pageflow_Action_SyncWithFacesConfig_Label=Synchronize with Faces-config -Pageflow_Action_SyncWithFacesConfig_ToolTip=Synchronizing PageFlow Model with Faces-config - -Pageflow_Action_UpdateFacesConfig_Label=Update Faces-config -Pageflow_Action_UpdateFacesConfig_ToolTip=Update Faces-config File from The Current PageFlow - -Pageflow_PaletteTool_Group_Controls=Controls - -Pageflow_PaletteTool_Select_Label=Select -Pageflow_PaletteTool_Select_Description=Select One or More Items - -Pageflow_PaletteTool_Marquee_Label=Marquee -Pageflow_PaletteTool_Marquee_Description=Marquee One or More Items - -Pageflow_PaletteTool_Link_Label=Link -Pageflow_PaletteTool_Link_Description=Creates a Link - -Pageflow_PaletteTool_Group_Nodes=Nodes - -Pageflow_PaletteTool_Begin_Label=Begin -Pageflow_PaletteTool_Begin_Description=Creates a PageFlow Begin - -Pageflow_PaletteTool_End_Label=End -Pageflow_PaletteTool_End_Description=Creates a PageFlow End - -Pageflow_PaletteTool_Action_Label=Action -Pageflow_PaletteTool_Action_Description=Creates a PageFlow Action - -Pageflow_PaletteTool_Page_Label=Page -Pageflow_PaletteTool_Page_Description=Creates a PageFlow Page - -Pageflow_Contextmenu_Align_Label=Align - -Pageflow_Contextmenu_ShowView_Label=Show View - - - -#################################################### -# Generic Strings for Commands -#################################################### -Pageflow_Commands_AddNodeCommand_Label=Add -Pageflow_Commands_CreateNodeCommand_Label=Create -Pageflow_Commands_DeleteNodeCommand_Label=Delete - -Pageflow_Commands_ConnectionCommand_Label=Connection -Pageflow_Commands_CreateBendpointCommand_Label=Create Bendpoint -Pageflow_Commands_MoveBendpointCommand_Label=Move Bendpoint -Pageflow_Commands_DeleteBendpointCommand_Label=Delete Bendpoint - -Pageflow_Commands_OpenEditorCommand_Label=Open -Pageflow_Commands_OrphanChildCommand_Label=Orphan Child -Pageflow_Commands_UpdatePageflowCommand_Label=Update Pageflow - -Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Title=Select JSP File -Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Description=Please select a jsp file. - -#################################################### -# Generic Strings for property attribute name -#################################################### -Pageflow_Model_Attributes_comment=description -Pageflow_Model_Attributes_name=display-name -Pageflow_Model_Attributes_largeicon=large-icon -Pageflow_Model_Attributes_smallicon=small-icon - -Pageflow_Model_Attributes_action=from-action -Pageflow_Model_Attributes_path=path -Pageflow_Model_Attributes_begin=begin -Pageflow_Model_Attributes_end=end -Pageflow_Model_Attributes_configfile=config file - -Pageflow_Model_Attributes_source = from-view-id -Pageflow_Model_Attributes_target = to-view-id - -Pageflow_Model_Attributes_outcome=from-outcome -Pageflow_Model_Attributes_redirect=redirect - -Pageflow_Model_Attributes_fromaction=from-action -Pageflow_Model_Attributes_referenceLink=reference - -Pageflow_Model_Items_Pageflow=File -Pageflow_Model_Items_PFPage=Page -Pageflow_Model_Items_PFLink=Link - - -Pageflow_Property_Action_OutcomeSelectionDialog_Choice=Enter the outcome or select one from action list below: - -Pageflow_Property_Action_OutcomeSelectionDialog_Title=Outcome Selection -Pageflow_Property_Action_OutcomeSelectionDialog_JSPName=JSP File Name: -Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Title=Actions -Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTableWithJSP_Title=Actions in {0} -Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Component=Component ID -Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Action=Action - -Pageflow_Property_Action_OutcomeSelectionDialog_Outcome=Outcome: - -#################################################### -#Pageflow validation -#################################################### -Pageflow_Validation_UndefinedOutcome=The outcome \''{0}\'' is not defined in previous page \''{1}\''. -Pageflow_Validation_NotExistedSourcePage=The source page \''{0}\'' is not existed. -Pageflow_Validation_MissingSourcePage=The source page should be specified. - -Pageflow_Validation_InvalidWebPage=The file \''{0}\'' is not valid web file. -Pageflow_Validation_NotExitedWebPage=The web page \''{0}\'' is not existed. -Pageflow_Validation_MissingWebPage=The web page's path should be specified. - -Pageflow_Validation_MissingManagedBean=The managed bean \''{0}\'' is not defined. -Pageflow_Validation_MissingAction=The action should be specified. - -ExistingPagePathDialogCellEdito_LabelText = Please enter or select a web page path: - -PageflowLinkEditPart_FromAction=fromAction: -PageflowLinkEditPart_FromOutcome=fromOutcome: - -####################################################### -PageflowContainerEditPolicy_OrphanLabel=label here -PageflowNode_NoRecursiveContainment=Recursive containment not allowed for -PageflowXYLayoutEditPolicy_Add=Add -SetConstraintCommand_Location=Change Page Location -SetConstraintCommand_Resize=Resize Page -ProjectWebPageSelectionDialog_Description=Please select a Web Page diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowPaletteRoot.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowPaletteRoot.java deleted file mode 100644 index eefad9294..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowPaletteRoot.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.gef.palette.CombinedTemplateCreationEntry; -import org.eclipse.gef.palette.ConnectionCreationToolEntry; -import org.eclipse.gef.palette.MarqueeToolEntry; -import org.eclipse.gef.palette.PaletteDrawer; -import org.eclipse.gef.palette.PaletteGroup; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.palette.PaletteSeparator; -import org.eclipse.gef.palette.SelectionToolEntry; -import org.eclipse.gef.palette.ToolEntry; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.ModelCreationFactory; - -/** - * This is the root of the palette used by pageflow editors. - */ -public class PageflowPaletteRoot extends PaletteRoot { - - /** - * Creates a new PageflowPaletteRoot instance. - */ - public PageflowPaletteRoot() { - // create root - super(); - - // a group of default control tools - // Pageflow.PaletteTool.Group.Controls = Controls - PaletteGroup controls = new PaletteGroup( - PageflowMessages.Pageflow_PaletteTool_Group_Controls); - add(controls); - - // the selection tool - // Pageflow.PaletteTool.Select.Label = Select - // Pageflow.PaletteTool.Select.Description = Select one or more items - ToolEntry tool = new SelectionToolEntry( - PageflowMessages.Pageflow_PaletteTool_Select_Label, - PageflowMessages.Pageflow_PaletteTool_Select_Description); - - controls.add(tool); - - // use selection tool as default entry - setDefaultEntry(tool); - - // the marquee selection tool - // Pageflow.PaletteTool.Marquee.Label = Marquee - // Pageflow.PaletteTool.Marquee.Description = Marquee one or more items - controls.add(new MarqueeToolEntry( - PageflowMessages.Pageflow_PaletteTool_Marquee_Label, - PageflowMessages.Pageflow_PaletteTool_Marquee_Description)); - - controls.add(new PaletteSeparator()); - - // conection creation - // Pageflow.PaletteTool.Link.Label = Link - // Pageflow.PaletteTool.Link.Description = Creates an link - ConnectionCreationToolEntry linkEntry = new ConnectionCreationToolEntry( - PageflowMessages.Pageflow_PaletteTool_Link_Label, - PageflowMessages.Pageflow_PaletteTool_Link_Description, - new ModelCreationFactory(PageflowLink.class), EditorPlugin - .getDefault().getImageDescriptor( - "facesconfig/Pageflow_Link.gif"), //$NON-NLS-1$ - EditorPlugin.getDefault().getImageDescriptor( - "facesconfig/Pageflow_Link24.gif")); //$NON-NLS-1$ - linkEntry.setUserModificationPermission(PERMISSION_FULL_MODIFICATION); - controls.add(linkEntry); - - controls.add(new PaletteSeparator()); - - // Pageflow.PaletteTool.Group.Nodes = Nodes - PaletteDrawer nodes = new PaletteDrawer( - PageflowMessages.Pageflow_PaletteTool_Group_Nodes); - add(nodes); - - // use CombinedTemplateCreationEntry which can be also dragged - CombinedTemplateCreationEntry entry; - - // Pageflow.PaletteTool.Page.Label = Page - // Pageflow.PaletteTool.Page.Description = Creates a pageflow page - entry = new CombinedTemplateCreationEntry( - PageflowMessages.Pageflow_PaletteTool_Page_Label, - PageflowMessages.Pageflow_PaletteTool_Page_Description, - PageflowPage.class, - new ModelCreationFactory(PageflowPage.class), EditorPlugin - .getDefault().getImageDescriptor( - "facesconfig/Pageflow_Page16.gif"), //$NON-NLS-1$ - EditorPlugin.getDefault().getImageDescriptor( - "facesconfig/Pageflow_Page24.gif")); //$NON-NLS-1$ - nodes.add(entry); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowTemplateTransferDropTargetListener.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowTemplateTransferDropTargetListener.java deleted file mode 100644 index 4c4a8a4df..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/PageflowTemplateTransferDropTargetListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.dnd.TemplateTransferDropTargetListener; -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.ModelCreationFactory; - -/** - * This is the drop listener for template transfers from the palette. Only need - * to implement the <code>getFactory</code> method. - */ -public class PageflowTemplateTransferDropTargetListener extends - TemplateTransferDropTargetListener { - /** - * Creates a new PageflowTemplateTransferDropTargetListener instance. - * - * @param viewer - - * target pageflow editor view. - */ - public PageflowTemplateTransferDropTargetListener(EditPartViewer viewer) { - super(viewer); - } - - /* - * (non-Javadoc) - * - * @see TemplateTransferDropTargetListener#getFactory(Object) - */ - protected CreationFactory getFactory(Object template) { - if (template instanceof Class) { - return new ModelCreationFactory((Class) template); - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/ResourceTransferDropTargetListener.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/ResourceTransferDropTargetListener.java deleted file mode 100644 index ecb6c73be..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/ResourceTransferDropTargetListener.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow; - -import org.eclipse.core.resources.IResource; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.Request; -import org.eclipse.gef.dnd.AbstractTransferDropTargetListener; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.DropTargetEvent; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ResourceTransfer; -import org.eclipse.ui.views.navigator.LocalSelectionTransfer; - -/** - * This is the listener for resource drag and drop operations - * - */ -public abstract class ResourceTransferDropTargetListener extends - AbstractTransferDropTargetListener { - /** the pageflow editor */ - private IEditorPart editor = null; - - /** - * Creates a new ResourceTransferDropTargetListener instance. - * - * @param viewer - - * target pageflow editor view. - * @param editor - */ - public ResourceTransferDropTargetListener(EditPartViewer viewer, - IEditorPart editor) { - super(viewer, ResourceTransfer.getInstance()); - - this.editor = editor; - } - - /* - * (non-Javadoc) - * - * @see AbstractTransferDropTargetListener#createTargetRequest() - */ - protected Request createTargetRequest() { - CreateRequest request = new CreateRequest(); - if (getCurrentEvent().data == null) { - request.setFactory(getFactory(null)); - } else { - IResource[] resources = (IResource[]) getCurrentEvent().data; - request.setFactory(getFactory(resources[0])); - } - return request; - } - - /** - * get the request for creating a new resource object - * - * @return - creation request - */ - protected final CreateRequest getCreateRequest() { - return (CreateRequest) getTargetRequest(); - } - - /** - * get creation factory for resource object, which should be implemented. - * - * @param obj - - * resource object - * @return - creation factory for resource object - */ - abstract protected CreationFactory getFactory(Object obj); - - /* - * (non-Javadoc) - * - * @see AbstractTransferDropTargetListener#handleDragOperationChanged() - */ - protected void handleDragOperationChanged() { - getCurrentEvent().detail = DND.DROP_COPY; - super.handleDragOperationChanged(); - } - - /** - * get the current transfered local selection object. - * - * @return - */ - private Object getCurrentLocalObject() { - ISelection sel = LocalSelectionTransfer.getInstance().getSelection(); - if (sel instanceof IStructuredSelection) { - return ((IStructuredSelection) sel).getFirstElement(); - } - return null; - } - - /* - * (non-Javadoc) - * - * @see AbstractTransferDropTargetListener#handleDragOver() - */ - protected void handleDragOver() { - if (!isValidJSFFile(getCurrentLocalObject())) { - getCurrentEvent().detail = DND.ERROR_INVALID_DATA; - } else { - getCurrentEvent().detail = DND.DROP_COPY; - } - getCurrentEvent().feedback = DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND; - super.handleDragOver(); - } - - /* - * (non-Javadoc) - * - * @see AbstractTransferDropTargetListener#handleDrop() - */ - protected void handleDrop() { - getCurrentEvent().detail = DND.DROP_COPY; - super.handleDrop(); - // because the handle drop can change this event to DND.DROP_NONE - if (getCurrentEvent().detail == DND.DROP_COPY) { - selectAddedObject(); - } - } - - /** - * select the new drag and drop object in the pageflow view. - */ - private void selectAddedObject() { - Object model = getCreateRequest().getNewObject(); - if (null == model) { - return; - } - EditPartViewer viewer = getViewer(); - Object editpart = viewer.getEditPartRegistry().get(model); - if (editpart instanceof EditPart) { - viewer.flush(); - viewer.select((EditPart) editpart); - // Activate the editor window - PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage().activate(editor); - } - } - - /* - * (non-Javadoc) - * - * @see AbstractTransferDropTargetListener#updateTargetRequest() - */ - protected void updateTargetRequest() { - CreateRequest request = getCreateRequest(); - request.setLocation(getDropLocation()); - } - - /** - * Allow drop if any of these types in the drop data, which can be jsp file - * or a sub folder of the webroot folder. - * - */ - private boolean isValidJSFFile(Object resource) { - if (resource == null || !(resource instanceof IResource)) { - return false; - } - - if (((IResource) resource).getProject() == ((FileEditorInput) editor - .getEditorInput()).getFile().getProject()) { - if (WebrootUtil.getWebPath(((IResource) resource).getFullPath()) - .length() > 0) { - return true; - } - } - return false; - } - - /* - * (non-Javadoc) - * - * @see AbstractTransferDropTargetListener#isEnabled() - */ - public boolean isEnabled(DropTargetEvent dropTargetEvent) { - if (super.isEnabled(dropTargetEvent)) { - if (dropTargetEvent.data != null) { - IResource[] resources = (IResource[]) dropTargetEvent.data; - // The resource should be under the same project of the current - // faces-config file - if (isValidJSFFile(resources[0])) { - return true; - } - return false; - } - // If no data, can't verify, so allow the drop - return true; - } - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/AlignmentAction.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/AlignmentAction.java deleted file mode 100644 index e108d8e55..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/AlignmentAction.java +++ /dev/null @@ -1,329 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.action; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.PrecisionRectangle; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.requests.AlignmentRequest; -import org.eclipse.gef.tools.ToolUtilities; -import org.eclipse.gef.ui.actions.GEFActionConstants; -import org.eclipse.gef.ui.actions.SelectionAction; -import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; - -/** - * An improved alignment action to align the selected parts in different action. - * - * @author xgzhang - * @version original version is from GEF - */ -public final class AlignmentAction extends SelectionAction { - - /** - * Indicates that the bottom edges should be aligned. - */ - public static final String ID_ALIGN_BOTTOM = GEFActionConstants.ALIGN_BOTTOM; - - /** - * Indicates that the horizontal centers should be aligned. - */ - public static final String ID_ALIGN_CENTER = GEFActionConstants.ALIGN_CENTER; - - /** - * Indicates that the left edges should be aligned. - */ - public static final String ID_ALIGN_LEFT = GEFActionConstants.ALIGN_LEFT; - - /** - * Indicates that the vertical midpoints should be aligned. - */ - public static final String ID_ALIGN_MIDDLE = GEFActionConstants.ALIGN_MIDDLE; - - /** - * Indicates that the right edges should be aligned. - */ - public static final String ID_ALIGN_RIGHT = GEFActionConstants.ALIGN_RIGHT; - - /** - * Indicates that the top edges should be aligned. - */ - public static final String ID_ALIGN_TOP = GEFActionConstants.ALIGN_TOP; - - private int alignment; - - private List operationSet; - - /** - * @deprecated use AlignmentAction(IWorkbenchPart, int align) - * @param editor - * the editor - * @param align - * the alignment ID - */ - public AlignmentAction(IEditorPart editor, int align) { - this((IWorkbenchPart) editor, align); - } - - /** - * Constructs an AlignmentAction with the given part and alignment ID. The - * alignment ID must by one of: - * <UL> - * <LI>GEFActionConstants.ALIGN_LEFT - * <LI>GEFActionConstants.ALIGN_RIGHT - * <LI>GEFActionConstants.ALIGN_CENTER - * <LI>GEFActionConstants.ALIGN_TOP - * <LI>GEFActionConstants.ALIGN_BOTTOM - * <LI>GEFActionConstants.ALIGN_MIDDLE - * </UL> - * - * @param part - * the workbench part used to obtain context - * @param align - * the aligment ID. - */ - public AlignmentAction(IWorkbenchPart part, int align) { - super(part); - alignment = align; - initUI(); - } - - /** - * Returns the alignment rectangle to which all selected parts should be - * aligned. - * - * @param request - * the alignment Request - * @return the alignment rectangle - */ - protected Rectangle calculateAlignmentRectangle(Request request) { - List editparts = getOperationSet(request); - if (editparts == null || editparts.isEmpty()) { - return null; - } - GraphicalEditPart part = null; - if (alignment == PositionConstants.MIDDLE - || alignment == PositionConstants.CENTER) { - part = (GraphicalEditPart) editparts.get(editparts.size() - 1); - } else { - part = getFitnessPart(editparts); - } - Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds()); - part.getFigure().translateToAbsolute(rect); - return rect; - } - - /** - * get the Fitness part in the four kinds of alignment directions - * - * @param editparts - */ - private GraphicalEditPart getFitnessPart(List editparts) { - if (alignment == PositionConstants.MIDDLE - || alignment == PositionConstants.CENTER) { - return null; - } - - int positionComparor = Integer.MAX_VALUE; - - if (alignment == PositionConstants.LEFT - || alignment == PositionConstants.TOP) { - positionComparor = Integer.MAX_VALUE; - } else if (alignment == PositionConstants.RIGHT - || alignment == PositionConstants.BOTTOM) { - positionComparor = Integer.MIN_VALUE; - } - - GraphicalEditPart fitnessPart = null; - - for (Iterator iter = editparts.iterator(); iter.hasNext();) { - GraphicalEditPart part = (GraphicalEditPart) iter.next(); - Rectangle rectPart = part.getFigure().getBounds(); - switch (alignment) { - case PositionConstants.LEFT: - if (rectPart.getLeft().x < positionComparor) { - fitnessPart = part; - positionComparor = rectPart.getLeft().x; - } - break; - - case PositionConstants.RIGHT: - if (rectPart.getRight().x > positionComparor) { - fitnessPart = part; - positionComparor = rectPart.getRight().x; - } - break; - case PositionConstants.TOP: - if (rectPart.getTop().y < positionComparor) { - fitnessPart = part; - positionComparor = rectPart.getTop().y; - } - break; - case PositionConstants.BOTTOM: - if (rectPart.getBottom().y > positionComparor) { - fitnessPart = part; - positionComparor = rectPart.getBottom().y; - } - break; - } - } - - return fitnessPart; - } - - /** - * @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled() - */ - protected boolean calculateEnabled() { - operationSet = null; - Command cmd = createAlignmentCommand(); - if (cmd == null) { - return false; - } - return cmd.canExecute(); - } - - private Command createAlignmentCommand() { - AlignmentRequest request = new AlignmentRequest( - RequestConstants.REQ_ALIGN); - request.setAlignmentRectangle(calculateAlignmentRectangle(request)); - request.setAlignment(alignment); - List editparts = getOperationSet(request); - if (editparts.size() < 2) { - return null; - } - - CompoundCommand command = new CompoundCommand(); - command.setDebugLabel(getText()); - for (int i = 0; i < editparts.size(); i++) { - EditPart editpart = (EditPart) editparts.get(i); - command.add(editpart.getCommand(request)); - } - return command; - } - - /** - * @see org.eclipse.gef.Disposable#dispose() - */ - public void dispose() { - operationSet = Collections.EMPTY_LIST; - super.dispose(); - } - - /** - * Returns the list of editparts which will participate in alignment. - * - * @param request - * the alignment request - * @return the list of parts which will be aligned - */ - protected List getOperationSet(Request request) { - if (operationSet != null) { - return operationSet; - } - List editparts = new ArrayList(getSelectedObjects()); - if (editparts.isEmpty() - || !(editparts.get(0) instanceof GraphicalEditPart)) { - return Collections.EMPTY_LIST; - } - Object primary = editparts.get(editparts.size() - 1); - editparts = ToolUtilities.getSelectionWithoutDependants(editparts); - ToolUtilities.filterEditPartsUnderstanding(editparts, request); - if (editparts.size() < 2 || !editparts.contains(primary)) { - return Collections.EMPTY_LIST; - } - EditPart parent = ((EditPart) editparts.get(0)).getParent(); - for (int i = 1; i < editparts.size(); i++) { - EditPart part = (EditPart) editparts.get(i); - if (part.getParent() != parent) { - return Collections.EMPTY_LIST; - } - } - return editparts; - } - - /** - * Initializes the actions UI presentation. - */ - protected void initUI() { - switch (alignment) { - case PositionConstants.LEFT: - setId(GEFActionConstants.ALIGN_LEFT); - setText(EditorMessages.AlignmentAction_AlignLeftAction_Label); - setToolTipText(EditorMessages.AlignmentAction_AlignLeftAction_Tooltip); - setImageDescriptor(InternalImages.DESC_HORZ_ALIGN_LEFT); - setDisabledImageDescriptor(InternalImages.DESC_HORZ_ALIGN_LEFT_DIS); - break; - - case PositionConstants.RIGHT: - setId(GEFActionConstants.ALIGN_RIGHT); - setText(EditorMessages.AlignmentAction_AlignRightAction_Label); - setToolTipText(EditorMessages.AlignmentAction_AlignRightAction_Tooltip); - setImageDescriptor(InternalImages.DESC_HORZ_ALIGN_RIGHT); - setDisabledImageDescriptor(InternalImages.DESC_HORZ_ALIGN_RIGHT_DIS); - break; - - case PositionConstants.TOP: - setId(GEFActionConstants.ALIGN_TOP); - setText(EditorMessages.AlignmentAction_AlignTopAction_Label); - setToolTipText(EditorMessages.AlignmentAction_AlignTopAction_Tooltip); - setImageDescriptor(InternalImages.DESC_VERT_ALIGN_TOP); - setDisabledImageDescriptor(InternalImages.DESC_VERT_ALIGN_TOP_DIS); - break; - - case PositionConstants.BOTTOM: - setId(GEFActionConstants.ALIGN_BOTTOM); - setText(EditorMessages.AlignmentAction_AlignBottomAction_Label); - setToolTipText(EditorMessages.AlignmentAction_AlignBottomAction_Tooltip); - setImageDescriptor(InternalImages.DESC_VERT_ALIGN_BOTTOM); - setDisabledImageDescriptor(InternalImages.DESC_VERT_ALIGN_BOTTOM_DIS); - break; - - case PositionConstants.CENTER: - setId(GEFActionConstants.ALIGN_CENTER); - setText(EditorMessages.AlignmentAction_AlignCenterAction_Label); - setToolTipText(EditorMessages.AlignmentAction_AlignCenterAction_Tooltip); - setImageDescriptor(InternalImages.DESC_HORZ_ALIGN_CENTER); - setDisabledImageDescriptor(InternalImages.DESC_HORZ_ALIGN_CENTER_DIS); - break; - - case PositionConstants.MIDDLE: - setId(GEFActionConstants.ALIGN_MIDDLE); - setText(EditorMessages.AlignmentAction_AlignMiddleAction_Label); - setToolTipText(EditorMessages.AlignmentAction_AlignMiddleAction_Tooltip); - setImageDescriptor(InternalImages.DESC_VERT_ALIGN_MIDDLE); - setDisabledImageDescriptor(InternalImages.DESC_VERT_ALIGN_MIDDLE_DIS); - break; - } - } - - /** - * @see org.eclipse.jface.action.IAction#run() - */ - public void run() { - operationSet = null; - execute(createAlignmentCommand()); - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/InternalImages.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/InternalImages.java deleted file mode 100644 index 8daa9ba7a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/InternalImages.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 Oracle Corporation. - * 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: - * Ian Trimble - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.action; - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Supplies image descriptors, intended for internal use only. - * - * @author Ian Trimble - Oracle - */ -public class InternalImages { - - /** - * ImageDescriptor instance for center alignment image. - */ - public static final ImageDescriptor DESC_HORZ_ALIGN_CENTER; - - /** - * ImageDescriptor instance for left alignment image. - */ - public static final ImageDescriptor DESC_HORZ_ALIGN_LEFT; - - /** - * ImageDescriptor instance for right alignment image. - */ - public static final ImageDescriptor DESC_HORZ_ALIGN_RIGHT; - - /** - * ImageDescriptor instance for middle alignment image. - */ - public static final ImageDescriptor DESC_VERT_ALIGN_MIDDLE; - - /** - * ImageDescriptor instance for top alignment image. - */ - public static final ImageDescriptor DESC_VERT_ALIGN_TOP; - - /** - * ImageDescriptor instance for bottom alignment image. - */ - public static final ImageDescriptor DESC_VERT_ALIGN_BOTTOM; - - /** - * ImageDescriptor instance for center alignment image (disabled). - */ - public static final ImageDescriptor DESC_HORZ_ALIGN_CENTER_DIS; - - /** - * ImageDescriptor instance for left alignment image (disabled). - */ - public static final ImageDescriptor DESC_HORZ_ALIGN_LEFT_DIS; - - /** - * ImageDescriptor instance for right alignment image (disabled). - */ - public static final ImageDescriptor DESC_HORZ_ALIGN_RIGHT_DIS; - - /** - * ImageDescriptor instance for middle alignment image (disabled). - */ - public static final ImageDescriptor DESC_VERT_ALIGN_MIDDLE_DIS; - - /** - * ImageDescriptor instance for top alignment image (disabled). - */ - public static final ImageDescriptor DESC_VERT_ALIGN_TOP_DIS; - - /** - * ImageDescriptor instance for bottom alignment image (disabled). - */ - public static final ImageDescriptor DESC_VERT_ALIGN_BOTTOM_DIS; - - static { - DESC_VERT_ALIGN_BOTTOM = createDescriptor("icons/alignbottom.gif"); //$NON-NLS-1$ - DESC_HORZ_ALIGN_CENTER = createDescriptor("icons/aligncenter.gif"); //$NON-NLS-1$ - DESC_HORZ_ALIGN_LEFT = createDescriptor("icons/alignleft.gif"); //$NON-NLS-1$ - DESC_VERT_ALIGN_MIDDLE = createDescriptor("icons/alignmid.gif"); //$NON-NLS-1$ - DESC_HORZ_ALIGN_RIGHT = createDescriptor("icons/alignright.gif"); //$NON-NLS-1$ - DESC_VERT_ALIGN_TOP = createDescriptor("icons/aligntop.gif"); //$NON-NLS-1$ - DESC_VERT_ALIGN_BOTTOM_DIS = createDescriptor("icons/alignbottom_d.gif"); //$NON-NLS-1$ - DESC_HORZ_ALIGN_CENTER_DIS = createDescriptor("icons/aligncenter_d.gif"); //$NON-NLS-1$ - DESC_HORZ_ALIGN_LEFT_DIS = createDescriptor("icons/alignleft_d.gif"); //$NON-NLS-1$ - DESC_VERT_ALIGN_MIDDLE_DIS = createDescriptor("icons/alignmid_d.gif"); //$NON-NLS-1$ - DESC_HORZ_ALIGN_RIGHT_DIS = createDescriptor("icons/alignright_d.gif"); //$NON-NLS-1$ - DESC_VERT_ALIGN_TOP_DIS = createDescriptor("icons/aligntop_d.gif"); //$NON-NLS-1$ - } - - private static ImageDescriptor createDescriptor(String filename) { - return ImageDescriptor.createFromFile(InternalImages.class, filename); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/OpenEditorAction.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/OpenEditorAction.java deleted file mode 100644 index 7c27eabd4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/OpenEditorAction.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.action; - -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.ui.actions.SelectionAction; -import org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.ui.IWorkbenchPart; - -/** - * - * This is the Action for opening a JSP page in the default JSP Editor from a - * Pageflow Diagram - * - */ -public class OpenEditorAction extends SelectionAction { - /** The name of the request */ - public static final String OPEN_EDITOR_REQUEST = PageflowMessages.Pageflow_Commands_OpenEditorCommand_Label; - - /** The request */ - Request request; - - /** - * The constructor - * - * @param part - - * the IWorkbenchPart - */ - public OpenEditorAction(IWorkbenchPart part) { - super(part); - request = new Request(OPEN_EDITOR_REQUEST); - // Pageflow.Action.OpenEditor.Label = Edit Page - setText(PageflowMessages.Pageflow_Action_OpenEditor_Label); - setId(FacesConfigEditor.EDITOR_ID); - // Pageflow.Action.OpenEditor.ToolTip = Edit this page - setToolTipText(PageflowMessages.Pageflow_Action_OpenEditor_ToolTip); - } - - /** - * Determines if the action can be enabled - * - * @return boolean - the enabled state - */ - protected boolean calculateEnabled() { - return canPerformAction(); - } - - /** - * Determines if the action can be performed - * - * @return boolean - the perform state - */ - private boolean canPerformAction() { - if (getSelectedObjects().isEmpty()) { - return false; - } - List parts = getSelectedObjects(); - for (int i = 0; i < parts.size(); i++) { - Object o = parts.get(i); - if (!(o instanceof EditPart)) { - return false; - } - EditPart part = (EditPart) o; - if (!(part.getModel() instanceof PageflowPage)) { - return false; - } - } - return true; - } - - /** - * Returns the command for the action - * - * @return Command - the action command - */ - private Command getCommand() { - List editparts = getSelectedObjects(); - CompoundCommand cc = new CompoundCommand(); - cc.setDebugLabel(OPEN_EDITOR_REQUEST); - for (int i = 0; i < editparts.size(); i++) { - EditPart part = (EditPart) editparts.get(i); - cc.add(part.getCommand(request)); - } - return cc; - } - - /** - * Runs the command - */ - public void run() { - execute(getCommand()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.ui.actions.WorkbenchPartAction#execute(org.eclipse.gef.commands.Command) - */ - protected void execute(Command command) { - if (command == null || !command.canExecute()) { - return; - } - command.execute(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/ShowPropertyViewAction.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/ShowPropertyViewAction.java deleted file mode 100644 index 24fe9daaf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/ShowPropertyViewAction.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.action; - -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.ui.actions.SelectionAction; -import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -/** - * - * This is the Action for opening a JSP page in the default JSP Editor from a - * Pageflow Diagram - * - * @author Xiao-guang Zhang - */ -public class ShowPropertyViewAction extends SelectionAction { - /** log instance */ - private static final Logger log = EditorPlugin - .getLogger(ShowPropertyViewAction.class); - - /** The ID of the action */ - public static final String SHOW_PROPERTY_VIEW = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.ShowPropertyViewAction"; //$NON-NLS-1$ - - /** - * The constructor - * - * @param part - - * the IWorkbenchPart - */ - public ShowPropertyViewAction(IWorkbenchPart part) { - super(part); - // Pageflow.Action.ShowPropertyView.Label = Properties - setText(PageflowMessages.Pageflow_Action_ShowPropertyView_Label); - setId(SHOW_PROPERTY_VIEW); - // Pageflow.Action.ShowPropertyView.ToolTip = Show properties - setToolTipText(PageflowMessages.Pageflow_Action_ShowPropertyView_ToolTip); - } - - /** - * Determines if the action can be enabled - * - * @return boolean - the enabled state - */ - protected boolean calculateEnabled() { - return canPerformAction(); - } - - /** - * Determines if the action can be performed - * - * @return boolean - the perform state - */ - private boolean canPerformAction() { - if (getSelectedObjects().isEmpty()) { - return false; - } - List parts = getSelectedObjects(); - for (int i = 0; i < parts.size(); i++) { - Object o = parts.get(i); - if (!(o instanceof EditPart)) { - return false; - } - EditPart part = (EditPart) o; - if (!((part.getModel() instanceof PageflowElement))) { - return false; - } - } - return true; - } - - /** - * Runs the command - */ - public void run() { - List editparts = getSelectedObjects(); - if (editparts.size() > 0) { - EditPart part = (EditPart) editparts.get(0); - // execute(getCommand()); - if (part.getModel() instanceof PageflowElement) { - // ensure the visibility of the palette view and property veiw. - IWorkbenchWindow dw = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); - IWorkbenchPage page = dw.getActivePage(); - if (page != null) { - try { - page.showView("org.eclipse.ui.views.PropertySheet"); //$NON-NLS-1$ - } catch (PartInitException e) { - // Pageflow.PageflowEditor.Error.canNotShowPropertyView - // = Failed to show property sheet view. - log - .error( - "Pageflow.PageflowEditor.Error.canNotShowPropertyView", //$NON-NLS-1$ - e); - } - - } - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignbottom.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignbottom.gif Binary files differdeleted file mode 100644 index 9eea5581b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignbottom.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignbottom_d.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignbottom_d.gif Binary files differdeleted file mode 100644 index 1c62797ec..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignbottom_d.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligncenter.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligncenter.gif Binary files differdeleted file mode 100644 index 4e8c94a88..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligncenter.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligncenter_d.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligncenter_d.gif Binary files differdeleted file mode 100644 index ceeafb780..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligncenter_d.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignleft.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignleft.gif Binary files differdeleted file mode 100644 index 55cecc20e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignleft.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignleft_d.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignleft_d.gif Binary files differdeleted file mode 100644 index 60fcc8f5c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignleft_d.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignmid.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignmid.gif Binary files differdeleted file mode 100644 index 5f13c93d4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignmid.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignmid_d.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignmid_d.gif Binary files differdeleted file mode 100644 index 2f7534e6f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignmid_d.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignright.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignright.gif Binary files differdeleted file mode 100644 index f6ead1580..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignright.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignright_d.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignright_d.gif Binary files differdeleted file mode 100644 index 0495ed5d6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/alignright_d.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligntop.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligntop.gif Binary files differdeleted file mode 100644 index 2f9ceeb11..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligntop.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligntop_d.gif b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligntop_d.gif Binary files differdeleted file mode 100644 index 9f1b49b1c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/action/icons/aligntop_d.gif +++ /dev/null diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AbstractBatchEditCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AbstractBatchEditCommand.java deleted file mode 100644 index eded9f1ed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AbstractBatchEditCommand.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.FC2PFTransformer; - -/** - * A batched edit command will enable adapters to interven before and after a - * set of operations was done by sending notification to the adapters. - * - * @author hmeng - */ - -/*package*/ abstract class AbstractBatchEditCommand extends Command { - Pageflow pageflow; - - /** - * @param pageflow - */ - public AbstractBatchEditCommand(Pageflow pageflow) { - this(pageflow, null); - } - - /** - * @param pageflow - * @param label - */ - public AbstractBatchEditCommand(Pageflow pageflow, String label) { - super(label); - this.pageflow = pageflow; - } - - /** - * @return the pageflow - */ - public Pageflow getPageflow() { - return pageflow; - } - - /** - * The subclass should extend methods doXXX only. - */ - final public void execute() { - preExecute(); - doExecute(); - postExecute(); - } - - final public void redo() { - doRedo(); - } - - final public void undo() { - preExecute(); - doUndo(); - postExecute(); - } - - /** - * - */ - abstract public void doExecute(); - - /** - * Do the customized redo - */ - public void doRedo() { - execute(); - } - - abstract void doUndo(); - - final void preExecute() { - getPageflow().eNotify( - new ENotificationImpl((InternalEObject) getPageflow(), - FC2PFTransformer.MY_NOTIFICATION_TYPE, - PageflowPackage.PAGEFLOW, null, null)); - } - - /** - * execute the post-execution handling - */ - final protected void postExecute() { - getPageflow().eNotify( - new ENotificationImpl((InternalEObject) getPageflow(), - FC2PFTransformer.MY_NOTIFICATION_TYPE1, - PageflowPackage.PAGEFLOW, null, null)); - notifyPageflow(getPageflow()); - } - - /** - * @param pageflow_ - */ - protected void notifyPageflow(Pageflow pageflow_) { - pageflow_.notifyModelChanged(new ENotificationImpl( - (InternalEObject) pageflow_, Notification.ADD, - PageflowPackage.PAGEFLOW, null, null)); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AddConnectionCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AddConnectionCommand.java deleted file mode 100644 index 149da0bdd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AddConnectionCommand.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.layout.PageflowLayoutManager; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; - -/** - * Add a new connection - * - * @author hmeng - * - */ -public class AddConnectionCommand extends ConnectionCommand { - - public boolean canExecute() { - // if user don't set PFLink object before, this command can't be - // executed. - if (link == null) { - return false; - } - - // It is a connection create command - if (oldSource == null && oldTarget == null) { - // It is a connection create command - // Source and target must be pointing to some - // real connection point - if (source == null || target == null) { - return false; - } - - if (!PageflowValidation.getInstance().isValidLinkForCreation( - source, target)) { - return false; - } - } - return true; - } - - public void doExecute() { - // It is a connection create command - if (canExecute() && oldSource == null && oldTarget == null) { - Pageflow pageflow = null; - // Get a reference to the pageflow - if (source != null) { - pageflow = source.getPageflow(); - } else if (target != null) { - pageflow = target.getPageflow(); - } - pageflow.connect(source, target, link); - - // self loop link - if (source == target) { - PageflowLayoutManager.updateSelfLoopLink(link); - } - } - } - - public void redo() { - // TODO Auto-generated method stub - super.redo(); - } - - public void undo() { - if (canExecute()) { - // It was a connection create command - if (oldSource == null && oldTarget == null) { - - Pageflow pageflow = null; - // Get a reference to the pageflow - if (source != null) { - pageflow = source.getPageflow(); - } else if (target != null) { - pageflow = target.getPageflow(); - } - - // Ensure that link knows nothing about nodes anymore. - link.setSource(null); - link.setTarget(null); - // Remove link from pageflow - pageflow.getLinks().remove(link); - } - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AddNodeCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AddNodeCommand.java deleted file mode 100644 index be41ab27f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/AddNodeCommand.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * This is the add command for pageflow editpart - * - */ -public class AddNodeCommand extends Command { - /** Pageflow node including Page, action, begin, end. */ - private PageflowNode child; - - /** parent Pageflow */ - private Pageflow parent; - - /** index of pageflow nodes */ - private int index = -1; - - /** - * Default constructor - */ - public AddNodeCommand() { - // Pageflow.Commands.AddNodeCommand.Label = add - super(PageflowMessages.Pageflow_Commands_AddNodeCommand_Label); - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - if (index < 0) { - parent.getNodes().add(child); - } else { - parent.getNodes().add(index, child); - } - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void redo() { - if (index < 0) { - parent.getNodes().add(child); - } else { - parent.getNodes().add(index, child); - } - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - parent.getNodes().remove(child); - } - - /** - * get parent pageflow of the node. - * @return the parent - * - */ - public Pageflow getParent() { - return parent; - } - - /** - * Set the child pageflow node - * - * @param subpart - - * child pageflow node - */ - public void setChild(PageflowNode subpart) { - child = subpart; - } - - /** - * Creates a new AbstractEditorPage instance. - * - * @param i - - * index of pageflow node - */ - public void setIndex(int i) { - index = i; - } - - /** - * Set the new parent pageflow - * - * @param newParent - - * parent pageflow - */ - public void setParent(Pageflow newParent) { - parent = newParent; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/BendpointCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/BendpointCommand.java deleted file mode 100644 index e4690d0fc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/BendpointCommand.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; - -/** - * base class for bend point commands. - * - */ -/*package*/ abstract class BendpointCommand extends Command { - /** the index of the bend point */ - protected int index; - - /** the location of the bendpoint */ - protected Point location; - - /** the parent link */ - protected PageflowLink link; - - /** relative dimension between the bendpoint with start point of the pflink */ - private Dimension dimStart; - - /** relative dimension between the bendpoint with end point of the pflink */ - private Dimension dimEnd; - - /** - * @param label - */ - public BendpointCommand(String label) { - super(label); - } - - /** - * get the dimension between the bendpoint and start point - * - * @return - the start dimension - */ - protected Dimension getFirstRelativeDimension() { - return dimStart; - } - - /** - * get the dimension between the bendpoint and end point - * - * @return - the end dimension - */ - protected Dimension getSecondRelativeDimension() { - return dimEnd; - } - - /** - * get the index of the bend point - * - * @return - the index - */ - protected int getIndex() { - return index; - } - - /** - * get the location of the bend point - * - * @return - the index - */ - protected Point getLocation() { - return location; - } - - /** - * get the parent link - * - * @return - parent link - */ - protected PageflowLink getPFLink() { - return link; - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void redo() { - execute(); - } - - /** - * set the relative dimensions of the bendpoint - * - * @param dim1 - - * the dimension between the bendpoint and start point - * @param dim2 - - * the dimension between the bendpoint and end point - */ - public void setRelativeDimensions(Dimension dim1, Dimension dim2) { - dimStart = dim1; - dimEnd = dim2; - } - - /** - * set the index of the bendpoint in the bendpoint list - * - * @param i - - * index - */ - public void setIndex(int i) { - index = i; - } - - /** - * set the location of the bendpoing - * - * @param p - - * new location - */ - public void setLocation(Point p) { - location = p; - } - - /** - * set the parent link - * - * @param newLink - - * new parent pflink - */ - public void setPFLink(PageflowLink newLink) { - link = newLink; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ConnectionCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ConnectionCommand.java deleted file mode 100644 index dafa9f613..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ConnectionCommand.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.TransformUtil; - -/** - * This is the connection command for pageflow editpart - * - * @author Xiao-guang Zhang, hmeng - */ -public abstract class ConnectionCommand extends Command { - /** Old source pageflow node */ - protected PageflowNode oldSource; - - /** Old target pageflow node */ - protected PageflowNode oldTarget; - - /** New source pageflow node */ - protected PageflowNode source; - - /** New target pageflow node */ - protected PageflowNode target; - - /** pageflow link */ - protected PageflowLink link; - - /** - * Default constructor - */ - public ConnectionCommand() { - super(PageflowMessages.Pageflow_Commands_ConnectionCommand_Label); - } - - /* - * (non-Javadoc) - * - * @see Command#canExecute() - */ - public boolean canExecute() { - return TransformUtil.isValidPageflowElement(link); - } - - /** - * perform the main command execution. Sub-classes should override. - */ - protected void doExecute() { - // do nothing; sub-class can over-ride - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public final void execute() { - if (canExecute()) { - doExecute(); - } else { - link = null; - } - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void redo() { - execute(); - } - - /* - * (non-Javadoc) - * - * @see ommand#undo() - */ - public void undo() { - // do nothing - } - - /** - * Get the source pageflow node - * - * @return - the source pageflow node - */ - public PageflowNode getSource() { - return source; - } - - /** - * Get the target pageflow node - * - * @return - the target pageflow node. - */ - public PageflowNode getTarget() { - return target; - } - - /** - * Get the pageflow link - * - * @return - the pageflow link. - */ - public PageflowLink getPFLink() { - return link; - } - - /** - * Set the source pageflow node - * - * @param newSource - - * new source pageflow node - */ - public void setSource(PageflowNode newSource) { - source = newSource; - } - - /** - * Set the target pageflow node - * - * @param newTarget - - * new target pageflow node - */ - public void setTarget(PageflowNode newTarget) { - target = newTarget; - } - - /** - * Set the pageflow link - * - * @param link - - * new pageflow link - */ - public void setPFLink(PageflowLink link) { - this.link = link; - oldSource = link.getSource(); - oldTarget = link.getTarget(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ConnectionCommandFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ConnectionCommandFactory.java deleted file mode 100644 index 8c7397c98..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ConnectionCommandFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; - -/** - * The factory helps to create connection commands. - * - * @author hmeng - * - */ -public class ConnectionCommandFactory { - /** - * @param request - * @return the connection command for the request - */ - public static ConnectionCommand createCommand(Request request) { - ConnectionCommand command = null; - if (request.getType() == RequestConstants.REQ_CONNECTION_START - || request.getType() == RequestConstants.REQ_CONNECTION_END) { - command = new AddConnectionCommand(); - } else if (request.getType() == RequestConstants.REQ_RECONNECT_SOURCE - || request.getType() == RequestConstants.REQ_RECONNECT_TARGET) { - command = new ReconnectConnectionCommand(); - } else if (request.getType() == RequestConstants.REQ_DELETE) { - command = new DeleteConnectionCommand(); - } - return command; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/CreateBendpointCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/CreateBendpointCommand.java deleted file mode 100644 index 60df11d4a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/CreateBendpointCommand.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; - -/** - * Create a new bend point command - * - */ -public class CreateBendpointCommand extends BendpointCommand { - /** - * Default constructor - */ - public CreateBendpointCommand() { - // Pageflow.Commands.CreateBendpointCommand.Label = Create Bendpoint - super(PageflowMessages.Pageflow_Commands_CreateBendpointCommand_Label); - - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - Map registry = EPackage.Registry.INSTANCE; - String pageflowURI = PageflowPackage.eNS_URI; - PageflowPackage pageflowPackage = (PageflowPackage) registry - .get(pageflowURI); - PageflowFactory factory = pageflowPackage.getPageflowFactory(); - PageflowLinkBendpoint _newBendpoint = factory.createPFLinkBendpoint(); - - _newBendpoint.setRelativeDimensions(getFirstRelativeDimension(), - getSecondRelativeDimension()); - getPFLink().insertBendpoint(getIndex(), _newBendpoint); - super.execute(); - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - super.undo(); - getPFLink().removeBendpoint(getIndex()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/CreateNodeCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/CreateNodeCommand.java deleted file mode 100644 index 0cb7b282f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/CreateNodeCommand.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.common.ui.internal.dialogs.CommonResourceDialog; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchWindow; - -/** - * This is the creation command for pageflow editpart - * - * @author Xiao-guang Zhang - */ -public class CreateNodeCommand extends Command implements IPreExecuteCommand { - private static final String UNNAMED_NODE = "unnamed"; //$NON-NLS-1$ - - /** new pageflow node */ - private PageflowNode child; - - /** size of pageflow node figure */ - private Rectangle rect; - - /** parent pageflow */ - private Pageflow parent; - - /** index of pageflow nodes */ - // private int _index = -1; - public CreateNodeCommand() { - // Pageflow.Commands.CreateNodeCommand.Label = Create new node - super(PageflowMessages.Pageflow_Commands_CreateNodeCommand_Label); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#canExecute() - */ - public boolean canExecute() { - return child != null && parent != null; - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - if (rect != null) { - child.setX(rect.x); - child.setY(rect.y); - if (!rect.isEmpty()) { - child.setHeight(rect.getSize().height); - child.setWidth(rect.getSize().width); - } - } - - if (child.getName() == UNNAMED_NODE) { - child.setName(parent.getDefaultNodeName(child.getClass())); - } - - parent.getNodes().add(child); - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void redo() { - if (rect != null) { - child.setX(rect.x); - child.setY(rect.y); - if (!rect.isEmpty()) { - child.setHeight(rect.getSize().height); - child.setWidth(rect.getSize().width); - } - } - - parent.getNodes().add(child); - - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - parent.getNodes().remove(child); - } - - /** - * select a jsp page in current project. - * - * @return - */ - private boolean selectJSPPage() { - - Shell shell = null; - IWorkbenchWindow workbenchWindow = EditorPlugin - .getActiveWorkbenchWindow(); - if (workbenchWindow.getShell() != null) { - shell = workbenchWindow.getShell(); - } else { - shell = new Shell(); - } - IProject project = WebrootUtil.getProject(getParent()); - - CommonResourceDialog dialog = new CommonResourceDialog(shell, project, - SWT.NONE); - - dialog - .setTitle(PageflowMessages.Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Title); - // no suffix filter - dialog.setSuffixs(null); - dialog - .setResourceDescription(PageflowMessages.Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Description); - - if (dialog.open() == Window.OK) { - Object[] result = dialog.getResult(); - if (result != null) { - IFile jspFile = (IFile) result[0]; - if (jspFile != null) { - // get the project path for the new created file, i.e., - // /project/webroot/*.jsp - String jsfSelection = WebrootUtil.getWebPath(jspFile - .getFullPath()); - if (jsfSelection != null && jsfSelection.length() > 0) { - if (PageflowValidation.getInstance().isExistedPage( - this.parent, jsfSelection)) { - // Pageflow.PageflowEditor.Alert.DNDResourceTitle = - // Pageflow Creation Error - // Pageflow.PageflowEditor.Alert.ExistingPage = The - // web page {0} is already existed in current - // PageFlow. - EditorPlugin - .getAlerts() - .error( - "Pageflow.PageflowEditor.Alert.DNDResourceTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.ExistingPage", //$NON-NLS-1$ - jsfSelection); - return false; - } - - ((PageflowPage) (child)).setPath(jsfSelection); - ((PageflowPage) (child)).setName(WebrootUtil - .getPageNameFromWebPath(jsfSelection)); - } - - return true; - } - } - } - return false; - } - - /** - * call the JSF wizard to create a new jsf page. - * @return the parent - * - */ - public Pageflow getParent() { - return parent; - } - - /** - * set the child node - * - * @param subpart - - * new child pageflow node - */ - public void setChild(PageflowNode subpart) { - child = subpart; - } - - /** - * set the location of the new pageflow node - * - * @param r - - * location of the new pageflow node - */ - public void setLocation(Rectangle r) { - rect = r; - } - - /** - * set the parent pageflow - * - * @param newParent - - * the new parent pageflow - */ - public void setParent(Pageflow newParent) { - parent = newParent; - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.commands.IPreExecuteCommand#preExecute() - */ - public boolean preExecute() { - // note that the model adds the ports to the node in this call - // pop up the new the wizard to create the new jsf file - if (child instanceof PageflowPage) { - // if the new page's file path is not empty, i.e., drag a file from - // resource navigator view - if (null != ((PageflowPage) child).getPath()) { - if (PageflowValidation.getInstance().isExistedPage(parent, - (PageflowPage) child)) { - // Pageflow.PageflowEditor.Alert.DNDResourceTitle = Pageflow - // Creation Error - // Pageflow.PageflowEditor.Alert.ExistingPage = The web page - // {0} is already existed in current PageFlow. - EditorPlugin.getAlerts().error( - "Pageflow.PageflowEditor.Alert.DNDResourceTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.ExistingPage", //$NON-NLS-1$ - ((PageflowPage) child).getPath()); - return false; - } - } else - // create a new jsf page from scratch - { - // return createNewJSFPage(); - return selectJSPPage(); - } - } - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DelegatingCommandStack.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DelegatingCommandStack.java deleted file mode 100644 index 1586f6fd0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DelegatingCommandStack.java +++ /dev/null @@ -1,262 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import java.util.EventObject; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.gef.commands.CommandStackListener; -import org.eclipse.gef.commands.UnexecutableCommand; - -/** - * This is a delegating command stack, which delegates everything to another - * CommandStack except event listners. - * <p> - * Event listeners registered to a <code>DelegatingCommandStack</code> will be - * informed whenever the underlying <code>CommandStack</code> changes. They - * will not be registered to the underlying <code>CommandStack</code> directly - * but they will be informed about change events of them. - * - */ -public class DelegatingCommandStack extends CommandStack implements - CommandStackListener { - /** the empty object array */ - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[] {}; - - /** the current command stack */ - private CommandStack currentCommandStack = null; - - /** - * Returns the current <code>CommandStack</code>. - * - * @return - the current <code>CommandStack</code> - */ - public CommandStack getCurrentCommandStack() { - return currentCommandStack; - } - - /** - * Sets the current <code>CommandStack</code>. - * - * @param stack - - * the <code>CommandStack</code> to set - */ - public void setCurrentCommandStack(CommandStack stack) { - if (currentCommandStack == stack) { - return; - } - - // remove from old command stack - if (null != currentCommandStack) { - currentCommandStack.removeCommandStackListener(this); - } - - // set new command stack - currentCommandStack = stack; - - if (currentCommandStack != null) { - // watch new command stack - currentCommandStack.addCommandStackListener(this); - - // the command stack changed - notifyListeners(); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#canRedo() - */ - public boolean canRedo() { - if (null == currentCommandStack) { - return false; - } - - return currentCommandStack.canRedo(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#canUndo() - */ - public boolean canUndo() { - if (null == currentCommandStack) { - return false; - } - - return currentCommandStack.canUndo(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#dispose() - */ - public void dispose() { - if (null != currentCommandStack) { - currentCommandStack.dispose(); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#execute(org.eclipse.gef.commands.Command) - */ - public void execute(Command command) { - if (null != currentCommandStack) { - currentCommandStack.execute(command); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#flush() - */ - public void flush() { - if (null != currentCommandStack) { - currentCommandStack.flush(); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#getCommands() - */ - public Object[] getCommands() { - if (null == currentCommandStack) { - return EMPTY_OBJECT_ARRAY; - } - - return currentCommandStack.getCommands(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#getRedoCommand() - */ - public Command getRedoCommand() { - if (null == currentCommandStack) { - return UnexecutableCommand.INSTANCE; - } - - return currentCommandStack.getRedoCommand(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#getUndoCommand() - */ - public Command getUndoCommand() { - if (null == currentCommandStack) { - return UnexecutableCommand.INSTANCE; - } - - return currentCommandStack.getUndoCommand(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#getUndoLimit() - */ - public int getUndoLimit() { - if (null == currentCommandStack) { - return -1; - } - - return currentCommandStack.getUndoLimit(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#isDirty() - */ - public boolean isDirty() { - if (null == currentCommandStack) { - return false; - } - - return currentCommandStack.isDirty(); - } - - /* - * (non-Javadoc) - * - * @see CommandStack#markSaveLocation() - */ - public void markSaveLocation() { - if (null != currentCommandStack) { - currentCommandStack.markSaveLocation(); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#redo() - */ - public void redo() { - if (null != currentCommandStack) { - currentCommandStack.redo(); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#setUndoLimit(int) - */ - public void setUndoLimit(int undoLimit) { - if (null != currentCommandStack) { - currentCommandStack.setUndoLimit(undoLimit); - } - } - - /* - * (non-Javadoc) - * - * @see CommandStack#undo() - */ - public void undo() { - if (null != currentCommandStack) { - currentCommandStack.undo(); - } - } - - /* - * (non-Javadoc) - * - * @see Object#toString() - */ - public String toString() { - return "DelegatingCommandStack(" + currentCommandStack + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /* - * (non-Javadoc) - * - * @see CommandStackListener#commandStackChanged(java.util.EventObject) - */ - public void commandStackChanged(EventObject event) { - notifyListeners(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteBendpointCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteBendpointCommand.java deleted file mode 100644 index 25e004937..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteBendpointCommand.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; - -/** - * - */ -public class DeleteBendpointCommand extends BendpointCommand { - - /** the deleting bendpoint */ - private PageflowLinkBendpoint bendpoint; - - /** - * Default constructor - */ - public DeleteBendpointCommand() { - - // Pageflow.Commands.DeleteBendpointCommand.Label = Delete Bendpoint - super(PageflowMessages.Pageflow_Commands_DeleteBendpointCommand_Label); - - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - super.execute(); - bendpoint = (PageflowLinkBendpoint) getPFLink().getBendPoints().get( - getIndex()); - getPFLink().removeBendpoint(getIndex()); - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - super.undo(); - getPFLink().insertBendpoint(getIndex(), bendpoint); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteConnectionCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteConnectionCommand.java deleted file mode 100644 index dd22437fd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteConnectionCommand.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -/** - * Delete a connection. - * - * @author hmeng - * - */ -public class DeleteConnectionCommand extends ConnectionCommand { - - public boolean canExecute() { - return link != null; - } - - protected void doExecute() { - // It is a delete connection command - if (link != null) { - link.setSource(null); - link.setTarget(null); - oldSource.getPageflow().getLinks().remove(link); - link.eAdapters().clear(); - } - } - - public void undo() { - // It is a delete connection command - if (canExecute()) { - link.setSource(oldSource); - link.setTarget(oldTarget); - oldSource.getPageflow().getLinks().add(link); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteNodeCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteNodeCommand.java deleted file mode 100644 index 4660942a7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/DeleteNodeCommand.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * This is the delete command for pageflow editpart - * - */ -public class DeleteNodeCommand extends AbstractBatchEditCommand { - /** the deleting pageflow node */ - private PageflowNode child; - - /** parent pageflow */ - private Pageflow parent; - - /** index of pageflow nodes */ - private int index = -1; - - /** source connections with the deleting node */ - private List sourceConnections = new ArrayList(); - - private List sourceConnectionSources = new ArrayList(); - - private List sourceConnectionTargets = new ArrayList(); - - /** target connections with the deleting node */ - private List targetConnections = new ArrayList(); - - private List targetConnectionSources = new ArrayList(); - - private List targetConnectionTargets = new ArrayList(); - - /** - * @param pageflow - */ - public DeleteNodeCommand(Pageflow pageflow) { - // Pageflow.Commands.DeleteNodeCommand.Label = Delete - super(pageflow, PageflowMessages.Pageflow_Commands_DeleteNodeCommand_Label); - - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void doExecute() { - primExecute(); - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void doRedo() { - primExecute(); - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void doUndo() { - parent.getNodes().add(index, child); - restoreConnections(child); - } - - /** - * delete the connections related with the pageflow node. - * - * @param node - - * the deleting pageflow node - */ - private void deleteConnections(PageflowNode node) { - while (node.getOutlinks().size() > 0) { - // Note:should save the source and target of the link, otherwise - // source and target will be lost, - // when the source and target node remove the link. - PageflowLink link = (PageflowLink) node.getOutlinks().get(0); - sourceConnections.add(link); - sourceConnectionSources.add(link.getSource()); - sourceConnectionTargets.add(link.getTarget()); - - link.getTarget().getInlinks().remove(link); - node.getOutlinks().remove(link); - parent.getLinks().remove(link); - } - - while (node.getInlinks().size() > 0) { - // Note: should save the source and target of the link, otherwise - // source and target will be lost, - // when the source and target node remove the link. - PageflowLink link = (PageflowLink) node.getInlinks().get(0); - targetConnections.add(link); - targetConnectionSources.add(link.getSource()); - targetConnectionTargets.add(link.getTarget()); - - link.getSource().getOutlinks().remove(link); - node.getInlinks().remove(link); - parent.getLinks().remove(link); - } - } - - /** - * execute the delete command - * - * - */ - protected void primExecute() { - deleteConnections(child); - index = parent.getNodes().indexOf(child); - parent.getNodes().remove(child); - } - - /** - * restore the connections of the deleted pageflow node - * - * @param node - - * the deleted pageflow node - */ - private void restoreConnections(PageflowNode node) { - for (int i = 0; i < sourceConnections.size(); i++) { - // restore the link with the source and target - PageflowLink link = (PageflowLink) sourceConnections.get(i); - PageflowNode source = (PageflowNode) sourceConnectionSources.get(i); - PageflowNode target = (PageflowNode) sourceConnectionTargets.get(i); - link.setSource(source); - link.setTarget(target); - - parent.getLinks().add(link); - node.getOutlinks().add(link); - link.getTarget().getInlinks().add(link); - } - sourceConnections.clear(); - for (int i = 0; i < targetConnections.size(); i++) { - // restore the link with the source and target - PageflowLink link = (PageflowLink) targetConnections.get(i); - PageflowNode source = (PageflowNode) targetConnectionSources.get(i); - PageflowNode target = (PageflowNode) targetConnectionTargets.get(i); - link.setSource(source); - link.setTarget(target); - - parent.getLinks().add(link); - node.getInlinks().add(link); - link.getSource().getOutlinks().add(link); - } - targetConnections.clear(); - } - - /** - * set the child pageflow node - * - * @param c - - * the child pageflow node - */ - public void setChild(PageflowNode c) { - child = c; - } - - /** - * set the parent pageflow - * - * @param p - - * the parent pageflow - */ - public void setParent(Pageflow p) { - parent = p; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/EMFCommandGEFAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/EMFCommandGEFAdapter.java deleted file mode 100644 index 456c1b888..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/EMFCommandGEFAdapter.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.gef.commands.Command; - -/** - * This class is used to adapter EMF Command to GEF Command. - * - * @author xgzhang - * @version - */ -/*package*/ class EMFCommandGEFAdapter extends Command { - private org.eclipse.emf.common.command.Command emfCommand; - - /** - * @param emfCommand - */ - public EMFCommandGEFAdapter( - org.eclipse.emf.common.command.Command emfCommand) { - super(); - this.emfCommand = emfCommand; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#canExecute() - */ - public boolean canExecute() { - if (emfCommand == null) { - return false; - } - return emfCommand.canExecute(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#canUndo() - */ - public boolean canUndo() { - if (emfCommand == null) { - return false; - } - return emfCommand.canUndo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#dispose() - */ - public void dispose() { - if (emfCommand == null) { - return; - } - emfCommand.dispose(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#execute() - */ - public void execute() { - if (emfCommand == null) { - return; - } - emfCommand.execute(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#getLabel() - */ - public String getLabel() { - if (emfCommand == null) { - return null; - } - return emfCommand.getLabel(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#redo() - */ - public void redo() { - if (emfCommand == null) { - return; - } - emfCommand.redo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.Command#undo() - */ - public void undo() { - if (emfCommand == null) { - return; - } - emfCommand.undo(); - } - - /** - * - */ - org.eclipse.emf.common.command.Command getEMFCommand() { - return emfCommand; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/EMFCommandStackGEFAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/EMFCommandStackGEFAdapter.java deleted file mode 100644 index a253dff20..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/EMFCommandStackGEFAdapter.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import java.util.EventObject; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.jface.text.IDocument; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * This adapter is used to let editor be able to monitor EMF CommandStack, e.g., - * in StructuredTextEditor, using GEF CommandStack. - * - * @author xgzhang - * @version - */ -public class EMFCommandStackGEFAdapter extends CommandStack implements - CommandStackListener { - private org.eclipse.emf.common.command.BasicCommandStack emfCommandStack; - private IStructuredModel model; - - /** - * @param doc - */ - public EMFCommandStackGEFAdapter (IDocument doc) { - - super(); - - model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc); - - if (model == null) { - model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) doc); - } - - emfCommandStack = ((BasicCommandStack) this.model.getUndoManager().getCommandStack()); - emfCommandStack.addCommandStackListener(this); - } - - - @Override - public void dispose() { - model.releaseFromEdit(); - super.dispose(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#canRedo() - */ - public boolean canRedo() { - if (emfCommandStack == null) { - return false; - } - return emfCommandStack.canRedo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#canUndo() - */ - public boolean canUndo() { - if (emfCommandStack == null) { - return false; - } - return emfCommandStack.canUndo(); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#execute(org.eclipse.gef.commands.Command) - */ - public void execute(Command command) { - if (!(command instanceof EMFCommandGEFAdapter)) { - return; - } - - org.eclipse.emf.common.command.Command emfCommand = ((EMFCommandGEFAdapter) command) - .getEMFCommand(); - if (emfCommand != null) { - emfCommandStack.execute(emfCommand); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#flush() - */ - public void flush() { - if (emfCommandStack == null) { - return; - } - emfCommandStack.flush(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#getRedoCommand() - */ - public Command getRedoCommand() { - if (emfCommandStack == null || emfCommandStack.getRedoCommand() == null) { - return null; - } - - return new EMFCommandGEFAdapter(emfCommandStack.getRedoCommand()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#getUndoCommand() - */ - public Command getUndoCommand() { - if (emfCommandStack == null || emfCommandStack.getUndoCommand() == null) { - return null; - } - - return new EMFCommandGEFAdapter(emfCommandStack.getUndoCommand()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#isDirty() - */ - public boolean isDirty() { - if (emfCommandStack == null) { - return false; - } - return emfCommandStack.isSaveNeeded(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#markSaveLocation() - */ - public void markSaveLocation() { - if (emfCommandStack == null) { - return; - } - emfCommandStack.saveIsDone(); - super.markSaveLocation(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#redo() - */ - public void redo() { - if (emfCommandStack == null) { - return; - } - emfCommandStack.redo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#undo() - */ - public void undo() { - if (emfCommandStack == null) { - return; - } - emfCommandStack.undo(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.common.command.CommandStackListener#commandStackChanged(java.util.EventObject) - */ - public void commandStackChanged(EventObject event) { - this.notifyListeners(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/IPreExecuteCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/IPreExecuteCommand.java deleted file mode 100644 index 4bed8f6e3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/IPreExecuteCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -/** - * Command with pre execute checking. - * - * @author Xiao-guang Zhang - * - * - */ -/*package*/ interface IPreExecuteCommand { - /** - * Do something pre-execution of the actual command execution. - * - * @return - successful to do the pre-execution - */ - boolean preExecute(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/MoveBendpointCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/MoveBendpointCommand.java deleted file mode 100644 index dc1e0fa48..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/MoveBendpointCommand.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; - -/** - * Move bend point command - */ -public class MoveBendpointCommand extends BendpointCommand { - /** - * old bend point of the link - */ - private PageflowLinkBendpoint oldBendpoint; - - /** - * Default constructor - */ - public MoveBendpointCommand() { - // Pageflow.Commands.MoveBendpointCommand.Label = Move Bendpoint - super(PageflowMessages.Pageflow_Commands_MoveBendpointCommand_Label); - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - Map registry = EPackage.Registry.INSTANCE; - String pageflowURI = PageflowPackage.eNS_URI; - PageflowPackage pageflowPackage = (PageflowPackage) registry - .get(pageflowURI); - PageflowFactory factory = pageflowPackage.getPageflowFactory(); - PageflowLinkBendpoint _newBendpoint = factory.createPFLinkBendpoint(); - - _newBendpoint.setRelativeDimensions(getFirstRelativeDimension(), - getSecondRelativeDimension()); - setOldBendpoint((PageflowLinkBendpoint) getPFLink().getBendPoints().get( - getIndex())); - - getPFLink().setBendpoint(getIndex(), _newBendpoint); - super.execute(); - } - - /** - * get the old bend point - * - * @return - old bend point - */ - protected PageflowLinkBendpoint getOldBendpoint() { - return oldBendpoint; - } - - /** - * set the old bend point - * - * @param bp - - * old bend point - */ - public void setOldBendpoint(PageflowLinkBendpoint bp) { - oldBendpoint = bp; - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - super.undo(); - getPFLink().setBendpoint(getIndex(), getOldBendpoint()); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/OpenEditorCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/OpenEditorCommand.java deleted file mode 100644 index e293eb8ab..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/OpenEditorCommand.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.FileEditorInput; - -/** - * - * This is the Command for opening a file in its default editor - * - * @author Xiao-guang Zhang - */ -public class OpenEditorCommand extends Command { - - /** The edit part */ - private EditPart part; - - /** log instance */ - private static final Logger log = EditorPlugin - .getLogger(FacesConfigEditor.class); - - /* - * (non-Javadoc) - * - * @see Command#canExecute() - */ - public boolean canExecute() { - return true; - } - - /** - * The constructor - * - * @param part - - * the EditPart - */ - public OpenEditorCommand(EditPart part) { - // Pageflow.Commands.OpenEditorCommand.Label = Open Editor - super(PageflowMessages.Pageflow_Commands_OpenEditorCommand_Label); - this.part = part; - } - - /** - * open existed JSF file or call the wizard to create a new one. - * - */ - private void executeOpenPFPage() { - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - String pagePath = ((PageflowPage) (part.getModel())).getPath(); - - // Check the fileName is empty or not - if (pagePath != null && pagePath.length() > 0) { - String resourceName = WebrootUtil.getProjectPath((EObject) part - .getModel(), pagePath); - Path resourcePath = new Path(resourceName); - if (resourcePath.getFileExtension() != null) { - final IFile file = (IFile) workspaceRoot - .findMember(resourcePath); - openExistingJSFFile(file); - } else { - // Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle = - // Open JSF File Error - // Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFFolderInfo = - // Cannot open the page in the page editor. - EditorPlugin - .getAlerts() - .error( - "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFFolderInfo"); //$NON-NLS-1$ - } - } else - // if the fileName is empty, a new jsf file should be created! - { - // Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle = Open JSF - // File Error - // Pageflow.PageflowEditor.Alert.confirmCreateNewJSFFile = No jsp - // file is related with this page. - EditorPlugin.getAlerts().error( - "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.confirmCreateNewJSFFile");// ) //$NON-NLS-1$ - } - } - - /** - * open existing jsf file in a new editor. - * - * @param file - */ - private void openExistingJSFFile(final IFile file) { - // if the file is existed, open it. - if (null != file && file.exists()) { - Display display = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell().getDisplay(); - display.asyncExec(new Runnable() { - public void run() { - IDE.setDefaultEditor(file, null); - try { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - IEditorDescriptor desc = IDE.getEditorDescriptor(file); - page.openEditor(new FileEditorInput(file), - desc.getId(), true, IWorkbenchPage.MATCH_INPUT - | IWorkbenchPage.MATCH_ID); - } catch (PartInitException e) { - // Pageflow.PageflowEditor.Error.CanNotOpenEditor4JSF = - // The jsf file can not be opened in the editor. - log - .error( - "Pageflow.PageflowEditor.Error.canNotOpenEditor4JSF", //$NON-NLS-1$ - e); - // Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle - // = Open JSF File Error - EditorPlugin - .getAlerts() - .error( - "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Error.CanNotOpenEditor4JSF"); //$NON-NLS-1$ - } - } - }); - } else - // otherwise, pop-up a error message box - { - String pagePath = ((PageflowPage) (part.getModel())).getPath(); - // Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle = Open JSF - // File Error - // Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFInfo = The JSF - // file is not existed. - EditorPlugin.getAlerts().error( - "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFInfo", //$NON-NLS-1$ - pagePath); - } - } - - /** - * Executes the OpenEditorCommand and opens the editor - */ - public void execute() { - if (part.getModel() instanceof PageflowPage) { - executeOpenPFPage(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/OrphanChildCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/OrphanChildCommand.java deleted file mode 100644 index a695c320d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/OrphanChildCommand.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import java.util.List; - -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * This is the orphan child command for pageflow container - * - */ -public class OrphanChildCommand extends Command { - - /** old location of pageflow node */ - private Point oldLocation; - - /** the parent pageflow */ - private Pageflow pageflow; - - /** the child pageflow node */ - private PageflowNode child; - - /** the index of pageflow nodes */ - private int index; - - /** - * Default constructor - */ - public OrphanChildCommand() { - // Pageflow.Commands.OrphanChildCommand.Label = Orphan Child - super(PageflowMessages.Pageflow_Commands_OrphanChildCommand_Label); - } - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - List children = pageflow.getNodes(); - index = children.indexOf(child); - oldLocation = new Point(child.getX(), child.getY()); - pageflow.getNodes().remove(child); - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void redo() { - pageflow.getNodes().remove(child); - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - child.setX(oldLocation.x); - child.setY(oldLocation.y); - pageflow.getNodes().add(index, child); - } - - /** - * set the child pageflow node - * - * @param child - - * child pageflow node - */ - public void setChild(PageflowNode child) { - this.child = child; - } - - /** - * set the parent pageflow - * - * @param parent - - * parent pageflow - */ - public void setParent(Pageflow parent) { - pageflow = parent; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/PreExecuteCommandStack.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/PreExecuteCommandStack.java deleted file mode 100644 index 2741862d8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/PreExecuteCommandStack.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; - -/** - * Before the command stack called execute to do the actual model modification, - * it will call the command's IPreExecuteCommand inteface to check the command - * can be execute or not. - * - * - * @author Xiao-guang Zhang - */ -public class PreExecuteCommandStack extends CommandStack { - /** - * - */ - public PreExecuteCommandStack() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.commands.CommandStack#execute(org.eclipse.gef.commands.Command) - */ - public void execute(Command command) { - if (command == null || !command.canExecute()) { - return; - } - if (command instanceof IPreExecuteCommand) { - if (!((IPreExecuteCommand) command).preExecute()) { - return; - } - } - super.execute(command); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ReconnectConnectionCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ReconnectConnectionCommand.java deleted file mode 100644 index 63519caf1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/ReconnectConnectionCommand.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; - -/** - * Change the end of a link. - * - * @author hmeng - * - */ -public class ReconnectConnectionCommand extends ConnectionCommand { - - /** - * Default constructor - */ - public ReconnectConnectionCommand() { - super(); - } - - public boolean canExecute() { - // if user didn't set PFLink object beforehand, this command can't be - // executed. - if (link == null || link.eContainer() == null) { - return false; - } - - // Reconnect both source and target - if (oldSource != null && source != null && oldTarget != null - && target != null) { - if (!PageflowValidation.getInstance().isValidLinkForCreation( - source, target)) { - return false; - } - } - - // Reconnect source - if (oldSource != null && source != null) { - if (!PageflowValidation.getInstance().isValidLinkForCreation( - source, oldTarget)) { - return false; - } - } - // Reconnect target - if (oldTarget != null && target != null) { - if (!PageflowValidation.getInstance().isValidLinkForCreation( - oldSource, target)) { - return false; - } - } - - return true; - - } - - public void doExecute() { - String outcome = null, action = null, largeIcon = null, smallIcon = null; - boolean isRedirect = false; - outcome = link.getOutcome(); - action = link.getFromaction(); - isRedirect = link.isRedirect(); - largeIcon = link.getLargeicon(); - smallIcon = link.getSmallicon(); - // It is a reconnect source command - if (oldSource != null && source != null) { - link.setSource(source); - } - // It is a reconnect target command - if (oldTarget != null && target != null) { - link.setTarget(target); - } - link.setOutcome(outcome); - link.setFromaction(action); - link.setLargeicon(largeIcon); - link.setSmallicon(smallIcon); - link.setRedirect(isRedirect); - } - - public void undo() { - if (canExecute()) { - // It was a reconnect source command - if (oldSource != null && source != null) { - // The link source must be replaced by the oldSource - if (link.getSource() != null) { - link.getSource().getOutlinks().remove(link); - } - source.getOutlinks().remove(link); - link.setSource(oldSource); - } - // It was a reconnect target command - if (oldTarget != null && target != null) { - // The link target must be replaced by the oldTarget - if (link.getTarget() != null) { - link.getTarget().getInlinks().remove(link); - } - target.getInlinks().remove(link); - link.setTarget(oldTarget); - } - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/RenameNodeCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/RenameNodeCommand.java deleted file mode 100644 index e3e526920..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/RenameNodeCommand.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * Command to rename Node. - * - * @author xgzhang - */ -public class RenameNodeCommand extends Command { - - /** new pageflow node */ - private PageflowNode node; - - /** new node name */ - private String name; - - /** old node name */ - private String oldName; - - /** - * @see org.eclipse.gef.commands.Command#execute() - */ - public void execute() { - node.setName(name); - } - - /** - * Sets the new Activity name - * - * @param string - * the new name - */ - public void setName(String string) { - name = string; - } - - /** - * Sets the old Activity name - * - * @param string - * the old name - */ - public void setOldName(String string) { - oldName = string; - } - - /** - * Sets the source Activity - * @param node - * the source Activity - */ - public void setSource(PageflowNode node) { - this.node = node; - } - - /** - * @see org.eclipse.gef.commands.Command#undo() - */ - public void undo() { - node.setName(oldName); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/SetConstraintCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/SetConstraintCommand.java deleted file mode 100644 index c36b92961..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/command/SetConstraintCommand.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; - -/** - * This is the SetConstraint command for XY layout edit policy - * - */ -public class SetConstraintCommand extends Command { - /** location command label */ - private static final String COMMAND_LABEL_LOCATION = PageflowMessages.SetConstraintCommand_Location; - - /** resize command label */ - private static final String COMMAND_LABEL_RESIZE = PageflowMessages.SetConstraintCommand_Resize; - - /** new position */ - private Point newPos; - - /** new size */ - private Dimension newSize; - - /** olde position */ - private Point oldPos; - - /** old size */ - private Dimension oldSize; - - /** pageflow element */ - private PageflowElement part; - - /* - * (non-Javadoc) - * - * @see Command#execute() - */ - public void execute() { - oldSize = new Dimension(part.getWidth(), part.getHeight()); - oldPos = new Point(part.getX(), part.getY()); - part.setX(newPos.x); - part.setY(newPos.y); - part.setHeight(newSize.height); - part.setWidth(newSize.width); - } - - /* - * (non-Javadoc) - * - * @see Command#redo() - */ - public void redo() { - part.setX(newPos.x); - part.setY(newPos.y); - part.setHeight(newSize.height); - part.setWidth(newSize.width); - } - - /* - * (non-Javadoc) - * - * @see Command#undo() - */ - public void undo() { - part.setX(oldPos.x); - part.setY(oldPos.y); - part.setHeight(oldSize.height); - part.setWidth(oldSize.width); - } - - /** - * return the label of the constraints - */ - public String getLabel() { - if (oldSize.equals(newSize)) { - return COMMAND_LABEL_LOCATION; - } - return COMMAND_LABEL_RESIZE; - } - - /** - * set the new location using rectangle - * - * @param r - - * new location - */ - public void setLocation(Rectangle r) { - setLocation(r.getLocation()); - setSize(r.getSize()); - } - - /** - * set the new location using point - * - * @param p - - * new location point - */ - public void setLocation(Point p) { - newPos = p; - } - - /** - * set the pageflow element - * - * @param part - - * pageflow element - */ - public void setPart(PageflowElement part) { - this.part = part; - } - - /** - * set the new size - * - * @param p - - * new size - */ - public void setSize(Dimension p) { - newSize = p; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/ConfigurableRootEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/ConfigurableRootEditPart.java deleted file mode 100644 index 083c65edc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/ConfigurableRootEditPart.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.SimpleLoweredBorder; -import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; - -/** - * This RootEditPart can set its own's background, fourground color, and font. - * All this properties can be changed. - * - * @author Xiao-guang Zhang - * - */ -public class ConfigurableRootEditPart extends ScalableFreeformRootEditPart - implements IFigurePreference { - /** - * - */ - public ConfigurableRootEditPart() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - IFigure fig = super.createFigure(); - fig.setOpaque(true); - fig.setBorder(new SimpleLoweredBorder()); - return fig; - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setForegroundColor(org.eclipse.swt.graphics.Color) - */ - public void setForegroundColor(Color c) { - getFigure().setForegroundColor(c); - - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setBackgroundColor(org.eclipse.swt.graphics.Color) - */ - public void setBackgroundColor(Color c) { - getFigure().setBackgroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setFont(org.eclipse.swt.graphics.Font) - */ - public void setFont(Font f) { - getFigure().setFont(f); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/DirectEditCellEditorLocator.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/DirectEditCellEditorLocator.java deleted file mode 100644 index 4c71c04bf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/DirectEditCellEditorLocator.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Text; - -/** - * CellEditorLocator for Pageflow Node. - * - * @author - Xiaoguang Zhang - */ -/*package*/ class DirectEditCellEditorLocator implements CellEditorLocator { - /** the source label */ - private Label label; - - /** - * Creates a new DirectEditCellEditorLocator for the given Label - * - * @param label - * the Label - */ - public DirectEditCellEditorLocator(Label label) { - setLabel(label); - } - - /* - * (non-javadoc) - * - * @see CellEditorLocator#relocate(CellEditor) - */ - public void relocate(CellEditor celleditor) { - Text text = (Text) celleditor.getControl(); - Point pref = text.computeSize(-1, -1); - // get the label's boundary - Rectangle rect = label.getTextBounds().getCopy(); - label.translateToAbsolute(rect); - - // because the label can be empty and the size is too small - // here get the prefered text size according to label's size and default - // size. - int width, height; - if (pref.x > rect.width) { - width = pref.x; - } else { - width = rect.width; - } - - if (pref.y > rect.height) { - height = pref.y; - } else { - height = rect.height; - } - - // set the boundary of the text control - text.setBounds(rect.x - 1, rect.y - 1, width + 1, height + 1); - } - - /** - * Returns the Label figure. - * - * @return the Label - */ - protected Label getLabel() { - return label; - } - - /** - * Sets the label. - * - * @param label - * The label to set - */ - protected void setLabel(Label label) { - this.label = label; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IAnnotationEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IAnnotationEditPart.java deleted file mode 100644 index 2c29393d0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IAnnotationEditPart.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.text.source.Annotation; - -/** - * Edit part's Annotation interface - * - * @author Xiao-guang Zhang - * - */ -public interface IAnnotationEditPart { - /** - * decorate current Edit Part. - * @param annotation - */ - void addAnnotation(Annotation annotation); - - /** - * un-decorate current EditPart - * - */ - void removeAnnotation(); - - /** - * get the maker's resource instance. - * - * @return marker resource - */ - IResource getMarkerResource(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IConnectionPreference.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IConnectionPreference.java deleted file mode 100644 index 8ff1b9a99..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IConnectionPreference.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.swt.graphics.Color; - -/** - * This interface can be used to set Connection's preference - * - * @author Xiaoguang Zhang - * - */ -public interface IConnectionPreference extends IFigurePreference { - - /** - * set the connection line width - * - * @param w - */ - void setLineWidth(int w); - - /** - * set the label visible or not - * - * @param b - */ - void setLabelVisible(boolean b); - - /** - * set the label's foreground color - * - * @param c - */ - void setLabelForegroundColor(Color c); - - /** - * set the label's background color - * - * @param c - */ - void setLabelBackgroundColor(Color c); - - /** - * set the connection router's style, it can be LINE_ROUTING_MANUAL, - * LINE_ROUTING_MANHATTAN - * - * @param style - - * The new connection router's style - */ - void setConnectionRouterStyle(int style); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IFigurePreference.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IFigurePreference.java deleted file mode 100644 index 3dc924b1e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/IFigurePreference.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; - -/** - * This interface can be implemented to set the figure's preferences - * - * @author Xiao-guang Zhang - * - */ -public interface IFigurePreference { - /** - * Sets the foreground color. - * - * @param c - * The new foreground color - */ - void setForegroundColor(Color c); - - /** - * Sets the background color. - * - * @param c - * The new background color - */ - void setBackgroundColor(Color c); - - /** - * sets the new font - * - * @param f - */ - void setFont(Font f); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/ILayerPanePreference.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/ILayerPanePreference.java deleted file mode 100644 index 91d2af63b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/ILayerPanePreference.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.swt.graphics.Color; - -/** - * LayerPane has muliple layers, this interface will be used to set different - * layer's style. - * - * @author Xiao-guang Zhang - * - */ -public interface ILayerPanePreference extends IFigurePreference { - /** - * Use manual line router - */ - public static int LINE_ROUTING_MANUAL = 0; - - /** - * Use manhattan line router - */ - public static int LINE_ROUTING_MANHATTAN = 1; - - /** - * sets the grid to be shown or not - * - * @param bVisible - */ - void setGridVisible(boolean bVisible); - - /** - * sets the grid's dimension - * - * @param d - * The new grid spacing - */ - void setGridSpacing(Dimension d); - - /** - * set the grid's foregoundColor - * - * @param c - - * The new foreground color - */ - void setGridForegroundColor(Color c); - - /** - * set the connection router's style, it can be LINE_ROUTING_MANUAL, - * LINE_ROUTING_MANHATTAN - * - * @param style - - * The new connection router's style - */ - void setConnectionRouterStyle(int style); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/INodePreference.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/INodePreference.java deleted file mode 100644 index 3a2a3f938..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/INodePreference.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - - -/** - * This interface can be used to set NodeEditPart's preference - * - * @author Xiaoguang Zhang - * - */ - -public interface INodePreference extends IFigurePreference { - - /** - * Sets the text placement of the label relative to its icon. The default is - * {@link org.eclipse.draw2d.PositionConstants#EAST}. Other possible values are - * {@link org.eclipse.draw2d.PositionConstants#NORTH}, {@link org.eclipse.draw2d.PositionConstants#SOUTH} and - * {@link org.eclipse.draw2d.PositionConstants#WEST}. - * - * @param where - * the text placement - */ - void setTextPlacement(int where); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PFValidator.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PFValidator.java deleted file mode 100644 index 413a5a1f9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PFValidator.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -/** - * @author hmeng - */ - -public interface PFValidator { - /** - * Validate the current page flow - */ - void validate(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowContainerEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowContainerEditPart.java deleted file mode 100644 index 83590a129..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowContainerEditPart.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.EditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowContainerEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowXYLayoutEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter; -import org.eclipse.ui.PlatformUI; - -/** - * abstract class for pageflow container. - */ -abstract class PageflowContainerEditPart extends PageflowElementEditPart { - - /** - * @param element - - * pageflow model. - */ - public PageflowContainerEditPart(PageflowElement element) { - super(element); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - return null; - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - installEditPolicy(EditPolicy.CONTAINER_ROLE, - new PageflowContainerEditPolicy()); - installEditPolicy(EditPolicy.LAYOUT_ROLE, - new PageflowXYLayoutEditPolicy()); - } - - public Adapter createEMFAdapter() { - return new PFBatchAdapter() { - /* - * (non-Javadoc) - * - * @see PageflowElementEditPart#notifyChanged(Notification) - */ - public void doNotifyChanged(Notification notification) { - int type = notification.getEventType(); - - switch (type) { - case Notification.ADD: - case Notification.ADD_MANY: - case Notification.REMOVE: - case Notification.REMOVE_MANY: - refreshChildrenOnUIThread(); - break; - case Notification.SET: - refreshVisualsOnUIThread(); - break; - } - super.notifyChanged(notification); - } - }; - } - - private void refreshChildrenOnUIThread() { - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshChildren(); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - public void run() { - refreshChildren(); - } - }); - } - } - - private void refreshVisualsOnUIThread() { - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshVisuals(); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - public void run() { - refreshVisuals(); - } - }); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowDirectEditManager.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowDirectEditManager.java deleted file mode 100644 index 5fa56d1fd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowDirectEditManager.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Text; - -/** - * DirectEditManager for Pageflow node - * - * @author - Xiaoguang Zhang - */ -/*package*/ final class PageflowDirectEditManager extends DirectEditManager { - /** text font */ - private Font scaledFont; - - /** verify listener for the text control */ - private VerifyListener verifyListener; - - /** the direct editor's parent label. */ - private final Label label; - - /** - * Creates a new PageflowDirectEditManager with the given attributes. - * - * @param source - * the source EditPart - * @param editorType - * type of editor - * @param locator - * the CellEditorLocator - * @param label - */ - public PageflowDirectEditManager(GraphicalEditPart source, - Class editorType, CellEditorLocator locator, Label label) { - super(source, editorType, locator); - this.label = label; - } - - /* - * (non-javadoc) - * - * @see org.eclipse.gef.tools.DirectEditManager#bringDown() - */ - protected void bringDown() { - // This method might be re-entered when super.bringDown() is called. - Font disposeFont = scaledFont; - scaledFont = null; - super.bringDown(); - if (disposeFont != null && !disposeFont.isDisposed()) { - disposeFont.dispose(); - } - } - - /* - * (non-javadoc) - * - * @see org.eclipse.gef.tools.DirectEditManager#initCellEditor() - */ - protected void initCellEditor() { - Text text = (Text) getCellEditor().getControl(); - verifyListener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - Text text_ = (Text) getCellEditor().getControl(); - String oldText = text_.getText(); - // get the left string of the new input character - String leftText = oldText.substring(0, event.start); - // get the right string of the new input charactor - String rightText = oldText.substring(event.end, oldText - .length()); - - GC gc = new GC(text_); - Point size = gc.textExtent(leftText + event.text + rightText); - gc.dispose(); - if (size.x != 0) { - size = text_.computeSize(size.x, SWT.DEFAULT); - } - getCellEditor().getControl().setSize(size.x, size.y); - } - }; - text.addVerifyListener(verifyListener); - - // set the initial text, font, to the direct editor - String initialLabelText = label.getText(); - getCellEditor().setValue(initialLabelText); - IFigure figure = getEditPart().getFigure(); - final Font figureFont = figure.getFont(); - // take a copy of the font data for the label we are cell editing - FontData data = figureFont.getFontData()[0]; - Dimension fontSize = new Dimension(0, data.getHeight()); - label.translateToAbsolute(fontSize); - data.setHeight(fontSize.height); - - if (scaledFont != null && !scaledFont.isDisposed()) - { - scaledFont.dispose(); - } - scaledFont = new Font(figureFont.getDevice(), data); - - text.setFont(scaledFont); - text.selectAll(); - } - - /* - * (non-javadoc) - * - * @see org.eclipse.gef.tools.DirectEditManager#unhookListeners() - */ - protected void unhookListeners() { - super.unhookListeners(); - Text text = (Text) getCellEditor().getControl(); - text.removeVerifyListener(verifyListener); - verifyListener = null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowEditPart.java deleted file mode 100644 index 3f3a80f7a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowEditPart.java +++ /dev/null @@ -1,424 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.draw2d.BendpointConnectionRouter; -import org.eclipse.draw2d.ConnectionLayer; -import org.eclipse.draw2d.FanRouter; -import org.eclipse.draw2d.FreeformLayer; -import org.eclipse.draw2d.FreeformLayout; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.ManhattanConnectionRouter; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.CompoundSnapToHelper; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.SnapToGeometry; -import org.eclipse.gef.SnapToGrid; -import org.eclipse.gef.SnapToGuides; -import org.eclipse.gef.SnapToHelper; -import org.eclipse.gef.editparts.AbstractEditPart; -import org.eclipse.gef.editparts.GridLayer; -import org.eclipse.gef.editpolicies.RootComponentEditPolicy; -import org.eclipse.gef.editpolicies.SnapFeedbackPolicy; -import org.eclipse.gef.rulers.RulerProvider; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.FC2PFTransformer; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowAnnotationUtil; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.ui.PlatformUI; - -/** - * The container editr part for the whole pageflow, which uses the - * WindowFigure(GEM) as the container figure. - * - */ -public class PageflowEditPart extends PageflowContainerEditPart implements - LayerConstants, ILayerPanePreference { - /** The seperation for the two possible coincided connections */ - private static final int CONNECTION_SEPERATION = 20; - - private int connectionStyle = -1; - - /** - * Creates a new PageflowEditPart instance. - * - * @param pageflow - - * pageflow model - */ - protected PageflowEditPart(Pageflow pageflow) { - super(pageflow); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - FreeformLayer layer = new FreeformLayer(); - // layer.setOpaque(true); - layer.setLayoutManager(new FreeformLayout()); - return layer; - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - super.createEditPolicies(); - - installEditPolicy(EditPolicy.NODE_ROLE, null); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null); - // installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null); - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new RootComponentEditPolicy()); - installEditPolicy("Snap Feedback", new SnapFeedbackPolicy()); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class key) { - if (key == SnapToHelper.class) { - IPreferenceStore store = EditorPlugin.getDefault() - .getPreferenceStore(); - - List snapStrategies = new ArrayList(); - Boolean bRulerVisible = (Boolean) getViewer().getProperty( - RulerProvider.PROPERTY_RULER_VISIBILITY); - if (bRulerVisible != null && bRulerVisible.booleanValue()) { - snapStrategies.add(new SnapToGuides(this)); - } - - boolean bSnapToGeometry = store - .getBoolean(GEMPreferences.SNAP_TO_GEOMETRY); - if (bSnapToGeometry) { - snapStrategies.add(new SnapToGeometry(this)); - } - boolean bSnapToGrid = store.getBoolean(GEMPreferences.SNAP_TO_GRID); - if (bSnapToGrid) { - snapStrategies.add(new SnapToGrid(this)); - } - - if (snapStrategies.size() == 0) { - return null; - } - if (snapStrategies.size() == 1) { - return snapStrategies.get(0); - } - - SnapToHelper ss[] = new SnapToHelper[snapStrategies.size()]; - for (int i = 0; i < snapStrategies.size(); i++) { - ss[i] = (SnapToHelper) snapStrategies.get(i); - } - return new CompoundSnapToHelper(ss); - } - return super.getAdapter(key); - } - - /** - * Returns the Pageflow. - * - * @return the pageflow - */ - public Pageflow getPageflow() { - return (Pageflow) getPageflowElement(); - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#getModelChildren() - */ - protected List getModelChildren() { - List allChildren = new LinkedList(); - Iterator it; - - it = getPageflow().getNodes().iterator(); - while (it.hasNext()) { - allChildren.add(it.next()); - } - - return allChildren; - } - - public Adapter createEMFAdapter() { - return new PFBatchAdapter() { - /* - * (non-Javadoc) - * - * @see Adapter#notifyChanged(Notification) - */ - public void doNotifyChanged(Notification notification) { - int type = notification.getEventType(); - - // int featureId = notification.getFeatureID( - // PageflowPackage.class ); - switch (type) { - case Notification.ADD: - case Notification.ADD_MANY: - case Notification.REMOVE: - case Notification.REMOVE_MANY: - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshChildren(); - } - else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - - public void run() { - refreshChildren(); - } - - }); - } - break; - - case Notification.SET: - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshChildren(); - refreshVisuals(); - } - else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - - public void run() { - refreshChildren(); - refreshVisuals(); - } - - }); - } - break; - case FC2PFTransformer.MY_NOTIFICATION_TYPE1: - restore((Pageflow) getModel()); - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshChildren(); - refreshVisuals(); - } - else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - - public void run() { - refreshChildren(); - refreshVisuals(); - } - - }); - } - break; - // restore all children - case FC2PFTransformer.MY_NOTIFICATION_TYPE: - // stop all children - postPone((Pageflow) getModel()); - break; - } - } - - protected void restore(Pageflow pageflow) { - TreeIterator nodes; - // restore - nodes = pageflow.eAllContents(); - while (nodes.hasNext()) { - setPostpone((EObject) nodes.next(), false); - } - setPostpone(pageflow, false); - } - - void setPostpone(EObject node, boolean enable) { - List adapters = node.eAdapters(); - for (int i = 0; i < adapters.size(); i++) { - if (adapters.get(i) instanceof PFBatchAdapter) { - ((PFBatchAdapter) adapters.get(i)) - .setNeedPostpone(enable); - } - } - } - - protected void postPone(Pageflow pageflow) { - TreeIterator nodes; - // postpone - nodes = pageflow.eAllContents(); - while (nodes.hasNext()) { - setPostpone((EObject) nodes.next(), true); - } - setPostpone(pageflow, true); - } - - }; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals() - */ - protected void refreshVisuals() { - super.refreshVisuals(); - for (int i = 0; i < this.getChildren().size(); i++) { - ((AbstractEditPart) getChildren().get(i)).refresh(); - } - ConnectionLayer cLayer = (ConnectionLayer) getLayer(CONNECTION_LAYER); - - if (cLayer.getConnectionRouter() == null) { - setConnectionRouterStyle(getConnectionRouterStyle()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editparts.AbstractEditPart#refreshChildren() - */ - protected void refreshChildren() { - super.refreshChildren(); - PageflowAnnotationUtil.validatePageflow(this); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setFont(org.eclipse.swt.graphics.Font) - */ - public void setFont(Font f) { - getFigure().setFont(f); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.ILayerPanePreference#setConnectionRouterStyle(int) - */ - public void setConnectionRouterStyle(int style) { - //TODO does this need to be execed on UI thread only??? - connectionStyle = style; - ConnectionLayer cLayer = (ConnectionLayer) getLayer(CONNECTION_LAYER); - if (style == ILayerPanePreference.LINE_ROUTING_MANHATTAN) { - FanRouter router = new FanRouter(); - router.setSeparation(CONNECTION_SEPERATION); - router.setNextRouter(new ManhattanConnectionRouter()); - cLayer.setConnectionRouter(router); - } else if (style == ILayerPanePreference.LINE_ROUTING_MANUAL) { - FanRouter router = new FanRouter(); - router.setSeparation(CONNECTION_SEPERATION); - router.setNextRouter(new BendpointConnectionRouter()); - cLayer.setConnectionRouter(router); - } - } - - /** - * get the foreground color from preference - * @return the router style value - * - */ - public int getConnectionRouterStyle() { - if (this.connectionStyle == -1) { - IPreferenceStore store = EditorPlugin.getDefault() - .getPreferenceStore(); - String connectionStyle_ = store - .getString(GEMPreferences.LINE_ROUTING); - - if (GEMPreferences.LINE_ROUTING_MANHATTAN.equals(connectionStyle_)) { - this.connectionStyle = ILayerPanePreference.LINE_ROUTING_MANHATTAN; - } else { - this.connectionStyle = ILayerPanePreference.LINE_ROUTING_MANUAL; - } - } - return this.connectionStyle; - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setForegroundColor(org.eclipse.swt.graphics.Color) - */ - public void setForegroundColor(Color c) { - getFigure().setForegroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setBackgroundColor(org.eclipse.swt.graphics.Color) - */ - public void setBackgroundColor(Color c) { - // getLayer(PRIMARY_LAYER).setOpaque(true); - getLayer(PRIMARY_LAYER).setBackgroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setGridVisible(boolean) - */ - public void setGridVisible(boolean bVisible) { - GridLayer gl = (GridLayer) getLayer(GRID_LAYER); - gl.setVisible(bVisible); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setGridSpacing(org.eclipse.draw2d.geometry.Dimension) - */ - public void setGridSpacing(Dimension d) { - GridLayer gl = (GridLayer) getLayer(GRID_LAYER); - gl.setSpacing(d); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.ILayerPanePreference#setGridForegroundColor(org.eclipse.swt.graphics.Color) - */ - public void setGridForegroundColor(Color c) { - GridLayer gl = (GridLayer) getLayer(GRID_LAYER); - gl.setForegroundColor(c); - } - - protected void performDirectEdit() { - // do nothing - } - - protected void performOpen() { - // do nothing - } - - public void addAnnotation(Annotation annotation) { - // do nothing - - } - - public void removeAnnotation() { - // do nothing - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowEditPartsFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowEditPartsFactory.java deleted file mode 100644 index fe5723589..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowEditPartsFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * - * Edit part factory to create different pageflow elements. - * - * - */ -public class PageflowEditPartsFactory implements EditPartFactory { - /* - * (non-Javadoc) - * - * @see EditPartFactory#createEditPart(EditPart, Object) - */ - public EditPart createEditPart(EditPart context, Object obj) { - if (obj instanceof Pageflow) { - return new PageflowEditPart((Pageflow) obj); - } else if (obj instanceof PageflowNode) { - return new PageflowNodeEditPart((PageflowNode) obj); - } else if (obj instanceof PageflowLink) { - return new PageflowLinkEditPart((PageflowLink) obj); - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowElementEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowElementEditPart.java deleted file mode 100644 index b897c5e24..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowElementEditPart.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.core.resources.IResource; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure.PageflowNodeFigure; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PageflowElementPropertySource; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.IPropertySource; - -/** - * - * - * <code>PageflowElementEditPart</code> is the base class for all the - * EditParts in the application, whose model is a subclass of PageflowElement. - * This class maintains the figure's size and location inresponse to changes in - * the model, and registers as a listener on its model using the - * <code>org.eclipse.emf.common.notify.Adapter</code> interface - */ -public abstract class PageflowElementEditPart extends AbstractGraphicalEditPart - implements IAnnotationEditPart { - /** image description for different edit part */ - public static final ImageDescriptor IMG_ACTION = EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/Pageflow_Action16.gif"); //$NON-NLS-1$ - - private Adapter adapter; - - /** - * @return the emf adapter - */ - public Adapter createEMFAdapter() { - return new PFBatchAdapter() { - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#notifyChanged() - */ - public void doNotifyChanged(Notification notification) { - int type = notification.getEventType(); - int featureId = notification - .getFeatureID(PageflowPackage.class); - if (type == Notification.SET) { - switch (featureId) { - case PageflowPackage.PAGEFLOW_ELEMENT__X: - case PageflowPackage.PAGEFLOW_ELEMENT__Y: - case PageflowPackage.PAGEFLOW_ELEMENT__WIDTH: - case PageflowPackage.PAGEFLOW_ELEMENT__HEIGHT: - refreshVisuals(); - break; - } - } - } - }; - } - - private static final ImageDescriptor IMG_PAGE = EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/Pageflow_Page.gif"); //$NON-NLS-1$ - - private static final ImageDescriptor IMG_NODE = EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/FacesConfig_Pageflow16.gif"); //$NON-NLS-1$ - - /** property source of the pageflow element */ - private IPropertySource propertySource = null; - - private Image image = null; - - /** - * @param element - */ - protected PageflowElementEditPart(PageflowElement element) { - setModel(element); - } - - /** - * Returns the image for the pageflow element. - * - * @param element - - * pageflow element - * @return - the image for the pageflow element. - */ - public Image getImage(PageflowElement element) { - if (image == null) { - ImageDescriptor imageDescriptor = null; - - if (element instanceof PageflowPage) { - imageDescriptor = IMG_PAGE; - } else { - imageDescriptor = IMG_NODE; - } - - image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - if (null == image) { - EditorPlugin.getDefault().getImageRegistry().put( - imageDescriptor.toString(), imageDescriptor); - image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - } - } - - return image; - } - - /** - * get the type name of the pageflow element - * - * @param element - - * pageflow element - * @return - the type name of the pageflow element - */ - public static String getTypeName(PageflowElement element) { - if (element instanceof Pageflow) { - return "Pageflow"; //$NON-NLS-1$ - } else if (element instanceof PageflowPage) { - return "Page"; //$NON-NLS-1$ - } - - return "[unknown]"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#activate() - */ - public void activate() { - if (isActive()) { - return; - } - - // start listening for changes in the model - hookIntoPageflowElement(getPageflowElement()); - - super.activate(); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#deactivate() - */ - public void deactivate() { - if (!isActive()) { - return; - } - - // stop listening for changes in the model - unhookFromPageflowElement(getPageflowElement()); - - super.deactivate(); - } - - /** - * Returns the model as pageflow element. - * - * @return - pageflow element - */ - public PageflowElement getPageflowElement() { - return (PageflowElement) getModel(); - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#refreshVisuals() - */ - protected void refreshVisuals() { - if (getParent() != null) { - final AbstractGraphicalEditPart part = this; - //ensure that this is executed on the UI thread - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshVisuals(part); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - - public void run() { - refreshVisuals(part); - } - }); - } - } - } - - private void refreshVisuals(AbstractGraphicalEditPart part) { - Point loc = new Point(getPageflowElement().getX(), - getPageflowElement().getY()); - Dimension size = new Dimension(getPageflowElement().getWidth(), - getPageflowElement().getHeight()); - Rectangle r = new Rectangle(loc, size); - - ((GraphicalEditPart) getParent()).setLayoutConstraint(part, - getFigure(), r); - } - - /* - * (non-Javadoc) - * - * @see IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class key) { - /* - * override the default behavior defined in AbstractEditPart which would - * expect the model to be a property sourced. instead the editpart can - * provide a property source - */ - if (key == IPropertySource.class) { - return getPropertySource(); - } - if (key == Adapter.class) { - if (adapter == null) { - adapter = createEMFAdapter(); - } - return adapter; - } - return super.getAdapter(key); - } - - /* - * (non-Javadoc) - * - * @see PageflowElementEditPart#getPropertySource() - */ - private IPropertySource getPropertySource() { - if (propertySource == null) { - propertySource = new PageflowElementPropertySource( - getPageflowElement()); - } - return propertySource; - } - - /** - * Registers this edit part as a listener for change notifications to the - * specified pageflow element. - * - * @param element - * the pagelfow element that should be observed for change - * notifications - */ - protected void hookIntoPageflowElement(PageflowElement element) { - if (null != element) { - if (!element.eAdapters().contains(getAdapter(Adapter.class))) { - element.eAdapters().add((Adapter) getAdapter(Adapter.class)); - } - } - } - - /** - * Removes this edit part from the specified pageflow element. Thus, it will - * no longe receive change notifications. - * - * @param element - * the pagelfow element that should not be observed any more - */ - protected void unhookFromPageflowElement(PageflowElement element) { - if (null != element) { - element.eAdapters().remove(getAdapter(Adapter.class)); - } - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - IFigure figure_ = null; - figure_ = new PageflowNodeFigure(); - PageflowElement elm = getPageflowElement(); - if (elm.getName() != null) { - ((PageflowNodeFigure) figure_).setImageText(getImage(elm), elm - .getName()); - } else { - ((PageflowNodeFigure) figure_).setImageText(getImage(elm), - getTypeName(elm)); - } - ((PageflowNodeFigure) figure_).update(); - return figure_; - } - - /** - * perform corresponding request related with double click or direct edit - * click. - * - * @param request : - * request composed by mouse click. - */ - public void performRequest(Request request) { - // the request is triggered by double clicked on a edit part - if (request.getType() == RequestConstants.REQ_OPEN) { - performOpen(); - } else if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) { - performDirectEdit(); - } - } - - /** - * perfrom direct edit request - * - */ - protected abstract void performDirectEdit(); - - /** - * perform double click request - * - */ - protected abstract void performOpen(); - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IEditPartDecorator#decorateEditPart() - */ - public abstract void addAnnotation(Annotation annotation); - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IEditPartDecorator#undecorateEditPart() - */ - public abstract void removeAnnotation(); - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.marker.IEditPartMarker#getMarkerResource() - */ - public IResource getMarkerResource() { - IResource resource = WebrootUtil.getResource((EObject) getModel()); - return resource; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowElementTreeEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowElementTreeEditPart.java deleted file mode 100644 index 9336e11e9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowElementTreeEditPart.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.gef.editparts.AbstractTreeEditPart; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PageflowElementPropertySource; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.IPropertySource; - -/** - * This is the abstract base <code>TreeEditPart</code> for pageflow elements. - */ -public class PageflowElementTreeEditPart extends AbstractTreeEditPart implements - Adapter { - /** Image descriptor of tree item for the different edit parts */ - private static final ImageDescriptor IMG_PAGE = EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/Pageflow_Page16.gif"); //$NON-NLS-1$ - - private static final ImageDescriptor IMG_NODE = EditorPlugin.getDefault() - .getImageDescriptor("facesconfig/FacesConfig_Pageflow16.gif"); //$NON-NLS-1$ - - /** Property resource for shared property view */ - private IPropertySource propertySource = null; - - /** notifer to pageflow element */ - private Notifier target = null; - - /** - * Returns the image for the pageflow element. - * - * @param element - - * pageflow element, such as Begin, End, Page, and Action. - * @return - the image for the pageflow element - */ - public static Image getImage(PageflowElement element) { - ImageDescriptor imageDescriptor = null; - - if (element instanceof PageflowPage) { - imageDescriptor = IMG_PAGE; - } else { - imageDescriptor = IMG_NODE; - } - - if (null == imageDescriptor) { - return null; - } - - Image image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - if (null == image) { - EditorPlugin.getDefault().getImageRegistry().put( - imageDescriptor.toString(), imageDescriptor); - image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - } - - return image; - } - - /** - * Creates a new PageflowElementTreeEditPart instance. - * - * @param pageflowElement - - * create a new edit part according to the pageflow model - */ - public PageflowElementTreeEditPart(PageflowElement pageflowElement) { - super(pageflowElement); - } - - /* - * (non-Javadoc) - * - * @see IAdaptable#getAdapter(Class) - */ - public Object getAdapter(Class key) { - /* - * override the default behavior defined in AbstractEditPart which would - * expect the model to be a property sourced. instead the editpart can - * provide a property source - */ - if (key == IPropertySource.class) { - return getPropertySource(); - } - return super.getAdapter(key); - } - - /* - * (non-Javadoc) - * - * @see AbstractTreeEditPart#getImage() - */ - protected Image getImage() { - return getImage(getPageflowElement()); - } - - /* - * (non-Javadoc) - * - * @see PageflowElementEditPart#getPropertySource() - */ - private IPropertySource getPropertySource() { - if (propertySource == null) { - propertySource = new PageflowElementPropertySource( - getPageflowElement()); - } - return propertySource; - } - - /* - * (non-Javadoc) - * - * @see Adapter#getTarget() - */ - public Notifier getTarget() { - return target; - } - - /* - * (non-Javadoc) - * - * @see AbstractTreeEditPart#getText() - */ - protected String getText() { - return (null != getPageflowElement().getName() ? getPageflowElement() - .getName() : "[unnamed]"); //$NON-NLS-1$ - } - - /** - * Returns the model as <code>PageflowElement</code>. - * - * @return - the model as <code>PageflowElement</code> - */ - public PageflowElement getPageflowElement() { - return (PageflowElement) getModel(); - } - - /* - * (non-Javadoc) - * - * @see Adapter#isAdapterForType(Object) - */ - public boolean isAdapterForType(Object type) { - return type.equals(getModel().getClass()); - } - - /* - * (non-Javadoc) - * - * @see Adapter#notifyChanged(Notification) - */ - public void notifyChanged(Notification notification) { - int type = notification.getEventType(); - - switch (type) { - case Notification.ADD: - case Notification.ADD_MANY: - case Notification.REMOVE: - case Notification.REMOVE_MANY: - case Notification.SET: - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshVisuals(); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - public void run() { - refreshVisuals(); - } - }); - } - break; - } - } - - /* - * (non-Javadoc) - * - * @see Adapter#setTarget(Notifier) - */ - public void setTarget(Notifier newTarget) { - target = newTarget; - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#activate() - */ - public void activate() { - if (isActive()) - return; - - // start listening for changes in the model - hookIntoPageflowElement(getPageflowElement()); - - super.activate(); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#deactivate() - */ - public void deactivate() { - if (!isActive()) - return; - - // stop listening for changes in the model - unhookFromPageflowElement(getPageflowElement()); - - super.deactivate(); - } - - /** - * Registers this edit part as a listener for change notifications to the - * specified pageflow element. - * - * @param element - - * the pagelfow element that should be observed for change - * notifications - */ - protected void hookIntoPageflowElement(PageflowElement element) { - if (null != element) { - element.eAdapters().add(this); - } - } - - /** - * Removes this edit part from the specified pageflow element. Thus, it will - * no longe receive change notifications. - * - * @param element - * -the pagelfow element that should not be observed - */ - protected void unhookFromPageflowElement(PageflowElement element) { - if (null != element) { - element.eAdapters().remove(this); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowLinkEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowLinkEditPart.java deleted file mode 100644 index f1bc513b0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowLinkEditPart.java +++ /dev/null @@ -1,491 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.RelativeBendpoint; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.editparts.AbstractConnectionEditPart; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PFLinkBendpointEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PFLinkEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PFLinkEndpointEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure.PFLinkFigure; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PageflowLinkPropertySource; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowAnnotationUtil; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.IPropertySource; - -/** - * <code>PFLinkEditPart</code> is the EditPart for PFLink model elements. The - * figure for this EditPart is simply a PolylineConnection. Because both - * AbstractConnectionEditPart and the Adapter interface have a getTarget method, - * we use an inner class to implement the Adapter interface in order to work - * around the name collision. - * - * - */ -public class PageflowLinkEditPart extends AbstractConnectionEditPart implements - IConnectionPreference, IAnnotationEditPart, PFValidator { - private static final String PAGEFLOW_ERROR_IMAGE_FILE = "facesconfig/Pageflow_Quickfix_Error.gif"; //$NON-NLS-1$ - - /** adapter for notification */ - private PFLinkAdapter adapter = new PFLinkAdapter(); - - /** property source of the pflink */ - private IPropertySource propertySource = null; - - /** image description for different edit part */ - public static final ImageDescriptor IMG_WARNING = EditorPlugin.getDefault() - .getImageDescriptor(PAGEFLOW_ERROR_IMAGE_FILE); - - private int connectionStyle = -1; - - private PFLinkBendpointEditPolicy bendpointEditPolicy; - - /** - * @param element - */ - public PageflowLinkEditPart(PageflowLink element) { - super(); - // element.getPageflow() - setModel(element); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#createFigure() - */ - protected IFigure createFigure() { - IFigure figure_ = new PFLinkFigure(); - return figure_; - - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, - new PFLinkEndpointEditPolicy()); - - if (getConnectionRouterStyle() == ILayerPanePreference.LINE_ROUTING_MANUAL) { - installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, - getBendpointEditPolicy()); - } - //PFLinkEditPolicy policy = new PFLinkEditPolicy(); - // policy.setSseModel(model); - installEditPolicy(EditPolicy.CONNECTION_ROLE, new PFLinkEditPolicy()); - - } - - private PFLinkBendpointEditPolicy getBendpointEditPolicy() { - if (bendpointEditPolicy == null) { - bendpointEditPolicy = new PFLinkBendpointEditPolicy(); - } - return bendpointEditPolicy; - } - - private PageflowLink getPFLink() { - return (PageflowLink) getModel(); - } - - private class PFLinkAdapter extends PFBatchAdapter { - private Notifier _newTarget = null; - - // private IPropertySource _propertySource = null; - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.common.notify.Adapter#getTarget() - */ - public Notifier getTarget() { - return _newTarget; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object) - */ - public boolean isAdapterForType(Object type) { - return getModel().getClass() == type; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) - */ - public void doNotifyChanged(Notification notification) { - int type = notification.getEventType(); - int featureId = notification.getFeatureID(PageflowPackage.class); - // FC2PFTransformer.getInstance().NotifyChanged(notification, - // getPFLink()); - switch (type) { - case Notification.ADD: - case Notification.ADD_MANY: - case Notification.REMOVE: - case Notification.SET: - if (featureId == PageflowPackage.PF_LINK__OUTCOME - || featureId == PageflowPackage.PF_LINK__SOURCE - || featureId == PageflowPackage.PF_LINK__TARGET) { - PageflowAnnotationUtil - .validateLink(PageflowLinkEditPart.this); - } - - refreshVisualsOnUIThread(); - break; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier) - */ - public void setTarget(Notifier newTarget) { - this._newTarget = newTarget; - } - - } - - /* - * (non-Javadoc) - * - * @see EditPart#activate() - */ - public void activate() { - getPFLink().eAdapters().add(adapter); - //PageflowLink element = (PageflowLink) getModel(); - super.activate(); - } - - /* - * (non-Javadoc) - * - * @see EditPart#deactivate() - */ - public void deactivate() { - // getPFLink().eAdapters().remove(adapter); - // PageflowLink element = (PageflowLink) getModel(); - // NavigationCaseType navCase = ((NavigationCaseType) element - // .getFCElements().getData().get(0)); - // navCase.eAdapters().remove(fcAdapter); - // TreeIterator iterator = navCase.eAllContents(); - // while (iterator.hasNext()) { - // ((EObject) iterator.next()).eAdapters().remove(fcAdapter); - // } - - super.deactivate(); - } - - /* - * (non-Javadoc) - * - * @see IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class key) { - /* - * override the default behavior defined in AbstractEditPart which would - * expect the model to be a property sourced. instead the editpart can - * provide a property source - */ - if (key == IPropertySource.class) { - return getPropertySource(); - } - return super.getAdapter(key); - } - - private IPropertySource getPropertySource() { - if (propertySource == null) { - propertySource = new PageflowLinkPropertySource(getPFLink()); - } - return propertySource; - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#refreshVisuals() - */ - protected void refreshVisuals() { - super.refreshVisuals(); - resetLabel(); - if (getConnectionRouterStyle() == ILayerPanePreference.LINE_ROUTING_MANUAL) { - refreshBendpoints(); - } - } - - private void refreshVisualsOnUIThread() { - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshVisuals(); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - public void run() { - refreshVisuals(); - } - }); - } - } - - /** - * set the bendpoint constraints of the pflink connection - * - */ - protected void refreshBendpoints() { - // bendpoints stored in pflink - List modelConstraint = getPFLink().getBendPoints(); - // bendpoint constraint list - List figureConstraint = new ArrayList(); - for (int i = 0; i < modelConstraint.size(); i++) { - PageflowLinkBendpoint wbp = (PageflowLinkBendpoint) modelConstraint - .get(i); - RelativeBendpoint rbp = new RelativeBendpoint(getConnectionFigure()); - rbp.setRelativeDimensions(wbp.getFirstRelativeDimension(), wbp - .getSecondRelativeDimension()); - rbp.setWeight((i + 1) / ((float) modelConstraint.size() + 1)); - figureConstraint.add(rbp); - } - // set the router constaints. - getConnectionFigure().setRoutingConstraint(figureConstraint); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IConnectionPreference#setLineWidth(int) - */ - public void setLineWidth(int w) { - ((PFLinkFigure) getFigure()).setLineWidth(w); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IConnectionPreference#setLabelVisible(boolean) - */ - public void setLabelVisible(boolean b) { - ((PFLinkFigure) getFigure()).setLabelVisible(b); - - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setForegroundColor(org.eclipse.swt.graphics.Color) - */ - public void setForegroundColor(Color c) { - ((PFLinkFigure) getFigure()).setForegroundColor(c); - - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setBackgroundColor(org.eclipse.swt.graphics.Color) - */ - public void setBackgroundColor(Color c) { - ((PFLinkFigure) getFigure()).setBackgroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setFont(org.eclipse.swt.graphics.Font) - */ - public void setFont(Font f) { - ((PFLinkFigure) getFigure()).setFont(f); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IConnectionPreference#setLabelForeground(org.eclipse.swt.graphics.Color) - */ - public void setLabelForegroundColor(Color c) { - ((PFLinkFigure) getFigure()).setLabelForegroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IConnectionPreference#setLabelBackground(org.eclipse.swt.graphics.Color) - */ - public void setLabelBackgroundColor(Color c) { - ((PFLinkFigure) getFigure()).setLabelBackgroundColor(c); - } - - private boolean needDrawingLabel() { - return (((PageflowLink) getModel()).getOutcome() != null && ((PageflowLink) getModel()) - .getOutcome().trim().length() > 0); - } - - private boolean needDrawingAction() { - return (((PageflowLink) getModel()).getFromaction() != null && ((PageflowLink) getModel()) - .getFromaction().trim().length() > 0); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IEditPartDecorator#decorateEditPart() - */ - public void addAnnotation(final Annotation annotation) { - getViewer().getControl().getDisplay().asyncExec(new Runnable() { - public void run() { - ((PFLinkFigure) getFigure()).setImage(getImage(IMG_WARNING)); - ((PFLinkFigure) getFigure()).setToolTipText(annotation - .getText()); - } - }); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IEditPartDecorator#undecorateEditPart() - */ - public void removeAnnotation() { - if (Thread.currentThread() == getViewer().getControl().getDisplay().getThread()) { - ((PFLinkFigure) getFigure()).clearIcon(); - resetLabel(); - } else { - getViewer().getControl().getDisplay().asyncExec(new Runnable() { - public void run() { - ((PFLinkFigure) getFigure()).clearIcon(); - resetLabel(); - } - }); - } - } - - private void resetLabel() { - StringBuffer tip = new StringBuffer(); - if (needDrawingAction()) { - ((PFLinkFigure) getFigure()).setActionImage(); - tip.append(PageflowMessages.PageflowLinkEditPart_FromAction).append( - ((PageflowLink) getModel()).getFromaction()); - } else if (((PFLinkFigure) getFigure()).getImage() != getImage(IMG_WARNING)) { - ((PFLinkFigure) getFigure()).clearIcon(); - } - if (needDrawingLabel()) { - ((PFLinkFigure) getFigure()).setLabel(((PageflowLink) getModel()) - .getOutcome()); - if (tip.length() > 0) - tip.append("\n"); //$NON-NLS-1$ - tip.append(PageflowMessages.PageflowLinkEditPart_FromOutcome).append( - ((PageflowLink) getModel()).getOutcome()); - } else { - ((PFLinkFigure) getFigure()).clearOutcome(); - } - ((PFLinkFigure) getFigure()).setToolTipText(tip.toString()); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.marker.IEditPartMarker#getMarkerResource() - * - */ - public IResource getMarkerResource() { - // IResource resource = null; - // if (getModel() instanceof PFLink) - // { - // resource = - // FacesConfigUtil.getFacesConfigResource(((PFLink)getModel()).getPageflow()); - // } - // FIXME: it should be changed to link to faces-config file. - IResource resource = WebrootUtil.getResource((EObject) getModel()); - return resource; - } - - private static Image getImage(ImageDescriptor imageDescriptor) { - Image image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - if (null == image) { - EditorPlugin.getDefault().getImageRegistry().put( - imageDescriptor.toString(), imageDescriptor); - image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - } - - return image; - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IConnectionPreference#setConnectionRouterStyle(int) - */ - public void setConnectionRouterStyle(int style) { - connectionStyle = style; - if (getConnectionRouterStyle() == ILayerPanePreference.LINE_ROUTING_MANUAL) { - installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, - getBendpointEditPolicy()); - refreshVisuals(); - } else { - removeEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE); - refreshVisuals(); - } - - } - - /** - * get the foreground color from preference - * - */ - private int getConnectionRouterStyle() { - if (this.connectionStyle == -1) { - IPreferenceStore store = EditorPlugin.getDefault() - .getPreferenceStore(); - String connectionStyle_ = store - .getString(GEMPreferences.LINE_ROUTING); - - if (GEMPreferences.LINE_ROUTING_MANHATTAN.equals(connectionStyle_)) { - this.connectionStyle = ILayerPanePreference.LINE_ROUTING_MANHATTAN; - } else { - this.connectionStyle = ILayerPanePreference.LINE_ROUTING_MANUAL; - } - } - return this.connectionStyle; - } - - public void validate() { - PageflowAnnotationUtil.validateLink(this); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowNodeEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowNodeEditPart.java deleted file mode 100644 index 8eac668e8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowNodeEditPart.java +++ /dev/null @@ -1,502 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ConnectionAnchor; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.ConnectionEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.NodeEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.DropRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.jdt.ui.JavaElementImageDescriptor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.OpenEditorCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowElementEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowNodeDirectEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowNodeEditPolicy; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure.ILabelDecorator; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure.PageflowNodeFigure; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowAnnotationUtil; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; - - -/** - * The base class for the applications EditParts that represent - * PageflowNode-derived objects in the model. This class implements the - * NodeEditPart interface which supports: - * <ul> - * <li>feedback for Connections when they are being - * <li> - * <li>initially connected and when they are disonnected/reconnected</li> - * </ul> - * - * - */ -public class PageflowNodeEditPart extends PageflowElementEditPart implements - NodeEditPart, INodePreference, PFValidator { - - /** property source of pageflow node */ - // private IPropertySource propertySource = null; - protected DirectEditManager editManager; - - private class ImageDecorator implements ILabelDecorator { - private Image decrateImage = null; - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.figures.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, - * java.lang.Object) - */ - public Image decorateImage(Image image, Object element) { - dispose(); - int adornmentFlags = computeAdornmentFlags(element); - if (adornmentFlags != 0) { - ImageDescriptor baseImage = ImageDescriptor.createFromImage(image); - org.eclipse.swt.graphics.Rectangle bounds = image.getBounds(); - decrateImage = (new JavaElementImageDescriptor(baseImage, - adornmentFlags, new org.eclipse.swt.graphics.Point( - bounds.width, bounds.height))).createImage(); - return decrateImage; - } - return image; - } - - /** - * Computes adornment flags for specified object. - * - * Note: This method is for internal use only. Clients should not call - * this method. - * - * @param obj Object to complute flags for. - * @return Adornment flags. - */ - protected int computeAdornmentFlags(Object obj) { - return JavaElementImageDescriptor.WARNING; - } - - /** - * Disposes this instance. - */ - public void dispose() { - if (decrateImage != null) { - decrateImage.dispose(); - } - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.figures.ILabelDecorator#decorateText(java.lang.String, - * java.lang.Object) - */ - public String decorateText(String text, Object element) { - // TODO Auto-generated method stub - return null; - } - - } - - /** - * Disposes this instance. - */ - public void dispose() { - if (imageDecorator != null) { - imageDecorator.dispose(); - } - } - - private ImageDecorator imageDecorator = null; - - /** - * Creates a new PageflowNodeEditPart instance. - * - * @param element - - * pageflow node - */ - public PageflowNodeEditPart(PageflowNode element) { - super(element); - } - - /** - * get the pageflow node - * - * @return - pageflow node - */ - public PageflowNode getPageflowNode() { - return (PageflowNode) getModel(); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#getModelSourceConnections() - */ - protected List getModelSourceConnections() { - return getPageflowNode().getOutlinks(); - } - - /* - * (non-Javadoc) - * - * @see AbstractGraphicalEditPart#getModelTargetConnections() - */ - protected List getModelTargetConnections() { - return getPageflowNode().getInlinks(); - } - - /** - * Returns the Figure of this, as a node type figure. - * - * @return - Figure as a NodeFigure. - */ - protected PageflowNodeFigure getPageflowNodeFigure() { - return (PageflowNodeFigure) getFigure(); - } - - public Adapter createEMFAdapter() { - return new PFBatchAdapter() { - /** - * when ports are added to a PageflowNode, add this EditPart as a - * listener on the port so that it gets notified of PFLinks being - * added or removed. When links are added or removed from a port - * owned by the PageflowNode of this EditPart, refresh the - * connections. - */ - public void doNotifyChanged(Notification notification) { - int type = notification.getEventType(); - // FC2PFTransformer.getInstance().NotifyChanged(notification, - // (PageflowElement) getModel()); - switch (type) { - case Notification.ADD: - case Notification.ADD_MANY: - case Notification.REMOVE: - case Notification.REMOVE_MANY: - if (notification.getNewValue() instanceof PageflowLink) { - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshTargetConnections(); - refreshSourceConnections(); - validate(); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - public void run() { - refreshTargetConnections(); - refreshSourceConnections(); - validate(); - } - }); - } - } - break; - - case Notification.SET: - int featureId = notification - .getFeatureID(PageflowPackage.class); - if (needValidation(featureId)) { - validate(); - } - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) { - refreshVisuals(); - } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ - public void run() { - refreshVisuals(); - } - }); - } - break; - } - } - }; - } - - private boolean needValidation(int featureId) { - if (getModel() instanceof PageflowPage) { - if (featureId == PageflowPackage.PF_PAGE__PATH) { - return true; - } - } - return false; - } - - public void validate() { - if (getModel() instanceof PageflowPage) { - PageflowAnnotationUtil.validatePage(this); - } - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#createEditPolicies() - */ - protected void createEditPolicies() { - // install the edit policy to handle connection creation - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new PageflowNodeEditPolicy()); - - installEditPolicy(EditPolicy.COMPONENT_ROLE, - new PageflowElementEditPolicy()); - - // install the direct policy - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, - new PageflowNodeDirectEditPolicy()); - } - - /* - * (non-Javadoc) - * - * @see NodeEditPart#getSourceConnectionAnchor(ConnectionEditPart) - */ - public ConnectionAnchor getSourceConnectionAnchor( - ConnectionEditPart connection) { - PageflowLink link = (PageflowLink) connection.getModel(); - return getPageflowNodeFigure().getSourceConnectionAnchorAt( - new Point(link.getSource().getX(), link.getSource().getY())); - } - - /* - * (non-Javadoc) - * - * @see NodeEditPart#getSourceConnectionAnchor(Request) - */ - public ConnectionAnchor getSourceConnectionAnchor(Request request) { - Point pt = new Point(((DropRequest) request).getLocation()); - return getPageflowNodeFigure().getSourceConnectionAnchorAt(pt); - } - - /* - * (non-Javadoc) - * - * @see NodeEditPart#getTargetConnectionAnchor(ConnectionEditPart) - */ - public ConnectionAnchor getTargetConnectionAnchor( - ConnectionEditPart connection) { - PageflowLink link = (PageflowLink) connection.getModel(); - return getPageflowNodeFigure().getTargetConnectionAnchorAt( - new Point(link.getTarget().getX(), link.getTarget().getY())); - } - - /* - * (non-Javadoc) - * - * @see NodeEditPart#getTargetConnectionAnchor(Request) - */ - public ConnectionAnchor getTargetConnectionAnchor(Request request) { - Point pt = new Point(((DropRequest) request).getLocation()); - return getPageflowNodeFigure().getTargetConnectionAnchorAt(pt); - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#refreshVisuals() - */ - protected void refreshVisuals() { - super.refreshVisuals(); - - getPageflowNodeFigure().setText(getPageflowNode().getName()); - } - - /** - * make this a listener on its ports - */ - public void activate() { - super.activate(); - - Iterator it; - - it = getPageflowNode().getInlinks().iterator(); - while (it.hasNext()) { - PageflowLink link = (PageflowLink) it.next(); - - hookIntoPageflowElement(link); - } - - it = getPageflowNode().getOutlinks().iterator(); - while (it.hasNext()) { - PageflowLink link = (PageflowLink) it.next(); - - hookIntoPageflowElement(link); - } - } - - /** - * remove this as a listener on its ports - */ - public void deactivate() { - super.deactivate(); - dispose(); - Iterator it; - - it = getPageflowNode().getInlinks().iterator(); - while (it.hasNext()) { - PageflowLink link = (PageflowLink) it.next(); - - unhookFromPageflowElement(link); - } - - it = getPageflowNode().getOutlinks().iterator(); - while (it.hasNext()) { - PageflowLink link = (PageflowLink) it.next(); - - unhookFromPageflowElement(link); - } - } - - /** - * perfrom direct edit request - * - */ - protected void performDirectEdit() { - if (editManager == null) { - Label l = ((PageflowNodeFigure) getFigure()).getLabel(); - editManager = new PageflowDirectEditManager(this, - TextCellEditor.class, new DirectEditCellEditorLocator(l), l); - } - editManager.show(); - } - - /** - * perform double click request - * - */ - protected void performOpen() { - // only Page and Action support the double-click commands - if (getModel() instanceof PageflowPage) { - // CommandStack stack = - // getViewer().getEditDomain().getCommandStack(); - Command command = new OpenEditorCommand(this); - if (command != null && command.canExecute()) { - // stack.execute(command); - command.execute(); - } - } - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setForegroundColor(org.eclipse.swt.graphics.Color) - */ - public void setForegroundColor(Color c) { - getPageflowNodeFigure().setForegroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setBackgroundColor(org.eclipse.swt.graphics.Color) - */ - public void setBackgroundColor(Color c) { - getPageflowNodeFigure().setBackgroundColor(c); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IFigurePreference#setFont(org.eclipse.swt.graphics.Font) - */ - public void setFont(Font f) { - getPageflowNodeFigure().setFont(f); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.INodePreference#setTextPlacement(int) - */ - public void setTextPlacement(int where) { - getPageflowNodeFigure().setTextPlacement(where); - - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IEditPartDecorator#decorateEditPart() - */ - public void addAnnotation(final Annotation annotation) { - getViewer().getControl().getDisplay().asyncExec(new Runnable() { - /* (non-Javadoc) - * @see java.lang.Runnable#run() - */ - public void run() { - getPageflowNodeFigure().setImage( - getDecoratedImage((PageflowElement) getModel())); - getPageflowNodeFigure().setToolTipText(annotation.getText()); - } - - }); - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.editparts.IEditPartDecorator#undecorateEditPart() - */ - public void removeAnnotation() { - getViewer().getControl().getDisplay().asyncExec(new Runnable() { - public void run() { - getPageflowNodeFigure().setImage( - getImage((PageflowElement) getModel())); - getPageflowNodeFigure().setToolTipText(null); - } - - }); - } - - /** - * Returns the image for the pageflow element. - * - * @param element - - * pageflow element - * @return - the image for the pageflow element. - */ - private Image getDecoratedImage(PageflowElement element) { - Image decoratedImage = getImage(element); - - decoratedImage = getImageDecorator().decorateImage(getImage(element), - null); - - return decoratedImage; - } - - private ImageDecorator getImageDecorator() { - if (imageDecorator == null) { - imageDecorator = new ImageDecorator(); - } - return imageDecorator; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowTreeEditPart.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowTreeEditPart.java deleted file mode 100644 index 34976d37e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowTreeEditPart.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; - -/** - * The <code>TreeEditPart</code> implementation for a pageflow. - * - * - */ -/*package*/ class PageflowTreeEditPart extends PageflowElementTreeEditPart { - - /** - * Creates a new PageflowTreeEditPart instance. - * - * @param pageflow - */ - public PageflowTreeEditPart(Pageflow pageflow) { - super(pageflow); - } - - /* - * (non-Javadoc) - * - * @see AbstractEditPart#getModelChildren() - */ - protected List getModelChildren() { - List children_ = getPageflow().getNodes(); - - return new ArrayList(children_); - } - - /** - * Returns the model as <code>Pageflow</code>. - * - * @return the model as <code>Pageflow</code> - */ - public Pageflow getPageflow() { - return (Pageflow) getModel(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowTreePartFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowTreePartFactory.java deleted file mode 100644 index 940113a5d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpart/PageflowTreePartFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; - -/** - * Edit Part Factory for creation pageflow tree parts - * - */ -public class PageflowTreePartFactory implements EditPartFactory { - /* - * (non-Javadoc) - * - * @see EditPartFactory#createEditPart() - */ - public EditPart createEditPart(EditPart context, Object model) { - - if (model instanceof Pageflow) { - return new PageflowTreeEditPart((Pageflow) model); - - } else if (model instanceof PageflowElement) { - return new PageflowElementTreeEditPart((PageflowElement) model); - } - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkBendpointEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkBendpointEditPolicy.java deleted file mode 100644 index 4dabafbb6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkBendpointEditPolicy.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.BendpointEditPolicy; -import org.eclipse.gef.requests.BendpointRequest; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.CreateBendpointCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.DeleteBendpointCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.MoveBendpointCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; - -/** - * Customize the bendpoint edit policy fro pageflow link connections - * - */ -public class PFLinkBendpointEditPolicy extends BendpointEditPolicy { - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.BendpointEditPolicy#getCreateBendpointCommand(org.eclipse.gef.requests.BendpointRequest) - */ - protected Command getCreateBendpointCommand(BendpointRequest request) { - CreateBendpointCommand createCmd = new CreateBendpointCommand(); - Point p = request.getLocation(); - Connection conn = getConnection(); - - conn.translateToRelative(p); - - createCmd.setLocation(p); - Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); - Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); - - conn.translateToRelative(ref1); - conn.translateToRelative(ref2); - - createCmd.setRelativeDimensions(p.getDifference(ref1), p - .getDifference(ref2)); - createCmd.setPFLink((PageflowLink) request.getSource().getModel()); - createCmd.setIndex(request.getIndex()); - return createCmd; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.BendpointEditPolicy#getDeleteBendpointCommand(org.eclipse.gef.requests.BendpointRequest) - */ - protected Command getDeleteBendpointCommand(BendpointRequest request) { - DeleteBendpointCommand deleteCom = new DeleteBendpointCommand(); - Point p = request.getLocation(); - deleteCom.setLocation(p); - deleteCom.setPFLink((PageflowLink) request.getSource().getModel()); - deleteCom.setIndex(request.getIndex()); - return deleteCom; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.editpolicies.BendpointEditPolicy#getMoveBendpointCommand(org.eclipse.gef.requests.BendpointRequest) - */ - protected Command getMoveBendpointCommand(BendpointRequest request) { - MoveBendpointCommand moveCmd = new MoveBendpointCommand(); - Point p = request.getLocation(); - Connection conn = getConnection(); - - conn.translateToRelative(p); - - moveCmd.setLocation(p); - - Point ref1 = getConnection().getSourceAnchor().getReferencePoint(); - Point ref2 = getConnection().getTargetAnchor().getReferencePoint(); - - conn.translateToRelative(ref1); - conn.translateToRelative(ref2); - - moveCmd.setRelativeDimensions(p.getDifference(ref1), p - .getDifference(ref2)); - moveCmd.setPFLink((PageflowLink) request.getSource().getModel()); - moveCmd.setIndex(request.getIndex()); - return moveCmd; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkEditPolicy.java deleted file mode 100644 index d25b22700..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkEditPolicy.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.ConnectionEditPolicy; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.ConnectionCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.DeleteConnectionCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; - -/** - * Customize the connection edit policy for pageflow links - * - */ -public class PFLinkEditPolicy extends ConnectionEditPolicy { - - /** - * Default constructor - */ - public PFLinkEditPolicy() { - super(); - } - - /* - * (non-Javadoc) - * - * @see ConnectionEditPolicy#getDeleteCommand - */ - protected Command getDeleteCommand(GroupRequest request) { - ConnectionCommand c = new DeleteConnectionCommand(); - c.setPFLink((PageflowLink) getHost().getModel()); - return c; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkEndpointEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkEndpointEditPolicy.java deleted file mode 100644 index 59875dbc5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PFLinkEndpointEditPolicy.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.draw2d.PolylineConnection; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; - -/** - * Customize the endpoint edit policy for pageflow links - * - */ -public class PFLinkEndpointEditPolicy extends ConnectionEndpointEditPolicy { - /** - * - */ - public PFLinkEndpointEditPolicy() { - super(); - } - - /* - * (non-Javadoc) - * - * @see ConnectionEndpointEditPolicy#addSelectionHandles - */ - protected void addSelectionHandles() { - super.addSelectionHandles(); - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - int connectionWidth = store.getInt(GEMPreferences.LINE_WIDTH); - getConnectionFigure().setLineWidth(connectionWidth + 1); - } - - private PolylineConnection getConnectionFigure() { - return (PolylineConnection) ((GraphicalEditPart) getHost()).getFigure(); - } - - /* - * (non-Javadoc) - * - * @see ConnectionEndpointEditPolicy#removeSelectionHandles - */ - protected void removeSelectionHandles() { - super.removeSelectionHandles(); - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - int connectionWidth = store.getInt(GEMPreferences.LINE_WIDTH); - getConnectionFigure().setLineWidth(connectionWidth); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowContainerEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowContainerEditPolicy.java deleted file mode 100644 index f392f25a6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowContainerEditPolicy.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.editpolicies.ContainerEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.OrphanChildCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * Customize the container policy for page flow containers - * - */ -public class PageflowContainerEditPolicy extends ContainerEditPolicy { - /* - * (non-Javadoc) - * - * @see ContainerEditPolicy#getCreateCommand() - */ - protected Command getCreateCommand(CreateRequest request) { - return null; - } - - /* - * (non-Javadoc) - * - * @see ContainerEditPolicy#getOrphanChildrenCommand() - */ - public Command getOrphanChildrenCommand(GroupRequest request) { - List parts = request.getEditParts(); - CompoundCommand result = new CompoundCommand("orphanchildcommand"); //$NON-NLS-1$ - for (int i = 0; i < parts.size(); i++) { - OrphanChildCommand orphan = new OrphanChildCommand(); - orphan - .setChild((PageflowNode) ((EditPart) parts.get(i)) - .getModel()); - orphan.setParent((Pageflow) getHost().getModel()); - orphan.setLabel(PageflowMessages.PageflowContainerEditPolicy_OrphanLabel); - result.add(orphan); - } - return result.unwrap(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowElementEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowElementEditPolicy.java deleted file mode 100644 index 04e86db81..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowElementEditPolicy.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.GroupRequest; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.DeleteNodeCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * Customize component edit policies for page flows - * - */ -public class PageflowElementEditPolicy extends - org.eclipse.gef.editpolicies.ComponentEditPolicy { - /* - * (non-Javadoc) - * - * @see ComponentEditPolicy#createDeleteCommand() - */ - protected Command createDeleteCommand(GroupRequest request) { - Object parent = getHost().getParent().getModel(); - DeleteNodeCommand deleteCmd = new DeleteNodeCommand((Pageflow) parent); - deleteCmd.setParent((Pageflow) parent); - deleteCmd.setChild((PageflowNode) getHost().getModel()); - return deleteCmd; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeDirectEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeDirectEditPolicy.java deleted file mode 100644 index c89d648c8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeDirectEditPolicy.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.DirectEditPolicy; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.RenameNodeCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * EditPolicy for the direct editing of pageflow node's name. - * - * @author Xiaoguang Zhang - */ -public class PageflowNodeDirectEditPolicy extends DirectEditPolicy { - - /* - * (non-javadoc) - * - * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest) - */ - protected Command getDirectEditCommand(DirectEditRequest request) { - RenameNodeCommand cmd = new RenameNodeCommand(); - cmd.setSource((PageflowNode) getHost().getModel()); - cmd.setOldName(((PageflowNode) getHost().getModel()).getName()); - cmd.setName((String) request.getCellEditor().getValue()); - return cmd; - } - - /* - * (non-javadoc) - * - * @see DirectEditPolicy#showCurrentEditValue(DirectEditRequest) - */ - protected void showCurrentEditValue(DirectEditRequest request) { - // String value = (String)request.getCellEditor().getValue(); - // ((PageflowNodeFigure)getHostFigure()).setText(value); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeEditPolicy.java deleted file mode 100644 index 192d818ed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeEditPolicy.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.PolylineConnection; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy; -import org.eclipse.gef.requests.CreateConnectionRequest; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.OpenEditorAction; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.ConnectionCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.ConnectionCommandFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.OpenEditorCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure.PageflowNodeFigure; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; - -/** - * Customizes conntection policies - * - */ -public class PageflowNodeEditPolicy extends GraphicalNodeEditPolicy { - /* - * (non-Javadoc) - * - * @see GraphicalNodeEditPolicy#createDummyConnection() - */ - protected Connection createDummyConnection(Request req) { - PolylineConnection conn = new PolylineConnection(); - conn.setLineWidth(getLineWidth()); - conn.setForegroundColor(ColorConstants.black); - - return conn; - } - - /** - * get the connection line width from preference. - */ - private int getLineWidth() { - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - int lineWidth = store.getInt(GEMPreferences.LINE_WIDTH); - return lineWidth; - } - - /* - * (non-Javadoc) - * - * @see GraphicalNodeEditPolicy#getConnectionCompleteCommand() - */ - protected Command getConnectionCompleteCommand( - CreateConnectionRequest request) { - ConnectionCommand command = (ConnectionCommand) request - .getStartCommand(); - // ConnectionAnchor anchor = - // getPageflowNodeEditPart().getTargetConnectionAnchor(request); - - command.setTarget(getPageflowNode()); - - return command; - } - - /* - * (non-Javadoc) - * - * @see GraphicalNodeEditPolicy#getConnectionCreateCommand() - */ - protected Command getConnectionCreateCommand(CreateConnectionRequest request) { - ConnectionCommand command = ConnectionCommandFactory - .createCommand(request); - command.setPFLink((PageflowLink) request.getNewObject()); - PageflowNode flowObject = getPageflowNode(); - command.setSource(flowObject); - request.setStartCommand(command); - return command; - } - - /** - * get the edit part of pageflow node - * - * @return - the edit part of pageflow node - */ - protected PageflowNodeEditPart getPageflowNodeEditPart() { - return (PageflowNodeEditPart) getHost(); - } - - /** - * get the pageflow node - * - * @return - the pageflow node - */ - protected PageflowNode getPageflowNode() { - return (PageflowNode) getHost().getModel(); - } - - /* - * (non-Javadoc) - * - * @see GraphicalNodeEditPolicy#getReconnectTargetCommand() - */ - protected Command getReconnectTargetCommand(ReconnectRequest request) { - ConnectionCommand cmd = ConnectionCommandFactory.createCommand(request); - cmd - .setPFLink((PageflowLink) request.getConnectionEditPart() - .getModel()); - cmd.setTarget(getPageflowNode()); - return cmd; - } - - /* - * (non-Javadoc) - * - * @see GraphicalNodeEditPolicy#getReconnectSourceCommand() - */ - protected Command getReconnectSourceCommand(ReconnectRequest request) { - ConnectionCommand cmd = ConnectionCommandFactory.createCommand(request); - cmd - .setPFLink((PageflowLink) request.getConnectionEditPart() - .getModel()); - cmd.setSource(getPageflowNode()); - return cmd; - } - - /* - * (non-Javadoc) - * - * @see GraphicalNodeEditPolicy#getCommand() - */ - public Command getCommand(Request request) { - if (OpenEditorAction.OPEN_EDITOR_REQUEST.equals(request.getType())) { - return new OpenEditorCommand(getHost()); - } - - return super.getCommand(request); - } - - /** - * return the pageflow node figure - * - * @return - the pageflow node's figure - */ - protected PageflowNodeFigure getPageflowNodeFigure() { - return (PageflowNodeFigure) ((GraphicalEditPart) getHost()).getFigure(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeSelectionEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeSelectionEditPolicy.java deleted file mode 100644 index fb0465df2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowNodeSelectionEditPolicy.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; - -/** - * Handles selection of Node. Primary selection is denoted by highlight and a - * focus rectangle. Normal selection is denoted by highlight only. - * - * @author xgzhang - */ -public class PageflowNodeSelectionEditPolicy extends NonResizableEditPolicy { - -// private PageflowNodeFigure getFigure() { -// PageflowNodeEditPart part = (PageflowNodeEditPart) getHost(); -// return ((PageflowNodeFigure) part.getFigure()); -// } - - /** - * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#hideSelection() - */ - protected void hideSelection() { - super.hideSelection(); - // getFigure().setSelected(false); - } - - /** - * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection() - */ - protected void showPrimarySelection() { - super.showPrimarySelection(); - // getFigure().setSelected(true); - } - - /** - * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection() - */ - protected void showSelection() { - super.showSelection(); - // getFigure().setSelected(true); - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowXYLayoutEditPolicy.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowXYLayoutEditPolicy.java deleted file mode 100644 index dccbfa61b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/editpolicy/PageflowXYLayoutEditPolicy.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy; - -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.ResizableEditPolicy; -import org.eclipse.gef.editpolicies.XYLayoutEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.AddNodeCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.CreateNodeCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.SetConstraintCommand; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; - -/** - * Customize the layout policy for page flows - * - */ -public class PageflowXYLayoutEditPolicy extends XYLayoutEditPolicy { - /* - * (non-Javadoc) - * - * @see XYLayoutEditPolicy#createAddCommand() - */ - protected Command createAddCommand(EditPart childEditPart, Object constraint) { - PageflowNode part = (PageflowNode) childEditPart.getModel(); - Rectangle rect = (Rectangle) constraint; - - AddNodeCommand add = new AddNodeCommand(); - add.setParent((Pageflow) getHost().getModel()); - add.setChild(part); - add.setLabel(PageflowMessages.PageflowXYLayoutEditPolicy_Add); - add.setDebugLabel("PageFlowXYEP add subpart"); //$NON-NLS-1$ - - SetConstraintCommand setConstraint = new SetConstraintCommand(); - - setConstraint.setLocation(rect); - setConstraint.setPart(part); - setConstraint.setLabel(PageflowMessages.PageflowXYLayoutEditPolicy_Add); - setConstraint.setDebugLabel("PageFlowXYEP setConstraint"); //$NON-NLS-1$ - return add.chain(setConstraint); - } - - /* - * (non-Javadoc) - * - * @see XYLayoutEditPolicy#createChangeConstraintCommand() - */ - protected Command createChangeConstraintCommand(EditPart child, - Object constraint) { - SetConstraintCommand locationCommand = new SetConstraintCommand(); - locationCommand.setPart((PageflowNode) child.getModel()); - locationCommand.setLocation((Rectangle) constraint); - return locationCommand; - } - - /* - * (non-Javadoc) - * - * @see XYLayoutEditPolicy#createChildEditPolicy() - */ - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof PageflowNodeEditPart) { - return new PageflowNodeSelectionEditPolicy(); - } - - return new ResizableEditPolicy(); - } - - /* - * (non-Javadoc) - * - * @see XYLayoutEditPolicy#getCreateCommand() - */ - protected Command getCreateCommand(CreateRequest request) { - CreateNodeCommand create = new CreateNodeCommand(); - create.setParent((Pageflow) getHost().getModel()); - create.setChild((PageflowNode) request.getNewObject()); - Rectangle constraint = (Rectangle) getConstraintFor(request); - create.setLocation(constraint); - create.setLabel(PageflowMessages.PageflowXYLayoutEditPolicy_Add); - return create; - } - - /* - * (non-Javadoc) - * - * @see XYLayoutEditPolicy#getDeleteDependantCommand() - */ - protected Command getDeleteDependantCommand(Request request) { - return null; - } - - /* - * (non-Javadoc) - * - * @see XYLayoutEditPolicy#getOrphanChildrenCommand() - */ - protected Command getOrphanChildrenCommand(Request request) { - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/ConnectionLabel.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/ConnectionLabel.java deleted file mode 100644 index 702e58e09..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/ConnectionLabel.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; - -/** - * This label is used in connection figure, which has a border. - * - * @author Xiao-guang Zhang - * - */ -public class ConnectionLabel extends Label { - /** - * - */ - public ConnectionLabel() { - this(null, null); - } - - /** - * @param s - */ - public ConnectionLabel(String s) { - this(s, null); - } - - /** - * @param i - */ - public ConnectionLabel(Image i) { - this(null, i); - } - - /** - * @param s - * @param i - */ - public ConnectionLabel(String s, Image i) { - super(s, i); - - // setBorder(new LineBorder()); - setOpaque(true); - } - - /** - * set the label's border's width - * - * @param w - */ - public void setBorderWidth(int w) { - if (getBorder() != null) { - ((LineBorder) getBorder()).setWidth(w); - } - } - - /** - * set the label's border's color - * - * @param c - */ - public void setBorderColor(Color c) { - if (getBorder() != null) { - ((LineBorder) getBorder()).setColor(c); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/ILabelDecorator.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/ILabelDecorator.java deleted file mode 100644 index d1d01373a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/ILabelDecorator.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure; - -import org.eclipse.swt.graphics.Image; - -/** - * A label decorator decorates the label text and image for some element. The - * original label text and image are obtained by some other means, - * - * - * @author Xiao-guang Zhang - */ -public interface ILabelDecorator { - /** - * Returns an image that is based on the given image, but decorated with - * additional information relating to the state of the provided element. - * - * @param image - * the input image to decorate, or <code>null</code> if the - * element has no image - * @param element - * the element whose image is being decorated - * @return the decorated image, or <code>null</code> if no decoration is - * to be applied - * - * @see org.eclipse.jface.resource.CompositeImageDescriptor - */ - public Image decorateImage(Image image, Object element); - - /** - * Returns a text label that is based on the given text label, but decorated - * with additional information relating to the state of the provided - * element. - * - * - * @param text - * the input text label to decorate - * @param element - * the element whose image is being decorated - * @return the decorated text label, or <code>null</code> if no decoration - * is to be applied - */ - public String decorateText(String text, Object element); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/NodeLabel.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/NodeLabel.java deleted file mode 100644 index fa5764d82..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/NodeLabel.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.swt.graphics.Image; - -/** - * This derived label has simple tooltip support - * - * @author Xiao-guang Zhang - * - */ -public class NodeLabel extends Label { - /** - * - */ - public NodeLabel() { - super(); - } - - /** - * @param s - */ - public NodeLabel(String s) { - super(s); - } - - /** - * @param i - */ - public NodeLabel(Image i) { - super(i); - } - - /** - * @param s - * @param i - */ - public NodeLabel(String s, Image i) { - super(s, i); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.draw2d.Label#setTextPlacement(int) - */ - public void setTextPlacement(int where) { - super.setTextPlacement(where); - layout(); - invalidate(); - } - - /** - * set tooltip text - * - * @param text - */ - public void setToolTipText(String text) { - Label toolTipLabel = null; - - if (text != null && text.length() > 0) { - toolTipLabel = new Label(text); - toolTipLabel.setBorder(new MarginBorder(3)); - } - - super.setToolTip(toolTipLabel); - } - - /** - * get tooltip's text - * - * @return the tool tip text string - */ - public String getToolTipText() { - if (getToolTip() != null) - return ((Label) getToolTip()).getText(); - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/PFLinkFigure.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/PFLinkFigure.java deleted file mode 100644 index f9ecd41e0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/PFLinkFigure.java +++ /dev/null @@ -1,318 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.MidpointLocator; -import org.eclipse.draw2d.PolygonDecoration; -import org.eclipse.draw2d.PolylineConnection; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.resource.FontRegistry; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -/** - * - * The figure for pflink, used by pflink edit part, which is a polyline with a - * label control on it, and with tooltip support. - * - * @author Xiao-guang Zhang - */ -public class PFLinkFigure extends PolylineConnection { - /** the label attached to the connection */ - private ConnectionLabel textLabel = null; - - //private ConnectionLabel iconLabel = null; - - /** The label's background color */ - private Color labelBgColor; - - /** The label's foreground color */ - private Color labelFgColor; - - /** The label's visiblity */ - private boolean bLabelVisible = false; - - /** The connection's line width */ - private int lineWidth = 0; - - /** the polygon decoration for connection line */ - private PolygonDecoration arrow; - - /** - * - */ - public PFLinkFigure() { - arrow = new PolygonDecoration(); - arrow.setTemplate(PolygonDecoration.TRIANGLE_TIP); - arrow.setScale(10, getLineWidth() * 2); - setTargetDecoration(arrow); - setForegroundColor(getForegroundColor()); - } - - /** - * set the connection's label string - * - * @param strLabel - */ - public void setLabel(String strLabel) { - if (null != strLabel) { - if (textLabel == null) { - textLabel = new ConnectionLabel(); - textLabel.setFont(getLabelFont()); - textLabel.setBackgroundColor(getLabelBackgroundColor()); - textLabel.setForegroundColor(getLabelForegroundColor()); - setLineWidth(getLineWidth()); - setLabelVisible(getLabelVisible()); - setForegroundColor(getForegroundColor()); - add(textLabel, new MidpointLocator(this, 1)); - } - // textLabel.setVisible(true); - textLabel.setText(strLabel); - } - } - - /** - * Set the icon image to null - */ - public void clearIcon() { - setImage(null); - } - - /** - * Set the label to empty string - */ - public void clearOutcome() { - setLabel(""); //$NON-NLS-1$ - } - - /** - * set the connection's label string - * - * @param image - */ - public void setImage(Image image) { - if (textLabel == null) { - textLabel = new ConnectionLabel(); - textLabel.setFont(getLabelFont()); - textLabel.setBackgroundColor(getLabelBackgroundColor()); - textLabel.setForegroundColor(getLabelForegroundColor()); - setLineWidth(getLineWidth()); - setLabelVisible(getLabelVisible()); - setForegroundColor(getForegroundColor()); - add(textLabel, new MidpointLocator(this, 0)); - } - textLabel.setIcon(image); - } - - /** - * Set the action image - */ - public void setActionImage() { - ImageDescriptor imageDescriptor = PageflowElementEditPart.IMG_ACTION; - Image image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - if (null == image) { - EditorPlugin.getDefault().getImageRegistry().put( - imageDescriptor.toString(), imageDescriptor); - image = EditorPlugin.getDefault().getImageRegistry().get( - imageDescriptor.toString()); - } - setImage(image); - } - - /** - * @return the icon image - */ - public Image getImage() { - if (textLabel != null) - { - return textLabel.getIcon(); - } - return null; - } - - - /** - * @param text - */ - public void setToolTipText(String text) { - Label toolTipLabel = null; - - if (text != null && text.length() > 0) { - toolTipLabel = new Label(text); - toolTipLabel.setBorder(new MarginBorder(3)); - } - - super.setToolTip(toolTipLabel); - } - - /** - * @return the tool tip text or null if none - */ - public String getToolTipText() { - if (getToolTip() != null) - { - return ((Label) getToolTip()).getText(); - } - return null; - } - - /** - * set the font including label's - * - */ - public void setFont(Font f) { - if (textLabel != null) - textLabel.setFont(f); - super.setFont(f); - } - - /** - * get the label's font from preference - * - */ - private Font getLabelFont() { - FontRegistry registry = JFaceResources.getFontRegistry(); - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - FontData fontData = PreferenceConverter.getFontData(store, - GEMPreferences.LINE_LABEL_FONT); - if (!registry.get(fontData.toString()).equals(registry.defaultFont())) - return registry.get(fontData.toString()); - - registry.put(fontData.toString(), new FontData[] {fontData}); - return registry.get(fontData.toString()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.draw2d.Shape#setLineWidth(int) - */ - public void setLineWidth(int w) { - if (textLabel != null) - textLabel.setBorderWidth(w); - arrow.setScale(10, getLineWidth() * 2); - super.setLineWidth(w); - } - - /** - * get the connection line width from preference. - */ - public int getLineWidth() { - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - lineWidth = store.getInt(GEMPreferences.LINE_WIDTH); - return lineWidth; - } - - /** - * set label's visibility - * - * @param flag - - * visible or not. - */ - public void setLabelVisible(boolean flag) { - if (textLabel != null) - textLabel.setVisible(flag); - } - - /** - * get the label's visiblity from preference - * - */ - private boolean getLabelVisible() { - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - bLabelVisible = store.getBoolean(GEMPreferences.SHOW_LINE_LABELS); - return bLabelVisible; - } - - /** - * set the label's foreground color - * - * @param c - */ - public void setLabelForegroundColor(Color c) { - labelFgColor = c; - if (textLabel != null) - textLabel.setForegroundColor(c); - } - - /** - * get the label's foreground color from preference - * - */ - private Color getLabelForegroundColor() { - if (labelFgColor == null) { - IPreferenceStore store = EditorPlugin.getDefault() - .getPreferenceStore(); - labelFgColor = GEMPreferences.getColor(store, - GEMPreferences.LINE_LABEL_FONT_COLOR); - } - return labelFgColor; - } - - /** - * set the label's background color - * - * @param c - */ - public void setLabelBackgroundColor(Color c) { - labelBgColor = c; - if (textLabel != null) - textLabel.setBackgroundColor(c); - } - - /** - * get the label's background color from preference - * - */ - private Color getLabelBackgroundColor() { - if (labelBgColor == null) { - IPreferenceStore store = EditorPlugin.getDefault() - .getPreferenceStore(); - labelBgColor = GEMPreferences.getColor(store, - GEMPreferences.LINE_LABEL_COLOR); - } - return labelBgColor; - } - - /** - * get the foreground color from preference - * - */ - public Color getForegroundColor() { - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - final Color newFgColor = GEMPreferences.getColor(store, GEMPreferences.LINE_COLOR); - setForegroundColor(newFgColor); - return newFgColor; - } - - /** - * set the figure's foreground, which will also update the label's border's - * color. - */ - public void setForegroundColor(Color c) { - if (textLabel != null) - textLabel.setBorderColor(c); - super.setForegroundColor(c); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/PageflowNodeFigure.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/PageflowNodeFigure.java deleted file mode 100644 index 9a0827329..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/figure/PageflowNodeFigure.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.figure; - -import java.util.Vector; - -import org.eclipse.draw2d.ChopboxAnchor; -import org.eclipse.draw2d.ConnectionAnchor; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FlowLayout; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.LabelAnchor; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.resource.FontRegistry; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; - -/** - * The figure for pageflow node, used by pageflow node edit part. - * - */ -public class PageflowNodeFigure extends Figure { - /** Same connection anchors for source and target */ - protected Vector connectionAnchors = new Vector(1); - - /** label of the pageflow node figure */ - private NodeLabel label; - - /** the foreground color of Label */ - private Color labelFgColor; - - /** the background color of Label */ -// private Color labelBgColor; // TODO: variable is never read because getter is private - - /** the text placement for the label */ - private int textPlacement = PositionConstants.SOUTH; - - /** - * Default constructor - */ - public PageflowNodeFigure() { - setLayoutManager(new FlowLayout()); - - // initializeConnectionAnchors(); - } - - /** - * get the source(output) anchor according to the input point. - * - * @param p - - * the input point - * @return - Source ConnectionAnchor - */ - public ConnectionAnchor getSourceConnectionAnchorAt(Point p) { - if (getSourceConnectionAnchors().size() == 0) - return null; - return (ConnectionAnchor) getSourceConnectionAnchors().get(0); - } - - /** - * get the default source anchor - * - * @return - Source ConnectionAnchor - */ - public ConnectionAnchor getSourceConnectionAnchor() { - if (getSourceConnectionAnchors().size() == 0) - return null; - return (ConnectionAnchor) getSourceConnectionAnchors().get(0); - } - - /** - * Get the source connection anchors vector - * - * @return - the vector - */ - private Vector getSourceConnectionAnchors() { - return connectionAnchors; - } - - /** - * get the target (input) connection Anchor according the input point - * - * @param p - - * the input Point - * @return - ConnectionAnchor - */ - public ConnectionAnchor getTargetConnectionAnchorAt(Point p) { - if (getTargetConnectionAnchors().size() == 0) - return null; - return (ConnectionAnchor) getTargetConnectionAnchors().get(0); - } - - /** - * get the default target (input) connection Anchor - * - * @return - ConnectionAnchor - */ - public ConnectionAnchor getTargetConnectionAnchor() { - if (getTargetConnectionAnchors().size() == 0) - return null; - return (ConnectionAnchor) getTargetConnectionAnchors().get(0); - } - - /** - * Get the target connection anchors vector - * - * @return - the vector - */ - private Vector getTargetConnectionAnchors() { - return connectionAnchors; - } - - /** - * update the anchors - * - */ - public void update() { - initializeConnectionAnchors(); - } - - /** - * Initialize the connection anchors - * - */ - private void initializeConnectionAnchors() { - connectionAnchors.removeAllElements(); - ChopboxAnchor inputConnectionAnchor = new LabelAnchor(label); - connectionAnchors.addElement(inputConnectionAnchor); - } - - /** - * get the text placement from preference. - * - */ - private int getTextPlacement() { - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - String s = store.getString(GEMPreferences.LABEL_PLACEMENT); - if (GEMPreferences.LABEL_PLACEMENT_TOP.equals(s)) - textPlacement = PositionConstants.NORTH; - else if (GEMPreferences.LABEL_PLACEMENT_BOTTOM.equals(s)) - textPlacement = PositionConstants.SOUTH; - else if (GEMPreferences.LABEL_PLACEMENT_LEFT.equals(s)) - textPlacement = PositionConstants.WEST; - else if (GEMPreferences.LABEL_PLACEMENT_RIGHT.equals(s)) - textPlacement = PositionConstants.EAST; - return textPlacement; - } - - /** - * get the label's background color from preference. - * - * @return - */ - // TODO: dead code -// private Color getLabelBackgroundColor() { -// return labelBgColor; -// } - - /** - * get the label's foreground color from preference. - * - * @return - */ - private Color getLabelForegroundColor() { - if (labelFgColor == null) { - IPreferenceStore store = EditorPlugin.getDefault() - .getPreferenceStore(); - labelFgColor = GEMPreferences.getColor(store, - GEMPreferences.FIGURE_LABEL_FONT_COLOR); - } - return labelFgColor; - } - - /** - * get the labe's font from preference. - * - * @return - */ - private Font getLabelFont() { - FontRegistry registry = JFaceResources.getFontRegistry(); - IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore(); - FontData fontData = PreferenceConverter.getFontData(store, - GEMPreferences.FIGURE_LABEL_FONT); - if (!registry.get(fontData.toString()).equals(registry.defaultFont())) - return registry.get(fontData.toString()); - - registry.put(fontData.toString(), new FontData[] {fontData}); - return registry.get(fontData.toString()); - } - - /** - * set the image and text of the figure - * - * @param image - - * the image - * @param str - - * the label - */ - public void setImageText(Image image, String str) { - if (image == null) - setText(str); - else if (str == null) - setImage(image); - else { - if (label == null) { - label = new NodeLabel(str, image); - label.setTextPlacement(getTextPlacement()); - label.setForegroundColor(getLabelForegroundColor()); - label.setFont(getLabelFont()); - add(label); - initializeConnectionAnchors(); - } else { - label.setIcon(image); - label.setText(str); - } - } - } - - /** - * set the image of the figure - * - * @param image - - * the image - */ - public void setImage(Image image) { - if (image == null) - return; - if (label == null) { - label = new NodeLabel(image); - label.setTextPlacement(getTextPlacement()); - label.setForegroundColor(getLabelForegroundColor()); - label.setFont(getLabelFont()); - add(label); - initializeConnectionAnchors(); - } else - label.setIcon(image); - } - - /** - * set the text of the figure - * - * @param str - - * the text - */ - public void setText(String str) { - if (str == null) - return; - if (label == null) { - label = new NodeLabel(str); - label.setTextPlacement(getTextPlacement()); - label.setForegroundColor(getLabelForegroundColor()); - label.setFont(getLabelFont()); - add(label); - initializeConnectionAnchors(); - } else - label.setText(str); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.draw2d.Figure#useLocalCoordinates() - */ - protected boolean useLocalCoordinates() { - return true; - } - - /** - * Returns the imageBounds. - * - * @return - Rectangle of image - */ - public Rectangle getImageBounds() { - return label.getIconBounds(); - } - - /** - * Returns the textBounds. - * - * @return - Rectangle of text field - */ - public Rectangle getTextBounds() { - return label.getTextBounds(); - } - - /** - * Returns the label. - * - * @return - Label - */ - public Label getLabel() { - return label; - } - - /** - * set the label's backaground - */ - public void setBackgroundColor(Color bg) { -// TODO: var is never read: labelBgColor = bg; - if (label != null) - label.setBackgroundColor(bg); - } - - /** - * set the label's foreground - */ - public void setForegroundColor(Color fg) { - labelFgColor = fg; - - if (label != null) - label.setForegroundColor(fg); - } - - /** - * Set the label's font - */ - public void setFont(Font f) { - if (label != null) - label.setFont(f); - super.setFont(f); - } - - /** - * Set the text placement for the label - * - * @param where - */ - public void setTextPlacement(int where) { - textPlacement = where; - if (label != null) - label.setTextPlacement(where); - } - - - /** - * @param text - */ - public void setToolTipText(String text) { - Label toolTipLabel = null; - - if (text != null && text.length() > 0) { - toolTipLabel = new Label(text); - toolTipLabel.setBorder(new MarginBorder(3)); - } - - super.setToolTip(toolTipLabel); - } - /** - * @return the figure's tool tip text or null if none - */ - public String getToolTipText() { - if (getToolTip() != null) - return ((Label) getToolTip()).getText(); - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/layout/PageflowLayoutManager.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/layout/PageflowLayoutManager.java deleted file mode 100644 index 74c3470a9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/layout/PageflowLayoutManager.java +++ /dev/null @@ -1,550 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.layout; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.draw2d.geometry.Insets; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.draw2d.graph.DirectedGraph; -import org.eclipse.draw2d.graph.DirectedGraphLayout; -import org.eclipse.draw2d.graph.Edge; -import org.eclipse.draw2d.graph.EdgeList; -import org.eclipse.draw2d.graph.Node; -import org.eclipse.draw2d.graph.NodeList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowModelManager; - -/** - * This class is a singleton adpater to create the directed graph for the - * specified pageflow model or update the location information of pageflow model - * according to directed graph layout algorithms. - * - * @author Xiao-guang Zhang - */ -public class PageflowLayoutManager { - /** node's default size */ - private static final int NODE_DEFAULT_WIDTH = 50; - - private static final int NODE_DEFAULT_HEIGHT = 50; - - /** - * the margin of the top and left , and margin between each connnected - * directed graph. - */ - private static final int X_SPACE = 50; - - private static final int Y_SPACE = 50; - - /** node's default padding */ - private static final int DEFAULT_PADDING = 30; - - private static PageflowLayoutManager manager; - - private Map copiedLinks = null; - - /** - * constructor of PageflowDirectedGraphAdapter - * - */ - private PageflowLayoutManager() { - // no external instantiation - } - - /** - * return the singleton instance of PageflowDirectedGraphAdapter - * - * @return - the singleton instance of PageflowDirectedGraphAdapter - */ - static public PageflowLayoutManager getInstance() { - if (manager == null) { - manager = new PageflowLayoutManager(); - } - return manager; - } - - /** - * layout pageflow using directed graph layout algorithms - * - * @param pageflow - - * pageflow model - */ - public void layoutPageflow(Pageflow pageflow) { - List selfLoopLinks = removeSelfLoopLinks(pageflow); - - List lstGraph = createGraphs(pageflow); - for (Iterator iter = lstGraph.iterator(); iter.hasNext();) { - DirectedGraph graph = (DirectedGraph) iter.next(); - new DirectedGraphLayout().visit(graph);// .visit(graph); - } - updatePageflow(lstGraph); - - if (selfLoopLinks != null) { - addSelfLoopLinks(pageflow, selfLoopLinks); - } - } - - /** - * remove the self loop links from pageflow, because the layout algorithm - * does not allow it. - * - * @param pageflow - * @return - */ - private List removeSelfLoopLinks(Pageflow pageflow) { - List selfLoopLinks = new ArrayList(); - - if (pageflow.getLinks() != null) { - for (Iterator iter = pageflow.getLinks().iterator(); iter.hasNext();) { - PageflowLink link = (PageflowLink) iter.next(); - - if (link.getSource() == link.getTarget()) { - iter.remove(); - link.getBendPoints().clear(); - selfLoopLinks.add(link); - } - } - } - return selfLoopLinks; - } - - /** - * add back the self loop links with updated bendpoints. - * - * @param pageflow - * @param selfLoopLinks - */ - private void addSelfLoopLinks(Pageflow pageflow, List selfLoopLinks) { - if (pageflow.getLinks() != null && selfLoopLinks != null - && selfLoopLinks.size() > 0) { - EList links = pageflow.getLinks(); - for (Iterator iter = selfLoopLinks.iterator(); iter.hasNext();) { - PageflowLink link = (PageflowLink) iter.next(); - updateSelfLoopLink(link); - links.add(link); - } - } - } - - /** - * Update the bendpoints of the self loop link Follow the following style: - * - * LeftTop-Top | | Left----Node - * - * @param selfLoopLink - */ - public static void updateSelfLoopLink(PageflowLink selfLoopLink) { - PageflowNode sourceNode = selfLoopLink.getSource(); - Rectangle rectNode = getPageflowNodeBounds(sourceNode); - - EList outLinks = sourceNode.getOutlinks(); - if (outLinks != null && outLinks.size() > 0) { - for (Iterator iter = outLinks.iterator(); iter.hasNext();) { - PageflowLink anotherSelfLoopLink = (PageflowLink) iter.next(); - if (anotherSelfLoopLink != selfLoopLink - && anotherSelfLoopLink.getTarget() == sourceNode) { - rectNode = getFitnessRectangle(rectNode, - anotherSelfLoopLink); - } - } - } - - PageflowFactory factory = PageflowModelManager.getFactory(); - PageflowLinkBendpoint bpTop = factory.createPFLinkBendpoint(); - PageflowLinkBendpoint bpLeftTop = factory.createPFLinkBendpoint(); - PageflowLinkBendpoint bpLeft = factory.createPFLinkBendpoint(); - - bpTop.setD1Height(-rectNode.height); - bpTop.setD2Height(-rectNode.height); - - bpLeftTop.setD1Width(-rectNode.width); - bpLeftTop.setD1Height(-rectNode.height); - bpLeftTop.setD2Width(-rectNode.width); - bpLeftTop.setD2Height(-rectNode.height); - - bpLeft.setD1Width(-rectNode.width); - bpLeft.setD2Width(-rectNode.width); - - selfLoopLink.getBendPoints().add(bpTop); - selfLoopLink.getBendPoints().add(bpLeftTop); - selfLoopLink.getBendPoints().add(bpLeft); - } - - /** - * Calculate the fitness rectangle without conflict with the existing self - * loop's rectangle. - * - * @param rectDefault - * @param anotherSelfLoopLink - */ - private static Rectangle getFitnessRectangle(Rectangle rectDefault, - PageflowLink anotherSelfLoopLink) { - EList bendPoints = anotherSelfLoopLink.getBendPoints(); - if (bendPoints != null && bendPoints.size() > 0) { - for (Iterator iterBendPoint = bendPoints.iterator(); iterBendPoint - .hasNext();) { - PageflowLinkBendpoint bendPoint = (PageflowLinkBendpoint) iterBendPoint - .next(); - if (bendPoint.getD1Width() == -rectDefault.width - && bendPoint.getD1Height() == -rectDefault.height) { - rectDefault = new Rectangle(0, 0, rectDefault.width - + DEFAULT_PADDING, rectDefault.height - + DEFAULT_PADDING); - break; - } - } - } - return rectDefault; - } - - /** - * get the pageflow node's bounds, the orginal point is (0,0) - * - * @param pfNode - * @return - */ - private static Rectangle getPageflowNodeBounds(PageflowNode pfNode) { - return new Rectangle(0, 0, 64, 36); - } - - /** - * get the pageflow node's border rectangle - * - * @param pfNode - * @return - */ - private static Rectangle getPageflowNodeRectangle(PageflowNode pfNode) { - Rectangle rectNode = null; - - Rectangle bounds = getPageflowNodeBounds(pfNode); - - rectNode = new Rectangle(pfNode.getX(), pfNode.getY(), bounds.width, - bounds.height); - - return rectNode; - } - - /** - * create the connected subgraphs for the pageflow model, because there - * maybe more than one connected graph in one pageflow definition. - * - * @param pageflow - - * Pageflow model - * @return - the connected subgraphs - */ - private List createGraphs(Pageflow pageflow) { - /** the connected subgraphs */ - List lstGraph = null; - - if (pageflow != null) { - // Graph is not connected totally. - DirectedGraph graph = null; - HashMap nodesMap = new HashMap(); - - NodeList nodes = new NodeList(); - EdgeList edges = new EdgeList(); - - // get all nodes in the pageflow - List pfNodes = pageflow.getNodes(); - if (pfNodes != null) { - for (Iterator iter = pfNodes.iterator(); iter.hasNext();) { - PageflowNode pfNode = (PageflowNode) iter.next(); - Node node = new Node(pfNode); - Rectangle rectNode = null; - rectNode = getPageflowNodeBounds(pfNode); - if (rectNode != null) { - node.width = rectNode.width * 2; - node.height = rectNode.height * 2; - node.setPadding(new Insets(node.height, node.width, - node.height, node.width)); - } else { - node.width = NODE_DEFAULT_WIDTH; - node.height = NODE_DEFAULT_HEIGHT; - node.setPadding(new Insets(DEFAULT_PADDING)); - } - nodesMap.put(pfNode, node); - nodes.add(node); - } - } - // get all edges in the pageflow - List pfLinks = pageflow.getLinks(); - for (Iterator iter = pfLinks.iterator(); iter.hasNext();) { - PageflowLink link = (PageflowLink) iter.next(); - PageflowNode source = link.getSource(); - PageflowNode target = link.getTarget(); - Node sourceNode = (Node) nodesMap.get(source); - Node targetNode = (Node) nodesMap.get(target); - - if (sourceNode != null && targetNode != null) { - Edge edge = new Edge(sourceNode, targetNode); - edges.add(edge); - } - } - - graph = new DirectedGraph(); - - graph.nodes = nodes; - graph.edges = edges; - - // get the connected subgraphs. - lstGraph = new ArrayList(); - lstGraph.add(graph);// ..getConnectedSubGraphs(); - } - return lstGraph; - } - - /** - * update the pageflow according to layout results which are stored in the - * connected subgraphs - * - * @param lstGraph - - * connected subgraphs - * - */ - private void updatePageflow(List lstGraph) { - // y coordiantion of the subgraph's start point - int topSubGraph = 0; - - for (Iterator iter = lstGraph.iterator(); iter.hasNext();) { - // sub graph's bottom - int bottomSubGraph = 0; - DirectedGraph graph = (DirectedGraph) iter.next(); - for (int i = 0; i < graph.nodes.size(); i++) { - Node node = graph.nodes.getNode(i); - if (!(node.data instanceof PageflowNode)) { - continue; - } - PageflowNode pfNode = (PageflowNode) node.data; - pfNode.setX(X_SPACE + node.y); - - pfNode.setY(Y_SPACE + node.x + topSubGraph); - - if ((Y_SPACE + node.x + topSubGraph) > bottomSubGraph) { - bottomSubGraph = Y_SPACE + node.x + topSubGraph; - } - } - topSubGraph = bottomSubGraph + Y_SPACE; - } - } - - /** - * update new pageflow's layout using the existing one. - * @param newPageflow - * @param oldPageflow - */ - public void updatePageflowLayout(Pageflow newPageflow, Pageflow oldPageflow) { - List notUpdatedNodes = new ArrayList(); - - copiedLinks = new HashMap(); - - if (oldPageflow.getNodes().size() > 0) { - for (Iterator iter = newPageflow.getNodes().iterator(); iter - .hasNext();) { - PageflowNode newNode = (PageflowNode) iter.next(); - - if (!updatePageflowNode(newNode, oldPageflow)) { - notUpdatedNodes.add(newNode); - } - } - } else { - notUpdatedNodes.addAll(newPageflow.getNodes()); - } - - if (oldPageflow.getLinks().size() > 0) { - for (Iterator iter = newPageflow.getLinks().iterator(); iter - .hasNext();) { - PageflowLink newLink = (PageflowLink) iter.next(); - - updatePFLink(newLink, oldPageflow); - } - } - - // if there are still some nodes which are not updated, - // they should be check whether there are some layout conflict. - if (notUpdatedNodes.size() > 0) { - resolveConflict(newPageflow, notUpdatedNodes); - } - - } - - /** - * Update pageflow node using the same node - * - * @param object - * @return - the old pageflow node. - */ - private boolean updatePageflowNode(PageflowNode newNode, - Pageflow oldPageflow) { - for (Iterator iter = oldPageflow.getNodes().iterator(); iter.hasNext();) { - PageflowNode oldNode = (PageflowNode) iter.next(); - - if (oldNode instanceof PageflowPage - && newNode instanceof PageflowPage) { - if (((PageflowPage) oldNode).getPath().trim().equals( - ((PageflowPage) newNode).getPath().trim())) { - updatePageflowNode(newNode, oldNode); - return true; - } - } - } - return false; - } - - /** - * Update pageflow node using the same node - * - * @param object - */ - private void updatePageflowNode(PageflowNode newNode, PageflowNode node) { - newNode.setX(node.getX()); - newNode.setY(node.getY()); - } - - /** - * If there are conflict for the nodes, it will resolve it. - * - * @param newPageflow - * @param notUpdatedNodes - */ - private void resolveConflict(Pageflow newPageflow, List notUpdatedNodes) { - for (Iterator iter = notUpdatedNodes.iterator(); iter.hasNext();) { - resolveConflict(newPageflow, (PageflowNode) iter.next()); - } - } - - /** - * Resolve the layout conflict - * - * @param newPageflow - * @param node - */ - private void resolveConflict(Pageflow newPageflow, PageflowNode node) { - Rectangle nodeRect = getPageflowNodeRectangle(node); - boolean bModified = false; - for (int i = 0, size = newPageflow.getNodes().size(); i < size; i++) { - PageflowNode fixedNode = (PageflowNode) newPageflow.getNodes().get( - i); - if (node == fixedNode) { - continue; - } - Rectangle fixedNodeRect = getPageflowNodeRectangle(fixedNode); - if (fixedNodeRect.intersects(nodeRect)) { - nodeRect.x += fixedNodeRect.width + X_SPACE; - nodeRect.y += fixedNodeRect.height + Y_SPACE; - bModified = true; - } - } - if (bModified) { - node.setX(nodeRect.x); - node.setY(nodeRect.y); - } - } - - /** - * Update the link using the same link in the old pageflow - * - * @param newLink - * @param oldPageflow - */ - private void updatePFLink(PageflowLink newLink, Pageflow oldPageflow) { - for (Iterator iter = oldPageflow.getLinks().iterator(); iter.hasNext();) { - PageflowLink oldLink = (PageflowLink) iter.next(); - - if (copiedLinks.get(oldLink) != null) { - continue; - } - - if (isSameLink(newLink, oldLink)) { - updatePFLink(newLink, oldLink); - break; - } - } - } - - /** - * Check whether this two links in differnet pageflow are same or not. - * - * @param newLink - * @param oldLink - * @return - */ - private boolean isSameLink(PageflowLink newLink, PageflowLink oldLink) { - PageflowNode newSource = newLink.getSource(); - PageflowNode newTarget = newLink.getTarget(); - - PageflowNode oldSource = oldLink.getSource(); - PageflowNode oldTarget = oldLink.getTarget(); - - // Page-Page - if (newSource instanceof PageflowPage - && oldSource instanceof PageflowPage - && newTarget instanceof PageflowPage - && oldTarget instanceof PageflowPage) { - if (((PageflowPage) newSource).getPath().trim().equalsIgnoreCase( - ((PageflowPage) oldSource).getPath().trim()) - && ((PageflowPage) newTarget) - .getPath() - .trim() - .equalsIgnoreCase( - ((PageflowPage) oldTarget).getPath().trim())) { - if ((newLink.getOutcome() == null && oldLink.getOutcome() == null) - || (newLink.getOutcome() != null - && oldLink.getOutcome() != null && newLink - .getOutcome().trim().equals( - oldLink.getOutcome().trim()))) { - return true; - } - } - } - - return false; - } - - /** - * Update the link using the same link - * - * @param nodesMap - * @param object - * @return - */ - private PageflowLink updatePFLink(PageflowLink newLink, PageflowLink link) { - PageflowFactory factory = PageflowModelManager.getFactory(); - - newLink.getBendPoints().clear(); - - for (Iterator iter = link.getBendPoints().iterator(); iter.hasNext();) { - PageflowLinkBendpoint bendPoint = (PageflowLinkBendpoint) iter - .next(); - PageflowLinkBendpoint newBendPoint = factory - .createPFLinkBendpoint(); - newBendPoint.setD1Height(bendPoint.getD1Height()); - newBendPoint.setD1Width(bendPoint.getD1Width()); - newBendPoint.setD2Height(bendPoint.getD2Height()); - newBendPoint.setD2Width(bendPoint.getD2Width()); - newLink.getBendPoints().add(newBendPoint); - } - - copiedLinks.put(link, link); - return newLink; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/Pageflow.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/Pageflow.java deleted file mode 100644 index b76fdafc2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/Pageflow.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>Pageflow</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getNodes <em>Nodes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getLinks <em>Links</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getConfigfile <em>Configfile</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflow() - * @model - * @generated - */ -public interface Pageflow extends PageflowElement { - /** - * Returns the value of the '<em><b>Nodes</b></em>' containment - * reference list. The list contents are of type - * {@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode}. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getPageflow <em>Pageflow</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Nodes</em>' containment reference list - * isn't clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Nodes</em>' containment reference list. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflow_Nodes() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getPageflow - * @model type="org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode" - * opposite="pageflow" containment="true" - * @generated - */ - EList getNodes(); - - /** - * Returns the value of the '<em><b>Links</b></em>' containment - * reference list. The list contents are of type - * {@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink}. It - * is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getPageflow <em>Pageflow</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Links</em>' containment reference list - * isn't clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Links</em>' containment reference list. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflow_Links() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getPageflow - * @model type="org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PFLink" - * opposite="pageflow" containment="true" - * @generated - */ - EList getLinks(); - - /** - * Returns the value of the '<em><b>Configfile</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Configfile</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Configfile</em>' attribute. - * @see #setConfigfile(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflow_Configfile() - * @model - * @generated - */ - String getConfigfile(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getConfigfile <em>Configfile</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Configfile</em>' attribute. - * @see #getConfigfile() - * @generated - */ - void setConfigfile(String value); - - /** - * - * @param source - * @param target - * @param link - * @generated NOT - */ - public void connect(PageflowNode source, PageflowNode target, PageflowLink link); - - /** - * - * @param nodeType - * @return the default node name - * @generated NOT - */ - public String getDefaultNodeName(Class nodeType); -} -// Pageflow diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowElement.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowElement.java deleted file mode 100644 index ba2ee9b68..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowElement.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.ReferenceElement; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>Element</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getComment <em>Comment</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getX <em>X</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getY <em>Y</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getWidth <em>Width</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getHeight <em>Height</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getId <em>Id</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement() - * @model abstract="true" - * @generated - */ -public interface PageflowElement extends EObject { - /** - * The pageflow model is based on faces-config model, its elements will - * reference faces-config elements with ReferenceElement. - * @return the ref element - * - * @generated NOT - */ - public ReferenceElement getFCElements(); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. The - * default value is <code>"unnamed"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_Name() - * @model default="unnamed" - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getName <em>Name</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>Comment</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Comment</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Comment</em>' attribute. - * @see #setComment(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_Comment() - * @model - * @generated - */ - String getComment(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getComment <em>Comment</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Comment</em>' attribute. - * @see #getComment() - * @generated - */ - void setComment(String value); - - /** - * Returns the value of the '<em><b>X</b></em>' attribute. The default - * value is <code>"0"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>X</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>X</em>' attribute. - * @see #setX(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_X() - * @model default="0" - * @generated - */ - int getX(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getX <em>X</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>X</em>' attribute. - * @see #getX() - * @generated - */ - void setX(int value); - - /** - * Returns the value of the '<em><b>Y</b></em>' attribute. The default - * value is <code>"0"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Y</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Y</em>' attribute. - * @see #setY(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_Y() - * @model default="0" - * @generated - */ - int getY(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getY <em>Y</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Y</em>' attribute. - * @see #getY() - * @generated - */ - void setY(int value); - - /** - * Returns the value of the '<em><b>Width</b></em>' attribute. The - * default value is <code>"-1"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Width</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Width</em>' attribute. - * @see #setWidth(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_Width() - * @model default="-1" - * @generated - */ - int getWidth(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getWidth <em>Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Width</em>' attribute. - * @see #getWidth() - * @generated - */ - void setWidth(int value); - - /** - * Returns the value of the '<em><b>Height</b></em>' attribute. The - * default value is <code>"-1"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Height</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Height</em>' attribute. - * @see #setHeight(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_Height() - * @model default="-1" - * @generated - */ - int getHeight(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getHeight <em>Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Height</em>' attribute. - * @see #getHeight() - * @generated - */ - void setHeight(int value); - - /** - * Returns the value of the '<em><b>Id</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Id</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Id</em>' attribute. - * @see #setId(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowElement_Id() - * @model id="true" required="true" volatile="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getId <em>Id</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Id</em>' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - - /** - * Returns the value of the '<em><b>Reference Link</b></em>' attribute. - * The default value is <code>""</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Reference Link</em>' attribute isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Reference Link</em>' attribute. - * @see #setReferenceLink(String) - * @model default="" dataType="org.eclipse.emf.ecore.xml.type.String" - * extendedMetaData="kind='attribute' name='referenceLink'" - * @generated - */ - String getReferenceLink(); - - /** - * Sets the value of the '{@link PageflowElement#getReferenceLink() <em>Reference Link</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Reference Link</em>' attribute. - * @see #getReferenceLink() - * @generated - */ - void setReferenceLink(String value); - - /** - * @param nofitification - * @generated NOT - */ - void notifyModelChanged(Notification nofitification); - - /** - * When the model is modified, the adapters or reference elements should be - * updated. - * - * @generated NOT - */ - void update(); - - /** - * @generated NOT - */ - void dispose(); -} -// PageflowElement diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowFactory.java deleted file mode 100644 index 3d52525eb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowFactory.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a - * create method for each non-abstract class of the model. <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage - * @generated - */ -public interface PageflowFactory extends EFactory { - /** - * The singleton instance of the factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - PageflowFactory eINSTANCE = new org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowFactoryImpl(); - - /** - * Returns a new object of class '<em>Pageflow</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Pageflow</em>'. - * @generated - */ - Pageflow createPageflow(); - - /** - * Returns a new object of class '<em>PF Link</em>'. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @return a new object of class '<em>PF Link</em>'. - * @generated - */ - PageflowLink createPFLink(); - - /** - * Returns a new object of class '<em>PF Page</em>'. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @return a new object of class '<em>PF Page</em>'. - * @generated - */ - PageflowPage createPFPage(); - - /** - * Returns a new object of class '<em>PF Link Bendpoint</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>PF Link Bendpoint</em>'. - * @generated - */ - PageflowLinkBendpoint createPFLinkBendpoint(); - - /** - * Returns the package supported by this factory. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @return the package supported by this factory. - * @generated - */ - PageflowPackage getPageflowPackage(); - -} -// PageflowFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowLink.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowLink.java deleted file mode 100644 index ac22bcdfa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowLink.java +++ /dev/null @@ -1,326 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import java.util.Vector; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>PF Link</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getPageflow <em>Pageflow</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getTarget <em>Target</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSmallicon <em>Smallicon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getLargeicon <em>Largeicon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getFromaction <em>Fromaction</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getOutcome <em>Outcome</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#isRedirect <em>Redirect</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getBendPoints <em>Bend Points</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink() - * @model - * @generated - */ -public interface PageflowLink extends PageflowElement { - /** - * Returns the value of the '<em><b>Pageflow</b></em>' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getLinks <em>Links</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Pageflow</em>' container reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Pageflow</em>' container reference. - * @see #setPageflow(Pageflow) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_Pageflow() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getLinks - * @model opposite="links" required="true" - * @generated - */ - Pageflow getPageflow(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getPageflow <em>Pageflow</em>}' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Pageflow</em>' container reference. - * @see #getPageflow() - * @generated - */ - void setPageflow(Pageflow value); - - /** - * Returns the value of the '<em><b>Target</b></em>' reference. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getInlinks <em>Inlinks</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Target</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Target</em>' reference. - * @see #setTarget(PageflowNode) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_Target() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getInlinks - * @model opposite="inlinks" required="true" - * @generated - */ - PageflowNode getTarget(); - - /** - * @param path - */ - void setTargetPath(String path); - - /** - * @param path - */ - void setSourcePath(String path); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getTarget <em>Target</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Target</em>' reference. - * @see #getTarget() - * @generated - */ - void setTarget(PageflowNode value); - - /** - * Returns the value of the '<em><b>Source</b></em>' reference. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getOutlinks <em>Outlinks</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Source</em>' reference. - * @see #setSource(PageflowNode) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_Source() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getOutlinks - * @model opposite="outlinks" required="true" - * @generated - */ - PageflowNode getSource(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSource <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source</em>' reference. - * @see #getSource() - * @generated - */ - void setSource(PageflowNode value); - - /** - * Returns the value of the '<em><b>Smallicon</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Smallicon</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Smallicon</em>' attribute. - * @see #setSmallicon(String) - * @model - * @generated - */ - String getSmallicon(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSmallicon <em>Smallicon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Smallicon</em>' attribute. - * @see #getSmallicon() - * @generated - */ - void setSmallicon(String value); - - /** - * Returns the value of the '<em><b>Largeicon</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Largeicon</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Largeicon</em>' attribute. - * @see #setLargeicon(String) - * @model - * @generated - */ - String getLargeicon(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getLargeicon <em>Largeicon</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Largeicon</em>' attribute. - * @see #getLargeicon() - * @generated - */ - void setLargeicon(String value); - - /** - * Returns the value of the '<em><b>Fromaction</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Fromaction</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Fromaction</em>' attribute. - * @see #setFromaction(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_Fromaction() - * @model - * @generated - */ - String getFromaction(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getFromaction <em>Fromaction</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Fromaction</em>' attribute. - * @see #getFromaction() - * @generated - */ - void setFromaction(String value); - - /** - * Returns the value of the '<em><b>Outcome</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Outcome</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Outcome</em>' attribute. - * @see #setOutcome(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_Outcome() - * @model - * @generated - */ - String getOutcome(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getOutcome <em>Outcome</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Outcome</em>' attribute. - * @see #getOutcome() - * @generated - */ - void setOutcome(String value); - - /** - * Returns the value of the '<em><b>Redirect</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Redirect</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Redirect</em>' attribute. - * @see #setRedirect(boolean) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_Redirect() - * @model - * @generated - */ - boolean isRedirect(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#isRedirect <em>Redirect</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Redirect</em>' attribute. - * @see #isRedirect() - * @generated - */ - void setRedirect(boolean value); - - /** - * Returns the value of the '<em><b>Bend Points</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint}. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getLink <em>Link</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Bend Points</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Bend Points</em>' containment reference list. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLink_BendPoints() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getLink - * @model type="org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PFLinkBendpoint" opposite="link" containment="true" - * @generated - */ - EList getBendPoints(); - - /** - * <!-- begin-user-doc --> - * insert a new bendpoint to the link - * @param index - * @param point - * <!--end-user-doc --> - * - * @generated NOT - */ - public void insertBendpoint(int index, PageflowLinkBendpoint point); - - /** - * <!-- begin-user-doc --> - * remove the current bendpoint - * @param index - * <!-- end-user-doc --> - * - * @generated NOT - */ - public void removeBendpoint(int index); - - /** - * <!-- begin-user-doc --> - * Set the current bendpoint - * - * @param index - * @param point - * <!-- end-user-doc --> - * - * @generated NOT - */ - public void setBendpoint(int index, PageflowLinkBendpoint point); - - /** - * <!-- begin-user-doc --> - * Set a group of bendpoints to reconstruct the link - * @param points - * <!-- end-user-doc --> - * - * @generated NOT - */ - public void setBendpoints(Vector points); - -} -// PFLink diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowLinkBendpoint.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowLinkBendpoint.java deleted file mode 100644 index 4e4070950..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowLinkBendpoint.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>PF Link Bendpoint</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Width <em>D1 Width</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Height <em>D1 Height</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Width <em>D2 Width</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Height <em>D2 Height</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getWeight <em>Weight</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getLink <em>Link</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint() - * @model - * @generated - */ -public interface PageflowLinkBendpoint extends EObject { - /** - * Returns the value of the '<em><b>D1 Width</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>D1 Width</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>D1 Width</em>' attribute. - * @see #setD1Width(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint_D1Width() - * @model - * @generated - */ - int getD1Width(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Width <em>D1 Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>D1 Width</em>' attribute. - * @see #getD1Width() - * @generated - */ - void setD1Width(int value); - - /** - * Returns the value of the '<em><b>D1 Height</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>D1 Height</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>D1 Height</em>' attribute. - * @see #setD1Height(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint_D1Height() - * @model - * @generated - */ - int getD1Height(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Height <em>D1 Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>D1 Height</em>' attribute. - * @see #getD1Height() - * @generated - */ - void setD1Height(int value); - - /** - * Returns the value of the '<em><b>D2 Width</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>D2 Width</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>D2 Width</em>' attribute. - * @see #setD2Width(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint_D2Width() - * @model - * @generated - */ - int getD2Width(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Width <em>D2 Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>D2 Width</em>' attribute. - * @see #getD2Width() - * @generated - */ - void setD2Width(int value); - - /** - * Returns the value of the '<em><b>D2 Height</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>D2 Height</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>D2 Height</em>' attribute. - * @see #setD2Height(int) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint_D2Height() - * @model - * @generated - */ - int getD2Height(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Height <em>D2 Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>D2 Height</em>' attribute. - * @see #getD2Height() - * @generated - */ - void setD2Height(int value); - - /** - * Returns the value of the '<em><b>Weight</b></em>' attribute. The - * default value is <code>"0.5"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Weight</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Weight</em>' attribute. - * @see #setWeight(float) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint_Weight() - * @model default="0.5" - * @generated - */ - float getWeight(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getWeight <em>Weight</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Weight</em>' attribute. - * @see #getWeight() - * @generated - */ - void setWeight(float value); - - /** - * Returns the value of the '<em><b>Link</b></em>' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getBendPoints <em>Bend Points</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Link</em>' container reference isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Link</em>' container reference. - * @see #setLink(PageflowLink) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFLinkBendpoint_Link() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getBendPoints - * @model opposite="bendPoints" required="true" - * @generated - */ - PageflowLink getLink(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getLink <em>Link</em>}' - * container reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Link</em>' container reference. - * @see #getLink() - * @generated - */ - void setLink(PageflowLink value); - - /** - * <!-- begin-user-doc --> - * @return the first relative dim - * <!-- end-user-doc --> - * - * @generated NOT - */ - public Dimension getFirstRelativeDimension(); - - /** - * <!-- begin-user-doc --> - * @return the second relative dim - * <!-- end-user-doc --> - * - * @generated NOT - */ - public Dimension getSecondRelativeDimension(); - - /** - * <!-- begin-user-doc --> - * @param dim1 - * @param dim2 - * <!-- end-user-doc --> - * - * @generated NOT - */ - public void setRelativeDimensions(Dimension dim1, Dimension dim2); - -} -// PFLinkBendpoint diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowNode.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowNode.java deleted file mode 100644 index 0559badf4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowNode.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>Node</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getPageflow <em>Pageflow</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getOutlinks <em>Outlinks</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getInlinks <em>Inlinks</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowNode() - * @model abstract="true" - * @generated - */ -public interface PageflowNode extends PageflowElement { - /** - * Returns the value of the '<em><b>Pageflow</b></em>' container - * reference. It is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getNodes <em>Nodes</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Pageflow</em>' container reference isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Pageflow</em>' container reference. - * @see #setPageflow(Pageflow) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowNode_Pageflow() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getNodes - * @model opposite="nodes" required="true" - * @generated - */ - Pageflow getPageflow(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getPageflow <em>Pageflow</em>}' - * container reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Pageflow</em>' container - * reference. - * @see #getPageflow() - * @generated - */ - void setPageflow(Pageflow value); - - /** - * Returns the value of the '<em><b>Outlinks</b></em>' reference list. - * The list contents are of type - * {@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink}. It - * is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSource <em>Source</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Outlinks</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Outlinks</em>' reference list. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowNode_Outlinks() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSource - * @model type="org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PFLink" - * opposite="source" - * @generated - */ - EList getOutlinks(); - - /** - * Returns the value of the '<em><b>Inlinks</b></em>' reference list. - * The list contents are of type - * {@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink}. It - * is bidirectional and its opposite is '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getTarget <em>Target</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Inlinks</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Inlinks</em>' reference list. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPageflowNode_Inlinks() - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getTarget - * @model type="org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PFLink" - * opposite="target" - * @generated - */ - EList getInlinks(); - - /** - * @param target - * @return the page flow node - * @generated NOT - */ - PageflowLink findLinkTo(PageflowNode target); - -} -// PageflowNode diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowPackage.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowPackage.java deleted file mode 100644 index e50714248..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowPackage.java +++ /dev/null @@ -1,1161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains - * accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory - * @generated - */ -public interface PageflowPackage extends EPackage { - /** - * The package name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNAME = "pageflow"; //$NON-NLS-1$ - - /** - * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_URI = "http://www.sybase.com/suade/pageflow"; //$NON-NLS-1$ - - /** - * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_PREFIX = "pageflow"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - PageflowPackage eINSTANCE = org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl - .init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl <em>Element</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl#getPageflowElement() - * @generated - */ - int PAGEFLOW_ELEMENT = 3; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__NAME = 0; - - /** - * The feature id for the '<em><b>Comment</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__COMMENT = 1; - - /** - * The feature id for the '<em><b>X</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__X = 2; - - /** - * The feature id for the '<em><b>Y</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__Y = 3; - - /** - * The feature id for the '<em><b>Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__WIDTH = 4; - - /** - * The feature id for the '<em><b>Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__HEIGHT = 5; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__ID = 6; - - /** - * The feature id for the '<em><b>Reference Link</b></em>' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT__REFERENCE_LINK = 7; - - /** - * The number of structural features of the the '<em>Element</em>' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_ELEMENT_FEATURE_COUNT = 8; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowImpl <em>Pageflow</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowImpl - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl#getPageflow() - * @generated - */ - int PAGEFLOW = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__NAME = PAGEFLOW_ELEMENT__NAME; - - /** - * The feature id for the '<em><b>Comment</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__COMMENT = PAGEFLOW_ELEMENT__COMMENT; - - /** - * The feature id for the '<em><b>X</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__X = PAGEFLOW_ELEMENT__X; - - /** - * The feature id for the '<em><b>Y</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__Y = PAGEFLOW_ELEMENT__Y; - - /** - * The feature id for the '<em><b>Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__WIDTH = PAGEFLOW_ELEMENT__WIDTH; - - /** - * The feature id for the '<em><b>Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__HEIGHT = PAGEFLOW_ELEMENT__HEIGHT; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__ID = PAGEFLOW_ELEMENT__ID; - - /** - * The feature id for the '<em><b>Reference Link</b></em>' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__REFERENCE_LINK = PAGEFLOW_ELEMENT__REFERENCE_LINK; - - /** - * The feature id for the '<em><b>Nodes</b></em>' containment reference - * list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__NODES = PAGEFLOW_ELEMENT_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Links</b></em>' containment reference - * list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__LINKS = PAGEFLOW_ELEMENT_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Configfile</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW__CONFIGFILE = PAGEFLOW_ELEMENT_FEATURE_COUNT + 2; - - /** - * The number of structural features of the the '<em>Pageflow</em>' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_FEATURE_COUNT = PAGEFLOW_ELEMENT_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowNodeImpl <em>Node</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowNodeImpl - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl#getPageflowNode() - * @generated - */ - int PAGEFLOW_NODE = 1; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__NAME = PAGEFLOW_ELEMENT__NAME; - - /** - * The feature id for the '<em><b>Comment</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__COMMENT = PAGEFLOW_ELEMENT__COMMENT; - - /** - * The feature id for the '<em><b>X</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__X = PAGEFLOW_ELEMENT__X; - - /** - * The feature id for the '<em><b>Y</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__Y = PAGEFLOW_ELEMENT__Y; - - /** - * The feature id for the '<em><b>Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__WIDTH = PAGEFLOW_ELEMENT__WIDTH; - - /** - * The feature id for the '<em><b>Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__HEIGHT = PAGEFLOW_ELEMENT__HEIGHT; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__ID = PAGEFLOW_ELEMENT__ID; - - /** - * The feature id for the '<em><b>Reference Link</b></em>' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__REFERENCE_LINK = PAGEFLOW_ELEMENT__REFERENCE_LINK; - - /** - * The feature id for the '<em><b>Pageflow</b></em>' container - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__PAGEFLOW = PAGEFLOW_ELEMENT_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Outlinks</b></em>' reference list. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__OUTLINKS = PAGEFLOW_ELEMENT_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Inlinks</b></em>' reference list. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE__INLINKS = PAGEFLOW_ELEMENT_FEATURE_COUNT + 2; - - /** - * The number of structural features of the the '<em>Node</em>' class. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PAGEFLOW_NODE_FEATURE_COUNT = PAGEFLOW_ELEMENT_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl <em>PF Link</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl#getPFLink() - * @generated - */ - int PF_LINK = 2; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__NAME = PAGEFLOW_ELEMENT__NAME; - - /** - * The feature id for the '<em><b>Comment</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__COMMENT = PAGEFLOW_ELEMENT__COMMENT; - - /** - * The feature id for the '<em><b>X</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__X = PAGEFLOW_ELEMENT__X; - - /** - * The feature id for the '<em><b>Y</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__Y = PAGEFLOW_ELEMENT__Y; - - /** - * The feature id for the '<em><b>Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__WIDTH = PAGEFLOW_ELEMENT__WIDTH; - - /** - * The feature id for the '<em><b>Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__HEIGHT = PAGEFLOW_ELEMENT__HEIGHT; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__ID = PAGEFLOW_ELEMENT__ID; - - /** - * The feature id for the '<em><b>Reference Link</b></em>' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__REFERENCE_LINK = PAGEFLOW_ELEMENT__REFERENCE_LINK; - - /** - * The feature id for the '<em><b>Pageflow</b></em>' container - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__PAGEFLOW = PAGEFLOW_ELEMENT_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Target</b></em>' reference. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__TARGET = PAGEFLOW_ELEMENT_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Source</b></em>' reference. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__SOURCE = PAGEFLOW_ELEMENT_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Outcome</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__OUTCOME = PAGEFLOW_ELEMENT_FEATURE_COUNT + 3; - - /** - * The feature id for the '<em><b>Redirect</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__REDIRECT = PAGEFLOW_ELEMENT_FEATURE_COUNT + 4; - - /** - * The feature id for the '<em><b>Bend Points</b></em>' containment - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__BEND_POINTS = PAGEFLOW_ELEMENT_FEATURE_COUNT + 5; - - /** - * The feature id for the '<em><b>Smallicon</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__SMALLICON = PAGEFLOW_ELEMENT_FEATURE_COUNT + 6; - - /** - * The feature id for the '<em><b>Largeicon</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__LARGEICON = PAGEFLOW_ELEMENT_FEATURE_COUNT + 7; - - /** - * The feature id for the '<em><b>Fromaction</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK__FROMACTION = PAGEFLOW_ELEMENT_FEATURE_COUNT + 8; - - /** - * The number of structural features of the the '<em>PF Link</em>' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_FEATURE_COUNT = PAGEFLOW_ELEMENT_FEATURE_COUNT + 9; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPageImpl <em>PF Page</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPageImpl - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl#getPFPage() - * @generated - */ - int PF_PAGE = 5; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__NAME = PAGEFLOW_NODE__NAME; - - /** - * The feature id for the '<em><b>Comment</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__COMMENT = PAGEFLOW_NODE__COMMENT; - - /** - * The feature id for the '<em><b>X</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__X = PAGEFLOW_NODE__X; - - /** - * The feature id for the '<em><b>Y</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__Y = PAGEFLOW_NODE__Y; - - /** - * The feature id for the '<em><b>Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__WIDTH = PAGEFLOW_NODE__WIDTH; - - /** - * The feature id for the '<em><b>Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__HEIGHT = PAGEFLOW_NODE__HEIGHT; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__ID = PAGEFLOW_NODE__ID; - - /** - * The feature id for the '<em><b>Pageflow</b></em>' container - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__PAGEFLOW = PAGEFLOW_NODE__PAGEFLOW; - - /** - * The feature id for the '<em><b>Outlinks</b></em>' reference list. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__OUTLINKS = PAGEFLOW_NODE__OUTLINKS; - - /** - * The feature id for the '<em><b>Inlinks</b></em>' reference list. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__INLINKS = PAGEFLOW_NODE__INLINKS; - - /** - * The feature id for the '<em><b>Path</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__PATH = PAGEFLOW_NODE_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Smallicon</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__SMALLICON = PAGEFLOW_NODE_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Largeicon</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE__LARGEICON = PAGEFLOW_NODE_FEATURE_COUNT + 2; - - /** - * The number of structural features of the the '<em>PF Page</em>' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_PAGE_FEATURE_COUNT = PAGEFLOW_NODE_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl <em>PF Link Bendpoint</em>}' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl#getPFLinkBendpoint() - * @generated - */ - int PF_LINK_BENDPOINT = 8; - - /** - * The feature id for the '<em><b>D1 Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT__D1_WIDTH = 0; - - /** - * The feature id for the '<em><b>D1 Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT__D1_HEIGHT = 1; - - /** - * The feature id for the '<em><b>D2 Width</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT__D2_WIDTH = 2; - - /** - * The feature id for the '<em><b>D2 Height</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT__D2_HEIGHT = 3; - - /** - * The feature id for the '<em><b>Weight</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT__WEIGHT = 4; - - /** - * The feature id for the '<em><b>Link</b></em>' container reference. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT__LINK = 5; - - /** - * The number of structural features of the the '<em>PF Link Bendpoint</em>' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PF_LINK_BENDPOINT_FEATURE_COUNT = 6; - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow <em>Pageflow</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Pageflow</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow - * @generated - */ - EClass getPageflow(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getNodes <em>Nodes</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list '<em>Nodes</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getNodes() - * @see #getPageflow() - * @generated - */ - EReference getPageflow_Nodes(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getLinks <em>Links</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list '<em>Links</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getLinks() - * @see #getPageflow() - * @generated - */ - EReference getPageflow_Links(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getConfigfile <em>Configfile</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Configfile</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow#getConfigfile() - * @see #getPageflow() - * @generated - */ - EAttribute getPageflow_Configfile(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode <em>Node</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Node</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode - * @generated - */ - EClass getPageflowNode(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getPageflow <em>Pageflow</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the container reference '<em>Pageflow</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getPageflow() - * @see #getPageflowNode() - * @generated - */ - EReference getPageflowNode_Pageflow(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getOutlinks <em>Outlinks</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference list '<em>Outlinks</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getOutlinks() - * @see #getPageflowNode() - * @generated - */ - EReference getPageflowNode_Outlinks(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getInlinks <em>Inlinks</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference list '<em>Inlinks</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode#getInlinks() - * @see #getPageflowNode() - * @generated - */ - EReference getPageflowNode_Inlinks(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink <em>PF Link</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>PF Link</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink - * @generated - */ - EClass getPFLink(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getPageflow <em>Pageflow</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the container reference '<em>Pageflow</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getPageflow() - * @see #getPFLink() - * @generated - */ - EReference getPFLink_Pageflow(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getTarget <em>Target</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Target</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getTarget() - * @see #getPFLink() - * @generated - */ - EReference getPFLink_Target(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSource <em>Source</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Source</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getSource() - * @see #getPFLink() - * @generated - */ - EReference getPFLink_Source(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getOutcome <em>Outcome</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Outcome</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getOutcome() - * @see #getPFLink() - * @generated - */ - EAttribute getPFLink_Outcome(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getOutcome <em>Outcome</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Outcome</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getOutcome() - * @see #getPFLink() - * @generated - */ - EAttribute getPFLink_Fromaction(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#isRedirect <em>Redirect</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Redirect</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#isRedirect() - * @see #getPFLink() - * @generated - */ - EAttribute getPFLink_Redirect(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getBendPoints <em>Bend Points</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list '<em>Bend Points</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink#getBendPoints() - * @see #getPFLink() - * @generated - */ - EReference getPFLink_BendPoints(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement <em>Element</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Element</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement - * @generated - */ - EClass getPageflowElement(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getName <em>Name</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getName() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_Name(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getComment <em>Comment</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Comment</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getComment() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_Comment(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getX <em>X</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>X</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getX() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_X(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getY <em>Y</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Y</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getY() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_Y(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getWidth <em>Width</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Width</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getWidth() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_Width(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getHeight <em>Height</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Height</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getHeight() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_Height(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getId <em>Id</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Id</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement#getId() - * @see #getPageflowElement() - * @generated - */ - EAttribute getPageflowElement_Id(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage <em>PF Page</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>PF Page</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage - * @generated - */ - EClass getPFPage(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getPath <em>Path</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Path</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getPath() - * @see #getPFPage() - * @generated - */ - EAttribute getPFPage_Path(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getSmallicon <em>Smallicon</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Smallicon</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getSmallicon() - * @see #getPFPage() - * @generated - */ - EAttribute getPFPage_Smallicon(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getLargeicon <em>Largeicon</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Largeicon</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getLargeicon() - * @see #getPFPage() - * @generated - */ - EAttribute getPFPage_Largeicon(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint <em>PF Link Bendpoint</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>PF Link Bendpoint</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint - * @generated - */ - EClass getPFLinkBendpoint(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Width <em>D1 Width</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>D1 Width</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Width() - * @see #getPFLinkBendpoint() - * @generated - */ - EAttribute getPFLinkBendpoint_D1Width(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Height <em>D1 Height</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>D1 Height</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD1Height() - * @see #getPFLinkBendpoint() - * @generated - */ - EAttribute getPFLinkBendpoint_D1Height(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Width <em>D2 Width</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>D2 Width</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Width() - * @see #getPFLinkBendpoint() - * @generated - */ - EAttribute getPFLinkBendpoint_D2Width(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Height <em>D2 Height</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>D2 Height</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getD2Height() - * @see #getPFLinkBendpoint() - * @generated - */ - EAttribute getPFLinkBendpoint_D2Height(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getWeight <em>Weight</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Weight</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getWeight() - * @see #getPFLinkBendpoint() - * @generated - */ - EAttribute getPFLinkBendpoint_Weight(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getLink <em>Link</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the container reference '<em>Link</em>'. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint#getLink() - * @see #getPFLinkBendpoint() - * @generated - */ - EReference getPFLinkBendpoint_Link(); - - /** - * Returns the factory that creates the instances of the model. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the factory that creates the instances of the model. - * @generated - */ - PageflowFactory getPageflowFactory(); - -} -// PageflowPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowPage.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowPage.java deleted file mode 100644 index b6cecb55e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/PageflowPage.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>PF Page</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getPath <em>Path</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getSmallicon <em>Smallicon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getLargeicon <em>Largeicon</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFPage() - * @model - * @generated - */ -public interface PageflowPage extends PageflowNode { - /** - * Returns the value of the '<em><b>Path</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Path</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Path</em>' attribute. - * @see #setPath(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFPage_Path() - * @model - * @generated - */ - String getPath(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getPath <em>Path</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Path</em>' attribute. - * @see #getPath() - * @generated - */ - void setPath(String value); - - /** - * Returns the value of the '<em><b>Smallicon</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Smallicon</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Smallicon</em>' attribute. - * @see #setSmallicon(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFPage_Smallicon() - * @model - * @generated - */ - String getSmallicon(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getSmallicon <em>Smallicon</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Smallicon</em>' attribute. - * @see #getSmallicon() - * @generated - */ - void setSmallicon(String value); - - /** - * Returns the value of the '<em><b>Largeicon</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Largeicon</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Largeicon</em>' attribute. - * @see #setLargeicon(String) - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#getPFPage_Largeicon() - * @model - * @generated - */ - String getLargeicon(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage#getLargeicon <em>Largeicon</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Largeicon</em>' attribute. - * @see #getLargeicon() - * @generated - */ - void setLargeicon(String value); - -} -// PFPage diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/LinkReferenceElement.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/LinkReferenceElement.java deleted file mode 100644 index 0ed483c5e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/LinkReferenceElement.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory; -import org.eclipse.jst.jsf.facesconfig.emf.FromActionType; -import org.eclipse.jst.jsf.facesconfig.emf.FromOutcomeType; -import org.eclipse.jst.jsf.facesconfig.emf.IconType; -import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.RedirectType; -import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.TransformUtil; - -/** - * The reference element represents a mapping from pageflow link to a navigation - * case. - * - * @author hmeng - */ - -public class LinkReferenceElement extends ReferenceElement { - - public void add(EObject object) { - Assert.isTrue(object instanceof NavigationCaseType); - clear(); - super.add(object); - } - - /** - * @param pageflowElement - */ - public LinkReferenceElement(PageflowElement pageflowElement) { - super(pageflowElement); - } - - /** - * @param pageflowElement - * @param facesConfigObject - */ - public LinkReferenceElement(PageflowElement pageflowElement, - EObject facesConfigObject) { - super(pageflowElement, facesConfigObject); - } - - public void update() { - for (Iterator nodes = getData().iterator(); nodes.hasNext();) { - Object next = nodes.next(); - if (!TransformUtil.isValidFacesConfigElement((EObject) next)) { - nodes.remove(); - } - } - } - - public Object get(int eFeature) { - Object result = null; - switch (eFeature) { - case PageflowPackage.PF_LINK__COMMENT: - break; - case PageflowPackage.PF_LINK__OUTCOME: - if (!isEmpty()) { - FromOutcomeType outcome = ((NavigationCaseType) getData() - .get(0)).getFromOutcome(); - if (outcome != null) { - result = outcome.getTextContent(); - } - } - break; - case PageflowPackage.PF_LINK__NAME: - break; - case PageflowPackage.PF_LINK__REDIRECT: - result = new Boolean(false); - if (!isEmpty()) { - RedirectType outcome = ((NavigationCaseType) getData().get(0)) - .getRedirect(); - if (outcome != null) { - result = new Boolean(true); - } - } - break; - - case PageflowPackage.PF_LINK__FROMACTION: - if (!isEmpty()) { - FromActionType fromActionType = ((NavigationCaseType) getData() - .get(0)).getFromAction(); - if (fromActionType != null) { - result = fromActionType.getTextContent(); - } - } - break; - case PageflowPackage.PF_LINK__SMALLICON: - if (!isEmpty()) { - List icons = ((NavigationCaseType) getData().get(0)).getIcon(); - if (icons.size() > 0) { - result = ((IconType) icons.get(0)).getSmallIcon() != null ? ((IconType) icons - .get(0)).getSmallIcon().getTextContent() - : null; - } - } - break; - case PageflowPackage.PF_LINK__LARGEICON: - if (!isEmpty()) { - List icons = ((NavigationCaseType) getData().get(0)).getIcon(); - if (icons.size() > 0) { - result = ((IconType) icons.get(0)).getLargeIcon() != null ? ((IconType) icons - .get(0)).getLargeIcon().getTextContent() - : null; - } - } - break; - } - return result; - } - - public void set(EStructuralFeature eFeature, Object newVal) { - switch (eFeature.getFeatureID()) { - case PageflowPackage.PF_LINK__COMMENT: - break; - case PageflowPackage.PF_LINK__OUTCOME: { - FromOutcomeType oldOutcome = null; - FromOutcomeType newOutcome = null; - String newValue = (String) newVal; - if (!isEmpty()) { - oldOutcome = ((NavigationCaseType) getData().get(0)) - .getFromOutcome(); - if (newValue == null || newValue.length() == 0) { - ((NavigationCaseType) getData().get(0)) - .setFromOutcome(null); - } else { - if (oldOutcome == null) { - newOutcome = FacesConfigFactory.eINSTANCE - .createFromOutcomeType(); - newOutcome.setTextContent(newValue); - ((NavigationCaseType) getData().get(0)) - .setFromOutcome(newOutcome); - } else { - oldOutcome.setTextContent(newValue); - } - } - } - break; - } - case PageflowPackage.PF_LINK__NAME: - break; - case PageflowPackage.PF_LINK__REDIRECT: - RedirectType redirect = null; - RedirectType oldRedirect = null; - boolean newRedirect = ((Boolean) newVal).booleanValue(); - if (!isEmpty()) { - oldRedirect = ((NavigationCaseType) getData().get(0)) - .getRedirect(); - if (!newRedirect) { - redirect = null; - } else { - if (oldRedirect == null) { - redirect = FacesConfigFactory.eINSTANCE - .createRedirectType(); - } - } - ((NavigationCaseType) getData().get(0)).setRedirect(redirect); - } - break; - case PageflowPackage.PF_LINK__FROMACTION: - FromActionType oldFromActionType, - newFromActionType; - String newFromaction = (String) newVal; - if (!isEmpty()) { - oldFromActionType = ((NavigationCaseType) getData().get(0)) - .getFromAction(); - if (newFromaction == null || newFromaction.length() == 0) { - ((NavigationCaseType) getData().get(0)).setFromAction(null); - } else { - if (oldFromActionType == null) { - newFromActionType = FacesConfigFactory.eINSTANCE - .createFromActionType(); - newFromActionType.setTextContent(newFromaction); - ((NavigationCaseType) getData().get(0)) - .setFromAction(newFromActionType); - } else { - oldFromActionType.setTextContent(newFromaction); - } - } - } - break; - case PageflowPackage.PF_LINK__SMALLICON: { - SmallIconType oldSmallicon = null; - SmallIconType newSmallIconType = null; - IconType icon = null; - String newValue = (String) newVal; - if (!isEmpty()) { - List icons = ((NavigationCaseType) getData().get(0)).getIcon(); - if (newValue == null || newValue.length() == 0) { - if (icons.size() > 0) { - if (((IconType) icons.get(0)).getSmallIcon() != null) { - ((IconType) icons.get(0)).setSmallIcon(null); - } - } - } else { - if (icons.size() == 0) { - icon = FacesConfigFactory.eINSTANCE.createIconType(); - newSmallIconType = FacesConfigFactory.eINSTANCE - .createSmallIconType(); - newSmallIconType.setTextContent(newValue); - icon.setSmallIcon(newSmallIconType); - icons.add(icon); - } else if (((IconType) icons.get(0)).getSmallIcon() == null) { - newSmallIconType = FacesConfigFactory.eINSTANCE - .createSmallIconType(); - newSmallIconType.setTextContent(newValue); - icon = ((IconType) icons.get(0)); - icon.setSmallIcon(newSmallIconType); - } else { - oldSmallicon = ((IconType) icons.get(0)).getSmallIcon(); - oldSmallicon.setTextContent(newValue); - } - } - } - break; - } - case PageflowPackage.PF_LINK__LARGEICON: { - String newValue = (String) newVal; - LargeIconType oldLargeIcon = null; - LargeIconType newLargeIconType = null; - IconType icon = null; - if (!isEmpty()) { - List icons = ((NavigationCaseType) getData().get(0)).getIcon(); - if (newValue == null || newValue.length() == 0) { - if (icons.size() > 0) { - if (((IconType) icons.get(0)).getLargeIcon() != null) { - ((IconType) icons.get(0)).setLargeIcon(null); - } - } - } else { - if (icons.size() == 0) { - icon = FacesConfigFactory.eINSTANCE.createIconType(); - newLargeIconType = FacesConfigFactory.eINSTANCE - .createLargeIconType(); - newLargeIconType.setTextContent(newValue); - icon.setLargeIcon(newLargeIconType); - icons.add(icon); - } else if (((IconType) icons.get(0)).getLargeIcon() == null) { - newLargeIconType = FacesConfigFactory.eINSTANCE - .createLargeIconType(); - newLargeIconType.setTextContent(newValue); - icon = ((IconType) icons.get(0)); - icon.setLargeIcon(newLargeIconType); - } else { - oldLargeIcon = ((IconType) icons.get(0)).getLargeIcon(); - oldLargeIcon.setTextContent(newValue); - } - } - } - break; - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageReferenceElement.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageReferenceElement.java deleted file mode 100644 index 0a81af6ed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageReferenceElement.java +++ /dev/null @@ -1,400 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType; -import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory; -import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType; -import org.eclipse.jst.jsf.facesconfig.emf.IconType; -import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType; -import org.eclipse.jst.jsf.facesconfig.emf.ToViewIdType; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.FC2PFTransformer; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.TransformUtil; - -/** - * The reference element represents a mapping from pageflow page to one or more - * navigation rules/cases's view IDs (fromViewID or toViewID). - * - * @author hmeng - */ - -public class PageReferenceElement extends ReferenceElement { - - /** - * @param pageflowElement - */ - public PageReferenceElement(PageflowElement pageflowElement) { - super(pageflowElement); - } - - /** - * @param pageflowElement - * @param facesConfigObject - */ - public PageReferenceElement(PageflowElement pageflowElement, - EObject facesConfigObject) { - super(pageflowElement, facesConfigObject); - } - - public void add(EObject object) { - Assert.isTrue(object instanceof FromViewIdType - || object instanceof ToViewIdType); - super.add(object); - } - - public void update() { - outer: for (Iterator nodes = getData().iterator(); nodes.hasNext();) { - Object next = nodes.next(); - if (next instanceof FromViewIdType) { - if (!TransformUtil.isValidFacesConfigElement((EObject) next)) { - nodes.remove(); - continue; - } - List links = ((PageflowPage) pageflowElement).getOutlinks(); - for (int i = 0; i < links.size(); i++) { - PageflowLink link = (PageflowLink) links.get(i); - if (!link.getFCElements().isEmpty() - && TransformUtil - .isValidFacesConfigElement((NavigationCaseType) ((PageflowLink) links - .get(i)).getFCElements().getData() - .get(0))) { - NavigationRuleType rule = (NavigationRuleType) ((NavigationCaseType) ((PageflowLink) links - .get(i)).getFCElements().getData().get(0)) - .eContainer(); - if (rule == null || rule.getFromViewId() == next) { - // There navigation case - // matching this end. - continue outer; - } - } - } - // No case contains this end. - nodes.remove(); - } else if (next instanceof ToViewIdType) { - if (!TransformUtil.isValidFacesConfigElement((EObject) next)) { - nodes.remove(); - continue; - } - // Verify this is case end. - List links = ((PageflowPage) pageflowElement).getInlinks(); - for (int i = 0; i < links.size(); i++) { - PageflowLink link = (PageflowLink) links.get(i); - if (!link.getFCElements().isEmpty() - && TransformUtil - .isValidFacesConfigElement((NavigationCaseType) link - .getFCElements().getData().get(0))) { - if (((NavigationCaseType) ((PageflowLink) links.get(i)) - .getFCElements().getData().get(0)) - .getToViewId() == next) { - // There navigation case - // matching this end. - continue outer; - } - } - } - // No case contains this end. - nodes.remove(); - } - } - } - - public Object get(int eFeature) { - Object result = null; - switch (eFeature) { - case PageflowPackage.PF_PAGE__COMMENT: - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - List descriptions = rule.getDescription(); - if (descriptions.size() > 0) { - result = ((DescriptionType) descriptions.get(0)) - .getTextContent(); - break; - } - } - } - } - break; - case PageflowPackage.PF_PAGE__LARGEICON: - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - List icons = rule.getIcon(); - if (icons.size() > 0) { - result = ((IconType) icons.get(0)).getLargeIcon() != null ? ((IconType) icons - .get(0)).getLargeIcon().getTextContent() - : null; - break; - } - } - } - } - break; - case PageflowPackage.PF_PAGE__NAME: - // To see if it is in navigation rule. - if (!isEmpty() && !isEndOnly()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - List displaynames = rule.getDisplayName(); - if (displaynames.size() > 0) { - result = ((DisplayNameType) displaynames.get(0)) - .getTextContent(); - break; - } - } - } - } - break; - case PageflowPackage.PF_PAGE__PATH: - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - if (getData().get(i) instanceof FromViewIdType) { - result = ((FromViewIdType) getData().get(i)) - .getTextContent(); - break; - } - } - if (result == null && getData().get(0) instanceof ToViewIdType) { - result = ((ToViewIdType) getData().get(0)).getTextContent(); - } - } - break; - case PageflowPackage.PF_PAGE__SMALLICON: - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - List icons = rule.getIcon(); - if (icons.size() > 0) { - result = ((IconType) icons.get(0)).getSmallIcon() != null ? ((IconType) icons - .get(0)).getSmallIcon().getTextContent() - : null; - break; - } - } - } - } - break; - } - return result; - } - - private NavigationRuleType resolveRuleFromFCElement(Object object) { - if (object instanceof FromViewIdType) { - return (NavigationRuleType) ((FromViewIdType) object).eContainer(); - } - return null; - } - - private NavigationRuleType resolveRuleFromPFElement(Object object) { - if (object instanceof PageflowLink) { - NavigationCaseType caseType = (NavigationCaseType) ((PageflowLink) object) - .getFCElements().getData().get(0); - return (NavigationRuleType) caseType.eContainer(); - } - return null; - } - - public void set(EStructuralFeature eFeature, Object newVal) { - switch (eFeature.getFeatureID()) { - case PageflowPackage.PF_PAGE__COMMENT: { - DescriptionType description = null; - String newValue = (String) newVal; - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - rule.getDescription().clear(); - description = FacesConfigFactory.eINSTANCE - .createDescriptionType(); - description.setTextContent(newValue); - rule.getDescription().add(description); - } - } - } - break; - } - case PageflowPackage.PF_PAGE__LARGEICON: { - LargeIconType oldLargeIcon = null; - LargeIconType newLargeIconType = null; - IconType icon = null; - String newValue = (String) newVal; - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - List icons = rule.getIcon(); - if (newValue == null || newValue.length() == 0) { - if (icons.size() > 0) { - if (((IconType) icons.get(0)).getLargeIcon() != null) { - ((IconType) icons.get(0)) - .setLargeIcon(null); - } - } - } else { - if (icons.size() == 0) { - icon = FacesConfigFactory.eINSTANCE - .createIconType(); - newLargeIconType = FacesConfigFactory.eINSTANCE - .createLargeIconType(); - newLargeIconType.setTextContent(newValue); - icon.setLargeIcon(newLargeIconType); - icons.add(icon); - } else if (((IconType) icons.get(0)).getLargeIcon() == null) { - newLargeIconType = FacesConfigFactory.eINSTANCE - .createLargeIconType(); - newLargeIconType.setTextContent(newValue); - icon = ((IconType) icons.get(0)); - icon.setLargeIcon(newLargeIconType); - } else { - oldLargeIcon = ((IconType) icons.get(0)) - .getLargeIcon(); - oldLargeIcon.setTextContent(newValue); - } - } - } - } - } - break; - } - case PageflowPackage.PF_PAGE__NAME: - DisplayNameType newDisplayNameType = null; - String newName = (String) newVal; - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - rule.getDisplayName().clear(); - if (newName != null && newName.length() > 0) { - newDisplayNameType = FacesConfigFactory.eINSTANCE - .createDisplayNameType(); - newDisplayNameType.setTextContent(newName); - rule.getDisplayName().add(newDisplayNameType); - } - } - } - } - break; - case PageflowPackage.PF_PAGE__PATH: { - Object oldPath = null; - Object newPath = null; - String newValue = (String) newVal; - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - if (getData().get(i) instanceof FromViewIdType) { - oldPath = getData().get(i); - ((FromViewIdType) oldPath).setTextContent(newValue); - } else if (getData().get(i) instanceof ToViewIdType) { - oldPath = getData().get(i); - ((ToViewIdType) oldPath).setTextContent(newValue); - } - } - } - // Create new fromViewID or toViewID node as needed. - else if (newValue != null && !"*".equals(newValue)) { //$NON-NLS-1$ - if (((PageflowPage) pageflowElement).getOutlinks().size() > 0) { - List links = ((PageflowPage) pageflowElement).getOutlinks(); - for (int i = 0, n = links.size(); i < n; i++) { - PageflowLink link = (PageflowLink) links.get(i); - NavigationRuleType rule = resolveRuleFromPFElement(link); - newPath = FC2PFTransformer.createRLFromViewID(newValue); - rule.setFromViewId((FromViewIdType) newPath); - add((EObject) newPath); - } - links = ((PageflowPage) pageflowElement).getInlinks(); - for (int i = 0, n = links.size(); i < n; i++) { - PageflowLink link = (PageflowLink) links.get(i); - NavigationCaseType caseType = (NavigationCaseType) link - .getFCElements().getData().get(0); - newPath = FC2PFTransformer.createFCToViewID(newValue); - caseType.setToViewId((ToViewIdType) newPath); - add((EObject) newPath); - } - } - } - break; - } - case PageflowPackage.PF_PAGE__SMALLICON: { - SmallIconType oldSmallicon = null; - SmallIconType newSmallIconType = null; - IconType icon = null; - String newValue = (String) newVal; - if (!isEmpty()) { - for (int i = 0, n = getData().size(); i < n; i++) { - NavigationRuleType rule = null; - if ((rule = resolveRuleFromFCElement(getData().get(i))) != null) { - List icons = rule.getIcon(); - if (newValue == null || newValue.length() == 0) { - if (icons.size() > 0) { - if (((IconType) icons.get(0)).getSmallIcon() != null) { - ((IconType) icons.get(0)) - .setSmallIcon(null); - } - } - } else { - if (icons.size() == 0) { - icon = FacesConfigFactory.eINSTANCE - .createIconType(); - newSmallIconType = FacesConfigFactory.eINSTANCE - .createSmallIconType(); - newSmallIconType.setTextContent(newValue); - icon.setSmallIcon(newSmallIconType); - icons.add(icon); - } else if (((IconType) icons.get(0)).getSmallIcon() == null) { - newSmallIconType = FacesConfigFactory.eINSTANCE - .createSmallIconType(); - newSmallIconType.setTextContent(newValue); - icon = ((IconType) icons.get(0)); - icon.setSmallIcon(newSmallIconType); - } else { - oldSmallicon = ((IconType) icons.get(0)) - .getSmallIcon(); - oldSmallicon.setTextContent(newValue); - } - } - } - } - } - break; - } - } - } - - /** - * @return true if none of the data are from view id's - */ - public boolean isEndOnly() { - for (int i = 0, n = getData().size(); i < n; i++) { - if (getData().get(i) instanceof FromViewIdType) { - return false; - } - } - return true; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowElementImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowElementImpl.java deleted file mode 100644 index 6948fd73c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowElementImpl.java +++ /dev/null @@ -1,616 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.TransformUtil; - -/** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getComment <em>Comment</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getX <em>X</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getY <em>Y</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getWidth <em>Width</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getHeight <em>Height</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowElementImpl#getId <em>Id</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class PageflowElementImpl extends EObjectImpl implements - PageflowElement { - private static final String idPrefix = "pf"; //$NON-NLS-1$ - - /** - * @generated NOT - */ - private String id; - - /** - * @generated NOT - */ - private static int counter = 0; - - /** - * the reference element - */ - protected ReferenceElement refElement; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = "unnamed"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * The default value of the '{@link #getComment() <em>Comment</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getComment() - * @generated - * @ordered - */ - protected static final String COMMENT_EDEFAULT = null; - - /** - * The cached value of the '{@link #getComment() <em>Comment</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getComment() - * @generated - * @ordered - */ - protected String comment = COMMENT_EDEFAULT; - - /** - * The default value of the '{@link #getX() <em>X</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getX() - * @generated - * @ordered - */ - protected static final int X_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getX() <em>X</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getX() - * @generated - * @ordered - */ - protected int x = X_EDEFAULT; - - /** - * The default value of the '{@link #getY() <em>Y</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getY() - * @generated - * @ordered - */ - protected static final int Y_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getY() <em>Y</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getY() - * @generated - * @ordered - */ - protected int y = Y_EDEFAULT; - - /** - * The default value of the '{@link #getWidth() <em>Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getWidth() - * @generated - * @ordered - */ - protected static final int WIDTH_EDEFAULT = -1; - - /** - * The cached value of the '{@link #getWidth() <em>Width</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getWidth() - * @generated - * @ordered - */ - protected int width = WIDTH_EDEFAULT; - - /** - * The default value of the '{@link #getHeight() <em>Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getHeight() - * @generated - * @ordered - */ - protected static final int HEIGHT_EDEFAULT = -1; - - /** - * The default value of the '{@link #getReferenceLink() <em>Reference Link</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getReferenceLink() - * @generated - * @ordered - */ - protected static final String REFERENCE_LINK_EDEFAULT = ""; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getReferenceLink() <em>Reference Link</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getReferenceLink() - * @generated - * @ordered - */ - protected String referenceLink = REFERENCE_LINK_EDEFAULT; - - /** - * The cached value of the '{@link #getHeight() <em>Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getHeight() - * @generated - * @ordered - */ - protected int height = HEIGHT_EDEFAULT; - - /** - * The default value of the '{@link #getId() <em>Id</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EClass eStaticClass() { - return PageflowPackage.eINSTANCE.getPageflowElement(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getName() { - return name == null || name.length() == 0 ? NAME_EDEFAULT : name; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getComment() { - return comment; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setComment(String newComment) { - String oldComment = comment; - comment = newComment; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__COMMENT, oldComment, - comment)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getX() { - return x; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setX(int newX) { - int oldX = x; - x = newX; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__X, oldX, x)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getY() { - return y; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setY(int newY) { - int oldY = y; - y = newY; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__Y, oldY, y)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getWidth() { - return width; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setWidth(int newWidth) { - int oldWidth = width; - width = newWidth; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__WIDTH, oldWidth, width)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getHeight() { - return height; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setHeight(int newHeight) { - int oldHeight = height; - height = newHeight; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__HEIGHT, oldHeight, height)); - } - - /** - * Generate (and cache) an id as needed - * - * @generated NOT - */ - public String getId() { - if (id == null) { - id = generateId(); - } - return id; - } - - /** - * Generate a random id based on the current time - * - * @return the generated id - * - * @generated NOT - */ - public synchronized String generateId() { - long current = System.currentTimeMillis(); - return idPrefix + current + counter++; - } - - /** - * Set or generate an Id This method should not be called except when - * populating from the serialization - * - * @generated NOT - */ - public void setId(String newId) { - if (newId == null && id == null) { - id = generateId(); - } else { - id = newId; - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getReferenceLink() { - return referenceLink; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setReferenceLink(String newReferenceLink) { - String oldReferenceLink = referenceLink; - referenceLink = newReferenceLink; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__REFERENCE_LINK, - oldReferenceLink, referenceLink)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_ELEMENT__NAME: - return getName(); - case PageflowPackage.PAGEFLOW_ELEMENT__COMMENT: - return getComment(); - case PageflowPackage.PAGEFLOW_ELEMENT__X: - return new Integer(getX()); - case PageflowPackage.PAGEFLOW_ELEMENT__Y: - return new Integer(getY()); - case PageflowPackage.PAGEFLOW_ELEMENT__WIDTH: - return new Integer(getWidth()); - case PageflowPackage.PAGEFLOW_ELEMENT__HEIGHT: - return new Integer(getHeight()); - case PageflowPackage.PAGEFLOW_ELEMENT__ID: - return getId(); - case PageflowPackage.PAGEFLOW_ELEMENT__REFERENCE_LINK: - return getReferenceLink(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_ELEMENT__NAME: - setName((String) newValue); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__COMMENT: - setComment((String) newValue); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__X: - setX(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__Y: - setY(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__WIDTH: - setWidth(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__HEIGHT: - setHeight(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__ID: - setId((String) newValue); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__REFERENCE_LINK: - setReferenceLink((String) newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_ELEMENT__NAME: - setName(NAME_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__COMMENT: - setComment(COMMENT_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__X: - setX(X_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__Y: - setY(Y_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__WIDTH: - setWidth(WIDTH_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__HEIGHT: - setHeight(HEIGHT_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__ID: - setId(ID_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_ELEMENT__REFERENCE_LINK: - setReferenceLink(REFERENCE_LINK_EDEFAULT); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_ELEMENT__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT - .equals(name); - case PageflowPackage.PAGEFLOW_ELEMENT__COMMENT: - return COMMENT_EDEFAULT == null ? comment != null - : !COMMENT_EDEFAULT.equals(comment); - case PageflowPackage.PAGEFLOW_ELEMENT__X: - return x != X_EDEFAULT; - case PageflowPackage.PAGEFLOW_ELEMENT__Y: - return y != Y_EDEFAULT; - case PageflowPackage.PAGEFLOW_ELEMENT__WIDTH: - return width != WIDTH_EDEFAULT; - case PageflowPackage.PAGEFLOW_ELEMENT__HEIGHT: - return height != HEIGHT_EDEFAULT; - case PageflowPackage.PAGEFLOW_ELEMENT__ID: - return ID_EDEFAULT == null ? getId() != null : !ID_EDEFAULT - .equals(getId()); - case PageflowPackage.PAGEFLOW_ELEMENT__REFERENCE_LINK: - return REFERENCE_LINK_EDEFAULT == null ? referenceLink != null - : !REFERENCE_LINK_EDEFAULT.equals(referenceLink); - } - return eDynamicIsSet(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(", comment: "); //$NON-NLS-1$ - result.append(comment); - result.append(", x: "); //$NON-NLS-1$ - result.append(x); - result.append(", y: "); //$NON-NLS-1$ - result.append(y); - result.append(", width: "); //$NON-NLS-1$ - result.append(width); - result.append(", height: "); //$NON-NLS-1$ - result.append(height); - result.append(", referenceLink: "); //$NON-NLS-1$ - result.append(referenceLink); - result.append(')'); - return result.toString(); - } - - /** - * The synchronizer will use this to notify adapters for the faces-config's - * modification. - * - * @generated NOT - */ - public void notifyModelChanged(Notification notification) { - if (eNotificationRequired()) - eNotify(notification); - } - - /** - * @generated NOT - */ - - public ReferenceElement getFCElements() { - return null; - } - - /** - * @generated NOT - */ - public void update() { - getFCElements().update(); - if (!TransformUtil.isValidPageflowElement(this)) { - eAdapters().clear(); - } - } - - /** - * @generated NOT - */ - public void dispose() { - getFCElements().dispose(); - eAdapters.clear(); - } - -} -// PageflowElementImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowFactoryImpl.java deleted file mode 100644 index aabbe3e3a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowFactoryImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- - * end-user-doc --> - * - * @generated - */ -public class PageflowFactoryImpl extends EFactoryImpl implements - PageflowFactory { - /** - * Creates and instance of the factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public PageflowFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case PageflowPackage.PAGEFLOW: - return createPageflow(); - case PageflowPackage.PF_LINK: - return createPFLink(); - case PageflowPackage.PF_PAGE: - return createPFPage(); - case PageflowPackage.PF_LINK_BENDPOINT: - return createPFLinkBendpoint(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() //$NON-NLS-1$ - + "' is not a valid classifier"); //$NON-NLS-1$ - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Pageflow createPageflow() { - PageflowImpl pageflow = new PageflowImpl(); - return pageflow; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowLink createPFLink() { - PageflowLinkImpl pfLink = new PageflowLinkImpl(); - return pfLink; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowPage createPFPage() { - PageflowPageImpl pfPage = new PageflowPageImpl(); - return pfPage; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowLinkBendpoint createPFLinkBendpoint() { - PageflowLinkBendpointImpl pfLinkBendpoint = new PageflowLinkBendpointImpl(); - return pfLinkBendpoint; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowPackage getPageflowPackage() { - return (PageflowPackage) getEPackage(); - } -} -// PageflowFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowImpl.java deleted file mode 100644 index f637ac262..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowImpl.java +++ /dev/null @@ -1,472 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; - -/** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>Pageflow</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowImpl#getNodes <em>Nodes</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowImpl#getLinks <em>Links</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowImpl#getConfigfile <em>Configfile</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class PageflowImpl extends PageflowElementImpl implements Pageflow { - - /** - * The cached value of the '{@link #getNodes() <em>Nodes</em>}' - * containment reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getNodes() - * @generated - * @ordered - */ - protected EList nodes = null; - - /** - * The cached value of the '{@link #getLinks() <em>Links</em>}' - * containment reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLinks() - * @generated - * @ordered - */ - protected EList links = null; - - /** - * The default value of the '{@link #getConfigfile() <em>Configfile</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getConfigfile() - * @generated - * @ordered - */ - protected static final String CONFIGFILE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getConfigfile() <em>Configfile</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getConfigfile() - * @generated - * @ordered - */ - protected String configfile = CONFIGFILE_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EClass eStaticClass() { - return PageflowPackage.eINSTANCE.getPageflow(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EList getNodes() { - if (nodes == null) { - nodes = new EObjectContainmentWithInverseEList(PageflowNode.class, - this, PageflowPackage.PAGEFLOW__NODES, - PageflowPackage.PAGEFLOW_NODE__PAGEFLOW); - } - return nodes; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EList getLinks() { - if (links == null) { - links = new EObjectContainmentWithInverseEList(PageflowLink.class, - this, PageflowPackage.PAGEFLOW__LINKS, - PageflowPackage.PF_LINK__PAGEFLOW); - } - return links; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getConfigfile() { - return configfile; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setConfigfile(String newConfigfile) { - String oldConfigfile = configfile; - configfile = newConfigfile; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW__CONFIGFILE, oldConfigfile, - configfile)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PAGEFLOW__NODES: - return ((InternalEList) getNodes()).basicAdd(otherEnd, msgs); - case PageflowPackage.PAGEFLOW__LINKS: - return ((InternalEList) getLinks()).basicAdd(otherEnd, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PAGEFLOW__NODES: - return ((InternalEList) getNodes()).basicRemove(otherEnd, msgs); - case PageflowPackage.PAGEFLOW__LINKS: - return ((InternalEList) getLinks()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, - msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW__NAME: - return getName(); - case PageflowPackage.PAGEFLOW__COMMENT: - return getComment(); - case PageflowPackage.PAGEFLOW__X: - return new Integer(getX()); - case PageflowPackage.PAGEFLOW__Y: - return new Integer(getY()); - case PageflowPackage.PAGEFLOW__WIDTH: - return new Integer(getWidth()); - case PageflowPackage.PAGEFLOW__HEIGHT: - return new Integer(getHeight()); - case PageflowPackage.PAGEFLOW__ID: - return getId(); - case PageflowPackage.PAGEFLOW__NODES: - return getNodes(); - case PageflowPackage.PAGEFLOW__LINKS: - return getLinks(); - case PageflowPackage.PAGEFLOW__CONFIGFILE: - return getConfigfile(); - } - return super.eGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW__NAME: - setName((String) newValue); - return; - case PageflowPackage.PAGEFLOW__COMMENT: - setComment((String) newValue); - return; - case PageflowPackage.PAGEFLOW__X: - setX(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW__Y: - setY(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW__WIDTH: - setWidth(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW__HEIGHT: - setHeight(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW__ID: - setId((String) newValue); - return; - case PageflowPackage.PAGEFLOW__NODES: - getNodes().clear(); - getNodes().addAll((Collection) newValue); - return; - case PageflowPackage.PAGEFLOW__LINKS: - getLinks().clear(); - getLinks().addAll((Collection) newValue); - return; - case PageflowPackage.PAGEFLOW__CONFIGFILE: - setConfigfile((String) newValue); - return; - } - super.eSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW__NAME: - setName(NAME_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__COMMENT: - setComment(COMMENT_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__X: - setX(X_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__Y: - setY(Y_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__WIDTH: - setWidth(WIDTH_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__HEIGHT: - setHeight(HEIGHT_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__ID: - setId(ID_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW__NODES: - getNodes().clear(); - return; - case PageflowPackage.PAGEFLOW__LINKS: - getLinks().clear(); - return; - case PageflowPackage.PAGEFLOW__CONFIGFILE: - setConfigfile(CONFIGFILE_EDEFAULT); - return; - } - super.eUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT - .equals(name); - case PageflowPackage.PAGEFLOW__COMMENT: - return COMMENT_EDEFAULT == null ? comment != null - : !COMMENT_EDEFAULT.equals(comment); - case PageflowPackage.PAGEFLOW__X: - return x != X_EDEFAULT; - case PageflowPackage.PAGEFLOW__Y: - return y != Y_EDEFAULT; - case PageflowPackage.PAGEFLOW__WIDTH: - return width != WIDTH_EDEFAULT; - case PageflowPackage.PAGEFLOW__HEIGHT: - return height != HEIGHT_EDEFAULT; - case PageflowPackage.PAGEFLOW__ID: - return ID_EDEFAULT == null ? getId() != null : !ID_EDEFAULT - .equals(getId()); - case PageflowPackage.PAGEFLOW__NODES: - return nodes != null && !nodes.isEmpty(); - case PageflowPackage.PAGEFLOW__LINKS: - return links != null && !links.isEmpty(); - case PageflowPackage.PAGEFLOW__CONFIGFILE: - return CONFIGFILE_EDEFAULT == null ? configfile != null - : !CONFIGFILE_EDEFAULT.equals(configfile); - } - return super.eIsSet(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (configfile: "); //$NON-NLS-1$ - result.append(configfile); - result.append(')'); - return result.toString(); - } - - /** - * set the valid link's source and target node. - * - * @generated NOT - */ - public void connect(PageflowNode source, PageflowNode target, - PageflowLink link) { - if (link != null) { - if (PageflowValidation.getInstance().isValidLinkForCreation(source, - target)) { - this.getLinks().add(link); - link.setSource(source); - link.setTarget(target); - } - } - } - - /** node prefixs map */ - private HashMap mapNodePrefix = null; - - /** - * get the prefix's map, and if the map is not existed, create it. - * - * @return - map for prefix - * - * @generated NOT - */ - private HashMap getNodePrefixMap() { - if (mapNodePrefix == null) { - mapNodePrefix = new HashMap(); - mapNodePrefix.put(PageflowPageImpl.class, new String("Page")); //$NON-NLS-1$ - } - return mapNodePrefix; - } - - /** - * get the default node name according current nodetype - * - * @param nodeType - - * node type, such as PFBeginImpl, PFPageImpl, etc. - * @return - the default node name. - * - * @generated NOT - */ - public String getDefaultNodeName(Class nodeType) { - HashMap mapNodePrefix_ = getNodePrefixMap(); - - String strNodePrefix = (String) mapNodePrefix_.get(nodeType); - - String strNodeName = null; - boolean bFound = true; - int numNode = 1; - while (bFound) { - strNodeName = strNodePrefix + numNode; - boolean bExisted = false; - for (Iterator iter = getNodes().iterator(); iter.hasNext();) { - PageflowNode node = (PageflowNode) iter.next(); - if (strNodeName.equalsIgnoreCase(node.getName())) { - bExisted = true; - break; - } - } - if (!bExisted) { - bFound = false; - } - numNode++; - } - - return strNodeName; - - } - - /** - * When faces-config has been changed, the pageflow model will be notified - * to enable refresher do some update in pageflow. - * - * @generated NOT - */ - public void notifyModelChanged(Notification notification) { - TreeIterator children = eAllContents(); - while (children.hasNext()) { - Object next = children.next(); - if (next instanceof PageflowElement) { - ((PageflowElement) next).update(); - } - } - super.notifyModelChanged(notification); - } - - /** - * @generated NOT - */ - public void dispose() { - TreeIterator children = eAllContents(); - while (children.hasNext()) { - Object next = children.next(); - if (next instanceof PageflowElement) { - ((PageflowElement) next).dispose(); - } - } - eAdapters.clear(); - } -} -// PageflowImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowLinkBendpointImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowLinkBendpointImpl.java deleted file mode 100644 index bdb66fcf8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowLinkBendpointImpl.java +++ /dev/null @@ -1,552 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.osgi.util.NLS; - -/** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>PF Link Bendpoint</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl#getD1Width <em>D1 Width</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl#getD1Height <em>D1 Height</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl#getD2Width <em>D2 Width</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl#getD2Height <em>D2 Height</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl#getWeight <em>Weight</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkBendpointImpl#getLink <em>Link</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class PageflowLinkBendpointImpl extends EObjectImpl implements PageflowLinkBendpoint { - /** - * The default value of the '{@link #getD1Width() <em>D1 Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD1Width() - * @generated - * @ordered - */ - protected static final int D1_WIDTH_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getD1Width() <em>D1 Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD1Width() - * @generated - * @ordered - */ - protected int d1Width = D1_WIDTH_EDEFAULT; - - /** - * The default value of the '{@link #getD1Height() <em>D1 Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD1Height() - * @generated - * @ordered - */ - protected static final int D1_HEIGHT_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getD1Height() <em>D1 Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD1Height() - * @generated - * @ordered - */ - protected int d1Height = D1_HEIGHT_EDEFAULT; - - /** - * The default value of the '{@link #getD2Width() <em>D2 Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD2Width() - * @generated - * @ordered - */ - protected static final int D2_WIDTH_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getD2Width() <em>D2 Width</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD2Width() - * @generated - * @ordered - */ - protected int d2Width = D2_WIDTH_EDEFAULT; - - /** - * The default value of the '{@link #getD2Height() <em>D2 Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD2Height() - * @generated - * @ordered - */ - protected static final int D2_HEIGHT_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getD2Height() <em>D2 Height</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getD2Height() - * @generated - * @ordered - */ - protected int d2Height = D2_HEIGHT_EDEFAULT; - - /** - * The default value of the '{@link #getWeight() <em>Weight</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getWeight() - * @generated - * @ordered - */ - protected static final float WEIGHT_EDEFAULT = 0.5F; - - /** - * The cached value of the '{@link #getWeight() <em>Weight</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getWeight() - * @generated - * @ordered - */ - protected float weight = WEIGHT_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - private Dimension dimStart, dimEnd; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowLinkBendpointImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EClass eStaticClass() { - return PageflowPackage.eINSTANCE.getPFLinkBendpoint(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getD1Width() { - return d1Width; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setD1Width(int newD1Width) { - int oldD1Width = d1Width; - d1Width = newD1Width; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK_BENDPOINT__D1_WIDTH, oldD1Width, - d1Width)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getD1Height() { - return d1Height; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setD1Height(int newD1Height) { - int oldD1Height = d1Height; - d1Height = newD1Height; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK_BENDPOINT__D1_HEIGHT, oldD1Height, - d1Height)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getD2Width() { - return d2Width; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setD2Width(int newD2Width) { - int oldD2Width = d2Width; - d2Width = newD2Width; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK_BENDPOINT__D2_WIDTH, oldD2Width, - d2Width)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public int getD2Height() { - return d2Height; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setD2Height(int newD2Height) { - int oldD2Height = d2Height; - d2Height = newD2Height; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK_BENDPOINT__D2_HEIGHT, oldD2Height, - d2Height)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public float getWeight() { - return weight; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setWeight(float newWeight) { - float oldWeight = weight; - weight = newWeight; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK_BENDPOINT__WEIGHT, oldWeight, - weight)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowLink getLink() { - if (eContainerFeatureID != PageflowPackage.PF_LINK_BENDPOINT__LINK) - return null; - return (PageflowLink) eContainer; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setLink(PageflowLink newLink) { - if (newLink != eContainer - || (eContainerFeatureID != PageflowPackage.PF_LINK_BENDPOINT__LINK && newLink != null)) { - if (EcoreUtil.isAncestor(this, newLink)) - throw new IllegalArgumentException( - NLS.bind(PageflowMessages.PageflowNode_NoRecursiveContainment,toString())); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newLink != null) - msgs = ((InternalEObject) newLink).eInverseAdd(this, - PageflowPackage.PF_LINK__BEND_POINTS, PageflowLink.class, - msgs); - msgs = eBasicSetContainer((InternalEObject) newLink, - PageflowPackage.PF_LINK_BENDPOINT__LINK, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK_BENDPOINT__LINK, newLink, newLink)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, - PageflowPackage.PF_LINK_BENDPOINT__LINK, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - return eBasicSetContainer(null, - PageflowPackage.PF_LINK_BENDPOINT__LINK, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, - msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - return eContainer.eInverseRemove(this, - PageflowPackage.PF_LINK__BEND_POINTS, PageflowLink.class, - msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, - EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK_BENDPOINT__D1_WIDTH: - return new Integer(getD1Width()); - case PageflowPackage.PF_LINK_BENDPOINT__D1_HEIGHT: - return new Integer(getD1Height()); - case PageflowPackage.PF_LINK_BENDPOINT__D2_WIDTH: - return new Integer(getD2Width()); - case PageflowPackage.PF_LINK_BENDPOINT__D2_HEIGHT: - return new Integer(getD2Height()); - case PageflowPackage.PF_LINK_BENDPOINT__WEIGHT: - return new Float(getWeight()); - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - return getLink(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK_BENDPOINT__D1_WIDTH: - setD1Width(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK_BENDPOINT__D1_HEIGHT: - setD1Height(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK_BENDPOINT__D2_WIDTH: - setD2Width(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK_BENDPOINT__D2_HEIGHT: - setD2Height(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK_BENDPOINT__WEIGHT: - setWeight(((Float) newValue).floatValue()); - return; - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - setLink((PageflowLink) newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK_BENDPOINT__D1_WIDTH: - setD1Width(D1_WIDTH_EDEFAULT); - return; - case PageflowPackage.PF_LINK_BENDPOINT__D1_HEIGHT: - setD1Height(D1_HEIGHT_EDEFAULT); - return; - case PageflowPackage.PF_LINK_BENDPOINT__D2_WIDTH: - setD2Width(D2_WIDTH_EDEFAULT); - return; - case PageflowPackage.PF_LINK_BENDPOINT__D2_HEIGHT: - setD2Height(D2_HEIGHT_EDEFAULT); - return; - case PageflowPackage.PF_LINK_BENDPOINT__WEIGHT: - setWeight(WEIGHT_EDEFAULT); - return; - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - setLink((PageflowLink) null); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK_BENDPOINT__D1_WIDTH: - return d1Width != D1_WIDTH_EDEFAULT; - case PageflowPackage.PF_LINK_BENDPOINT__D1_HEIGHT: - return d1Height != D1_HEIGHT_EDEFAULT; - case PageflowPackage.PF_LINK_BENDPOINT__D2_WIDTH: - return d2Width != D2_WIDTH_EDEFAULT; - case PageflowPackage.PF_LINK_BENDPOINT__D2_HEIGHT: - return d2Height != D2_HEIGHT_EDEFAULT; - case PageflowPackage.PF_LINK_BENDPOINT__WEIGHT: - return weight != WEIGHT_EDEFAULT; - case PageflowPackage.PF_LINK_BENDPOINT__LINK: - return getLink() != null; - } - return eDynamicIsSet(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (d1Width: "); //$NON-NLS-1$ - result.append(d1Width); - result.append(", d1Height: "); //$NON-NLS-1$ - result.append(d1Height); - result.append(", d2Width: "); //$NON-NLS-1$ - result.append(d2Width); - result.append(", d2Height: "); //$NON-NLS-1$ - result.append(d2Height); - result.append(", weight: "); //$NON-NLS-1$ - result.append(weight); - result.append(')'); - return result.toString(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public Dimension getFirstRelativeDimension() { - dimStart = new Dimension(getD1Width(), getD1Height()); - return dimStart; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public Dimension getSecondRelativeDimension() { - dimEnd = new Dimension(getD2Width(), getD2Height()); - return dimEnd; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setRelativeDimensions(Dimension dim1, Dimension dim2) { - dimStart = dim1; - dimEnd = dim2; - setD1Width(dimStart.width); - setD1Height(dimStart.height); - - setD2Width(dimEnd.width); - setD2Height(dimEnd.height); - } - -} -// PFLinkBendpointImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowLinkImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowLinkImpl.java deleted file mode 100644 index 61d45f8cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowLinkImpl.java +++ /dev/null @@ -1,893 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.Collection; -import java.util.Vector; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.osgi.util.NLS; - -/** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>PF Link</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getPageflow <em>Pageflow</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getTarget <em>Target</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getOutcome <em>Outcome</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#isRedirect <em>Redirect</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getBendPoints <em>Bend Points</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getSmallicon <em>Smallicon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowLinkImpl#getLargeicon <em>Largeicon</em>}</li> - * </ul> - * </p> - * - * @generated - * - */ -public class PageflowLinkImpl extends PageflowElementImpl implements - PageflowLink { - /** - * The cached value of the '{@link #getTarget() <em>Target</em>}' - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getTarget() - * @generated - * @ordered - */ - protected PageflowNode target = null; - - /** - * The cached value of the '{@link #getSource() <em>Source</em>}' - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getSource() - * @generated - * @ordered - */ - protected PageflowNode source = null; - - /** - * The default value of the '{@link #getOutcome() <em>Outcome</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getOutcome() - * @generated - * @ordered - */ - protected static final String OUTCOME_EDEFAULT = null; - - /** - * The default value of the '{@link #isRedirect() <em>Redirect</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #isRedirect() - * @generated - * @ordered - */ - protected static final boolean REDIRECT_EDEFAULT = false; - - /** - * The cached value of the '{@link #getBendPoints() <em>Bend Points</em>}' - * containment reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getBendPoints() - * @generated - * @ordered - */ - protected EList bendPoints = null; - - /** - * The default value of the '{@link #getSmallicon() <em>Smallicon</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getSmallicon() - * @generated - * @ordered - */ - protected static final String SMALLICON_EDEFAULT = null; - - /** - * The default value of the '{@link #getLargeicon() <em>Largeicon</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLargeicon() - * @generated - * @ordered - */ - protected static final String LARGEICON_EDEFAULT = null; - - /** - * The default value of the '{@link #getFromaction() <em>Fromaction</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getFromaction() - * @generated - * @ordered - */ - protected static final String FROMACTION_EDEFAULT = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowLinkImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EClass eStaticClass() { - return PageflowPackage.eINSTANCE.getPFLink(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Pageflow getPageflow() { - if (eContainerFeatureID != PageflowPackage.PF_LINK__PAGEFLOW) - return null; - return (Pageflow) eContainer; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setPageflow(Pageflow newPageflow) { - if (newPageflow != eContainer - || (eContainerFeatureID != PageflowPackage.PF_LINK__PAGEFLOW && newPageflow != null)) { - if (EcoreUtil.isAncestor(this, newPageflow)) - throw new IllegalArgumentException( - NLS.bind(PageflowMessages.PageflowNode_NoRecursiveContainment,toString())); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newPageflow != null) - msgs = ((InternalEObject) newPageflow).eInverseAdd(this, - PageflowPackage.PAGEFLOW__LINKS, Pageflow.class, msgs); - msgs = eBasicSetContainer((InternalEObject) newPageflow, - PageflowPackage.PF_LINK__PAGEFLOW, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__PAGEFLOW, newPageflow, newPageflow)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowNode getTarget() { - if (target != null && target.eIsProxy()) { - PageflowNode oldTarget = target; - target = (PageflowNode) eResolveProxy((InternalEObject) target); - if (target != oldTarget) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, - PageflowPackage.PF_LINK__TARGET, oldTarget, target)); - } - } - return target; - } - - public void setSourcePath(String path) { - if (getSource() != null - && path.equals(((PageflowPage) getSource()).getPath())) { - return; - } - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__SOURCE, getSource(), path)); - } - - public void setTargetPath(String path) { - if (getTarget() != null - && path.equals(((PageflowPage) getTarget()).getPath())) { - return; - } - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__TARGET, getTarget(), path)); - } - - /** - * <!-- begin-user-doc --> - * @return the target - * <!-- end-user-doc --> - * - * - * @generated - */ - public PageflowNode basicGetTarget() { - return target; - } - - /** - * <!-- begin-user-doc --> - * @param newTarget - * @param msgs - * @return the notification chain - * <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain basicSetTarget(PageflowNode newTarget, - NotificationChain msgs) { - PageflowNode oldTarget = target; - target = newTarget; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, - Notification.SET, PageflowPackage.PF_LINK__TARGET, - oldTarget, newTarget); - if (msgs == null) - msgs = notification; - else - msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setTarget(PageflowNode newTarget) { - if (newTarget != target) { - NotificationChain msgs = null; - if (target != null) - msgs = ((InternalEObject) target).eInverseRemove(this, - PageflowPackage.PAGEFLOW_NODE__INLINKS, - PageflowNode.class, msgs); - if (newTarget != null) - msgs = ((InternalEObject) newTarget).eInverseAdd(this, - PageflowPackage.PAGEFLOW_NODE__INLINKS, - PageflowNode.class, msgs); - msgs = basicSetTarget(newTarget, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__TARGET, newTarget, newTarget)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowNode getSource() { - if (source != null && source.eIsProxy()) { - PageflowNode oldSource = source; - source = (PageflowNode) eResolveProxy((InternalEObject) source); - if (source != oldSource) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, - PageflowPackage.PF_LINK__SOURCE, oldSource, source)); - } - } - return source; - } - - /** - * <!-- begin-user-doc --> - * @return the pageflow node - * <!-- end-user-doc --> - * - * @generated - */ - public PageflowNode basicGetSource() { - return source; - } - - /** - * <!-- begin-user-doc --> - * @param newSource - * @param msgs - * @return the notification chain - * <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain basicSetSource(PageflowNode newSource, - NotificationChain msgs) { - // Assert.isTrue(newSource != null); - PageflowNode oldSource = source; - source = newSource; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, - Notification.SET, PageflowPackage.PF_LINK__SOURCE, - oldSource, newSource); - if (msgs == null) - msgs = notification; - else - msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setSource(PageflowNode newSource) { - // Assert.isTrue(newSource != null); - if (newSource != source) { - NotificationChain msgs = null; - if (source != null) - msgs = ((InternalEObject) source).eInverseRemove(this, - PageflowPackage.PAGEFLOW_NODE__OUTLINKS, - PageflowNode.class, msgs); - if (newSource != null) - msgs = ((InternalEObject) newSource).eInverseAdd(this, - PageflowPackage.PAGEFLOW_NODE__OUTLINKS, - PageflowNode.class, msgs); - msgs = basicSetSource(newSource, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__SOURCE, newSource, newSource)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EList getBendPoints() { - if (bendPoints == null) { - bendPoints = new EObjectContainmentWithInverseEList( - PageflowLinkBendpoint.class, this, - PageflowPackage.PF_LINK__BEND_POINTS, - PageflowPackage.PF_LINK_BENDPOINT__LINK); - } - return bendPoints; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PF_LINK__PAGEFLOW: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, - PageflowPackage.PF_LINK__PAGEFLOW, msgs); - case PageflowPackage.PF_LINK__TARGET: - if (target != null) - msgs = ((InternalEObject) target).eInverseRemove(this, - PageflowPackage.PAGEFLOW_NODE__INLINKS, - PageflowNode.class, msgs); - return basicSetTarget((PageflowNode) otherEnd, msgs); - case PageflowPackage.PF_LINK__SOURCE: - if (source != null) - msgs = ((InternalEObject) source).eInverseRemove(this, - PageflowPackage.PAGEFLOW_NODE__OUTLINKS, - PageflowNode.class, msgs); - return basicSetSource((PageflowNode) otherEnd, msgs); - case PageflowPackage.PF_LINK__BEND_POINTS: - return ((InternalEList) getBendPoints()).basicAdd(otherEnd, - msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PF_LINK__PAGEFLOW: - return eBasicSetContainer(null, - PageflowPackage.PF_LINK__PAGEFLOW, msgs); - case PageflowPackage.PF_LINK__TARGET: - return basicSetTarget(null, msgs); - case PageflowPackage.PF_LINK__SOURCE: - return basicSetSource(null, msgs); - case PageflowPackage.PF_LINK__BEND_POINTS: - return ((InternalEList) getBendPoints()).basicRemove(otherEnd, - msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, - msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case PageflowPackage.PF_LINK__PAGEFLOW: - return eContainer.eInverseRemove(this, - PageflowPackage.PAGEFLOW__LINKS, Pageflow.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, - EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK__NAME: - return getName(); - case PageflowPackage.PF_LINK__COMMENT: - return getComment(); - case PageflowPackage.PF_LINK__X: - return new Integer(getX()); - case PageflowPackage.PF_LINK__Y: - return new Integer(getY()); - case PageflowPackage.PF_LINK__WIDTH: - return new Integer(getWidth()); - case PageflowPackage.PF_LINK__HEIGHT: - return new Integer(getHeight()); - case PageflowPackage.PF_LINK__ID: - return getId(); - case PageflowPackage.PF_LINK__PAGEFLOW: - return getPageflow(); - case PageflowPackage.PF_LINK__TARGET: - if (resolve) - return getTarget(); - return basicGetTarget(); - case PageflowPackage.PF_LINK__SOURCE: - if (resolve) - return getSource(); - return basicGetSource(); - case PageflowPackage.PF_LINK__OUTCOME: - return getOutcome(); - case PageflowPackage.PF_LINK__REDIRECT: - return isRedirect() ? Boolean.TRUE : Boolean.FALSE; - case PageflowPackage.PF_LINK__BEND_POINTS: - return getBendPoints(); - case PageflowPackage.PF_LINK__SMALLICON: - return getSmallicon(); - case PageflowPackage.PF_LINK__LARGEICON: - return getLargeicon(); - case PageflowPackage.PF_LINK__FROMACTION: - return getFromaction(); - } - return super.eGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK__NAME: - setName((String) newValue); - return; - case PageflowPackage.PF_LINK__COMMENT: - setComment((String) newValue); - return; - case PageflowPackage.PF_LINK__X: - setX(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK__Y: - setY(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK__WIDTH: - setWidth(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK__HEIGHT: - setHeight(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_LINK__ID: - setId((String) newValue); - return; - case PageflowPackage.PF_LINK__PAGEFLOW: - setPageflow((Pageflow) newValue); - return; - case PageflowPackage.PF_LINK__TARGET: - setTarget((PageflowNode) newValue); - return; - case PageflowPackage.PF_LINK__SOURCE: - setSource((PageflowNode) newValue); - return; - case PageflowPackage.PF_LINK__OUTCOME: - setOutcome((String) newValue); - return; - case PageflowPackage.PF_LINK__REDIRECT: - setRedirect(((Boolean) newValue).booleanValue()); - return; - case PageflowPackage.PF_LINK__BEND_POINTS: - getBendPoints().clear(); - getBendPoints().addAll((Collection) newValue); - return; - case PageflowPackage.PF_LINK__SMALLICON: - setSmallicon((String) newValue); - return; - case PageflowPackage.PF_LINK__LARGEICON: - setLargeicon((String) newValue); - return; - case PageflowPackage.PF_LINK__FROMACTION: - setFromaction((String) newValue); - return; - } - super.eSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK__NAME: - setName(NAME_EDEFAULT); - return; - case PageflowPackage.PF_LINK__COMMENT: - setComment(COMMENT_EDEFAULT); - return; - case PageflowPackage.PF_LINK__X: - setX(X_EDEFAULT); - return; - case PageflowPackage.PF_LINK__Y: - setY(Y_EDEFAULT); - return; - case PageflowPackage.PF_LINK__WIDTH: - setWidth(WIDTH_EDEFAULT); - return; - case PageflowPackage.PF_LINK__HEIGHT: - setHeight(HEIGHT_EDEFAULT); - return; - case PageflowPackage.PF_LINK__ID: - setId(ID_EDEFAULT); - return; - case PageflowPackage.PF_LINK__PAGEFLOW: - setPageflow((Pageflow) null); - return; - case PageflowPackage.PF_LINK__TARGET: - setTarget((PageflowNode) null); - return; - case PageflowPackage.PF_LINK__SOURCE: - setSource((PageflowNode) null); - return; - case PageflowPackage.PF_LINK__OUTCOME: - setOutcome(OUTCOME_EDEFAULT); - return; - case PageflowPackage.PF_LINK__REDIRECT: - setRedirect(REDIRECT_EDEFAULT); - return; - case PageflowPackage.PF_LINK__BEND_POINTS: - getBendPoints().clear(); - return; - case PageflowPackage.PF_LINK__SMALLICON: - setSmallicon(SMALLICON_EDEFAULT); - return; - case PageflowPackage.PF_LINK__LARGEICON: - setLargeicon(LARGEICON_EDEFAULT); - return; - case PageflowPackage.PF_LINK__FROMACTION: - setFromaction(FROMACTION_EDEFAULT); - return; - } - super.eUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_LINK__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT - .equals(name); - case PageflowPackage.PF_LINK__COMMENT: - return COMMENT_EDEFAULT == null ? comment != null - : !COMMENT_EDEFAULT.equals(comment); - case PageflowPackage.PF_LINK__X: - return x != X_EDEFAULT; - case PageflowPackage.PF_LINK__Y: - return y != Y_EDEFAULT; - case PageflowPackage.PF_LINK__WIDTH: - return width != WIDTH_EDEFAULT; - case PageflowPackage.PF_LINK__HEIGHT: - return height != HEIGHT_EDEFAULT; - case PageflowPackage.PF_LINK__ID: - return ID_EDEFAULT == null ? getId() != null : !ID_EDEFAULT - .equals(getId()); - case PageflowPackage.PF_LINK__PAGEFLOW: - return getPageflow() != null; - case PageflowPackage.PF_LINK__TARGET: - return target != null; - case PageflowPackage.PF_LINK__SOURCE: - return source != null; - case PageflowPackage.PF_LINK__OUTCOME: - return OUTCOME_EDEFAULT == null ? getOutcome() != null - : !OUTCOME_EDEFAULT.equals(getOutcome()); - case PageflowPackage.PF_LINK__REDIRECT: - return isRedirect() != REDIRECT_EDEFAULT; - case PageflowPackage.PF_LINK__BEND_POINTS: - return bendPoints != null && !bendPoints.isEmpty(); - case PageflowPackage.PF_LINK__SMALLICON: - return SMALLICON_EDEFAULT == null ? getSmallicon() != null - : !SMALLICON_EDEFAULT.equals(getSmallicon()); - case PageflowPackage.PF_LINK__LARGEICON: - return LARGEICON_EDEFAULT == null ? getLargeicon() != null - : !LARGEICON_EDEFAULT.equals(getLargeicon()); - case PageflowPackage.PF_LINK__FROMACTION: - return FROMACTION_EDEFAULT == null ? getFromaction() != null - : !FROMACTION_EDEFAULT.equals(getFromaction()); - } - return super.eIsSet(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (smallicon: "); //$NON-NLS-1$ - result.append(getSmallicon()); - result.append(", largeicon: "); //$NON-NLS-1$ - result.append(getLargeicon()); - result.append(", fromaction: "); //$NON-NLS-1$ - result.append(getFromaction()); - result.append(", outcome: "); //$NON-NLS-1$ - result.append(getOutcome()); - result.append(", redirect: "); //$NON-NLS-1$ - result.append(isRedirect()); - result.append(')'); - return result.toString(); - } - - /** - * <!-- begin-user-doc --> insert a new bendpoint to the link <!-- - * end-user-doc --> - * - * @generated NOT - */ - public void insertBendpoint(int index, PageflowLinkBendpoint point) { - getBendPoints().add(index, point); - - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.ADD, - PageflowPackage.PF_LINK__BEND_POINTS, null, point)); - } - - /** - * <!-- begin-user-doc --> remove the current bendpoint <!-- end-user-doc - * --> - * - * @generated NOT - */ - public void removeBendpoint(int index) { - getBendPoints().remove(index); - } - - /** - * <!-- begin-user-doc --> Set the current bendpoint <!-- end-user-doc --> - * - * @generated NOT - */ - public void setBendpoint(int index, PageflowLinkBendpoint point) { - getBendPoints().set(index, point); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__BEND_POINTS, null, point)); - - } - - /** - * <!-- begin-user-doc --> Set a group of bendpoints to reconstruct the link - * <!-- end-user-doc --> - * - * @generated NOT - */ - public void setBendpoints(Vector points) { - bendPoints = (EList) points; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.ADD_MANY, - PageflowPackage.PF_LINK__BEND_POINTS, null, points)); - - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public boolean isRedirect() { - Boolean result = (Boolean) getFCElements().get( - PageflowPackage.PF_LINK__REDIRECT); - return result.booleanValue(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setRedirect(boolean newRedirect) { - Boolean oldRedirect = new Boolean(isRedirect()); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__REDIRECT, oldRedirect, - new Boolean(newRedirect))); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getOutcome() { - String result = (String) getFCElements().get( - PageflowPackage.PF_LINK__OUTCOME); - - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setOutcome(String newValue) { - String oldOutcome = getOutcome(); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__OUTCOME, oldOutcome, newValue)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getSmallicon() { - String result = (String) getFCElements().get( - PageflowPackage.PF_LINK__SMALLICON); - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setSmallicon(String newValue) { - String oldSmallicon = getSmallicon(); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__SMALLICON, oldSmallicon, newValue)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getLargeicon() { - String result = (String) getFCElements().get( - PageflowPackage.PF_LINK__LARGEICON); - - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setLargeicon(String newValue) { - String oldLargeIcon = getLargeicon(); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__LARGEICON, oldLargeIcon, newValue)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getFromaction() { - String result = (String) getFCElements().get( - PageflowPackage.PF_LINK__FROMACTION); - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setFromaction(String newFromaction) { - String oldFromActionType = getFromaction(); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_LINK__FROMACTION, oldFromActionType, - newFromaction)); - } - - /** - * @generated NOT - */ - public ReferenceElement getFCElements() { - - if (refElement == null) { - refElement = new LinkReferenceElement(this); - } - return refElement; - } - -} -// PFLinkImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowNodeImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowNodeImpl.java deleted file mode 100644 index 6e64d61e5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowNodeImpl.java +++ /dev/null @@ -1,390 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.osgi.util.NLS; - -/** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>Node</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowNodeImpl#getPageflow <em>Pageflow</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowNodeImpl#getOutlinks <em>Outlinks</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowNodeImpl#getInlinks <em>Inlinks</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class PageflowNodeImpl extends PageflowElementImpl implements - PageflowNode { - /** - * The cached value of the '{@link #getOutlinks() <em>Outlinks</em>}' - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getOutlinks() - * @generated - * @ordered - */ - protected EList outlinks = null; - - /** - * The cached value of the '{@link #getInlinks() <em>Inlinks</em>}' - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getInlinks() - * @generated - * @ordered - */ - protected EList inlinks = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowNodeImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EClass eStaticClass() { - return PageflowPackage.eINSTANCE.getPageflowNode(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Pageflow getPageflow() { - if (eContainerFeatureID != PageflowPackage.PAGEFLOW_NODE__PAGEFLOW) - return null; - return (Pageflow) eContainer; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setPageflow(Pageflow newPageflow) { - if (newPageflow != eContainer - || (eContainerFeatureID != PageflowPackage.PAGEFLOW_NODE__PAGEFLOW && newPageflow != null)) { - if (EcoreUtil.isAncestor(this, newPageflow)) - throw new IllegalArgumentException( - NLS.bind(PageflowMessages.PageflowNode_NoRecursiveContainment,toString())); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newPageflow != null) - msgs = ((InternalEObject) newPageflow).eInverseAdd(this, - PageflowPackage.PAGEFLOW__NODES, Pageflow.class, msgs); - msgs = eBasicSetContainer((InternalEObject) newPageflow, - PageflowPackage.PAGEFLOW_NODE__PAGEFLOW, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_NODE__PAGEFLOW, newPageflow, - newPageflow)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EList getOutlinks() { - if (outlinks == null) { - outlinks = new EObjectWithInverseResolvingEList(PageflowLink.class, this, - PageflowPackage.PAGEFLOW_NODE__OUTLINKS, - PageflowPackage.PF_LINK__SOURCE); - } - return outlinks; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EList getInlinks() { - if (inlinks == null) { - inlinks = new EObjectWithInverseResolvingEList(PageflowLink.class, this, - PageflowPackage.PAGEFLOW_NODE__INLINKS, - PageflowPackage.PF_LINK__TARGET); - } - return inlinks; - } - - /** - * @generated NOT - */ - public PageflowLink findLinkTo(PageflowNode target) { - // - java.util.Iterator i = this.getOutlinks().iterator(); - while (i.hasNext()) { - PageflowLink link = (PageflowLink) i.next(); - if (link.getTarget() == target) - return link; - } - return null; - - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, - PageflowPackage.PAGEFLOW_NODE__PAGEFLOW, msgs); - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - return ((InternalEList) getOutlinks()).basicAdd(otherEnd, msgs); - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - return ((InternalEList) getInlinks()).basicAdd(otherEnd, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - return eBasicSetContainer(null, - PageflowPackage.PAGEFLOW_NODE__PAGEFLOW, msgs); - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - return ((InternalEList) getOutlinks()).basicRemove(otherEnd, - msgs); - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - return ((InternalEList) getInlinks()).basicRemove(otherEnd, - msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, - msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - return eContainer.eInverseRemove(this, - PageflowPackage.PAGEFLOW__NODES, Pageflow.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, - EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_NODE__NAME: - return getName(); - case PageflowPackage.PAGEFLOW_NODE__COMMENT: - return getComment(); - case PageflowPackage.PAGEFLOW_NODE__X: - return new Integer(getX()); - case PageflowPackage.PAGEFLOW_NODE__Y: - return new Integer(getY()); - case PageflowPackage.PAGEFLOW_NODE__WIDTH: - return new Integer(getWidth()); - case PageflowPackage.PAGEFLOW_NODE__HEIGHT: - return new Integer(getHeight()); - case PageflowPackage.PAGEFLOW_NODE__ID: - return getId(); - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - return getPageflow(); - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - return getOutlinks(); - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - return getInlinks(); - } - return super.eGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_NODE__NAME: - setName((String) newValue); - return; - case PageflowPackage.PAGEFLOW_NODE__COMMENT: - setComment((String) newValue); - return; - case PageflowPackage.PAGEFLOW_NODE__X: - setX(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_NODE__Y: - setY(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_NODE__WIDTH: - setWidth(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_NODE__HEIGHT: - setHeight(((Integer) newValue).intValue()); - return; - case PageflowPackage.PAGEFLOW_NODE__ID: - setId((String) newValue); - return; - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - setPageflow((Pageflow) newValue); - return; - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - getOutlinks().clear(); - getOutlinks().addAll((Collection) newValue); - return; - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - getInlinks().clear(); - getInlinks().addAll((Collection) newValue); - return; - } - super.eSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_NODE__NAME: - setName(NAME_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__COMMENT: - setComment(COMMENT_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__X: - setX(X_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__Y: - setY(Y_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__WIDTH: - setWidth(WIDTH_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__HEIGHT: - setHeight(HEIGHT_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__ID: - setId(ID_EDEFAULT); - return; - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - setPageflow((Pageflow) null); - return; - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - getOutlinks().clear(); - return; - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - getInlinks().clear(); - return; - } - super.eUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PAGEFLOW_NODE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT - .equals(name); - case PageflowPackage.PAGEFLOW_NODE__COMMENT: - return COMMENT_EDEFAULT == null ? comment != null - : !COMMENT_EDEFAULT.equals(comment); - case PageflowPackage.PAGEFLOW_NODE__X: - return x != X_EDEFAULT; - case PageflowPackage.PAGEFLOW_NODE__Y: - return y != Y_EDEFAULT; - case PageflowPackage.PAGEFLOW_NODE__WIDTH: - return width != WIDTH_EDEFAULT; - case PageflowPackage.PAGEFLOW_NODE__HEIGHT: - return height != HEIGHT_EDEFAULT; - case PageflowPackage.PAGEFLOW_NODE__ID: - return ID_EDEFAULT == null ? getId() != null : !ID_EDEFAULT - .equals(getId()); - case PageflowPackage.PAGEFLOW_NODE__PAGEFLOW: - return getPageflow() != null; - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - return outlinks != null && !outlinks.isEmpty(); - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - return inlinks != null && !inlinks.isEmpty(); - } - return super.eIsSet(eFeature); - } - -} -// PageflowNodeImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowPackageImpl.java deleted file mode 100644 index f24f95bc8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowPackageImpl.java +++ /dev/null @@ -1,782 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- - * end-user-doc --> - * - * @generated - */ -public class PageflowPackageImpl extends EPackageImpl implements - PageflowPackage { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pageflowEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pageflowNodeEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pfLinkEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pageflowElementEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pfPageEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pfLinkBendpointEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the - * package package URI value. - * <p> - * Note: the correct way to create the package is via the static factory - * method {@link #init init()}, which also performs initialization of the - * package, or returns the registered package, if one already exists. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage#eNS_URI - * @see #init() - * @generated - */ - private PageflowPackageImpl() { - super(eNS_URI, PageflowFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, - * and for any others upon which it depends. Simple dependencies are - * satisfied by calling this method on all dependent packages before doing - * anything else. This method drives initialization for interdependent - * packages directly, in parallel with this package, itself. - * <p> - * Of this package and its interdependencies, all packages which have not - * yet been registered by their URI values are first created and registered. - * The packages are then initialized in two steps: meta-model objects for - * all of the packages are created before any are initialized, since one - * package's meta-model objects may refer to those of another. - * <p> - * Invocation of this method will not affect any packages that have already - * been initialized. - * - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static PageflowPackage init() { - if (isInited) - return (PageflowPackage) EPackage.Registry.INSTANCE - .get(PageflowPackage.eNS_URI); - - // Obtain or create and register package - PageflowPackageImpl thePageflowPackage = (PageflowPackageImpl) (EPackage.Registry.INSTANCE - .get(eNS_URI) instanceof PageflowPackageImpl ? EPackage.Registry.INSTANCE - .get(eNS_URI) - : new PageflowPackageImpl()); - - isInited = true; - - // Create package meta-data objects - thePageflowPackage.createPackageContents(); - - // Initialize created meta-data - thePageflowPackage.initializePackageContents(); - - return thePageflowPackage; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getPageflow() { - return pageflowEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPageflow_Nodes() { - return (EReference) pageflowEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPageflow_Links() { - return (EReference) pageflowEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflow_Configfile() { - return (EAttribute) pageflowEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getPageflowNode() { - return pageflowNodeEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPageflowNode_Pageflow() { - return (EReference) pageflowNodeEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPageflowNode_Outlinks() { - return (EReference) pageflowNodeEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPageflowNode_Inlinks() { - return (EReference) pageflowNodeEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getPFLink() { - return pfLinkEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPFLink_Pageflow() { - return (EReference) pfLinkEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPFLink_Target() { - return (EReference) pfLinkEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPFLink_Source() { - return (EReference) pfLinkEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLink_Outcome() { - return (EAttribute) pfLinkEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLink_Redirect() { - return (EAttribute) pfLinkEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPFLink_BendPoints() { - return (EReference) pfLinkEClass.getEStructuralFeatures().get(5); - } - - /** - * <!-- begin-user-doc --> - * @return the small icon eattribute - * <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLink_Smallicon() { - return (EAttribute) pfLinkEClass.getEStructuralFeatures().get(6); - } - - /** - * <!-- begin-user-doc --> - * @return the large icon attribute - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getPFLink_Largeicon() { - return (EAttribute) pfLinkEClass.getEStructuralFeatures().get(7); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLink_Fromaction() { - return (EAttribute) pfLinkEClass.getEStructuralFeatures().get(8); - } - - /** - * <!-- begin-user-doc --> - * @return the reference link eattribute - * <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_ReferenceLink() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 7); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getPageflowElement() { - return pageflowElementEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_Name() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_Comment() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_X() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_Y() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 3); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_Width() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 4); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_Height() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 5); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPageflowElement_Id() { - return (EAttribute) pageflowElementEClass.getEStructuralFeatures().get( - 6); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getPFPage() { - return pfPageEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFPage_Path() { - return (EAttribute) pfPageEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFPage_Smallicon() { - return (EAttribute) pfPageEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFPage_Largeicon() { - return (EAttribute) pfPageEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getPFLinkBendpoint() { - return pfLinkBendpointEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLinkBendpoint_D1Width() { - return (EAttribute) pfLinkBendpointEClass.getEStructuralFeatures().get( - 0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLinkBendpoint_D1Height() { - return (EAttribute) pfLinkBendpointEClass.getEStructuralFeatures().get( - 1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLinkBendpoint_D2Width() { - return (EAttribute) pfLinkBendpointEClass.getEStructuralFeatures().get( - 2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLinkBendpoint_D2Height() { - return (EAttribute) pfLinkBendpointEClass.getEStructuralFeatures().get( - 3); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPFLinkBendpoint_Weight() { - return (EAttribute) pfLinkBendpointEClass.getEStructuralFeatures().get( - 4); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getPFLinkBendpoint_Link() { - return (EReference) pfLinkBendpointEClass.getEStructuralFeatures().get( - 5); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public PageflowFactory getPageflowFactory() { - return (PageflowFactory) getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is guarded to - * have no affect on any invocation but its first. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - public void createPackageContents() { - if (isCreated) - return; - isCreated = true; - - // Create classes and their features - pageflowEClass = createEClass(PAGEFLOW); - createEReference(pageflowEClass, PAGEFLOW__NODES); - createEReference(pageflowEClass, PAGEFLOW__LINKS); - createEAttribute(pageflowEClass, PAGEFLOW__CONFIGFILE); - - pageflowNodeEClass = createEClass(PAGEFLOW_NODE); - createEReference(pageflowNodeEClass, PAGEFLOW_NODE__PAGEFLOW); - createEReference(pageflowNodeEClass, PAGEFLOW_NODE__OUTLINKS); - createEReference(pageflowNodeEClass, PAGEFLOW_NODE__INLINKS); - - pfLinkEClass = createEClass(PF_LINK); - createEReference(pfLinkEClass, PF_LINK__PAGEFLOW); - createEReference(pfLinkEClass, PF_LINK__TARGET); - createEReference(pfLinkEClass, PF_LINK__SOURCE); - createEAttribute(pfLinkEClass, PF_LINK__OUTCOME); - createEAttribute(pfLinkEClass, PF_LINK__REDIRECT); - createEReference(pfLinkEClass, PF_LINK__BEND_POINTS); - createEAttribute(pfLinkEClass, PF_LINK__SMALLICON); - createEAttribute(pfLinkEClass, PF_LINK__LARGEICON); - createEAttribute(pfLinkEClass, PF_LINK__FROMACTION); - - pageflowElementEClass = createEClass(PAGEFLOW_ELEMENT); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__NAME); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__COMMENT); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__X); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__Y); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__WIDTH); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__HEIGHT); - createEAttribute(pageflowElementEClass, PAGEFLOW_ELEMENT__ID); - createEAttribute(pageflowElementEClass, - PAGEFLOW_ELEMENT__REFERENCE_LINK); - - pfPageEClass = createEClass(PF_PAGE); - createEAttribute(pfPageEClass, PF_PAGE__PATH); - createEAttribute(pfPageEClass, PF_PAGE__SMALLICON); - createEAttribute(pfPageEClass, PF_PAGE__LARGEICON); - - pfLinkBendpointEClass = createEClass(PF_LINK_BENDPOINT); - createEAttribute(pfLinkBendpointEClass, PF_LINK_BENDPOINT__D1_WIDTH); - createEAttribute(pfLinkBendpointEClass, PF_LINK_BENDPOINT__D1_HEIGHT); - createEAttribute(pfLinkBendpointEClass, PF_LINK_BENDPOINT__D2_WIDTH); - createEAttribute(pfLinkBendpointEClass, PF_LINK_BENDPOINT__D2_HEIGHT); - createEAttribute(pfLinkBendpointEClass, PF_LINK_BENDPOINT__WEIGHT); - createEReference(pfLinkBendpointEClass, PF_LINK_BENDPOINT__LINK); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void initializePackageContents() { - if (isInitialized) - return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Add supertypes to classes - pageflowEClass.getESuperTypes().add(this.getPageflowElement()); - pageflowNodeEClass.getESuperTypes().add(this.getPageflowElement()); - pfLinkEClass.getESuperTypes().add(this.getPageflowElement()); - pfPageEClass.getESuperTypes().add(this.getPageflowNode()); - - // Initialize classes and features; add operations and parameters - initEClass(pageflowEClass, Pageflow.class, "Pageflow", !IS_ABSTRACT, //$NON-NLS-1$ - !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPageflow_Nodes(), this.getPageflowNode(), this - .getPageflowNode_Pageflow(), "nodes", null, 0, -1, //$NON-NLS-1$ - Pageflow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getPageflow_Links(), this.getPFLink(), this - .getPFLink_Pageflow(), "links", null, 0, -1, Pageflow.class, //$NON-NLS-1$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, - !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEAttribute(getPageflow_Configfile(), ecorePackage.getEString(), - "configfile", null, 0, 1, Pageflow.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - - initEClass(pageflowNodeEClass, PageflowNode.class, "PageflowNode", //$NON-NLS-1$ - IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPageflowNode_Pageflow(), this.getPageflow(), this - .getPageflow_Nodes(), "pageflow", null, 1, 1, //$NON-NLS-1$ - PageflowNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getPageflowNode_Outlinks(), this.getPFLink(), this - .getPFLink_Source(), "outlinks", null, 0, -1, //$NON-NLS-1$ - PageflowNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getPageflowNode_Inlinks(), this.getPFLink(), this - .getPFLink_Target(), "inlinks", null, 0, -1, //$NON-NLS-1$ - PageflowNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - - initEClass(pfLinkEClass, PageflowLink.class, "PFLink", !IS_ABSTRACT, //$NON-NLS-1$ - !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getPFLink_Pageflow(), this.getPageflow(), this - .getPageflow_Links(), "pageflow", null, 1, 1, //$NON-NLS-1$ - PageflowLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getPFLink_Target(), this.getPageflowNode(), this - .getPageflowNode_Inlinks(), "target", null, 1, 1, //$NON-NLS-1$ - PageflowLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getPFLink_Source(), this.getPageflowNode(), this - .getPageflowNode_Outlinks(), "source", null, 1, 1, //$NON-NLS-1$ - PageflowLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLink_Outcome(), ecorePackage.getEString(), - "outcome", null, 0, 1, PageflowLink.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLink_Redirect(), ecorePackage.getEBoolean(), - "redirect", null, 0, 1, PageflowLink.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getPFLink_BendPoints(), this.getPFLinkBendpoint(), this - .getPFLinkBendpoint_Link(), "bendPoints", null, 0, -1, //$NON-NLS-1$ - PageflowLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLink_Smallicon(), ecorePackage.getEString(), - "smallicon", null, 0, 1, PageflowLink.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLink_Largeicon(), ecorePackage.getEString(), - "largeicon", null, 0, 1, PageflowLink.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLink_Fromaction(), ecorePackage.getEString(), - "fromaction", null, 0, 1, PageflowLink.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - - initEClass(pageflowElementEClass, PageflowElement.class, - "PageflowElement", IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ - IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPageflowElement_Name(), ecorePackage.getEString(), - "name", "unnamed", 0, 1, PageflowElement.class, !IS_TRANSIENT, //$NON-NLS-1$ //$NON-NLS-2$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPageflowElement_Comment(), ecorePackage.getEString(), - "comment", null, 0, 1, PageflowElement.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPageflowElement_X(), ecorePackage.getEInt(), "x", //$NON-NLS-1$ - "0", 0, 1, PageflowElement.class, !IS_TRANSIENT, !IS_VOLATILE, //$NON-NLS-1$ - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEAttribute(getPageflowElement_Y(), ecorePackage.getEInt(), "y", //$NON-NLS-1$ - "0", 0, 1, PageflowElement.class, !IS_TRANSIENT, !IS_VOLATILE, //$NON-NLS-1$ - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEAttribute(getPageflowElement_Width(), ecorePackage.getEInt(), - "width", "-1", 0, 1, PageflowElement.class, !IS_TRANSIENT, //$NON-NLS-1$ //$NON-NLS-2$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPageflowElement_Height(), ecorePackage.getEInt(), - "height", "-1", 0, 1, PageflowElement.class, !IS_TRANSIENT, //$NON-NLS-1$ //$NON-NLS-2$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPageflowElement_Id(), ecorePackage.getEString(), - "id", null, 1, 1, PageflowElement.class, !IS_TRANSIENT, //$NON-NLS-1$ - IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPageflowElement_ReferenceLink(), ecorePackage - .getEString(), "referenceLink", "", 0, 1, //$NON-NLS-1$ //$NON-NLS-2$ - PageflowElement.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - - initEClass(pfPageEClass, PageflowPage.class, "PFPage", !IS_ABSTRACT, //$NON-NLS-1$ - !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPFPage_Path(), ecorePackage.getEString(), "path", //$NON-NLS-1$ - null, 0, 1, PageflowPage.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEAttribute(getPFPage_Smallicon(), ecorePackage.getEString(), - "smallicon", null, 0, 1, PageflowPage.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFPage_Largeicon(), ecorePackage.getEString(), - "largeicon", null, 0, 1, PageflowPage.class, !IS_TRANSIENT, //$NON-NLS-1$ - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - - initEClass(pfLinkBendpointEClass, PageflowLinkBendpoint.class, - "PFLinkBendpoint", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$ - IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPFLinkBendpoint_D1Width(), ecorePackage.getEInt(), - "d1Width", null, 0, 1, PageflowLinkBendpoint.class, //$NON-NLS-1$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, - !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLinkBendpoint_D1Height(), ecorePackage.getEInt(), - "d1Height", null, 0, 1, PageflowLinkBendpoint.class, //$NON-NLS-1$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, - !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLinkBendpoint_D2Width(), ecorePackage.getEInt(), - "d2Width", null, 0, 1, PageflowLinkBendpoint.class, //$NON-NLS-1$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, - !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLinkBendpoint_D2Height(), ecorePackage.getEInt(), - "d2Height", null, 0, 1, PageflowLinkBendpoint.class, //$NON-NLS-1$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, - !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getPFLinkBendpoint_Weight(), ecorePackage.getEFloat(), - "weight", "0.5", 0, 1, PageflowLinkBendpoint.class, //$NON-NLS-1$ //$NON-NLS-2$ - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, - !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getPFLinkBendpoint_Link(), this.getPFLink(), this - .getPFLink_BendPoints(), "link", null, 1, 1, //$NON-NLS-1$ - PageflowLinkBendpoint.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, - !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - } - -} -// PageflowPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowPageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowPageImpl.java deleted file mode 100644 index eca7a66b5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/PageflowPageImpl.java +++ /dev/null @@ -1,531 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * <!-- begin-user-doc --> An implementation of the model object '<em><b>PF Page</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPageImpl#getPath <em>Path</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPageImpl#getSmallicon <em>Smallicon</em>}</li> - * <li>{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPageImpl#getLargeicon <em>Largeicon</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class PageflowPageImpl extends PageflowNodeImpl implements PageflowPage { - private String path; - - private String smallIcon; - - private String largeIcon; - - /** - * The default value of the '{@link #getPath() <em>Path</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getPath() - * @generated - * @ordered - */ - protected static final String PATH_EDEFAULT = null; - - /** - * The default value of the '{@link #getSmallicon() <em>Smallicon</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getSmallicon() - * @generated - * @ordered - */ - protected static final String SMALLICON_EDEFAULT = null; - - /** - * The default value of the '{@link #getLargeicon() <em>Largeicon</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLargeicon() - * @generated - * @ordered - */ - protected static final String LARGEICON_EDEFAULT = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowPageImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EClass eStaticClass() { - return PageflowPackage.eINSTANCE.getPFPage(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getPath() { - String result = (String) getFCElements().get( - PageflowPackage.PF_PAGE__PATH); - // Try to return reasonable result. - return result == null && getFCElements().isEmpty() ? path - : (result != null ? result : PATH_EDEFAULT); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setPath(String newValue) { - String oldPath = getPath(); - path = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_PAGE__PATH, oldPath, newValue)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - - public void setComment(String newValue) { - super.setComment(newValue); - String oldComment = getComment(); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PAGEFLOW_ELEMENT__COMMENT, oldComment, - newValue)); - - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - - public String getComment() { - String result = (String) getFCElements().get( - PageflowPackage.PF_PAGE__COMMENT); - return result == null - && (getFCElements().isEmpty() || ((PageReferenceElement) getFCElements()) - .isEndOnly()) ? super.getComment() - : (result != null ? result - : PageflowElementImpl.COMMENT_EDEFAULT); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - - public String getName() { - String result; - // To see if it is in navigation rule. - result = (String) getFCElements().get(PageflowPackage.PF_PAGE__NAME); - if (result == null) { - if (super.getName() == null || super.getName().trim().length() == 0) { - result = getPath(); - } else { - result = super.getName(); - } - } - return result == null - && (getFCElements().isEmpty() || ((PageReferenceElement) getFCElements()) - .isEndOnly()) ? PageflowElementImpl.NAME_EDEFAULT - : (result == null ? null : result); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - - public void setName(String newName) { - super.setName(newName); - String oldName = getName(); - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_PAGE__NAME, oldName, newName)); - - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getSmallicon() { - String result = (String) getFCElements().get( - PageflowPackage.PF_PAGE__SMALLICON); - - return result == null - && (getFCElements().isEmpty() || ((PageReferenceElement) getFCElements()) - .isEndOnly()) ? smallIcon : (result != null ? result - : SMALLICON_EDEFAULT); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setSmallicon(String newValue) { - String oldSmallicon = getSmallicon(); - smallIcon = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_PAGE__SMALLICON, oldSmallicon, newValue)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getLargeicon() { - String result = (String) getFCElements().get( - PageflowPackage.PF_PAGE__LARGEICON); - - return result == null - && (getFCElements().isEmpty() || ((PageReferenceElement) getFCElements()) - .isEndOnly()) ? largeIcon : (result != null ? result - : LARGEICON_EDEFAULT); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public void setLargeicon(String newValue) { - String oldLargeIcon = getLargeicon(); - largeIcon = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - PageflowPackage.PF_PAGE__LARGEICON, oldLargeIcon, newValue)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PF_PAGE__PAGEFLOW: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, - PageflowPackage.PF_PAGE__PAGEFLOW, msgs); - case PageflowPackage.PF_PAGE__OUTLINKS: - return ((InternalEList) getOutlinks()).basicAdd(otherEnd, msgs); - case PageflowPackage.PF_PAGE__INLINKS: - return ((InternalEList) getInlinks()).basicAdd(otherEnd, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case PageflowPackage.PF_PAGE__PAGEFLOW: - return eBasicSetContainer(null, - PageflowPackage.PF_PAGE__PAGEFLOW, msgs); - case PageflowPackage.PF_PAGE__OUTLINKS: - return ((InternalEList) getOutlinks()).basicRemove(otherEnd, - msgs); - case PageflowPackage.PF_PAGE__INLINKS: - return ((InternalEList) getInlinks()).basicRemove(otherEnd, - msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, - msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case PageflowPackage.PF_PAGE__PAGEFLOW: - return eContainer.eInverseRemove(this, - PageflowPackage.PAGEFLOW__NODES, Pageflow.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, - EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_PAGE__NAME: - return getName(); - case PageflowPackage.PF_PAGE__COMMENT: - return getComment(); - case PageflowPackage.PF_PAGE__X: - return new Integer(getX()); - case PageflowPackage.PF_PAGE__Y: - return new Integer(getY()); - case PageflowPackage.PF_PAGE__WIDTH: - return new Integer(getWidth()); - case PageflowPackage.PF_PAGE__HEIGHT: - return new Integer(getHeight()); - case PageflowPackage.PF_PAGE__ID: - return getId(); - case PageflowPackage.PF_PAGE__PAGEFLOW: - return getPageflow(); - case PageflowPackage.PF_PAGE__OUTLINKS: - return getOutlinks(); - case PageflowPackage.PF_PAGE__INLINKS: - return getInlinks(); - case PageflowPackage.PF_PAGE__PATH: - return getPath(); - case PageflowPackage.PF_PAGE__SMALLICON: - return getSmallicon(); - case PageflowPackage.PF_PAGE__LARGEICON: - return getLargeicon(); - } - return super.eGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_PAGE__NAME: - setName((String) newValue); - return; - case PageflowPackage.PF_PAGE__COMMENT: - setComment((String) newValue); - return; - case PageflowPackage.PF_PAGE__X: - setX(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_PAGE__Y: - setY(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_PAGE__WIDTH: - setWidth(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_PAGE__HEIGHT: - setHeight(((Integer) newValue).intValue()); - return; - case PageflowPackage.PF_PAGE__ID: - setId((String) newValue); - return; - case PageflowPackage.PF_PAGE__PAGEFLOW: - setPageflow((Pageflow) newValue); - return; - case PageflowPackage.PF_PAGE__OUTLINKS: - getOutlinks().clear(); - getOutlinks().addAll((Collection) newValue); - return; - case PageflowPackage.PF_PAGE__INLINKS: - getInlinks().clear(); - getInlinks().addAll((Collection) newValue); - return; - case PageflowPackage.PF_PAGE__PATH: - setPath((String) newValue); - return; - case PageflowPackage.PF_PAGE__SMALLICON: - setSmallicon((String) newValue); - return; - case PageflowPackage.PF_PAGE__LARGEICON: - setLargeicon((String) newValue); - return; - } - super.eSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_PAGE__NAME: - setName(NAME_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__COMMENT: - setComment(COMMENT_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__X: - setX(X_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__Y: - setY(Y_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__WIDTH: - setWidth(WIDTH_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__HEIGHT: - setHeight(HEIGHT_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__ID: - setId(ID_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__PAGEFLOW: - setPageflow((Pageflow) null); - return; - case PageflowPackage.PF_PAGE__OUTLINKS: - getOutlinks().clear(); - return; - case PageflowPackage.PF_PAGE__INLINKS: - getInlinks().clear(); - return; - case PageflowPackage.PF_PAGE__PATH: - setPath(PATH_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__SMALLICON: - setSmallicon(SMALLICON_EDEFAULT); - return; - case PageflowPackage.PF_PAGE__LARGEICON: - setLargeicon(LARGEICON_EDEFAULT); - return; - } - super.eUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case PageflowPackage.PF_PAGE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT - .equals(name); - case PageflowPackage.PF_PAGE__COMMENT: - return COMMENT_EDEFAULT == null ? comment != null - : !COMMENT_EDEFAULT.equals(comment); - case PageflowPackage.PF_PAGE__X: - return x != X_EDEFAULT; - case PageflowPackage.PF_PAGE__Y: - return y != Y_EDEFAULT; - case PageflowPackage.PF_PAGE__WIDTH: - return width != WIDTH_EDEFAULT; - case PageflowPackage.PF_PAGE__HEIGHT: - return height != HEIGHT_EDEFAULT; - case PageflowPackage.PF_PAGE__ID: - return ID_EDEFAULT == null ? getId() != null : !ID_EDEFAULT - .equals(getId()); - case PageflowPackage.PF_PAGE__PAGEFLOW: - return getPageflow() != null; - case PageflowPackage.PF_PAGE__OUTLINKS: - return outlinks != null && !outlinks.isEmpty(); - case PageflowPackage.PF_PAGE__INLINKS: - return inlinks != null && !inlinks.isEmpty(); - case PageflowPackage.PF_PAGE__PATH: - return PATH_EDEFAULT == null ? getPath() != null : !PATH_EDEFAULT - .equals(getPath()); - case PageflowPackage.PF_PAGE__SMALLICON: - return SMALLICON_EDEFAULT == null ? getSmallicon() != null - : !SMALLICON_EDEFAULT.equals(getSmallicon()); - case PageflowPackage.PF_PAGE__LARGEICON: - return LARGEICON_EDEFAULT == null ? getLargeicon() != null - : !LARGEICON_EDEFAULT.equals(getLargeicon()); - } - return super.eIsSet(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (path: "); //$NON-NLS-1$ - result.append(getPath()); - result.append(", smallicon: "); //$NON-NLS-1$ - result.append(getSmallicon()); - result.append(", largeicon: "); //$NON-NLS-1$ - result.append(getLargeicon()); - result.append(')'); - return result.toString(); - } - - public ReferenceElement getFCElements() { - - if (refElement == null) { - refElement = new PageReferenceElement(this); - } - return refElement; - } - -} -// PFPageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/ReferenceElement.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/ReferenceElement.java deleted file mode 100644 index d013ee66c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/model/impl/ReferenceElement.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResource; - -/** - * The base class for mapping facesconfig node from pageflow node. The - * ReferenceElement could be extended later to enable other model to be - * referenced by pageflow. - * - * @author hmeng - * - */ -public abstract class ReferenceElement { - - private List data = new ArrayList(); - - /** - * the pageflow element - */ - protected PageflowElement pageflowElement; - - /** - * @param pageflowElement - */ - public ReferenceElement(PageflowElement pageflowElement) { - this.pageflowElement = pageflowElement; - } - - /** - * @param pageflowElement - * @param facesConfigObject - */ - public ReferenceElement(PageflowElement pageflowElement, - EObject facesConfigObject) { - this(pageflowElement); - this.add(facesConfigObject); - } - - /** - * Add object to the list. - * - * @param object - */ - public void add(EObject object) { - if (!data.contains(object)) { - data.add(object); - } - } - - - /** - * The fragment path of a node. - * - * @param object - * @return the path - */ - public static String resolvePath(EObject object) { - if (object != null) { - ((CompatibilityXMIResource) object.eResource()) - .setFormat(CompatibilityXMIResource.FORMAT_EMF1); - String uriTarget = object.eResource().getURIFragment(object); - return uriTarget; - } - return ""; //$NON-NLS-1$ - } - - /** - * Resolve each referenced data's path and combine the result into one - * string, the path will be seperated with '|'. - * - * @return the resolved string - */ - public String resolveReferenceString() { - String result = ""; //$NON-NLS-1$ - for (int i = 0, n = data.size(); i < n; i++) { - result += resolvePath((EObject) data.get(i)) + "|"; //$NON-NLS-1$ - } - if (result.length() > 0) { - result = result.substring(0, result.length()); - } - return result; - } - - /** - * The EMF paths of all referenced elements. - * - * @return the list of resolved paths for the data elements - */ - public List getPaths() { - List paths = new ArrayList(); - for (int i = 0, n = data.size(); i < n; i++) { - paths.add(resolvePath((EObject) data.get(i))); - } - return paths; - } - - /** - * The facesconfig elements that are referenced. - * - * @return the list of elements - */ - public List getData() { - return data; - } - - /** - * Clear the data - */ - public void clear() { - if (!data.isEmpty()) { - data.clear(); - } - } - - /** - * @return true if the data is empty - */ - public boolean isEmpty() { - return data.isEmpty(); - } - - /** - * Dispose the element - */ - public void dispose() { - clear(); - } - - /** - * Update the referenced faces-config elements. - * - */ - abstract public void update(); - - /** - * Return a pageflow property's value with referenced faces-config element. - * - * @param eFeature - * @return the value for eFeature - */ - abstract public Object get(int eFeature); - - /** - * To set a pageflow property's value will result in seting a faces-config - * element. - * - * @param eFeature - * @param newValue - */ - abstract public void set(EStructuralFeature eFeature, Object newValue); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionDialogCellEditor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionDialogCellEditor.java deleted file mode 100644 index a68e86cc0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionDialogCellEditor.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * - * Dialog Cell Editor for Action browser. - * - * @author Xiao-guang Zhang - */ -public class ActionDialogCellEditor extends EditableDialogCellEditor { - - - /** - * Default constructor - */ - public ActionDialogCellEditor() { - super(); - } - - - /** - * @param parent - */ - public ActionDialogCellEditor(Composite parent) { - super(parent); - } - - /** - * @param parent - * @param style - */ - public ActionDialogCellEditor(Composite parent, int style) { - super(parent, style); - } - - /* - * (non-Javadoc) - * - * @see DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control) - */ - protected Object openDialogBox(Control cellEditorWindow) { - String actionExpression = getDefaultText().getText(); - // IStructuredSelection selectionToPass = StructuredSelection.EMPTY; - // Create a new jsf Wizard - - // FIXME sfshi 2005-11-16 - // ActionSelectionWizard actionSelectionWizard = - // new ActionSelectionWizard(ActionSelectionWizard.CONSIDER_METHODS); - // actionSelectionWizard.init(EditorPlugin.getDefault().getWorkbench(), - // selectionToPass); - // actionSelectionWizard.setActionExpression(actionExpression); - // //using a wizard dialog to display the new jsf wizard - // WizardDialog actionSelectionWizardDialog = - // new WizardDialog(cellEditorWindow.getShell(),actionSelectionWizard); - // if (actionSelectionWizardDialog.open() == WizardDialog.OK ) - // { - // actionExpression = actionSelectionWizard.getActionExpression(); - // } - return actionExpression; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeDialogCellEditor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeDialogCellEditor.java deleted file mode 100644 index 3c683411e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeDialogCellEditor.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * - * Dialog Cell Editor for Action's outcome browser. - * - * @author Xiao-guang Zhang - */ -public class ActionOutcomeDialogCellEditor extends EditableDialogCellEditor { - /** the source PFLink element */ - PageflowElement element; - - /** - * @param element - */ - public ActionOutcomeDialogCellEditor(PageflowElement element) { - super(); - this.element = element; - } - - /** - * @param parent - * @param element - */ - public ActionOutcomeDialogCellEditor(Composite parent, - PageflowElement element) { - super(parent); - this.element = element; - } - - - /** - * @param parent - * @param style - * @param element - */ - public ActionOutcomeDialogCellEditor(Composite parent, int style, - PageflowElement element) { - super(parent, style); - this.element = element; - } - - /** - * get the previous JSP page, it can be null if the previous node is not - * PFPage, but PFAction. - * - * @param element_ - * @return - */ - private String getPreviousJSPPath(PageflowElement element_) { - String jspPath = null; - if (element_ instanceof PageflowLink) { - PageflowNode source = ((PageflowLink) element_).getSource(); - - if (source instanceof PageflowPage) { - jspPath = ((PageflowPage) source).getPath(); - } - } - return jspPath; - } - - /* - * (non-Javadoc) - * - * @see DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control) - */ - protected Object openDialogBox(Control cellEditorWindow) { - String outcome = getDefaultText().getText(); - - String jspPathName = WebrootUtil.getProjectPath(element, - getPreviousJSPPath(element)); - - ActionOutcomeSelectionDialog selectionDialog = new ActionOutcomeSelectionDialog( - getControl().getShell(), outcome, jspPathName); - - if (selectionDialog.open() == Window.OK) { - outcome = selectionDialog.getSelectedAction(); - } - - return outcome; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java deleted file mode 100644 index b788e53e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java +++ /dev/null @@ -1,379 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ColumnPixelData; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.Separator; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.JSPUtil; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -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.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * This dialog is used to edit outcome property of link component of Pageflow - * Designer. - * - * @author Xiao-guang Zhang - */ -public class ActionOutcomeSelectionDialog extends Dialog { - - /** property's name text control */ - private Text actionText; - - /** linked source jsp file name */ - private String jspName; - - /** the current outcome */ - private String outcome; - - /** action table control */ - private Table actionTable; - - /** Column width of component name and action */ - private static final int COMPONENT_COL_WIDTH = 160; - - private static final int ACTION_COL_WIDTH = 160; - - /** Dialog default height and width */ - private static final int DIALOG_DEFAULT_WIDTH = 400; - - private static final int DIALOG_DEFAULT_HEIGHT = 300; - - private static String JSF_EL_LEFT_BRACE = "#{"; //$NON-NLS-1$ - - private static String JSF_EL_RIGHT_BRACE = "}"; //$NON-NLS-1$ - - /** the listener for the text modification */ - private ModifyListener modifyListener; - - /** - * @param parentShell - * @param outcome - * @param jspName - */ - public ActionOutcomeSelectionDialog(Shell parentShell, String outcome, - String jspName) { - super(parentShell); - this.outcome = outcome; - this.jspName = jspName; - - modifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - verifyComplete(); - } - }; - } - - /* - * (non-Javadoc) - * - * @see Dialog#createDialogArea(Composite) - */ - protected Control createDialogArea(Composite parent) { - GridLayout gridLayout; - - Composite container = (Composite) super.createDialogArea(parent); - gridLayout = new GridLayout(); - gridLayout.numColumns = 1; - gridLayout.marginWidth = 10; - gridLayout.marginHeight = 10; - container.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_BOTH); - // gd.widthHint = 300; - gd.heightHint = DIALOG_DEFAULT_HEIGHT; - gd.widthHint = DIALOG_DEFAULT_WIDTH; - container.setLayoutData(gd); - - Label choiceLabel = new Label(container, SWT.LEFT); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - // gd.widthHint = 100; - choiceLabel.setLayoutData(gd); - // Pageflow.Property.Action.OutcomeSelectionDialog.Choice = Enter the - // outcome or select one from action list below: - choiceLabel - .setText(PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_Choice); - - createOutcomeSection(container); - - createActionListSection(container); - - return container; - } - - /** - * create a Outcome input section - * - * @param container - */ - protected void createOutcomeSection(Composite container) { - Composite outcomeSection = new Composite(container, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 1; - gl.marginWidth = 0; - outcomeSection.setLayout(gl); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - outcomeSection.setLayoutData(gd); - - actionText = new Text(outcomeSection, SWT.BORDER); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL - | GridData.FILL_HORIZONTAL); - actionText.setLayoutData(gd); - - actionText.addModifyListener(modifyListener); - - if (outcome != null && outcome.length() > 0) { - actionText.setText(outcome); - } - } - - /** - * create action list table section - * - * @param container - */ - protected void createActionListSection(Composite container) { - final Group actionSection = new Group(container, SWT.NONE); - GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 1; - actionSection.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_BOTH); - actionSection.setLayoutData(gd); - - String actionListTitle = null; - if (jspName != null && jspName.length() > 0) { - actionListTitle = NLS.bind(PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTableWithJSP_Title, jspName); - } else { - actionListTitle = PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Title; - } - - // Pageflow.Property.Action.OutcomeSelectionDialog.ActionListTable.Title - // = Actions - actionSection.setText(actionListTitle); - - actionTable = new Table(actionSection, SWT.BORDER | SWT.FULL_SELECTION); - actionTable.setLayoutData(new GridData(GridData.FILL_BOTH)); - actionTable.setHeaderVisible(true); - actionTable.setLinesVisible(true); - TableLayout layout = new TableLayout(); - actionTable.setLayout(layout); - - layout.addColumnData(new ColumnPixelData(COMPONENT_COL_WIDTH)); - layout.addColumnData(new ColumnPixelData(ACTION_COL_WIDTH)); - TableColumn componentCol = new TableColumn(actionTable, SWT.NONE); - // Pageflow.Property.Action.OutcomeSelectionDialog.ActionListTable.Component - // = Component ID - componentCol - .setText(PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Component); - TableColumn actionCol = new TableColumn(actionTable, SWT.NONE); - - // Pageflow.Property.Action.OutcomeSelectionDialog.ActionListTable.Action - // = Action - actionCol - .setText(PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Action); - - actionTable.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - TableItem selItem = (TableItem) e.item; - String action = selItem.getText(1); - if (action != null && action.length() > 0) - actionText.setText(action); - } - }); - - addActionsInJSP(); - - } - - /** - * Creates a separator line. Expects a <code>GridLayout</code> with at - * least 1 column. - * - * @param composite - * the parent composite - * @param nColumns - * number of columns to span - */ - protected void createSeparator(Composite composite, int nColumns) { - (new Separator(SWT.SEPARATOR | SWT.HORIZONTAL)).doFillIntoGrid(null, - composite, nColumns, convertHeightInCharsToPixels(1)); - } - - /* - * (non-Javadoc) - * - * @see Dialog#createButtonsForButtonBar(Composite) - */ - protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, - true); - createButton(parent, IDialogConstants.CANCEL_ID, - IDialogConstants.CANCEL_LABEL, false); - - verifyComplete(); - } - - /* - * (non-Javadoc) - * - * @see Dialog#configureShell(Shell) - */ - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - - // Pageflow.Property.Action.OutcomeSelectionDialog.Title = Outcome - // Selection - newShell - .setText(PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_Title); - - } - - /* - * (non-Javadoc) - * - * @see Dialog#buttonPressed(int) - */ - protected void buttonPressed(int buttonId) { - if (buttonId == IDialogConstants.CANCEL_ID) { - setReturnCode(CANCEL); - close(); - return; - } else if (buttonId == IDialogConstants.OK_ID) { - setReturnCode(OK); - - outcome = actionText.getText(); - - close(); - return; - } - super.buttonPressed(buttonId); - } - - /** - * - * check the dialog inputs are complete or not, and set the OK button enable - * or not. - */ - private void verifyComplete() { - if (getButton(IDialogConstants.OK_ID) != null) { - getButton(IDialogConstants.OK_ID).setEnabled(isDialogComplete()); - } - } - - /** - * check the dialog inputs are complete or not. - * - * @return - */ - private boolean isDialogComplete() { - return isValidName(); - } - - /** - * the input name is valid or not - * - * @return - */ - private boolean isValidName() { - return actionText.getText().length() > 0; - } - - /** - * get the selected action in the action table - * - * @return - selected action - */ - public String getSelectedAction() { - return outcome; - } - - /** - * add actions in the source jsp file to the action list table control - * - */ - private void addActionsInJSP() { - List actionNodes = JSPUtil.getActionListInJSPFile(jspName); - - if (actionNodes != null) { - for (int i = 0, n = actionNodes.size(); i < n; i++) { - Element node = (Element) actionNodes.get(i); - StringBuffer componentName = new StringBuffer(); - - Attr idAttr = node.getAttributeNode("id"); //$NON-NLS-1$ - if (idAttr != null) - componentName.append(idAttr.getNodeValue()); - - componentName.append("(").append(node.getTagName()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ - - Attr actionAttr = node.getAttributeNode("action"); //$NON-NLS-1$ - if (actionAttr != null) { - String action = actionAttr.getValue(); - if (isValidEL(action)) - addActionTableItem(componentName.toString(), action); - } - } - } - } - - /** - * @param expressionString - * @return true if expressionString is valid EL - */ - public static boolean isValidEL(String expressionString) { - if (expressionString == null || expressionString.length() == 0) - return true; - - return (expressionString.startsWith(JSF_EL_LEFT_BRACE) && expressionString - .endsWith(JSF_EL_RIGHT_BRACE)) - || (!expressionString.startsWith(JSF_EL_LEFT_BRACE) && !expressionString - .endsWith(JSF_EL_RIGHT_BRACE)); - } - - /** - * add a new action item in the previous jsp page. - * - * @param componentName - - * JSF component element - * @param action - - * value of action's attribute - */ - private void addActionTableItem(String componentName, String action) { - if (componentName != null && componentName.length() > 0 - && action != null && action.length() > 0) { - TableItem item = new TableItem(actionTable, SWT.NONE); - item.setText(0, componentName); - item.setText(1, action); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionSectionDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionSectionDescriptor.java deleted file mode 100644 index 85ff2e28e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionSectionDescriptor.java +++ /dev/null @@ -1,11 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 Oracle 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: - * Oracle Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/EditableDialogCellEditor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/EditableDialogCellEditor.java deleted file mode 100644 index ee2cd23b6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/EditableDialogCellEditor.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.text.MessageFormat; - -import org.eclipse.jface.viewers.DialogCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.FocusAdapter; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; - -/** - * @author Hong-tao Meng - */ -public abstract class EditableDialogCellEditor extends DialogCellEditor { - private Text text; - - /** - * - */ - public EditableDialogCellEditor() { - super(); - } - - /** - * @param parent - */ - public EditableDialogCellEditor(Composite parent) { - super(parent); - } - - /** - * @param parent - * @param style - */ - public EditableDialogCellEditor(Composite parent, int style) { - super(parent, style); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.DialogCellEditor#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite cell) { - text = new Text(cell, SWT.LEFT); - text.setFont(cell.getFont()); - text.setBackground(cell.getBackground()); - text.addKeyListener(new KeyAdapter() { - // hook key pressed - see PR 14201 - public void keyPressed(KeyEvent e) { - keyReleaseOccured(e); - // disposed this cell editor - if ((getControl() == null) || getControl().isDisposed()) { - return; - } - } - }); - // when the text control has focus, the cellEditor will deactive even - // when you press the button. - // Add the follow codes enable switch to the button control. - text.addFocusListener(new FocusAdapter() { - public void focusLost(FocusEvent e) { - boolean newValidState = isCorrect(text.getText()); - if (newValidState) { - markDirty(); - doSetValue(text.getText()); - } else { - // try to insert the current value into the error message. - setErrorMessage(MessageFormat.format(getErrorMessage(), - new Object[] { text.getText().toString() })); - } - } - }); - - return text; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.CellEditor#doSetFocus() - */ - protected void doSetFocus() { - text.setFocus(); - text.selectAll(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.DialogCellEditor#updateContents(java.lang.Object) - */ - protected void updateContents(Object value) { - if (text == null) { - return; - } - - String text_ = "";//$NON-NLS-1$ - if (value != null) { - text_ = value.toString(); - } - this.text.setText(text_); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.CellEditor#keyReleaseOccured(org.eclipse.swt.events.KeyEvent) - */ - protected void keyReleaseOccured(KeyEvent keyEvent) { - if (keyEvent.character == '\r') { - boolean newValidState = isCorrect(text.getText()); - if (newValidState) { - markDirty(); - doSetValue(text.getText()); - } else { - // try to insert the current value into the error message. - setErrorMessage(MessageFormat.format(getErrorMessage(), - new Object[] { text.getText().toString() })); - } - fireApplyEditorValue(); - } - super.keyReleaseOccured(keyEvent); - } - - /** - * @return the default text - */ - public Text getDefaultText() { - return text; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/EditorSectionDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/EditorSectionDescriptor.java deleted file mode 100644 index 6628690b6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/EditorSectionDescriptor.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.List; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section.EditorSection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; - - - -/** - * @author jchoi - */ -public class EditorSectionDescriptor implements ISectionDescriptor { - /** - * constructor - */ - public EditorSectionDescriptor() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return ITabbedPropertiesConstants.EDITOR_SECTION; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new EditorSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return ITabbedPropertiesConstants.ATTRIBUTE_TAB_ID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) selection; - object = structuredSelection.getFirstElement(); - // The editor section in the attribute tab will be shown for only - // pageflow element - if (object instanceof PageflowEditPart) { - return true; - } - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getAfterSection() - */ - public String getAfterSection() { - return ITabbedPropertiesConstants.TOP_SECTION; - } - - public int getEnablesFor() { - return ENABLES_FOR_ANY; - } - - public IFilter getFilter() { - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ExistingPagePathDialogCellEditor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ExistingPagePathDialogCellEditor.java deleted file mode 100644 index 121a2dafd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ExistingPagePathDialogCellEditor.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.facesconfig.ui.dialog.ListChoiceDialog; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * The cell editor used to locate an existing pageflow page node in current - * pageflow. - * - * @author hmeng - * - */ -public class ExistingPagePathDialogCellEditor extends EditableDialogCellEditor { - Pageflow pageflow; - - /** - * - */ - public ExistingPagePathDialogCellEditor() { - super(); - } - - /** - * @param parent - * @param style - */ - public ExistingPagePathDialogCellEditor(Composite parent, int style) { - super(parent, style); - } - - /** - * @param parent - * @param pageflow - */ - public ExistingPagePathDialogCellEditor(Composite parent, Pageflow pageflow) { - super(parent); - this.pageflow = pageflow; - } - - /* - * (non-Javadoc) - * - * @see DialogCellEditor#openDialogBox(Control) - */ - protected Object openDialogBox(Control cellEditorWindow) { - String jsfSelection = ""; //$NON-NLS-1$ - if (getDefaultText() != null && getDefaultText().getText().length() > 0) { - jsfSelection = getDefaultText().getText(); - } - ListChoiceDialog dialog = new ListChoiceDialog(cellEditorWindow - .getShell(), getPagePaths(), - PageflowMessages.ExistingPagePathDialogCellEdito_LabelText); - - if (dialog.open() == Window.OK) { - jsfSelection = dialog.getResult(); - } - return jsfSelection; - } - - /** - * Collect page paths in current pageflow. - * - * @return - */ - private String[] getPagePaths() { - List result = new ArrayList(); - List list = pageflow.getNodes(); - for (int i = 0; i < list.size(); i++) { - String path = ((PageflowPage) list.get(i)).getPath(); - if (path != null && path.trim().length() > 0) { - result.add(path); - } - } - String[] r = (String[]) result.toArray(new String[result.size()]); - Arrays.sort(r); - return r; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/GeneralViewSection.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/GeneralViewSection.java deleted file mode 100644 index 85884e39d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/GeneralViewSection.java +++ /dev/null @@ -1,379 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.views.properties.IPropertySheetPage; -import org.eclipse.ui.views.properties.PropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.wst.sse.ui.StructuredTextEditor; - -/** - * This class defines the general tab for pageflow attributes. This class - * defines the controls shown in this sectin and their event handler. For - * MultiPageEditorPart, if it support getAdapter(IEditorPart.class) to get the - * current active editor, then, this section can get the different - * PropertySheetPage for different sub EditorPart. - * - * @author Xiao-guang Zhang - */ -public class GeneralViewSection implements ISection, - ISelectionChangedListener { - /** the pagebook */ - private PageBook pageBook = null; - - /** - * A data structure used to store the information about a single page within - * a MultiPageEditorPart - */ - protected static class PageRec { - - /** - * The part including editorpart, or Control - */ - public IWorkbenchPart part; - - /** - * The page. - */ - public IPropertySheetPage page; - - /** - * Creates a new page record initialized to the given part and page. - * - * @param part - * @param page - */ - public PageRec(IWorkbenchPart part, IPropertySheetPage page) { - this.part = part; - this.page = page; - } - - /** - * Disposes of this page record by <code>null</code>ing its fields. - */ - public void dispose() { - part = null; - page = null; - } - } - - /** - * Map from parts to part records (key type: <code>IWorkbenchPart</code>; - * value type: <code>PartRec</code>). - */ - private Map mapPartToRec = new HashMap(); - - /** - * The page record for the default page. - */ - private PageRec defaultPageRec; - - /** - * The page rec which provided the current page or <code>null</code> - */ - private PageRec activeRec; - - /* - * (non-Javadoc) - * - * @see com.createControls(Composite, TabbedPropertySheetPage) - */ - public void createControls(Composite parent, - TabbedPropertySheetPage tabbedPropertySheetPage) { - FillLayout layout = new FillLayout(); - layout.marginWidth = ITabbedPropertyConstants.HSPACE; - layout.marginHeight = ITabbedPropertyConstants.VSPACE; - - // composite.setLayout(layout); - parent.setLayout(layout); - // pagebook - pageBook = new PageBook(parent, SWT.BORDER); - - // create a default property page. - createDefaultPage(); - - // Show the default page - if (defaultPageRec != null) { - showPageRec(defaultPageRec); - } - } - - /** - * Shows page contained in the given page record in this view. The page - * record must be one from this pagebook view. - * <p> - * The <code>PageBookView</code> implementation of this method asks the - * pagebook control to show the given page's control, and records that the - * given page is now current. Subclasses may extend. - * </p> - * - * @param pageRec - * the page record containing the page to show - */ - protected void showPageRec(PageRec pageRec) { - // If already showing do nothing - if (activeRec == pageRec) { - return; - } - // If the page is the same, just set activeRec to pageRec - if (activeRec != null && pageRec != null - && activeRec.page == pageRec.page) { - activeRec = pageRec; - return; - } - - // Show new page. - activeRec = pageRec; - Control pageControl = activeRec.page.getControl(); - if (pageControl != null && !pageControl.isDisposed()) { - // Verify that the page control is not disposed - // If we are closing, it may have already been disposed - pageBook.showPage(pageControl); - } - } - - /** - * Creates a page for a given part. Adds it to the pagebook but does not - * show it. - * - * @param part - * The part we are making a page for. - * @return IWorkbenchPart - */ - private PageRec createPage(IWorkbenchPart part) { - PageRec rec = doCreatePage(part); - if (rec != null) { - mapPartToRec.put(part, rec); - } - return rec; - } - - /* - * (non-Javadoc) Method declared on PageBookView. - */ - /** - * @param part - * @return PageRec for part - */ - protected PageRec doCreatePage(IWorkbenchPart part) { - // FIXME: Because the PropertySheetPage of StructuredTextEditor has a - // bug: - // the editor can't be opened twice if the property view is shown. - // This bug only exists in WTP 1.0.0 version. - if (part instanceof StructuredTextEditor) { - return null; - } - // Try to get an property page. - Object obj = part.getAdapter(IPropertySheetPage.class); - if (obj instanceof IPropertySheetPage) { - IPropertySheetPage page = (IPropertySheetPage) obj; - - page.createControl(getPageBook()); - - return new PageRec(part, page); - } - // There is no content property page - return null; - } - - private void createDefaultPage() { - // Create the default PropertySheetPage rec. - IPropertySheetPage defaultPage = new PropertySheetPage(); - defaultPage.createControl(getPageBook()); - - defaultPageRec = new PageRec(null, defaultPage); - } - - /** - * Returns the pagebook control for this view. - * - * @return the pagebook control, or <code>null</code> if not initialized - */ - protected PageBook getPageBook() { - return pageBook; - } - - /** - * Returns the page record for the given part. - * - * @param part - * the part - * @return the corresponding page record, or <code>null</code> if not - * found - */ - protected PageRec getPageRec(Object part) { - return (PageRec) mapPartToRec.get(part); - } - - /* - * (non-Javadoc) - * - * @see ISection#setInput(IWorkbenchPart, ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection selection) { - if (part instanceof MultiPageEditorPart) { - IEditorPart subPage = (IEditorPart) part - .getAdapter(IEditorPart.class); - if (subPage != null) { - // get or Create a PropertySheetPage for the part. - PageRec rec = getPageRec(subPage); - if (rec == null) { - rec = createPage(subPage); - } - - // Show the page. - if (rec != null) { - showPageRec(rec); - } else { - showPageRec(defaultPageRec); - } - } - } - activeRec.page.selectionChanged(part, selection); - } - - /* - * (non-Javadoc) - * - * @see ISection#aboutToBeShown() - */ - public void aboutToBeShown() { - refresh(); - } - - /* - * (non-Javadoc) - * - * @see ISection#aboutToBeHidden() - */ - public void aboutToBeHidden() { - // do nothing - } - - /* - * (non-Javadoc) - * - * @see ISection#dispose() - */ - public void dispose() { - // Deref all of the pages. - activeRec = null; - if (defaultPageRec != null) { - // check for null since the default page may not have - // been created (ex. perspective never visible) - defaultPageRec.page.dispose(); - defaultPageRec = null; - } - Map clone = (Map) ((HashMap) mapPartToRec).clone(); - Iterator iter = clone.values().iterator(); - while (iter.hasNext()) { - PageRec rec = (PageRec) iter.next(); - removePage(rec); - } - } - - /** - * Removes a page record. If it is the last reference to the page dispose of - * it - otherwise just decrement the reference count. - * - * @param rec - */ - private void removePage(PageRec rec) { - mapPartToRec.remove(rec.part); - - Control control = rec.page.getControl(); - if (control != null && !control.isDisposed()) { - // Dispose the page's control so pages don't have to do this in - // their - // dispose method. - // The page's control is a child of this view's control so if this - // view - // is closed, the page's control will already be disposed. - control.dispose(); - } - - // free the page - doDestroyPage(rec.part, rec); - } - - /** - * Destroys a page in the pagebook for a particular part. - * - * @param part - * the input part - * @param rec - * a page record for the part - */ - protected void doDestroyPage(IWorkbenchPart part, PageRec rec) { - IPropertySheetPage page = rec.page; - page.dispose(); - rec.dispose(); - } - - /* - * (non-Javadoc) - * - * @see ISection#getMinimumHeight() - */ - public int getMinimumHeight() { - return SWT.DEFAULT; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.xtools.common.ui.properties.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() { - /** - * here should return true, otherwise, the component controls will not - * fill the whole panel of the tab. - */ - return true; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.xtools.common.ui.properties.ISection#refresh() - */ - public void refresh() { - return; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) { - setInput((IWorkbenchPart) event.getSource(), event.getSelection()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/GeneralViewSectionDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/GeneralViewSectionDescriptor.java deleted file mode 100644 index 4a7502807..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/GeneralViewSectionDescriptor.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.List; - -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementTreeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowLinkEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; - -/** - * This class defines the section descriptor for pageflow attributes. Following - * is the typical function of SectionDescriptor for tabbed property views. 1. In - * tabbed property view, there are multiple sections, one or more than one - * sections can be composed of one tab. 2. Each of section has an ID, and their - * relationship is defined by the function "getAfterSection". 3. Not all - * sections are enabled always. They are enabled according to current - * WorkbenchPart and selection, which is defined in function "appliesTo". - * - * @author Xiao-guang Zhang - */ -public class GeneralViewSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see ISectionDescriptor#getId() - */ - public String getId() { - return ITabbedPropertiesConstants.GENERAL_TAB_ID; - } - - - /* - * (non-Javadoc) - * - * @see ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - return null; - } - - /* - * (non-Javadoc) - * - * @see ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new GeneralViewSection(); - } - - /* - * (non-Javadoc) - * - * @see com.ibm.xtools.common.ui.properties.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return ITabbedPropertiesConstants.GENERAL_TAB_ID; - } - - /* - * (non-Javadoc) - * - * @see ISectionDescriptor#appliesTo(IWorkbenchPart, ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - // FIXME: Should move the appliesTo to differnt page of - // MultiPageEditorPart. - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) selection; - object = structuredSelection.getFirstElement(); - // The general tab will be shown for only pageflow element and - // pageflow link editparts - if (object instanceof PageflowElementEditPart - || object instanceof PageflowElementTreeEditPart) { - return true; - } else if (object instanceof PageflowLinkEditPart) { - PageflowLink pfLink = (PageflowLink) ((PageflowLinkEditPart) object) - .getModel(); - if (PageflowValidation.getInstance().isValidLinkForProperty( - pfLink)) { - return true; - } - } else { - return true; - } - } else if (selection instanceof ITextSelection) { - return true; - } - - return false; - } - - /* - * (non-Javadoc) - * - * @see ISectionDescriptor#getAfterSection() - */ - public String getAfterSection() { - return ""; //$NON-NLS-1$ - } - - public int getEnablesFor() { - return ENABLES_FOR_ANY; - } - - - public IFilter getFilter() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ITabbedPropertiesConstants.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ITabbedPropertiesConstants.java deleted file mode 100644 index 54e6e75d1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ITabbedPropertiesConstants.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -/** - * @author jchoi - * @version - */ -public interface ITabbedPropertiesConstants { - /** - * used to set grid data height hints on dialog fields - */ - public static int BROWSE_HEIGHT = 18; - - /** - * used to set grid data width hints on dialog fields - */ - public static int BROWSE_WIDTH = 20; - - /** - * the general tag id - */ - public static final String GENERAL_TAB_ID = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.general"; //$NON-NLS-1$ - - /** - * the attribute tag id - */ - public static final String ATTRIBUTE_TAB_ID = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.attribute"; //$NON-NLS-1$ - - /** - * the link section id - */ - public static final String LINK_SECTION = "attribute.link"; // 4 //$NON-NLS-1$ - - /** - * the page section id - */ - public static final String PAGE_SECTION = "attribute.page"; // 3 //$NON-NLS-1$ - - /** - * the editor section id - */ - public static final String EDITOR_SECTION = "attribute.editor"; // 1 //$NON-NLS-1$ - - /** - * the top section id - */ - public static final String TOP_SECTION = "top"; // 0 //$NON-NLS-1$ - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/LinkSectionDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/LinkSectionDescriptor.java deleted file mode 100644 index d0cc43028..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/LinkSectionDescriptor.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.List; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowLinkEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section.LinkSection; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; - -/** - * @author jchoi - * @version - */ -public class LinkSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return ITabbedPropertiesConstants.LINK_SECTION; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new LinkSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return ITabbedPropertiesConstants.ATTRIBUTE_TAB_ID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof PageflowLinkEditPart) { - PageflowLink pfLink = (PageflowLink) ((PageflowLinkEditPart) object).getModel(); - if (PageflowValidation.getInstance().isValidLinkForProperty( - pfLink)) { - - return true; - } - - } - } - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getAfterSection() - */ - public String getAfterSection() { - return ITabbedPropertiesConstants.TOP_SECTION; - } - - public int getEnablesFor() { - return ENABLES_FOR_ANY; - } - - public IFilter getFilter() { - return null; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PagePathDialogCellEditor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PagePathDialogCellEditor.java deleted file mode 100644 index fbe5502c6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PagePathDialogCellEditor.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * Dialog Cell Editor for Page path browser. - * - * @author Xiao-guang Zhang - */ -public class PagePathDialogCellEditor extends EditableDialogCellEditor { - PageflowPage element; - - /** - * Default constructor - */ - public PagePathDialogCellEditor() { - super(); - } - - /** - * @param parent - * @param element - */ - public PagePathDialogCellEditor(Composite parent, PageflowPage element) { - super(parent); - this.element = element; - } - - - /** - * @param parent - * @param style - */ - public PagePathDialogCellEditor(Composite parent, int style) { - super(parent, style); - } - - /* - * (non-Javadoc) - * - * @see DialogCellEditor#openDialogBox(Control) - */ - protected Object openDialogBox(Control cellEditorWindow) { - String jsfSelection = ""; //$NON-NLS-1$ - if (getDefaultText() != null && getDefaultText().getText().length() > 0) { - jsfSelection = getDefaultText().getText(); - IProject project = WebrootUtil.getProject(element); - ProjectWebPageSelectionDialog dlg = new ProjectWebPageSelectionDialog( - cellEditorWindow.getShell(), project); - if (dlg.open() == Window.OK) { - jsfSelection = dlg.getResultFilePath(); - } - } - return jsfSelection; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageSectionDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageSectionDescriptor.java deleted file mode 100644 index 4e7fc8096..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageSectionDescriptor.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.List; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPageImpl; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section.PageSection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; - -/** - * @author jchoi - * @version - */ -public class PageSectionDescriptor implements ISectionDescriptor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() - */ - public String getId() { - return ITabbedPropertiesConstants.PAGE_SECTION; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() - */ - public List getInputTypes() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() - */ - public ISection getSectionClass() { - return new PageSection(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() - */ - public String getTargetTab() { - return ITabbedPropertiesConstants.ATTRIBUTE_TAB_ID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public boolean appliesTo(IWorkbenchPart part, ISelection selection) { - Object object = null; - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) selection; - object = structuredSelection.getFirstElement(); - if (object instanceof PageflowNodeEditPart) { - Object model = ((PageflowNodeEditPart) object).getModel(); - if (model instanceof PageflowPageImpl) { - return true; - } - } - } - return false; - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getAfterSection() - */ - public String getAfterSection() { - return ITabbedPropertiesConstants.TOP_SECTION; - } - - public int getEnablesFor() { - return ENABLES_FOR_ANY; - } - - - public IFilter getFilter() { - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowElementPropertySource.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowElementPropertySource.java deleted file mode 100644 index 8eebce5fa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowElementPropertySource.java +++ /dev/null @@ -1,478 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor; -import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.IPropertySource; -import org.eclipse.ui.views.properties.PropertyDescriptor; -import org.eclipse.ui.views.properties.TextPropertyDescriptor; - -/** - * This class is intended to be a generic property source for all the objects in - * the application's model. It currently only supports String and boolean types, - * and doesn't support reset or nested properties. It uses information in the - * EMF EAttribute and EDataType classes to get the id, display name, and type - * information. - * - * @author Xiao-guang Zhang - */ -public class PageflowElementPropertySource implements IPropertySource { - /** attribute name of "path" and "action", which have special property editor */ - private static final String PAGEFLOW_PATH = "path"; //$NON-NLS-1$ - - static final String PAGEFLOW_NAME = "name"; //$NON-NLS-1$ - - static final String PAGEFLOW_COMMENT = "comment"; //$NON-NLS-1$ - - private static final String PAGEFLOW_CONFIG_FILE = "configfile"; //$NON-NLS-1$ - - /** pageflow elememt */ - PageflowElement element; - - /** boolean value's label */ - private static final String P_VALUE_TRUE_LABEL = PageflowMessages.Pageflow_Label_True; - - private static final String P_VALUE_FALSE_LABEL = PageflowMessages.Pageflow_Label_False; - - /** Integer value for boolean type */ - private static final int P_VALUE_TRUE = 0; - - private static final int P_VALUE_FALSE = 1; - - static class BooleanLabelProvider extends LabelProvider { - public String getText(Object element) { - String[] values = new String[] { P_VALUE_TRUE_LABEL, - P_VALUE_FALSE_LABEL }; - return values[((Integer) element).intValue()]; - } - - public Image getImage(Object element) { - return EditorPlugin.getDefault().getImage( - "facesconfig/Pageflow_BooleanValue.gif"); //$NON-NLS-1$ - } - } - - static class PageflowLabelProvider extends LabelProvider { - - public Image getImage(Object element) { - if (element instanceof String) { - return EditorPlugin.getDefault().getImage( - "facesconfig/Pageflow_TextValue.gif");//$NON-NLS-1$ - } else if (element instanceof Integer) { - return EditorPlugin.getDefault().getImage( - "facesconfig/Pageflow_IntegralValue.gif");//$NON-NLS-1$ - } else { - return EditorPlugin.getDefault().getImage( - "facesconfig/Pageflow_GenericValue.gif");//$NON-NLS-1$ - } - } - } - - /** - * constructor - * - * @param element - - * pageflow element model. - */ - public PageflowElementPropertySource(PageflowElement element) { - this.element = element; - } - - /* - * (non-Javadoc) - * - * @see IPropertySource#getEditableValue() - */ - public Object getEditableValue() { - return element; - } - - /* - * (non-Javadoc) - * - * @see IPropertySource#getPropertyDescriptors() - */ - public IPropertyDescriptor[] getPropertyDescriptors() { - // property descriptors - List propertyDescriptors = new Vector(); - - // if (element instanceof PageflowLink) { - // return getLinkPropertyDescriptors(); - // } - - Iterator it; - EClass cls = element.eClass(); - - it = cls.getEAllAttributes().iterator(); - while (it.hasNext()) { - EAttribute attr = (EAttribute) it.next(); - if (attr.isID() - || attr.getFeatureID() == PageflowPackage.PAGEFLOW__REFERENCE_LINK) { - continue; - } - EDataType type = attr.getEAttributeType(); - if (type.getInstanceClass() == String.class) { - PropertyDescriptor propertyDescriptor; - if (attr.getName().equalsIgnoreCase(PAGEFLOW_PATH)) { - propertyDescriptor = getPagePathPropertyDescriptor(attr); - } else if (attr.getName() - .equalsIgnoreCase(PAGEFLOW_CONFIG_FILE)) { - propertyDescriptor = null; - } else { - propertyDescriptor = new TextPropertyDescriptor(Integer - .toString(attr.getFeatureID()), getString(attr - .getName())); - } - if (propertyDescriptor != null) { - propertyDescriptor - .setLabelProvider(new PageflowLabelProvider()); - propertyDescriptors.add(propertyDescriptor); - } - - } else if (type.getInstanceClass() == boolean.class) { - PropertyDescriptor propertyDescriptor; - propertyDescriptor = getBooleanTypePropertyDescriptor(attr); - propertyDescriptor.setLabelProvider(new BooleanLabelProvider()); - propertyDescriptors.add(propertyDescriptor); - } - } - - return (IPropertyDescriptor[]) propertyDescriptors - .toArray(new IPropertyDescriptor[] {}); - } - - /** - * @return - */ - // TODO: method not used; dead? -// private IPropertyDescriptor[] getLinkPropertyDescriptors() { -// // property descriptors -// List propertyDescriptors = new Vector(); -// -// Iterator it; -// EClass cls = element.eClass(); -// -// it = cls.getEAllAttributes().iterator(); -// while (it.hasNext()) { -// EAttribute attr = (EAttribute) it.next(); -// if (attr.isID() -// || attr.getName().equalsIgnoreCase(PAGEFLOW_NAME) -// || attr.getName().equalsIgnoreCase(PAGEFLOW_COMMENT) -// || attr.getFeatureID() == PageflowPackage.PAGEFLOW__REFERENCE_LINK) { -// continue; -// } -// -// EDataType type = attr.getEAttributeType(); -// if (type.getInstanceClass() == String.class) { -// PropertyDescriptor propertyDescriptor; -// -// propertyDescriptor = new TextPropertyDescriptor(Integer -// .toString(attr.getFeatureID()), getString(attr -// .getName())); -// -// if (propertyDescriptor != null) { -// propertyDescriptor -// .setLabelProvider(new PageflowLabelProvider()); -// propertyDescriptors.add(propertyDescriptor); -// } -// -// } else if (type.getInstanceClass() == boolean.class) { -// PropertyDescriptor propertyDescriptor; -// propertyDescriptor = getBooleanTypePropertyDescriptor(attr); -// propertyDescriptor.setLabelProvider(new BooleanLabelProvider()); -// propertyDescriptors.add(propertyDescriptor); -// } -// } -// -// return (IPropertyDescriptor[]) propertyDescriptors -// .toArray(new IPropertyDescriptor[] {}); -// } - - /** - * get the property descriptor for the attribute "path" of page component - * - * @param attr - - * EAttribute - * @return - */ - private PropertyDescriptor getPagePathPropertyDescriptor(EAttribute attr) { - PropertyDescriptor propertyDescriptor = new PropertyDescriptor(Integer - .toString(attr.getFeatureID()), getString(attr.getName())) { - public CellEditor createPropertyEditor(Composite parent) { - CellEditor editor = new PagePathDialogCellEditor(parent, - (PageflowPage) element); - if (getValidator() != null) { - editor.setValidator(getValidator()); - } - return editor; - } - - /** - * Returns the input validator for editing the property. - * - * @return the validator used to verify correct values for this - * property, or <code>null</code> - */ - protected ICellEditorValidator getValidator() { - return new ICellEditorValidator() { - public String isValid(Object value) { - if (((PageflowPage) element).getPath() != null - && value != null - && !((PageflowPage) element).getPath() - .equalsIgnoreCase((String) value)) { - if (PageflowValidation.getInstance().isExistedPage( - ((PageflowPage) element).getPageflow(), - (String) value)) { - // Pageflow.PageflowEditor.Alert.DNDResourceTitle - // = Pageflow Creation Error - // Pageflow.PageflowEditor.Alert.ExistingPage = - // The web page {0} is already existed in - // current PageFlow. - EditorPlugin - .getAlerts() - .error( - "Pageflow.PageflowEditor.Alert.DNDResourceTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.ExistingPage", //$NON-NLS-1$ - value); - - return EditorPlugin - .getResourceString("Pageflow.PageflowEditor.Alert.ExistingPage"); //$NON-NLS-1$ - } - } - return null; - } - - }; - } - - }; - return propertyDescriptor; - } - - /** - * get the property descriptor for the attribute "action" of Action - * component - * - * @param attr - - * EAttribute - * @return - */ - // TODO: method not used; dead? -// private PropertyDescriptor getActionPropertyDescriptor(EAttribute attr) { -// PropertyDescriptor propertyDescriptor = new PropertyDescriptor(Integer -// .toString(attr.getFeatureID()), getString(attr.getName())) { -// public CellEditor createPropertyEditor(Composite parent) { -// CellEditor editor = new ActionDialogCellEditor(parent); -// if (getValidator() != null) { -// editor.setValidator(getValidator()); -// } -// return editor; -// } -// -// /** -// * Returns the input validator for editing the property. -// * -// * @return the validator used to verify correct values for this -// * property, or <code>null</code> -// */ -// protected ICellEditorValidator getValidator() { -// return new ICellEditorValidator() { -// public String isValid(Object value) { -// -// return null; -// } -// -// }; -// } -// }; -// return propertyDescriptor; -// } - - /** - * get the property descriptor for the attribute "outcome" of Link component - * - * @param attr - - * EAttribute - * @return - */ - // TODO: method not used; dead? -// private PropertyDescriptor getActionOutcomePropertyDescriptor( -// EAttribute attr) { -// PropertyDescriptor propertyDescriptor = new PropertyDescriptor(Integer -// .toString(attr.getFeatureID()), getString(attr.getName())) { -// public CellEditor createPropertyEditor(Composite parent) { -// CellEditor editor = new ActionOutcomeDialogCellEditor(parent, -// element); -// if (getValidator() != null) { -// editor.setValidator(getValidator()); -// } -// return editor; -// } -// }; -// return propertyDescriptor; -// } - - /** - * get property descriptor for the attribute with the boolean type - * - * @param attr - - * EAttribute - * @return - */ - PropertyDescriptor getBooleanTypePropertyDescriptor(EAttribute attr) { - PropertyDescriptor propertyDescriptor; - propertyDescriptor = new ComboBoxPropertyDescriptor(Integer - .toString(attr.getFeatureID()), getString(attr.getName()), - new String[] { P_VALUE_TRUE_LABEL, P_VALUE_FALSE_LABEL }); - return propertyDescriptor; - } - - /** - * Get a translated string from the resource locator. - * @param key - * @return the string for the key - */ - protected final String getString(String key) { - if ("comment".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_comment; - } - - if ("name".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_name; - } - - if ("largeicon".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_largeicon; - } - - if ("smallicon".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_smallicon; - } - - if ("source".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_source; - } - - if ("target".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_target; - } - - if ("fromaction".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_fromaction; - } - - if ("path".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_path; - } - if ("begin".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_begin; - } - if ("end".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_end; - } - if ("configfile".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_configfile; - } - if ("outcome".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_outcome; - } - if ("redirect".equals(key)) { //$NON-NLS-1$ - return PageflowMessages.Pageflow_Model_Attributes_redirect; - } - - return ""; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see IPropertySource#getPropertyValue(Object) - */ - public Object getPropertyValue(Object id) { - EStructuralFeature feature = element.eClass().getEStructuralFeature( - Integer.parseInt((String) id)); - - Object result = element.eGet(feature); - - if (result instanceof Boolean) { - if (result == Boolean.TRUE) { - result = new Integer(P_VALUE_TRUE); - } else { - result = new Integer(P_VALUE_FALSE); - } - } - - return result != null ? result : ""; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see IPropertySource#isPropertySet(Object) - */ - public boolean isPropertySet(Object id) { - return false; - } - - /* - * (non-Javadoc) - * - * @see IPropertySouce#resetPropertyValue(Object) - */ - public void resetPropertyValue(Object id) { - // do nothing - } - - /* - * (non-Javadoc) - * - * @see IPropertySource#setPropertyValue(Object, Object) - */ - public void setPropertyValue(Object id, Object value) { - EStructuralFeature feature = element.eClass().getEStructuralFeature( - Integer.parseInt((String) id)); - - Object result = element.eGet(feature); - // if the attribute is boolean type, the value should be changed from - // string "true" or "false" - // to Boolean.TRUE or Boolean.FALSE - if (result instanceof Boolean) { - if (value.equals(new Integer(P_VALUE_TRUE))) { - value = Boolean.TRUE; - } else { - value = Boolean.FALSE; - } - } - element.eSet(feature, value); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowLinkPropertySource.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowLinkPropertySource.java deleted file mode 100644 index e3c1f304a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowLinkPropertySource.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.PropertyDescriptor; -import org.eclipse.ui.views.properties.TextPropertyDescriptor; - -/** - * The property source for Pageflow Link. - * - * @author hmeng - */ - -public class PageflowLinkPropertySource extends PageflowElementPropertySource { - - /** - * @param element - */ - public PageflowLinkPropertySource(PageflowElement element) { - super(element); - } - - public Object getPropertyValue(Object id) { - Object result = super.getPropertyValue(id); - if (Integer.parseInt((String) id) == PageflowPackage.PF_LINK__SOURCE - || Integer.parseInt((String) id) == PageflowPackage.PF_LINK__TARGET) { - result = ((PageflowPage) result).getPath(); - } - return result; - } - - public void setPropertyValue(Object id, Object value) { - if (Integer.parseInt((String) id) == PageflowPackage.PF_LINK__SOURCE) { - ((PageflowLink) element).setSourcePath((String) value); - - } else if (Integer.parseInt((String) id) == PageflowPackage.PF_LINK__TARGET) { - ((PageflowLink) element).setTargetPath((String) value); - } else { - super.setPropertyValue(id, value); - } - } - - public IPropertyDescriptor[] getPropertyDescriptors() { - // property descriptors - List propertyDescriptors = new Vector(); - - Iterator it; - EClass cls = element.eClass(); - - it = cls.getEAllAttributes().iterator(); - while (it.hasNext()) { - EAttribute attr = (EAttribute) it.next(); - if (attr.isID() - || attr.getName().equalsIgnoreCase(PAGEFLOW_NAME) - || attr.getName().equalsIgnoreCase(PAGEFLOW_COMMENT) - || attr.getFeatureID() == PageflowPackage.PAGEFLOW__REFERENCE_LINK) { - continue; - } - - EDataType type = attr.getEAttributeType(); - if (type.getInstanceClass() == String.class) { - PropertyDescriptor propertyDescriptor; - - propertyDescriptor = new TextPropertyDescriptor(Integer - .toString(attr.getFeatureID()), - getString(attr.getName())); - - if (propertyDescriptor != null) { - propertyDescriptor - .setLabelProvider(new PageflowLabelProvider()); - propertyDescriptors.add(propertyDescriptor); - } - - } else if (type.getInstanceClass() == boolean.class) { - PropertyDescriptor propertyDescriptor; - propertyDescriptor = getBooleanTypePropertyDescriptor(attr); - propertyDescriptor.setLabelProvider(new BooleanLabelProvider()); - propertyDescriptors.add(propertyDescriptor); - } - } - it = cls.getEReferences().iterator(); - while (it.hasNext()) { - EReference attr = (EReference) it.next(); - if (attr.getFeatureID() == PageflowPackage.PF_LINK__SOURCE - || attr.getFeatureID() == PageflowPackage.PF_LINK__TARGET) { - - PropertyDescriptor propertyDescriptor; - - propertyDescriptor = getExistingPagePathPropertyDescriptor(attr); - - if (propertyDescriptor != null) { - propertyDescriptor - .setLabelProvider(new PageflowLabelProvider()); - propertyDescriptors.add(propertyDescriptor); - } - } - } - - return (IPropertyDescriptor[]) propertyDescriptors - .toArray(new IPropertyDescriptor[] {}); - } - - /** - * The link's ends can be modified to another page existing in current pageflow. - * @param attr - * @return - */ - private PropertyDescriptor getExistingPagePathPropertyDescriptor( - EReference attr) { - PropertyDescriptor propertyDescriptor = new PropertyDescriptor(Integer - .toString(attr.getFeatureID()), getString(attr.getName())) { - public CellEditor createPropertyEditor(Composite parent) { - CellEditor editor = new ExistingPagePathDialogCellEditor( - parent, (Pageflow) element.eContainer()); - if (getValidator() != null) { - editor.setValidator(getValidator()); - } - return editor; - } - - /** - * Returns the input validator for editing the property. - * - * @return the validator used to verify correct values for this - * property, or <code>null</code> - */ - protected ICellEditorValidator getValidator() { - return new ICellEditorValidator() { - public String isValid(Object value) { - if (value != null) { - if (!PageflowValidation.getInstance() - .isExistedPage( - ((Pageflow) element.eContainer()), - (String) value)) { - // Pageflow.PageflowEditor.Alert.DNDResourceTitle - // = Pageflow Creation Error - // Pageflow.PageflowEditor.Alert.ExistingPage = - // The web page {0} is already existed in - // current PageFlow. - EditorPlugin.getAlerts().info(PageflowMessages.PageflowLinkPropertySource_Title, - PageflowMessages.PageflowLinkPropertySource_Text); - // "Pageflow.PageflowEditor.Alert.DNDResourceTitle", - // "Pageflow.PageflowEditor.Alert.ExistingPage", - // (String) value); - - return EditorPlugin - .getResourceString("Pageflow.PageflowEditor.Alert.ExistingPage"); //$NON-NLS-1$ - } - } - return null; - } - - }; - } - - }; - return propertyDescriptor; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowSectionDescriptorProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowSectionDescriptorProvider.java deleted file mode 100644 index e36d2828e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowSectionDescriptorProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; -import org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider; - -/** - * this class defines all section descriptors for pageflow. Similar with - * PropertyDescriptors, this class defines all sections used by pageflow through - * SectionDescriptor. - * - */ -public class PageflowSectionDescriptorProvider implements - ISectionDescriptorProvider { - /** - * Default constructor - */ - public PageflowSectionDescriptorProvider() { - super(); - } - - /* - * (non-Javadoc) - * - * @see ISectionDescriptorProvider#getSectionDescriptors() - */ - public ISectionDescriptor[] getSectionDescriptors() { - ISectionDescriptor[] descriptors = new ISectionDescriptor[] { - new LinkSectionDescriptor(), new PageSectionDescriptor(), - new EditorSectionDescriptor(), - new GeneralViewSectionDescriptor() }; - return descriptors; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowSectionLabelProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowSectionLabelProvider.java deleted file mode 100644 index 1c72dae2b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PageflowSectionLabelProvider.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.gef.editparts.AbstractEditPart; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementTreeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowLinkEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.swt.graphics.Image; - -/** - * This class defines label provider for the property view's title. Tabbed - * property view has a common area as a Title. Different decription and image - * can be shown according to Different selection. - * - */ -public class PageflowSectionLabelProvider extends LabelProvider { - - private static final String PAGEFLOW_IMAGE_FILE = "facesconfig/FacesConfig_Pageflow16.gif"; //$NON-NLS-1$ - - /** - * Default constructor - */ - public PageflowSectionLabelProvider() { - super(); - } - - /* - * (non-Javadoc) - * - * @see getImage(java.lang.Object) - */ - public Image getImage(Object object) { - Image result = EditorPlugin.getDefault().getImage( - PAGEFLOW_IMAGE_FILE); - - return result; - } - - /* - * (non-Javadoc) - * - * @see getText(java.lang.Object) - */ - public String getText(Object object) { - String result = null; - if (object instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) object; - Object pageflow = structuredSelection.getFirstElement(); - if (pageflow instanceof PageflowElementEditPart - || pageflow instanceof PageflowLinkEditPart - || pageflow instanceof PageflowElementTreeEditPart) { - - if (((PageflowElement) ((AbstractEditPart) pageflow).getModel()) - .eClass() == PageflowPackage.eINSTANCE.getPageflow()) { - result = PageflowMessages.Pageflow_Model_Items_Pageflow; - } else if (((PageflowElement) ((AbstractEditPart) pageflow) - .getModel()).eClass() == PageflowPackage.eINSTANCE - .getPFPage()) { - result = PageflowMessages.Pageflow_Model_Items_PFPage; - } else if (((PageflowElement) ((AbstractEditPart) pageflow) - .getModel()).eClass() == PageflowPackage.eINSTANCE - .getPFLink()) { - result = PageflowMessages.Pageflow_Model_Items_PFLink; - } - } - } - return result; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ProjectWebPageSelectionDialog.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ProjectWebPageSelectionDialog.java deleted file mode 100644 index 7d668d7d1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ProjectWebPageSelectionDialog.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.jsf.common.ui.internal.dialogs.CommonResourceDialog; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.swt.widgets.Shell; - -/** - * @author hmeng - */ - -public class ProjectWebPageSelectionDialog extends CommonResourceDialog { - - /** - * @param parentShell - * @param project - * @param style - */ - public ProjectWebPageSelectionDialog(Shell parentShell, IProject project, - int style) { - super(parentShell, project, style); - init(); - } - - /** - * @param parentShell - * @param project - */ - public ProjectWebPageSelectionDialog(Shell parentShell, IProject project) { - super(parentShell, project); - init(); - } - - private void init() { - setResourceDescription(PageflowMessages.ProjectWebPageSelectionDialog_Description); - setSuffixs(new String[] { "jsp", "jspx", "jsf", "html", "htm" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - } - - /** - * @return the rseult file path - */ - public String getResultFilePath() { - String result = ""; //$NON-NLS-1$ - IFile selectedFile = (IFile) getResult()[0]; - IPath path = selectedFile.getProjectRelativePath(); - path = path.removeFirstSegments(1); - result = "/" + path.toString(); //$NON-NLS-1$ - return result; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PropertyMessages.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PropertyMessages.java deleted file mode 100644 index d8fb04dc0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PropertyMessages.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties; - -import org.eclipse.osgi.util.NLS; - -/** - * NLS Message bundle for properties - * - */ -public final class PropertyMessages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PropertyMessages"; //$NON-NLS-1$ - - private PropertyMessages() { - // Do not instantiate - } - - static { - NLS.initializeMessages(BUNDLE_NAME, PropertyMessages.class); - } - - /** - * see PropertyMessages.properties - */ - public static String property_displayName; - /** - * see PropertyMessages.properties - */ - public static String property_description; - /** - * see PropertyMessages.properties - */ - public static String property_configFile; - /** - * see PropertyMessages.properties - */ - public static String property_largeIcon; - - /** - * see PropertyMessages.properties - */ - public static String property_smallIcon; - - /** - * see PropertyMessages.properties - */ - public static String property_fromAction; - - /** - * see PropertyMessages.properties - */ - public static String property_fromView; - - /** - * see PropertyMessages.properties - */ - public static String property_fromOutcome; - - /** - * see PropertyMessages.properties - */ - public static String property_redirect; - - /** - * see PropertyMessages.properties - */ - public static String property_browseButton; - - /** - * see PropertyMessages.properties - */ - public static String property_Command_SetValue; - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PropertyMessages.properties b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PropertyMessages.properties deleted file mode 100644 index 3de4f3af7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/PropertyMessages.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2007 Oracle 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: -# Oracle Corporation - initial API and implementation -############################################################################### -property_displayName=Display Name: -property_description=Description: -property_configFile=Faces-config file: -property_largeIcon=Large Icon: -property_smallIcon=Small Icon: -property_fromAction=From Action: -property_fromView=Page Path: -property_fromOutcome=From Outcome: -property_redirect=Redirect: -property_browseButton=... - -property_Command_SetValue=Set {0} Property diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/AbstractEditPartGroup.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/AbstractEditPartGroup.java deleted file mode 100644 index 6ccbc2c4f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/AbstractEditPartGroup.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogFieldGroup; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PropertyMessages; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author jchoi - * @version - */ -/*package*/ abstract class AbstractEditPartGroup extends DialogFieldGroup { - - private StringDialogField descField; - - private StringDialogField displayNameField; - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#initialize() - */ - public void initialize() { - displayNameField = new StringDialogField(); - displayNameField.setLabelText(PropertyMessages.property_displayName); - displayNameField - .setDialogFieldChangeListener(getDefaultChangeListener()); - descField = new StringDialogField(); - - descField.setLabelText(PropertyMessages.property_description); - descField.setDialogFieldChangeListener(getDefaultChangeListener()); - - } - - - /** - * @param toolkit - * @param parent - * @param col - */ - protected void layoutDialogFields(FormToolkit toolkit, Composite parent, - int col) { - displayNameField.doFillIntoGrid(toolkit, parent, col); - descField.doFillIntoGrid(toolkit, parent, col); - - } - - /** - * @param elem - */ - protected void refreshData(PageflowElement elem) { - descField.setTextWithoutUpdate(elem.getComment()); - displayNameField.setTextWithoutUpdate(elem.getName()); - } - - /** - * @return the description field - */ - protected StringDialogField getDescField() { - return descField; - } - - /** - * @return the display name field - */ - protected StringDialogField getDisplayNameField() { - return displayNameField; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#initialize() - */ - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#validateDialogFields() - */ - public IStatus[] validateDialogFields() { - - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/AbstractEditPartSection.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/AbstractEditPartSection.java deleted file mode 100644 index 00dcfca48..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/AbstractEditPartSection.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.gef.commands.CommandStackListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldChangeListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.IPropertySource; -import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; - -/** - * This is base section, which support GEF command stack to redo/undo setting - * properties. - * - * @author jchoi, Xiao-guang Zhang - */ -/*package*/ abstract class AbstractEditPartSection extends AbstractPropertySection { - - IDialogFieldChangeListener changeListener = new IDialogFieldChangeListener() { - public void dialogFieldChanged(DialogField field) { - validate(); - } - }; - - /** property source of edit part */ - private IPropertySource propertySource; - - /** EditPart instance */ - private EditPart editPart; - - /** map for property registry to store a map between the property id and name */ - private Map propertyRegistry; - - /** GEF command stack */ - private CommandStack commandStack; - - /** command stack listener to refresh the section */ - private CommandStackListener commandStackListener; - - /** - * - */ - public AbstractEditPartSection() { - super(); - } - - /** - * refresh the whole section - * - */ - public void refreshData() { - super.refresh(); - } - - /** - * TODO: this method seems unused - */ - public abstract void validate(); - - /** - * dispose the command stack listener - */ - public void dispose() { - super.dispose(); - if (getCommandStack() != null) { - getCommandStack().removeCommandStackListener( - getCommandStackListener()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection selection) { - if (part != null) { - if (part.getAdapter(CommandStack.class) != null) { - setCommandStack((CommandStack) part - .getAdapter(CommandStack.class)); - } - - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) selection; - if (structuredSelection.getFirstElement() instanceof EditPart) { - editPart = (EditPart) structuredSelection.getFirstElement(); - } - - if (editPart != null - && ((IAdaptable) editPart) - .getAdapter(IPropertySource.class) != null) { - propertySource = (IPropertySource) ((IAdaptable) editPart) - .getAdapter(IPropertySource.class); - } - - } - } - - super.setInput(part, selection); - } - - /** - * get the commandstacklistener, if not existed, create a new one. - * - * @return - */ - private CommandStackListener getCommandStackListener() { - if (commandStackListener == null) { - commandStackListener = new CommandStackListener() { - public void commandStackChanged(EventObject e) { - refreshData(); - } - }; - } - return commandStackListener; - } - - /** - * set a <code>CommandStack</code> forthis section, and add a - * <code>CommandStackListener</code> for this commandstack - * - * @param stack - */ - public void setCommandStack(CommandStack stack) { - commandStack = stack; - stack.addCommandStackListener(getCommandStackListener()); - } - - /** - * get the <code>CommandStack</code> - * - * @return the command stack - */ - public CommandStack getCommandStack() { - return commandStack; - } - - /** - * get the property source registered for current editpart - * - * @return the property source - */ - public IPropertySource getPropertySource() { - return propertySource; - } - - /** - * get the property's EMF featureID based on property name. - * - * @param propertyName - * @return the feature id for propertyName - */ - protected Object getFeatureID(String propertyName) { - if (editPart != null && !(editPart.getModel() instanceof EObject)) { - return null; - } - - Object propertyID = getPropertyRegistry().get(propertyName); - if (propertyID == null) { - - EClass cls = ((EObject) editPart.getModel()).eClass(); - for (Iterator it = cls.getEAllAttributes().iterator(); it.hasNext();) { - EAttribute attr = (EAttribute) it.next(); - if (attr.getName().equalsIgnoreCase(propertyName)) { - propertyID = Integer.toString(attr.getFeatureID()); - getPropertyRegistry().put(propertyName, propertyID); - break; - } - } - } - return propertyID; - } - - /** - * @return the property registry - */ - protected Map getPropertyRegistry() { - if (propertyRegistry == null) { - propertyRegistry = new HashMap(); - } - return propertyRegistry; - } - - /** - * get the input edit part - * - * @return the input - */ - public Object getInput() { - return editPart; - } - - /** - * set the value of property - * - * @param propertyName - * @param propertyValue - */ - public void setValue(String propertyName, Object propertyValue) { - if (propertyName != null && propertyValue != null - && getPropertySource() != null) { - SetPropertyValueCommand setCommand = new SetPropertyValueCommand( - propertyName); - setCommand.setTarget(getPropertySource()); - setCommand.setPropertyId(getFeatureID(propertyName)); - setCommand.setPropertyValue(propertyValue); - if (getCommandStack() != null) { - getCommandStack().execute(setCommand); - } else { - setCommand.execute(); - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/EditorGroup.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/EditorGroup.java deleted file mode 100644 index dd6bea929..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/EditorGroup.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author jchoi - * @version - */ -/*package*/ class EditorGroup extends AbstractEditPartGroup { - private Pageflow pageflow = null; - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#initialize() - */ - public void initialize() { - super.initialize(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#refreshData() - */ - public void refreshData() { - if (pageflow != null) { - super.refreshData(pageflow); - } - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#layoutDialogFields(org.eclipse.ui.forms.widgets.FormToolkit, - * org.eclipse.swt.widgets.Composite) - */ - public void layoutDialogFields(FormToolkit toolkit, Composite parent) { - Composite top; - if (toolkit == null) { - top = new Composite(parent, SWT.NONE); - } else { - top = toolkit.createComposite(parent); - } - FillLayout fillLayout = new FillLayout(SWT.VERTICAL); - parent.setLayout(fillLayout); - - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - top.setLayout(layout); - - Label separator = toolkit.createSeparator(top, SWT.HORIZONTAL); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 3; - separator.setLayoutData(data); - super.layoutDialogFields(toolkit, top, 3); - - } - - /** - * @param elem - */ - public void setPropertyProvider(Pageflow elem) { - pageflow = elem; - this.refreshData(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/EditorSection.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/EditorSection.java deleted file mode 100644 index 1b9d62cd8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/EditorSection.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -/** - * Edit section for Pagflow (EditPart) - * - * @author jchoi, Xiao-guang Zhang - */ -public class EditorSection extends AbstractEditPartSection { - /** edit group */ - private EditorGroup group; - - /** the emf model for Pageflow */ - private Pageflow pageflow; - - /** - * - */ - public EditorSection() { - super(); - group = new EditorGroup(); - group.setDefaultChangeListener(changeListener); - group.initialize(); - - group.getDisplayNameField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - public void dialogFieldApplied(DialogField field) { - EditorSection.this.setValue( - PageflowPackageImpl.eINSTANCE - .getPageflowElement_Name().getName(), - group.getDisplayNameField().getText()); - } - }); - - group.getDescField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - public void dialogFieldApplied(DialogField field) { - EditorSection.this - .setValue( - PageflowPackageImpl.eINSTANCE - .getPageflowElement_Comment() - .getName(), group - .getDescField().getText()); - } - }); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage) - */ - public void createControls(Composite parent, - TabbedPropertySheetPage aTabbedPropertySheetPage) { - super.createControls(parent, aTabbedPropertySheetPage); - TabbedPropertySheetWidgetFactory factory = aTabbedPropertySheetPage - .getWidgetFactory(); - Composite top = factory.createFlatFormComposite(parent); - - group.layoutDialogFields(factory, top); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection selection) { - super.setInput(part, selection); - - if (getInput() != null && getInput() instanceof PageflowEditPart) { - Object model = ((PageflowEditPart) getInput()).getModel(); - if (model instanceof Pageflow) { - pageflow = (Pageflow) model; - refreshData(); - } - } - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.properties.sections.AbstractEditPartSection#refreshData() - */ - public void refreshData() { - super.refreshData(); - group.setPropertyProvider(pageflow); - } - - public void validate() { - // do nothing. - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/LinkGroup.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/LinkGroup.java deleted file mode 100644 index bfe0d8732..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/LinkGroup.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ComboDialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IStringButtonAdapter; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.ActionOutcomeSelectionDialog; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.ITabbedPropertiesConstants; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PropertyMessages; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author jchoi - * @version - */ -/*package*/ class LinkGroup extends AbstractEditPartGroup { - private StringButtonDialogField fromOutcomeField; - - private StringDialogField fromActionField; - - private ComboDialogField redirectField; - - private PageflowLink pfLink; - - /** Integer value for boolean type */ - private static final Integer P_VALUE_TRUE = new Integer(0); - - private static final Integer P_VALUE_FALSE = new Integer(1); - - private class StringButtonAdapter implements IStringButtonAdapter { - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.IStringButtonAdapter#changeControlPressed(org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogField) - */ - public void changeControlPressed(DialogField field) { - String outcome = ""; //$NON-NLS-1$ - String jspPage = ""; //$NON-NLS-1$ - Shell shell = field.getLabelControl(null, null).getShell(); - if (pfLink != null) { - outcome = pfLink.getOutcome(); - jspPage = WebrootUtil.getProjectPath(pfLink, - getPreviousJSPPath(pfLink)); - ActionOutcomeSelectionDialog actionDialog = new ActionOutcomeSelectionDialog( - shell, outcome, jspPage); - if (actionDialog.open() == Window.OK) { - outcome = actionDialog.getSelectedAction(); - fromOutcomeField.setText(outcome); - pfLink.setOutcome(outcome); - refreshData(); - } - } - } - - /** - * @param _element - * @return - */ - private String getPreviousJSPPath(PageflowElement element) { - String jspPath = null; - if (element instanceof PageflowLink) { - PageflowNode source = ((PageflowLink) element).getSource(); - if (source instanceof PageflowPage) { - jspPath = ((PageflowPage) source).getPath(); - } - } - return jspPath; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#initialize() - */ - public void initialize() { - fromOutcomeField = new StringButtonDialogField( - new StringButtonAdapter()); - fromOutcomeField.setLabelText(PropertyMessages.property_fromOutcome); - fromOutcomeField.setButtonLabel(PropertyMessages.property_browseButton); - fromOutcomeField - .setDialogFieldChangeListener(getDefaultChangeListener()); - fromActionField = new StringDialogField(); - fromActionField.setLabelText(PropertyMessages.property_fromAction); - fromActionField - .setDialogFieldChangeListener(getDefaultChangeListener()); - redirectField = new ComboDialogField(SWT.DROP_DOWN | SWT.READ_ONLY); - redirectField.setLabelText(PropertyMessages.property_redirect); - redirectField - .setDialogFieldChangeListener((getDefaultChangeListener())); - List redirectList; - redirectList = new ArrayList(); - redirectList.add(Boolean.TRUE.toString()); - redirectList.add(Boolean.FALSE.toString()); - redirectField.setItems((String[]) redirectList.toArray(new String[0])); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#refreshData() - */ - public void refreshData() { - if (pfLink != null) { - fromOutcomeField.setTextWithoutUpdate(pfLink.getOutcome()); - fromActionField.setTextWithoutUpdate(pfLink.getFromaction()); - if (pfLink.isRedirect()) { - redirectField.setTextWithoutUpdate(Boolean.TRUE.toString()); - } else { - redirectField.setTextWithoutUpdate(Boolean.FALSE.toString()); - } - } - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#layoutDialogFields(org.eclipse.ui.forms.widgets.FormToolkit, - * org.eclipse.swt.widgets.Composite) - */ - public void layoutDialogFields(FormToolkit toolkit, Composite parent) { - Composite top; - if (toolkit == null) { - top = new Composite(parent, SWT.NONE); - } else { - top = toolkit.createComposite(parent); - } - FillLayout fillLayout = new FillLayout(SWT.VERTICAL); - parent.setLayout(fillLayout); - - int numberOfColumns = 4; - GridLayout layout = new GridLayout(numberOfColumns, false); - top.setLayout(layout); - - fromActionField.doFillIntoGrid(toolkit, top, numberOfColumns); - fromOutcomeField.doFillIntoGrid(toolkit, top, numberOfColumns); - redirectField.doFillIntoGrid(toolkit, top, numberOfColumns); - - LayoutUtil.setHorizontalGrabbing(fromOutcomeField.getTextControl( - toolkit, top)); - GridData data = new GridData(); - data.widthHint = ITabbedPropertiesConstants.BROWSE_WIDTH; - data.heightHint = ITabbedPropertiesConstants.BROWSE_HEIGHT; - - fromOutcomeField.getChangeControl(toolkit, top).setLayoutData(data); - - } - - /** - * @param elem - */ - public void setPropertyProvider(PageflowLink elem) { - pfLink = elem; - this.refreshData(); - } - - /** - * @return the outcome field - */ - public StringButtonDialogField getFromOutcomeField() { - return fromOutcomeField; - } - - /** - * @return the fromAction field - */ - public StringDialogField getFromActionField() { - return fromActionField; - } - - /** - * @return the redirect field - */ - public ComboDialogField getRedirectField() { - return redirectField; - } - - /** - * @return the redirect value - */ - public Integer getRedirectValue() { - if (redirectField.getText().equalsIgnoreCase(Boolean.TRUE.toString())) { - return LinkGroup.P_VALUE_TRUE; - } - return LinkGroup.P_VALUE_FALSE; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/LinkSection.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/LinkSection.java deleted file mode 100644 index c6b0dce56..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/LinkSection.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowLinkEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -/** - * Edit section for Pagflow Link element (EditPart) - * - * @author jchoi - */ -public class LinkSection extends AbstractEditPartSection { - /** edit group */ - private LinkGroup group; - - /** the emf model for Pageflow link */ - private PageflowLink pfLink; - - /** - * - */ - public LinkSection() { - super(); - group = new LinkGroup(); - group.setDefaultChangeListener(changeListener); - group.initialize(); - - group.getFromOutcomeField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - public void dialogFieldApplied(DialogField field) { - LinkSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPFLink_Outcome().getName(), group - .getFromOutcomeField().getText()); - } - }); - - group.getRedirectField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - public void dialogFieldApplied(DialogField field) { - LinkSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPFLink_Redirect().getName(), group - .getRedirectValue()); - } - }); - group.getFromActionField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - public void dialogFieldApplied(DialogField field) { - LinkSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPFLink_Fromaction().getName(), group - .getFromActionField().getText()); - } - }); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage) - */ - public void createControls(Composite parent, - TabbedPropertySheetPage aTabbedPropertySheetPage) { - super.createControls(parent, aTabbedPropertySheetPage); - TabbedPropertySheetWidgetFactory factory = aTabbedPropertySheetPage - .getWidgetFactory(); - Composite top = factory.createFlatFormComposite(parent); - - group.layoutDialogFields(factory, top); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection selection) { - super.setInput(part, selection); - - if (getInput() != null && getInput() instanceof PageflowLinkEditPart) { - Object model = ((PageflowLinkEditPart) getInput()).getModel(); - if (model instanceof PageflowLink) { - pfLink = (PageflowLink) model; - if (PageflowValidation.getInstance().isValidLinkForProperty( - pfLink)) { - refreshData(); - } - } - } - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.properties.sections.AbstractEditPartSection#refreshData() - */ - public void refreshData() { - super.refresh(); - group.setPropertyProvider(pfLink); - } - - public void validate() { - // do nothing - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/PageGroup.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/PageGroup.java deleted file mode 100644 index 6d3252bc0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/PageGroup.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IStringButtonAdapter; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.ITabbedPropertiesConstants; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.ProjectWebPageSelectionDialog; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PropertyMessages; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author jchoi - * @version - */ -/*package*/ class PageGroup extends AbstractEditPartGroup { - - private StringButtonDialogField fromViewField; - - private PageflowPage pfPage = null; - - private StringDialogField largeIconField; - - private StringDialogField smallIconField; - - class StringButtonAdapter implements IStringButtonAdapter { - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.IStringButtonAdapter#changeControlPressed(org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogField) - */ - public void changeControlPressed(DialogField field) { - IProject project = WebrootUtil.getProject(pfPage); - ProjectWebPageSelectionDialog dlg = new ProjectWebPageSelectionDialog( - field.getLabelControl(null, null).getShell(), project); - if (dlg.open() == Window.OK) { - fromViewField.setText(dlg.getResultFilePath()); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#initialize() - */ - public void initialize() { - fromViewField = new StringButtonDialogField(new StringButtonAdapter()); - fromViewField.setLabelText(PropertyMessages.property_fromView); - fromViewField.setButtonLabel(PropertyMessages.property_browseButton); - fromViewField.setDialogFieldChangeListener(getDefaultChangeListener()); - - largeIconField = new StringDialogField(); - largeIconField.setLabelText(PropertyMessages.property_largeIcon); - largeIconField - .setDialogFieldChangeListener((getDefaultChangeListener())); - smallIconField = new StringDialogField(); - smallIconField.setLabelText(PropertyMessages.property_smallIcon); - smallIconField - .setDialogFieldChangeListener((getDefaultChangeListener())); - super.initialize(); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#refreshData() - */ - public void refreshData() { - if (pfPage != null) { - fromViewField.setTextWithoutUpdate(assertString(pfPage.getPath())); - largeIconField.setTextWithoutUpdate(assertString(pfPage - .getLargeicon())); - smallIconField.setTextWithoutUpdate(assertString(pfPage - .getSmallicon())); - super.refreshData(pfPage); - - } - - } - /** - * @param value - * @return the assertion string - */ - private static String assertString(String value) { - return value == null ? "" : value; //$NON-NLS-1$ - } - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.jsf.facesconfig.ui.common.dialogfield.DialogFieldGroup#layoutDialogFields(org.eclipse.ui.forms.widgets.FormToolkit, - * org.eclipse.swt.widgets.Composite) - */ - public void layoutDialogFields(FormToolkit toolkit, Composite parent) { - Composite top; - if (toolkit == null) { - top = new Composite(parent, SWT.NONE); - } else { - top = toolkit.createComposite(parent); - } - FillLayout fillLayout = new FillLayout(SWT.VERTICAL); - parent.setLayout(fillLayout); - - int numberOfColumns = 4; - GridLayout layout = new GridLayout(numberOfColumns, false); - top.setLayout(layout); - - fromViewField.doFillIntoGrid(toolkit, top, numberOfColumns); - LayoutUtil.setHorizontalGrabbing(fromViewField.getTextControl(toolkit, - top)); - largeIconField.doFillIntoGrid(toolkit, top, numberOfColumns); - smallIconField.doFillIntoGrid(toolkit, top, numberOfColumns); - super.layoutDialogFields(toolkit, top, 4); - - GridData data = new GridData(); - data.widthHint = ITabbedPropertiesConstants.BROWSE_WIDTH; - data.heightHint = ITabbedPropertiesConstants.BROWSE_HEIGHT; - - fromViewField.getChangeControl(toolkit, top).setLayoutData(data); - } - - /** - * @param elem - */ - public void setPropertyProvider(PageflowPage elem) { - pfPage = elem; - this.refreshData(); - } - - /** - * @return the fromView field - */ - public StringButtonDialogField getFromViewField() { - return fromViewField; - } - - /** - * @return the large icon field - */ - public StringDialogField getLargeIconField() { - return largeIconField; - } - - /** - * @return the small icon field - */ - public StringDialogField getSmallIconField() { - return smallIconField; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/PageSection.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/PageSection.java deleted file mode 100644 index 5a0920355..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/PageSection.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField; -import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowValidation; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -/** - * Edit section for Pagflow Page Element (EditPart) - * - * @author jchoi, Xiao-guang Zhang - */ -public class PageSection extends AbstractEditPartSection { - /** edit group */ - private PageGroup group; - - /** the emf model for Pageflow page */ - private PageflowPage pfPage = null; - - /** - * - */ - public PageSection() { - super(); - group = new PageGroup(); - group.setDefaultChangeListener(changeListener); - group.initialize(); - - group.getFromViewField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - - public void dialogFieldApplied(DialogField field) { - if (pfPage != null) { - String jsfNew = group.getFromViewField().getText(); - if (jsfNew != null && jsfNew.length() > 0) { - if (PageflowValidation.getInstance() - .isExistedPage(pfPage.getPageflow(), - jsfNew)) { - // Pageflow.PageflowEditor.Alert.DNDResourceTitle - // = Pageflow Creation Error - // Pageflow.PageflowEditor.Alert.ExistingPage - // = The web page {0} is already existed in - // current PageFlow. - EditorPlugin - .getAlerts() - .error( - "Pageflow.PageflowEditor.Alert.DNDResourceTitle", //$NON-NLS-1$ - "Pageflow.PageflowEditor.Alert.ExistingPage", //$NON-NLS-1$ - jsfNew); - } else { - PageSection.this - .setValue( - PageflowPackageImpl.eINSTANCE - .getPFPage_Path() - .getName(), jsfNew); - } - } - } - } - }); - - group.getLargeIconField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - - public void dialogFieldApplied(DialogField field) { - PageSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPFPage_Largeicon().getName(), group - .getLargeIconField().getText()); - } - }); - group.getSmallIconField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - - public void dialogFieldApplied(DialogField field) { - PageSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPFPage_Smallicon().getName(), group - .getSmallIconField().getText()); - } - }); - - group.getDescField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - - public void dialogFieldApplied(DialogField field) { - PageSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPageflowElement_Comment().getName(), group - .getDescField().getText()); - } - }); - - group.getDisplayNameField().setDialogFieldApplyListener( - new IDialogFieldApplyListener() { - - public void dialogFieldApplied(DialogField field) { - PageSection.this.setValue(PageflowPackageImpl.eINSTANCE - .getPageflowElement_Name().getName(), group - .getDisplayNameField().getText()); - } - }); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, - * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage) - */ - public void createControls(Composite parent, - TabbedPropertySheetPage aTabbedPropertySheetPage) { - super.createControls(parent, aTabbedPropertySheetPage); - TabbedPropertySheetWidgetFactory factory = aTabbedPropertySheetPage - .getWidgetFactory(); - Composite top = factory.createFlatFormComposite(parent); - - group.layoutDialogFields(factory, top); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, - * org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection selection) { - super.setInput(part, selection); - - if (getInput() != null && getInput() instanceof PageflowNodeEditPart) { - Object model = ((PageflowNodeEditPart) getInput()).getModel(); - if (model instanceof PageflowPage) { - pfPage = (PageflowPage) model; - refreshData(); - } - } - } - - /* - * (non-Javadoc) - * - * @see com.sybase.stf.jmt.editors.pageflow.properties.sections.AbstractEditPartSection#refreshData() - */ - public void refreshData() { - super.refreshData(); - group.setPropertyProvider(pfPage); - } - - public void validate() { - // do nothing - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/SetPropertyValueCommand.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/SetPropertyValueCommand.java deleted file mode 100644 index 96d227628..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/section/SetPropertyValueCommand.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.section; - -import java.text.MessageFormat; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.properties.PropertyMessages; -import org.eclipse.ui.views.properties.IPropertySource; - -/*package*/ class SetPropertyValueCommand extends Command { - - private Object propertyValue; - - private Object propertyID; - - private Object undoValue; - - private boolean resetOnUndo; - - private IPropertySource target; - - /** - * @param propLabel - */ - public SetPropertyValueCommand(String propLabel) { - super(MessageFormat.format( - PropertyMessages.property_Command_SetValue, - new Object[] { propLabel }).trim()); - } - - public boolean canExecute() { - return true; - } - - public void execute() { - boolean wasPropertySet = getTarget().isPropertySet(propertyID); - undoValue = getTarget().getPropertyValue(propertyID); - if (undoValue instanceof IPropertySource) { - undoValue = ((IPropertySource) undoValue).getEditableValue(); - } - if (propertyValue instanceof IPropertySource) { - propertyValue = ((IPropertySource) propertyValue) - .getEditableValue(); - } - getTarget().setPropertyValue(propertyID, propertyValue); - resetOnUndo = wasPropertySet != getTarget().isPropertySet(propertyID); - if (resetOnUndo) { - undoValue = null; - } - } - - /** - * @return the target - */ - private IPropertySource getTarget() { - return target; - } - - void setTarget(IPropertySource aTarget) { - target = aTarget; - } - - public void redo() { - execute(); - } - - void setPropertyId(Object pName) { - propertyID = pName; - } - - void setPropertyValue(Object val) { - propertyValue = val; - } - - public void undo() { - if (resetOnUndo) { - getTarget().resetPropertyValue(propertyID); - } else { - getTarget().setPropertyValue(propertyID, undoValue); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/FC2PFSynchronizer.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/FC2PFSynchronizer.java deleted file mode 100644 index 2cc7a136c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/FC2PFSynchronizer.java +++ /dev/null @@ -1,271 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.facesconfig.emf.ToViewIdType; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; - -/** - * The adapter that listens to modification of faces-config and updates pageflow - * as needed. - * - * @author hmeng - * - */ - -public class FC2PFSynchronizer extends AdapterImpl { - private final boolean DEBUG = false; - - FC2PFTransformer transformer; - - private static final Logger logger = EditorPlugin - .getLogger(FC2PFSynchronizer.class); - - /** - * @param transformer - */ - public FC2PFSynchronizer(FC2PFTransformer transformer) { - this.transformer = transformer; - } - - public Notifier getTarget() { - // can't set target so return null - return null; - } - - public void setTarget(Notifier newTarget) { - // do nothing - } - - public boolean isAdapterForType(Object type) { - return type == FC2PFSynchronizer.class; - } - - public void notifyChanged(Notification notification) { - if (!isProcessorFor(notification)) { - return; - } - transformer.setInEvent(true); - try { - int type = notification.getEventType(); - switch (type) { - case Notification.ADD: { - processAdd(notification); - notifyPageflow(notification); - break; - } - case Notification.SET: { - processSet(notification); - notifyPageflow(notification); - break; - } - case Notification.REMOVE: - processRemove(notification); - notifyPageflow(notification); - break; - } - } catch (Exception e) { - logger.error(e); - } finally { - if (notification.getEventType() != Notification.REMOVING_ADAPTER) { - transformer.refreshFCAdapter((EObject) notification - .getNotifier()); - transformer.refreshPFAdapter(transformer.getPageflow()); - } - transformer.setInEvent(false); - } - } - - private boolean isProcessorFor(Notification notification) { - boolean result = false; - if (transformer.isListenToNotify() - && (notification.getNotifier() instanceof EObject)) { - if (notification.getNotifier() == transformer.getFacesConfig()) { - // For faces-config, only navigation rule's change is awared. - if (notification.getFeature() == FacesConfigPackage.eINSTANCE - .getFacesConfigType_NavigationRule()) { - result = true; - } - } else { - result = true; - } - } - return result; - } - - private void processAdd(Notification notification) { - Object feature = notification.getFeature(); - if (feature == FacesConfigPackage.eINSTANCE - .getNavigationRuleType_NavigationCase()) { - if (DEBUG) - System.out.println("New navigation case"); //$NON-NLS-1$ - NavigationCaseType newCase = (NavigationCaseType) notification - .getNewValue(); - transformer.updatePageflowElements(transformer.getPageflow(), - newCase); - } else if (feature == FacesConfigPackage.eINSTANCE - .getFacesConfigType_NavigationRule()) { - NavigationRuleType newRule = (NavigationRuleType) notification - .getNewValue(); - if (newRule.getNavigationCase().size() > 0) { - for (int i = 0; i < newRule.getNavigationCase().size(); i++) { - transformer.updatePageflowElements(transformer - .getPageflow(), (NavigationCaseType) newRule - .getNavigationCase().get(i)); - } - } - if (DEBUG) - System.out.println("New navigation rule"); //$NON-NLS-1$ - } else if (DEBUG) - System.out.println("Something is added"); //$NON-NLS-1$ - } - - /** - * Notify pageflow the changes. - * - * @param notification - */ - private void notifyPageflow(Notification notification) { - Assert.isTrue(notification.getNotifier() instanceof InternalEObject); - transformer.getPageflow().notifyModelChanged( - new ENotificationImpl((InternalEObject) notification - .getNotifier(), Notification.SET, - PageflowPackage.PAGEFLOW, null, null)); - } - - /** - * Deal with the case when some element is removed. - * - * @param notification - */ - private void processRemove(Notification notification) { - if (notification.getFeature() == FacesConfigPackage.eINSTANCE - .getNavigationRuleType_NavigationCase()) { - if (notification.getOldValue() instanceof NavigationCaseType) { - NavigationCaseType caseType = (NavigationCaseType) notification - .getOldValue(); - transformer.removeLink(caseType); - } - if (DEBUG) - System.out.println("Navigation case"); //$NON-NLS-1$ - } else if (notification.getFeature() == FacesConfigPackage.eINSTANCE - .getNavigationCaseType()) { - if (notification.getOldValue() instanceof NavigationRuleType) { - NavigationRuleType rule = (NavigationRuleType) notification - .getOldValue(); - for (int i = 0; i < rule.getNavigationCase().size(); i++) { - NavigationCaseType caseType = (NavigationCaseType) rule - .getNavigationCase().get(i); - transformer.refreshLink(caseType); - } - } - if (DEBUG) - System.out.println("navigation rule"); //$NON-NLS-1$ - } else if (notification.getFeature() == FacesConfigPackage.eINSTANCE - .getFacesConfigType_NavigationRule()) { - if (notification.getOldValue() instanceof NavigationRuleType) { - NavigationRuleType rule = (NavigationRuleType) notification - .getOldValue(); - for (int i = 0; i < rule.getNavigationCase().size(); i++) { - NavigationCaseType caseType = (NavigationCaseType) rule - .getNavigationCase().get(i); - transformer.refreshLink(caseType); - } - } - } - if (DEBUG) - System.out.println("Something is removed"); //$NON-NLS-1$ - } - - /** - * Deal with property change. - * - * @param notification - */ - private void processSet(Notification notification) { - Object feature = notification.getFeature(); - if (feature == FacesConfigPackage.eINSTANCE - .getFromViewIdType_TextContent() - || feature == FacesConfigPackage.eINSTANCE - .getNavigationRuleType_FromViewId()) { - fromViewIdChanged(notification); - } else if (feature == FacesConfigPackage.eINSTANCE - .getToViewIdType_TextContent() - || feature == FacesConfigPackage.eINSTANCE - .getNavigationCaseType_ToViewId()) { - toViewIdChanged(notification); - } - if (DEBUG) - System.out.println("Something is set"); //$NON-NLS-1$ - } - - private void fromViewIdChanged(Notification notification) { - // remove - Object feature = notification.getFeature(); - if (feature == FacesConfigPackage.eINSTANCE - .getNavigationRuleType_FromViewId() - && notification.getNewValue() == null - && notification.getOldValue() instanceof FromViewIdType) { - NavigationRuleType rule = (NavigationRuleType) notification - .getNotifier(); - for (int i = 0; i < rule.getNavigationCase().size(); i++) { - NavigationCaseType caseType = (NavigationCaseType) rule - .getNavigationCase().get(i); - transformer.refreshLink(caseType); - } - } - // add or change - else if (feature == FacesConfigPackage.eINSTANCE - .getFromViewIdType_TextContent()) { - NavigationRuleType rule = (NavigationRuleType) ((EObject) notification - .getNotifier()).eContainer(); - for (int i = 0; i < rule.getNavigationCase().size(); i++) { - NavigationCaseType caseType = (NavigationCaseType) rule - .getNavigationCase().get(i); - transformer.refreshLink(caseType); - } - } - } - - private void toViewIdChanged(Notification notification) { - // remove - Object feature = notification.getFeature(); - if (feature == FacesConfigPackage.eINSTANCE - .getNavigationCaseType_ToViewId() - && notification.getNewValue() == null - && notification.getOldValue() instanceof ToViewIdType) { - NavigationCaseType caseType = (NavigationCaseType) notification - .getNotifier(); - transformer.refreshLink(caseType); - } - // add or change - else if (feature == FacesConfigPackage.eINSTANCE - .getToViewIdType_TextContent()) { - NavigationCaseType caseType = (NavigationCaseType) ((EObject) notification - .getNotifier()).eContainer(); - transformer.refreshLink(caseType); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/FC2PFTransformer.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/FC2PFTransformer.java deleted file mode 100644 index e2a9fb08e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/FC2PFTransformer.java +++ /dev/null @@ -1,983 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType; -import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType; -import org.eclipse.jst.jsf.facesconfig.emf.IconType; -import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType; -import org.eclipse.jst.jsf.facesconfig.emf.ToViewIdType; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageReferenceElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.ReferenceElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowModelManager; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.PageflowTransform; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; - -/** - * Update and synchronize pageflow from faces-config or vice-versa. - * - * @author hmeng - * - */ - -public class FC2PFTransformer extends AdapterImpl { - - // For code debug. - private static final boolean DEBUG = false; - - /** - * the first notification event type after the defaults - */ - public static final int MY_NOTIFICATION_TYPE = Notification.EVENT_TYPE_COUNT + 1; - - /** - * the first notification event type after MY_NOTIFICATION_TYPE - */ - public static final int MY_NOTIFICATION_TYPE1 = MY_NOTIFICATION_TYPE + 1; - - /** - * The listener is active. - */ - private boolean listenToNotify; - - /** - * Avoid redundent event. - */ - private boolean isInEvent; - - boolean pageflowChanged = false; - - /** - * Perform operations batched. - */ - boolean needBatchOperations = false; - - /** - * Catches - */ - private Map mapPaths2PF = new HashMap(); - - private Map mapCases2Links = new HashMap(); - - /** - * The pageflow model. - */ - private Pageflow pageflow; - - /** - * The faces-config model. - */ - FacesConfigType facesConfig; - - /** - * Default constructor - */ - public FC2PFTransformer() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @param listenToNotify - */ - public void setListenToNotify(boolean listenToNotify) { - this.listenToNotify = listenToNotify; - } - - private void postEMFChanged() { - startFCNotify(); - // Refresh all facesConfig? - facesConfig.eNotify(new ENotificationImpl( - (InternalEObject) facesConfig, Notification.REMOVE, - FacesConfigPackage.FACES_CONFIG_TYPE__NAVIGATION_RULE, null, - null)); - List rules; - rules = facesConfig.getNavigationRule(); - for (int i = 0; i < rules.size(); i++) { - ((NavigationRuleType) rules.get(i)).eNotify(new ENotificationImpl( - (InternalEObject) rules.get(i), Notification.REMOVE, - FacesConfigPackage.NAVIGATION_RULE_TYPE__NAVIGATION_CASE, - null, null)); - } - } - - /** - * Set notify adapters. - * - */ - private void startFCNotify() { - TreeIterator iterator = facesConfig.eAllContents(); - while (iterator.hasNext()) { - EObject object = (EObject) iterator.next(); - object.eSetDeliver(true); - } - facesConfig.eSetDeliver(true); - } - - /** - * Set not notify adapters - * - * @return - */ - private TreeIterator stopFCNotify() { - TreeIterator iterator = facesConfig.eAllContents(); - // Stop the listener - while (iterator.hasNext()) { - EObject object = (EObject) iterator.next(); - object.eSetDeliver(false); - } - facesConfig.eSetDeliver(false); - return iterator; - } - - /** - * For performance issue, we are going to update DOM only after the EMF - * modifications are done. - */ - boolean isNeedBatchOperations() { - return needBatchOperations; - } - - /** - * @param enable - */ - public void setNeedBatchOperations(boolean enable) { - this.needBatchOperations = enable; - if (!enable) { - isInEvent = true; - postEMFChanged(); - isInEvent = false; - } else { - stopFCNotify(); - } - } - - private void updateFacesRule(NavigationRuleType navigationRule, - PageflowPage pageSource) { - FacesConfigFactory factory = FacesConfigFactory.eINSTANCE; - if (pageSource.getComment() != null) { - DescriptionType description = factory.createDescriptionType(); - description.setTextContent(pageSource.getComment()); - navigationRule.getDescription().clear(); - navigationRule.getDescription().add(description); - } - // set the navigation rule's icon - if (pageSource.getLargeicon() != null - || pageSource.getSmallicon() != null) { - IconType icon = factory.createIconType(); - if (pageSource.getLargeicon() != null) { - LargeIconType largeicon = factory.createLargeIconType(); - largeicon.setTextContent(pageSource.getLargeicon()); - icon.setLargeIcon(largeicon); - } - - if (pageSource.getSmallicon() != null) { - SmallIconType smallicon = factory.createSmallIconType(); - smallicon.setTextContent(pageSource.getSmallicon()); - icon.setSmallIcon(smallicon); - } - navigationRule.getIcon().clear(); - navigationRule.getIcon().add(icon); - } - if (pageSource.getName() != null) { - DisplayNameType displayName = factory.createDisplayNameType(); - displayName.setTextContent(pageSource.getName()); - navigationRule.getDisplayName().clear(); - navigationRule.getDisplayName().add(displayName); - } - } - - /** - * TODO: If we cache the case's properties in a link, then we can restore - * them. - * - * @param navigationCase - * @param link - */ - // TODO: not used, dead? -// private void updateFacesCase(NavigationCaseType navigationCase, -// PageflowLink link) { -// FacesConfigFactory factory = FacesConfigFactory.eINSTANCE; -// if (link.getComment() != null) { -// DescriptionType description = factory.createDescriptionType(); -// description.setTextContent(link.getComment()); -// navigationCase.getDescription().clear(); -// navigationCase.getDescription().add(description); -// } -// // set the navigation rule's icon -// if (link.getLargeicon() != null || link.getSmallicon() != null) { -// IconType icon = factory.createIconType(); -// if (link.getLargeicon() != null) { -// LargeIconType largeicon = factory.createLargeIconType(); -// largeicon.setTextContent(link.getLargeicon()); -// icon.setLargeIcon(largeicon); -// } -// -// if (link.getSmallicon() != null) { -// SmallIconType smallicon = factory.createSmallIconType(); -// smallicon.setTextContent(link.getSmallicon()); -// icon.setSmallIcon(smallicon); -// } -// navigationCase.getIcon().clear(); -// navigationCase.getIcon().add(icon); -// } -// if (link.getFromaction() != null) { -// FromActionType fromAction = factory.createFromActionType(); -// fromAction.setTextContent(link.getFromaction()); -// navigationCase.setFromAction(fromAction); -// } -// if (link.getOutcome() != null) { -// FromOutcomeType fromOutcome = factory.createFromOutcomeType(); -// fromOutcome.setTextContent(link.getOutcome()); -// navigationCase.setFromOutcome(fromOutcome); -// } -// } - - private void createFacesCase(PageflowLink link, PageflowPage source, - PageflowPage target_) { - NavigationRuleType rule = FacesConfigFactory.eINSTANCE - .createNavigationRuleType(); - FromViewIdType from = FacesConfigFactory.eINSTANCE - .createFromViewIdType(); - from.setTextContent((source).getPath()); - rule.setFromViewId(from); - NavigationCaseType navCase = FacesConfigFactory.eINSTANCE - .createNavigationCaseType(); - ToViewIdType toView = FacesConfigFactory.eINSTANCE.createToViewIdType(); - toView.setTextContent((target_).getPath()); - navCase.setToViewId(toView); - rule.getNavigationCase().add(navCase); - facesConfig.getNavigationRule().add(rule); - updateFacesRule(rule, source); - source.getFCElements().add(from); - target_.getFCElements().add(toView); - link.getFCElements().add(navCase); - mapCases2Links.put(navCase, link); - } - - private void removePageflowPage(PageflowPage source) { - Assert.isTrue(source.getOutlinks().size() == 0 - && source.getInlinks().size() == 0); - pageflow.getNodes().remove(source); - } - - void removeCase(NavigationCaseType navCase) { - NavigationRuleType rule = (NavigationRuleType) navCase.eContainer(); - (rule).getNavigationCase().remove(navCase); - if (rule.getNavigationCase().size() == 0) { - facesConfig.getNavigationRule().remove(rule); - } - } - - /** - * Remove a link in pageflow model. - * - * @param pLink - */ - private void removeLink(PageflowLink pLink) { - // Link - PageflowPage source = (PageflowPage) pLink.getSource(); - PageflowPage target_ = (PageflowPage) pLink.getTarget(); - pLink.getPageflow().getLinks().remove(pLink); - source.getOutlinks().remove(pLink); - target_.getInlinks().remove(pLink); - // Navigation case - pLink.getFCElements().clear(); - cleanPage(source); - cleanPage(target_); - } - - /** - * Remove a link in pageflow model. - * - * @param pLink - */ - void changePFLinkStart(PageflowLink pLink, String newValue) { - PageflowPage newPage = null; - if ((newPage = getValidPFPageInCache(newValue)) != null) { - if (newValue.equals(((PageflowPage) pLink.getSource()).getPath())) { - return; - } - } else if ((newPage = TransformUtil.findPage(newValue, pageflow)) == null) { - return; - } - - // remove old case - NavigationCaseType caseType = (NavigationCaseType) pLink - .getFCElements().getData().get(0); - //NavigationRuleType rule = (NavigationRuleType) caseType.eContainer(); - removeCase(caseType); - - // create new rule / case - NavigationCaseType newCase = FacesConfigFactory.eINSTANCE - .createNavigationCaseType(); - ToViewIdType toView = FacesConfigFactory.eINSTANCE.createToViewIdType(); - toView.setTextContent(caseType.getToViewId().getTextContent()); - newCase.setToViewId(toView); - - NavigationRuleType newRule = FacesConfigFactory.eINSTANCE - .createNavigationRuleType(); - FromViewIdType fromView = FacesConfigFactory.eINSTANCE - .createFromViewIdType(); - fromView.setTextContent(newValue); - newRule.setFromViewId(fromView); - newRule.getNavigationCase().add(newCase); - facesConfig.getNavigationRule().add(newRule); - - // update - // updateNode(rule, newRule); - updateNode(caseType, newCase); - - pLink.getFCElements().clear(); - pLink.getFCElements().add(newCase); - pLink.setSource(newPage); - - updatePageflowElements(pageflow, newCase); - } - - private void updateNode(EObject old, EObject newOne) { - if (old instanceof NavigationRuleType) { - ((NavigationRuleType) newOne).getDescription().clear(); - ((NavigationRuleType) newOne).getDescription().addAll( - ((NavigationRuleType) old).getDescription()); - ((NavigationRuleType) newOne).getDisplayName().clear(); - ((NavigationRuleType) newOne).getDisplayName().addAll( - ((NavigationRuleType) old).getDisplayName()); - ((NavigationRuleType) newOne).getDescription().clear(); - ((NavigationRuleType) newOne).getIcon().clear(); - ((NavigationRuleType) newOne).getIcon().addAll( - ((NavigationRuleType) old).getIcon()); - } else if (old instanceof NavigationCaseType) { - ((NavigationCaseType) newOne).getDescription().clear(); - ((NavigationCaseType) newOne).getDescription().addAll( - ((NavigationCaseType) old).getDescription()); - ((NavigationCaseType) newOne).getDisplayName().clear(); - ((NavigationCaseType) newOne).getDisplayName().addAll( - ((NavigationCaseType) old).getDisplayName()); - ((NavigationCaseType) newOne).getDescription().clear(); - ((NavigationCaseType) newOne).getIcon().clear(); - ((NavigationCaseType) newOne).getIcon().addAll( - ((NavigationCaseType) old).getIcon()); - ((NavigationCaseType) newOne) - .setFromAction(((NavigationCaseType) old).getFromAction()); - ((NavigationCaseType) newOne) - .setFromOutcome(((NavigationCaseType) old).getFromOutcome()); - } - } - - void changePFLinkEnd(PageflowLink pLink, String newValue) { - PageflowPage newPage = null; - if ((newPage = getValidPFPageInCache(newValue)) != null) { - if (newValue.equals(((PageflowPage) pLink.getSource()).getPath())) { - return; - } - } else if ((newPage = TransformUtil.findPage(newValue, pageflow)) == null) { - return; - } - - // remove old case - NavigationCaseType caseType = (NavigationCaseType) pLink - .getFCElements().getData().get(0); - ToViewIdType toView = caseType.getToViewId(); // FacesConfigFactory.eINSTANCE.createToViewIdType(); - if (toView == null) { - toView = FacesConfigFactory.eINSTANCE.createToViewIdType(); - } - toView.setTextContent(newValue); - caseType.setToViewId(toView); - - pLink.setTarget(newPage); - - updatePageflowElements(pageflow, caseType); - } - - void removeLink(NavigationCaseType caseType) { - PageflowLink link = (PageflowLink) mapCases2Links.get(caseType); - if (link != null) { - removeLink(link); - } - } - - void addLink(PageflowPage source, PageflowPage target_, PageflowLink value) { - if (source != null && target_ != null && value != null) { - createFacesCase(value, source, target_); - } - } - - private void cleanPage(PageflowPage source) { - if (source.getInlinks().size() == 0 && source.getOutlinks().size() == 0) { - removePageflowPage(source); - } - source.update(); - } - - void refreshPFAdapter(EObject object) { - TreeIterator content = object.eAllContents(); - while (content.hasNext()) { - Object next = content.next(); - adapt((EObject) next); - } - adapt(object); - } - - void refreshFCAdapter(EObject object) { - List rules = facesConfig.getNavigationRule(); - if (rules != null) { - for (int i = 0; i < rules.size(); i++) { - NavigationRuleType rule = (NavigationRuleType) rules.get(i); - adapt(rule); - TreeIterator children = rule.eAllContents(); - while (children.hasNext()) { - adapt((EObject) children.next()); - } - } - } - adapt(facesConfig); - } - - /** - * @param facesConfig - */ - public void setFacesConfig(FacesConfigType facesConfig) { - this.facesConfig = facesConfig; - refreshFCAdapter(facesConfig); - } - - /** - * @param pageflow - */ - public void setPageflow(Pageflow pageflow) { - this.pageflow = pageflow; - pageflow.eAdapters().add(this); - refreshPFAdapter(pageflow); - } - - /** - * Install compatible synchronization adapter for particular object. - * - * @param object - */ - public void adapt(EObject object) { - if (object != null && !isAdapted(object)) { - if (object instanceof PageflowElement) { - object.eAdapters().add(new PF2FCSynchronizer(this)); - } else { - object.eAdapters().add(new FC2PFSynchronizer(this)); - } - } - } - - /** - * Remove the synchronization adapter. - * - * @param object - */ - public void unAdapt(EObject object) { - Iterator adapters = object.eAdapters().iterator(); - while (adapters.hasNext()) { - Object adapter = adapters.next(); - if (adapter instanceof FC2PFSynchronizer - || adapter instanceof PF2FCSynchronizer) { - adapters.remove(); - } - } - } - - /** - * @param object - * @return true if this transformer adapts object - */ - public boolean isAdapted(EObject object) { - if (object != null) { - Iterator adapters = object.eAdapters().iterator(); - while (adapters.hasNext()) { - Object adapter = adapters.next(); - if (adapter instanceof FC2PFSynchronizer - || adapter instanceof PF2FCSynchronizer) { - return true; - } - } - } - return false; - } - - /** - * clear the internal maps - */ - public void clearCaches() { - mapPaths2PF.clear(); - mapCases2Links.clear(); - } - - /** - * dispose of this object. - */ - public void dispose() { - clearCaches(); - Pageflow pageFlow = getPageflow(); - - if (pageFlow != null) - { - pageFlow.dispose(); - } - } - - public Notifier getTarget() { - return null; - } - - public boolean isAdapterForType(Object type) { - return false; - } - - public void setTarget(Notifier newTarget) { - // do nothing - } - - /** - * @param caseType - * @return the from view id in caseType - */ - public static FromViewIdType getSource(NavigationCaseType caseType) { - if (caseType.eContainer() instanceof NavigationRuleType) { - NavigationRuleType rule = (NavigationRuleType) caseType - .eContainer(); - return rule.getFromViewId(); - } - return null; - } - - private PageflowPage getOrCreateStartPage(NavigationCaseType navCase) {// FromViewIdType - PageflowPage startPageflowNode = null; - String path = "*"; //$NON-NLS-1$ - NavigationRuleType rule = (NavigationRuleType) navCase.eContainer(); - FromViewIdType source = getSource(navCase); - if (source != null) { - path = source.getTextContent(); - } - if (getValidPFPageInCache(path) == null) { - startPageflowNode = TransformUtil.findPage(path, pageflow); - - if (startPageflowNode == null) { - // not exist or is "*" - if (DEBUG) - System.out.println("Create new start page"); //$NON-NLS-1$ - startPageflowNode = createPFPage(path); - pageflowChanged = true; - } - mapPaths2PF.put(path, startPageflowNode); - PageflowTransform.getInstance().updatePageflowSourcePage( - startPageflowNode, rule); - } else { - startPageflowNode = (PageflowPage) mapPaths2PF.get(path); - } - if (source != null) { - ReferenceElement element = new PageReferenceElement( - startPageflowNode); - element.add(source); - startPageflowNode - .setReferenceLink(element.resolveReferenceString()); - startPageflowNode.getFCElements().add(source); - } - return startPageflowNode; - } - - /** - * Search for an existing pageflow page matching to navigation case's - * target, if there is no such page existing, create one. - * - * @param navCase - * @return - */ - private PageflowPage getOrCreateEndPage(NavigationCaseType navCase) { - PageflowPage endPageflowNode = null; - ToViewIdType target_ = navCase.getToViewId(); - if (target_ != null) { - String path = target_.getTextContent(); - if (getValidPFPageInCache(path) == null) { - endPageflowNode = TransformUtil.findPage(path, pageflow); - if (endPageflowNode == null) { - endPageflowNode = createPFPage(path); - if (DEBUG) - System.out.println("Create new end page"); //$NON-NLS-1$ - pageflowChanged = true; - } - mapPaths2PF.put(path, endPageflowNode); - PageflowTransform.getInstance().updatePageflowTargetPage( - endPageflowNode, navCase); - } else { - endPageflowNode = (PageflowPage) mapPaths2PF.get(path); - } - if (target_ != null) { - ReferenceElement element = new PageReferenceElement( - endPageflowNode); - element.add(target_); - endPageflowNode.setReferenceLink(element - .resolveReferenceString()); - endPageflowNode.getFCElements().add(target_); - } - } - return endPageflowNode; - } - - /** - * Return a valid cached pageflow node. - * - * @param key - * @return - */ - private PageflowPage getValidPFPageInCache(Object key) { - EObject element = (EObject) mapPaths2PF.get(key); - if (!TransformUtil.isValidPageflowElement(element) - || !(element instanceof PageflowPage) - || !((PageflowPage) element).getPath().equals(key)) { - mapPaths2PF.remove(key); - element = null; - } - return (PageflowPage) element; - } - - /** - * Return a valid cached pageflow link. - * - * @param caseType - * @return - */ - private PageflowLink getValidPFLinkInCache(EObject caseType) { - PageflowLink link = (PageflowLink) mapCases2Links.get(caseType); - if (!TransformUtil.isValidLink(link)) { - mapCases2Links.remove(caseType); - link = null; - } - return link; - - } - - /** - * Update pageflow model elements against faces-config navigation case. - * @param pageflow_ - * @param caseFC - * @return true if the pageflow was changed - */ - public boolean updatePageflowElements(Pageflow pageflow_, - NavigationCaseType caseFC) { - this.pageflowChanged = false; - this.pageflow = pageflow_; - ToViewIdType target_ = caseFC.getToViewId(); - if (target_ == null) { - return false; - } - - PageflowPage start = null, end = null; - // start page - start = getOrCreateStartPage(caseFC); - String action = null; - // action - if (caseFC.getFromAction() != null) { - action = caseFC.getFromAction().getTextContent(); - } - // from outcome - String fromOutCome = null; - if (caseFC.getFromOutcome() != null) { - fromOutCome = caseFC.getFromOutcome().getTextContent(); - } - // end page - end = getOrCreateEndPage(caseFC); - // link - // Is there a link in pageflow model? - PageflowLink link = null; - if ((link = findUnmappedLink(start, end, caseFC)) == null) { - if (end != null) { - if (DEBUG) - System.out.println("Create new link"); //$NON-NLS-1$ - link = createPFLink(start, end, action, fromOutCome); - pageflowChanged = true; - } - } - if (link != null) { - link.getFCElements().clear(); - link.getFCElements().add(caseFC); - mapCases2Links.put(caseFC, link); - } - adapt(start); - adapt(end); - adapt(caseFC); - adapt(link); - return pageflowChanged; - } - - private boolean cleanPageflowNavigationRule(Pageflow pageflow_) { - boolean dirty = false; - List links = pageflow_.getLinks(); - Iterator linksIterator = links.iterator(); - while (linksIterator.hasNext()) { - PageflowLink link = (PageflowLink) linksIterator.next(); - if (link.getFCElements().isEmpty()) { - linksIterator.remove(); - if (link.getSource() != null) { - link.getSource().getOutlinks().remove(link); - } - if (link.getTarget() != null) { - link.getTarget().getInlinks().remove(link); - } - dirty = true; - } - } - return dirty; - } - - /** - * merge the two navigation rules list between pageflow and face-config - * file. merge rule: 1. if the from-view-id, from-action, and from-outcome - * are same, they are the same navigation case, then the navigation case in - * face-config file should be updated by one in the pageflow. 2. otherwise - * the new navigation case should be created. - * - * FIXME: Not merge, only update page flow from faces-config. - * - * @param rulesFC - - * navigation rules in faces-config. - * @param navigationRulesInPageflow - - * navigation rules in pageflow model. - * - * @return boolean - whether add a new rule or not. - */ - private boolean updateNavigationRulesInPageflowFromFacesConfig(List rulesFC) { - boolean isNew = false; - // if the faces-config file is empty, the links should be removed. - if (rulesFC == null || rulesFC.isEmpty()) { - for (Iterator iterLink = pageflow.getLinks().iterator(); iterLink - .hasNext();) { - PageflowLink link = (PageflowLink) iterLink.next(); - link.getSource().getOutlinks().remove(link); - link.getTarget().getInlinks().remove(link); - } - pageflow.getLinks().clear(); - } else { - // Rule - Cases - for (Iterator iterRulesFC = rulesFC.iterator(); iterRulesFC - .hasNext();) { - NavigationRuleType ruleFC = (NavigationRuleType) iterRulesFC - .next(); - - List casesFC = ruleFC.getNavigationCase(); - for (Iterator iterCasesFC = casesFC.iterator(); iterCasesFC - .hasNext();) { - NavigationCaseType navigationCaseFC = (NavigationCaseType) iterCasesFC - .next(); - isNew |= updatePageflowElements(pageflow, navigationCaseFC); - } - } - } - isNew |= cleanPageflowNavigationRule(pageflow); - return isNew; - } - - /** - * Find a pageflow link that is not linked to a faces-config element. Since - * user might edit faces-config file with other editor, so the path is not - * always valid, here we still try to match link and navigation case. TODO: - * should we always resolve mapping from referenceLink on PageflowElement? - */ - private PageflowLink findUnmappedLink(PageflowPage start, PageflowPage end, - NavigationCaseType caseFC) { - List links = start.getOutlinks(); - for (int i = 0, n = links.size(); i < n; i++) { - PageflowLink link = (PageflowLink) links.get(i); - if (link.getSource() == start && link.getTarget() == end) { - link.update(); - if (link.getFCElements().isEmpty() - || link.getFCElements().getData().get(0) == caseFC) { - return link; - } - } - } - return null; - } - - /** - * create a new PFLink object according to fromOutcome attribute - * - * @param fromOutcome - - * PFLink's fromOutcome attribute - * @return - new PFLink object - */ - public PageflowLink createPFLink(String fromOutcome) { - PageflowLink link = null; - link = PageflowModelManager.getFactory().createPFLink(); - if (fromOutcome != null && fromOutcome.length() > 0) { - link.setOutcome(fromOutcome.trim()); - } - pageflow.getLinks().add(link); - return link; - } - - /** - * create a new PFLink object according to fromOutcome attribute - * @param start - * @param target_ - * @param action - * - * @param fromOutcome - - * PFLink's fromOutcome attribute - * @return - new PFLink object - */ - public PageflowLink createPFLink(PageflowNode start, PageflowNode target_, - String action, String fromOutcome) { - Assert.isTrue(start != null && target_ != null); - PageflowLink link = null; - link = createPFLink(fromOutcome); - link.setFromaction(action); - link.setSource(start); - link.setTarget(target_); - start.getOutlinks().add(link); - target_.getInlinks().add(link); - return link; - } - - /** - * Create a new PFPage according to from-view-id - * - * @param fromViewID - - * page's from-view-id - * @return the page flow page - */ - public PageflowPage createPFPage(String fromViewID) { - PageflowPage page = PageflowFactory.eINSTANCE.createPFPage(); - if (fromViewID != null && fromViewID.length() > 0) { - page.setPath(fromViewID.trim()); - page.setName(WebrootUtil.getPageNameFromWebPath(fromViewID.trim())); - } - this.pageflow.getNodes().add(page); - return page; - } - - /** - * update pageflow model according to the face-config model - * - * @author sfshi - * @return true if new rules were added - */ - public boolean updatePageflowModelFromEMF() { - if (pageflow != null && facesConfig != null) { - List navigationRulesInFacesconfig = facesConfig.getNavigationRule(); - clearCaches(); - // if add new one, we can relayout the current pageflow. - return updateNavigationRulesInPageflowFromFacesConfig(navigationRulesInFacesconfig); - } - return false; - } - - void refreshLink(NavigationCaseType caseType) { - PageflowLink link = getValidPFLinkInCache(caseType); - if (link != null) { - removeLink(link); - } - // update pageflow - if (TransformUtil.isValidFacesConfigElement(caseType)) { - updatePageflowElements(pageflow, caseType); - } - } - - public void notifyChanged(Notification msg) { - int type = msg.getEventType(); - switch (type) { - case MY_NOTIFICATION_TYPE: - setNeedBatchOperations(true); - break; - case MY_NOTIFICATION_TYPE1: - setNeedBatchOperations(false); - } - } - - /** - * @return true if is listening to notifications and not - * currently in an event - */ - public boolean isListenToNotify() { - return listenToNotify && !isInEvent; - } - - /** - * @return true if in event - */ -// public boolean isInEvent() { -// return isInEvent; -// } - - /** - * @param isInEvent - */ - public void setInEvent(boolean isInEvent) { - this.isInEvent = isInEvent; - } - - /** - * @return the faces config model - */ - public FacesConfigType getFacesConfig() { - return facesConfig; - } - - /** - * @return the root page flow - */ - public Pageflow getPageflow() { - return pageflow; - } - - /** - * @param value - * @return a new fromViewId with the text content set to value - */ - public static FromViewIdType createRLFromViewID(String value) { - FromViewIdType fromView = FacesConfigFactory.eINSTANCE - .createFromViewIdType(); - fromView.setTextContent(value); - return fromView; - } - - /** - * @param value - * @return a new to view with the text content set to value - */ - public static ToViewIdType createFCToViewID(String value) { - ToViewIdType toView = FacesConfigFactory.eINSTANCE.createToViewIdType(); - toView.setTextContent(value); - return toView; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/PF2FCSynchronizer.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/PF2FCSynchronizer.java deleted file mode 100644 index 88b4953fe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/PF2FCSynchronizer.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * The adapter that listens to modification of pageflow and updates faces-config - * as needed. - * - * @author hmeng - * - */ -public class PF2FCSynchronizer extends AdapterImpl { - FC2PFTransformer tranformer; - - private final boolean DEBUG = false; - - private static final Logger logger = EditorPlugin - .getLogger(PF2FCSynchronizer.class); - - /** - * @param tranformer - */ - public PF2FCSynchronizer(FC2PFTransformer tranformer) { - this.tranformer = tranformer; - } - - public Notifier getTarget() { - // TODO Auto-generated method stub - return null; - } - - public void setTarget(Notifier newTarget) { - // TODO Auto-generated method stub - - } - - public boolean isAdapterForType(Object type) { - return type == PF2FCSynchronizer.class; - } - - public void notifyChanged(Notification notification) { - if (!isProcessorFor(notification)) { - return; - } - tranformer.setInEvent(true); - try { - if (!(notification.getNotifier() instanceof PageflowElement)) { - return; - } - processChange(notification); - } catch (Exception e) { - logger.error(e); - } finally { - if (notification.getEventType() != Notification.REMOVING_ADAPTER) { - tranformer.refreshPFAdapter(tranformer.getPageflow()); - tranformer.refreshFCAdapter(tranformer.getFacesConfig()); - } - tranformer.setInEvent(false); - } - } - - private boolean isProcessorFor(Notification notification) { - return tranformer.isListenToNotify(); - } - - private void processChange(Notification notification) { - PageflowElement element; - element = (PageflowElement) notification.getNotifier(); - int type = notification.getEventType(); - switch (type) { - case Notification.ADD: { - int featureId = notification.getFeatureID(PageflowPackage.class); - switch (featureId) { - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - addOutLink(notification, element); - break; - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - addInLink(notification, element); - break; - case PageflowPackage.PAGEFLOW: - break; - } - if (!tranformer.isNeedBatchOperations()) { - updateAndNotify(notification); - } - break; - } - case Notification.SET: - if (notification.getNewValue() != null) { - processSet(notification, element); - updateAndNotify(notification); - } - break; - case Notification.REMOVE: - case Notification.REMOVE_MANY: { - int featureId = notification.getFeatureID(PageflowPackage.class); - switch (featureId) { - case PageflowPackage.PF_PAGE: - // removePage(notification, (PageflowPage) element); - break; - case PageflowPackage.PAGEFLOW_NODE__OUTLINKS: - case PageflowPackage.PAGEFLOW_NODE__INLINKS: - removeLink(notification, element); - break; - } - if (!tranformer.isNeedBatchOperations()) { - updateAndNotify(notification); - } - break; - } - } - } - - private void processSet(Notification notification, PageflowElement element) { - if (notification.getNewValue() != null) { - int value = notification.getFeatureID(PageflowPackage.class); - if (element instanceof PageflowPage) { - setProperties(notification, element, value); - } else if (element instanceof PageflowLink) { - if (DEBUG) - System.out.println("The link property is changed"); //$NON-NLS-1$ - setProperties(notification, element, value); - } - } - } - - private void setProperties(Notification notification, - PageflowElement element, int value) { - if (notification.getFeature() == PageflowPackage.eINSTANCE - .getPFLink_Source()) { - if (notification.getNewValue() instanceof String) { - tranformer.changePFLinkStart((PageflowLink) element, - (String) notification.getNewValue()); - } - } else if (notification.getFeature() == PageflowPackage.eINSTANCE - .getPFLink_Target()) { - if (notification.getNewValue() instanceof String) { - tranformer.changePFLinkEnd((PageflowLink) element, - (String) notification.getNewValue()); - } - } else { - element.getFCElements().set( - (EStructuralFeature) notification.getFeature(), - notification.getNewValue()); - } - } - - private void addInLink(Notification notification, PageflowElement element) { - Object value = notification.getNewValue(); - PageflowLink link = (PageflowLink) value; - if (element instanceof PageflowPage) { - PageflowNode source = link.getSource(); - if (source instanceof PageflowPage) { - tranformer.addLink((PageflowPage) source, - (PageflowPage) element, link); - } - } - - } - - private void addOutLink(Notification notification, PageflowElement element) { - Object value = notification.getNewValue(); - // for outLink remove, only target is referenced. - PageflowLink link = (PageflowLink) value; - if (element instanceof PageflowPage) { - PageflowNode target_ = link.getTarget(); - // page->page - if (target_ instanceof PageflowPage) { - tranformer.addLink((PageflowPage) element, - (PageflowPage) target_, link); - } - } - } - - private void removeLink(Notification notification, PageflowElement element) { - Object value = notification.getOldValue(); - PageflowLink link = (PageflowLink) value; - - if (!link.getFCElements().isEmpty()) { - NavigationCaseType caseFC = (NavigationCaseType) link - .getFCElements().getData().get(0); - if (caseFC != null) - tranformer.removeCase(caseFC); - } - link.update(); - } - - private void updateAndNotify(Notification notification) { - tranformer.getPageflow().notifyModelChanged( - new ENotificationImpl((InternalEObject) notification - .getNotifier(), Notification.SET, - PageflowPackage.PAGEFLOW, null, null)); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/PFBatchAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/PFBatchAdapter.java deleted file mode 100644 index d30e7d133..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/PFBatchAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.ui.PlatformUI; - -/** - * @author hmeng - */ - -public abstract class PFBatchAdapter extends AdapterImpl { - private boolean needPostpone; - - AbstractGraphicalEditPart editPart; - - /** - * @param msg - * @return true postponement needed - */ - public boolean isNeedPostpone(Notification msg) { - return needPostpone - && !(msg.getEventType() == FC2PFTransformer.MY_NOTIFICATION_TYPE || msg - .getEventType() == FC2PFTransformer.MY_NOTIFICATION_TYPE1); - } - - /** - * @param needPostpone - */ - public void setNeedPostpone(boolean needPostpone) { - this.needPostpone = needPostpone; - } - - final public void notifyChanged(final Notification msg) { - if (!isNeedPostpone(msg)) { - if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) - doNotifyChanged(msg); - else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - doNotifyChanged(msg); - } - }); - } - } - } - - /** - * @param notification - */ - abstract public void doNotifyChanged(Notification notification); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/TransformUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/TransformUtil.java deleted file mode 100644 index d2b40b992..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/synchronization/TransformUtil.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType; -import org.eclipse.jst.jsf.facesconfig.emf.FromOutcomeType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * The util for pageflow and faces-config transforming - * - * @author hmeng - */ - -public class TransformUtil { - - /** - * To see if the faces-config element is on a valid hirachy. - * @param object - * @return true if object's root ancestor is a facesConfig model - */ - public static boolean isValidFacesConfigElement(EObject object) { - EObject parent = EcoreUtil.getRootContainer(object); - boolean result = parent instanceof FacesConfigType; - return result; - } - - /** - * To see if the pageflow element is on a valid hirachy. - * @param element - * @return true if element's root ancestor is a page flow element - */ - public static boolean isValidPageflowElement(EObject element) { - EObject root = EcoreUtil.getRootContainer(element); - boolean result = root instanceof Pageflow; - return result; - } - - /** - * @param link - * @return true the link is valid - */ - public static boolean isValidLink(PageflowLink link) { - return isValidPageflowElement(link) && link.getSource() != null - && link.getTarget() != null; - } - - /** - * @param rule - * @return gets the from-view-id from rule - */ - public static String getFromViewID(NavigationRuleType rule) { - String result = "*"; //$NON-NLS-1$ - if (rule.getFromViewId() != null) { - result = rule.getFromViewId().getTextContent(); - } - return result; - } - - /** - * @param navCase - * @return gets the to-view-id from navCase - */ - public static String getToViewID(NavigationCaseType navCase) { - String result = "*"; //$NON-NLS-1$ - if (navCase.getToViewId() != null) { - result = navCase.getToViewId().getTextContent(); - } - return result; - } - - /** - * @param path - * @param pageflow - * @return get pageflowpage in pageflow corresponding to path - */ - public static PageflowPage findPage(String path, Pageflow pageflow) { - List nodes = pageflow.getNodes(); - for (int i = 0; i < nodes.size(); i++) { - if (nodes.get(i) instanceof PageflowPage) { - if (path != null) { - if (path.equals(((PageflowPage) nodes.get(i)).getPath())) { - return (PageflowPage) nodes.get(i); - } - } - } - } - return null; - } - - /** - * @param action - * @param outcome - * @param pageflow - * @return find the end case - */ - public static PageflowNode findCaseEnd(PageflowPage action, - FromOutcomeType outcome, Pageflow pageflow) { - // TODO: find a case end in pageflow model - List links = action.getOutlinks(); - for (int i = 0; i < links.size(); i++) { - PageflowLink link = (PageflowLink) links.get(i); - String outcomeStr = ""; //$NON-NLS-1$ - if (outcome != null) { - outcomeStr = outcome.getTextContent(); - } - if (link.getOutcome().equals(outcomeStr)) { - return link.getTarget(); - } - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/EditPartMarkerUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/EditPartMarkerUtil.java deleted file mode 100644 index a1e3c645b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/EditPartMarkerUtil.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.util.Iterator; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; - -/** - * - * Utility class to add and remove edit part markers. - * - * FIXME: add the identification mechanism of the model and remove the - * dependency on the PageflowElement - * - * @author Xiao-guang Zhang - * - * - */ -public class EditPartMarkerUtil { - - /** - * Removes all markers that were created using createMarker() - * - * @param model - - * the emf model related with edit part - * @throws CoreException - */ - public static void removeAllMarkers(EObject model) throws CoreException { - IResource resource = getResource(model); - - if (resource != null) { - String markerTypes[] = { IMarker.PROBLEM, IMarker.TASK }; - - for (int iMT = 0; iMT < markerTypes.length; iMT++) { - IMarker[] markers = resource.findMarkers(markerTypes[iMT], - false, IResource.DEPTH_ONE); - - for (int iMark = 0; iMark < markers.length; iMark++) { - markers[iMark].delete(); - } - } - } - } - - /** - * Removes a specific problem marker type with the given severity. - * - * @param model - - * the model related with this edit part. - * @param sMarkerType - - * the marker type, either IMarker.PROBLEM or IMarker.TASK - * @param iSeverity - - * severity/priority: if sMarkerType is IMarker.PROBLEM, then - * this value is one of the PROBLEM severities; if sMarkerType is - * IMarker.TASK, this is a task priority. - * @throws CoreException - * passed on from IResource.findMarkers() - */ - public static void removeAllMarkers(EObject model, String sMarkerType, - int iSeverity) throws CoreException { - IResource resource = getResource(model); - - if (resource != null) { - IMarker[] markers = resource.findMarkers(sMarkerType, false, - IResource.DEPTH_ONE); - - for (int i = 0; i < markers.length; i++) { - IMarker marker = markers[i]; - int iMarkerSeverity = marker.getAttribute(IMarker.SEVERITY, - IMarker.SEVERITY_ERROR); - - if (iMarkerSeverity == iSeverity || iSeverity == -1) { - markers[i].delete(); - } - } - } - } - - /** - * get the resouce according to part or model. - * - * @param part - * @param model - * @return - */ - private static IResource getResource(EObject model) { - IResource resource = null; - resource = WebrootUtil.getResource(model); - return resource; - } - - /** - * Create a problem marker. - * - * @param model - - * the model related with this edit part. - * @param sMarkerType - * @param severity - - * the problem severity, one of IMarker.SEVERITY_ERROR, - * IMarker.SEVERITY_WARNING or IMarker.SEVERITY_INFO - * @param message - - * the text associated with this marker - * @param location - - * a unique ID that the application can use to locate the - * editpart - * - * that corresponds to this marker; this is typically the DiagramElement's - * ID string - * @throws CoreException - */ - public static void createMarker(EObject model, String sMarkerType, - int severity, String message, String location) throws CoreException { - IResource resource = getResource(model); - - if (resource != null) { - IMarker marker = resource.createMarker(sMarkerType); - marker.setAttribute(IMarker.MESSAGE, message); - marker.setAttribute(IMarker.SEVERITY, severity); - // The problem view doesn't show the location - only the line number - // is shown in the "location" column. Doh! - if (location != null && location.length() > 0) { - marker.setAttribute(IMarker.LOCATION, location); - } - } - } - - /** - * Removes a specific problem marker type with the given severity. - * - * @param model - - * the model related with this edit part. - * @param sMarkerType - - * the marker type, either IMarker.PROBLEM or IMarker.TASK - * @throws CoreException - * passed on from IResource.findMarkers() - */ - public static void removeMarker(EObject model, String sMarkerType) - throws CoreException { - IResource resource = getResource(model); - if (resource != null) { - IMarker[] markers = resource.findMarkers(sMarkerType, false, - IResource.DEPTH_ONE); - - for (int i = 0; i < markers.length; i++) { - IMarker marker = markers[i]; - // get the marker's location - Object id = marker.getAttribute(IMarker.LOCATION); - - if (model instanceof PageflowElement) { - if (((PageflowElement) model).getId().equals(id)) { - markers[i].delete(); - } - } - } - } - } - - /** - * Searches the hierarchy starting at the given EditPart for a given model - * object ID string (the DiagramElement.ID value) and returns that EditPart - * - * @param containerPart - * @param id - * @return the EditPart that corresponds to the given ID string, or null if - * not found - */ - public static GraphicalEditPart findEditPart( - GraphicalEditPart containerPart, String id) { - Object model = containerPart.getModel(); - if (model instanceof PageflowElement) { - String modelId = ((PageflowElement) model).getId(); - if (modelId != null && modelId.equals(id)) { - return containerPart; - } - } - - Iterator iterNode = containerPart.getChildren().iterator(); - while (iterNode.hasNext()) { - GraphicalEditPart child = (GraphicalEditPart) iterNode.next(); - GraphicalEditPart foundPart = findEditPart(child, id); - if (foundPart != null) { - return foundPart; - } - } - - Iterator iterConnection = containerPart.getSourceConnections() - .iterator(); - while (iterConnection.hasNext()) { - GraphicalEditPart child = (GraphicalEditPart) iterConnection.next(); - GraphicalEditPart foundPart = findEditPart(child, id); - if (foundPart != null) { - return foundPart; - } - } - - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter.java deleted file mode 100644 index 36845dc9f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; -import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; -import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.IStructuredDocumentContextResolverFactory2; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -/** - * This class is defined as a simple adapter to JSP DOM model. User can get the - * taglib prefix, and get the needed element by element tage name, and - * namespace(prefix) Usage: User should initialize this class instance before - * using it. Following is a typical example: JSPDomAdapter jspAdapter = new - * JSPDomAdapter(); IFile jspFile = - * ResourcesPlugin.getWorkspace().getRoot().getFile(jspPath); if - * (_jspAdapter.initialize(jspFile)) { //the prefix of JSF HTML TagLib String - * prefix = _jspAdapter.getTagLibPrefix(JSPDomAdapter.JSF_HTML_TAGLIB); } - * - * @author Xiao-guang Zhang - */ -public class JSPDomAdapter { - /** log instance */ - private static final Logger log = EditorPlugin - .getLogger(JSPDomAdapter.class); - - /** JSP Taglib's tag name */ - public static String JSP_TAGLIB_TAG = "jsp:directive.taglib"; //$NON-NLS-1$ - - /** JSF HTML TagLib name */ - public static String JSF_HTML_TAGLIB = "http://java.sun.com/jsf/html"; //$NON-NLS-1$ - - /** singleton model manager */ - private static IModelManager modelManager; - - /** source jsp file */ - private IFile jspFile; - - /** Structured Model of JSP File */ - private IStructuredModel model; - - /** Root Document (Node) of JSP file */ - private Document document; - - /** - * - */ - public JSPDomAdapter() { - super(); - - } - - /** - * initialize this adapter to get the StructuredModel for the input file. - * At last user should call releaseModel() method to release the Structured Model. - * - * @param file - - * JSP file - * @return - True means sucessfully load jsp file. - */ - public boolean initialize(final IFile file) { - jspFile = file; - - if (jspFile != null && jspFile.exists()) { - try { - model = getModel(jspFile); - } catch (final IOException e) { - // PageFlow.JSPDomAdapter.FailToGetStructuredModel = Failed to - // get the structured model - log.error("PageFlow.JSPDomAdapter.FailToGetStructuredModel", e); //$NON-NLS-1$ - } catch (final CoreException e) { - // PageFlow.JSPDomAdapter.FailToGetStructuredModel = Failed to - // get the structured model - log.error("PageFlow.JSPDomAdapter.FailToGetStructuredModel", e);//$NON-NLS-1$ - } - - if (model != null && model instanceof IDOMModel) { - return true; - } - } - - return false; - } - - /** - * get the prefix for the input taglib URI, e.g., - * http://java.sun.com/jsf/html -> "h" - * - * @param taglibURI - * @return the prefix - */ - public String getTagLibPrefix(final String taglibURI) { - String prefix = null; - - final IStructuredDocument sdocument = model.getStructuredDocument(); - - if (sdocument != null) - { - IStructuredDocumentContext context = - IStructuredDocumentContextFactory.INSTANCE.getContext(sdocument, -1); - ITaglibContextResolver resolver = - IStructuredDocumentContextResolverFactory2.INSTANCE.getTaglibContextResolverFromDelegates(context); - prefix = resolver.getTagPrefixForURI(taglibURI); - } - - return prefix; - } - - /** - * get the elements by the namespace and its tag name, e.g., h and - * commandButton. - * - * @param namespace - - * namespace for the taglib, e.g., h for - * http://java.sun.com/jsf/html - * @param elementName - - * element Tag Name, e.g., h - * @return - Element Node list. - */ - public List getElementsByTagNameNS(final String namespace, final String elementName) { - List nodes = null; - - if (getDocument() != null) { - NodeList listNodes = null; - if (namespace != null) { - listNodes = getDocument().getElementsByTagName( - namespace + ":" + elementName); //$NON-NLS-1$ - } else { - listNodes = getDocument().getElementsByTagName(elementName); - } - - if (listNodes != null && listNodes.getLength() > 0) { - nodes = new ArrayList(); - for (int i = 0; i < listNodes.getLength(); i++) { - nodes.add(listNodes.item(i)); - } - } - } - return nodes; - } - - /** - * get the singleton model manager. - * - * @return - */ - private IModelManager getModelManager() { - if (modelManager == null) { - modelManager = StructuredModelManager.getModelManager(); - } - return modelManager; - } - - /** - * get the structured model for the JSP file - * - * @param file - - * JSP File - * @return - IStructuredModel - * @throws IOException - * @throws CoreException - */ - private IStructuredModel getModel(final IFile file) throws IOException, - CoreException { - return getModelManager().getModelForRead(file); - } - - /** - * get the root docuement for the StructuredModel - * - * @return - */ - private Document getDocument() { - if (document == null) { - if (model != null && model instanceof IDOMModel) { - document = ((IDOMModel) model).getDocument(); - } - } - return document; - } - - - /** - * signal we are done with the model - */ - public void releaseModel() { - if (model != null) { - model.releaseFromRead(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java deleted file mode 100644 index 7b1414b72..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * utility class for JSP related information. - * - * @author Yang Liu - */ -public class JSPUtil { - - /** - * get the action list in the jsp file - * @param jspFileName - * - * @return - action list - */ - public static List getActionListInJSPFile(String jspFileName) { - /** jsp dom adapter */ - - List actions = new ArrayList(); - - // convert the relative directory to project directory, e.g., /a.jsp to - // /testproject/webroot/a.sjp - String physicalJspPath = jspFileName; - if (physicalJspPath != null && physicalJspPath.length() > 0) - { - IPath jspPath = new Path(physicalJspPath); - IFile jspFile = ResourcesPlugin.getWorkspace().getRoot().getFile( - jspPath); - - if (jspFile != null && jspFile.exists()) - { - JSPDomAdapter jspAdapter = null; - try - { - jspAdapter = new JSPDomAdapter(); - // initialize the adapter to initialize the model of jsp - if (jspAdapter.initialize(jspFile)) - { - // the prefix of JSF HTML TagLib - String prefix = jspAdapter - .getTagLibPrefix(JSPDomAdapter.JSF_HTML_TAGLIB); - - // get the command butonns - List buttonActions = jspAdapter.getElementsByTagNameNS( - prefix, "commandButton");//$NON-NLS-1$ - if (buttonActions != null) - actions.addAll(buttonActions); - - // get the command links - List linkActions = jspAdapter.getElementsByTagNameNS( - prefix, "commandLink");//$NON-NLS-1$ - if (linkActions != null) - actions.addAll(linkActions); - } - } - finally - { - if (jspAdapter != null) - { - jspAdapter.releaseModel(); - } - } - } - } - return actions; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/ModelCreationFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/ModelCreationFactory.java deleted file mode 100644 index b869353ed..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/ModelCreationFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; - -/** - * This class implements the CreationFactory used by the CreationTool. It in - * turn uses the EMF-generated factories to create the model instances - * - * @author Xiao-guang Zhang - */ -public class ModelCreationFactory implements CreationFactory { - private Class targetClass; - - /** - * @param targetClass - */ - public ModelCreationFactory(Class targetClass) { - this.targetClass = targetClass; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.requests.CreationFactory#getNewObject() - */ - public Object getNewObject() { - PageflowFactory factory = PageflowModelManager.getFactory(); - - Object result = null; - - if (targetClass.equals(PageflowLink.class)) { - result = factory.createPFLink(); - - } else if (targetClass.equals(PageflowPage.class)) { - result = factory.createPFPage(); - } - - return result; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.gef.requests.CreationFactory#getObjectType() - */ - public Object getObjectType() { - return targetClass; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowAdapterFactory.java deleted file mode 100644 index 8da99bf53..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowAdapterFactory.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; - -/** - * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It - * provides an adapter <code>createXXX</code> method for each class of the - * model. <!-- end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage - * @generated - */ -// FIXME: this appears to be a dead class. -public class PageflowAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static PageflowPackage modelPackage; - - /** - * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public PageflowAdapterFactory() { - if (modelPackage == null) { - modelPackage = PageflowPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> This implementation returns <code>true</code> - * if the object is either the model's package or is an instance object of - * the model. <!-- end-user-doc --> - * - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject) object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the <code>createXXX</code> methods. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PageflowSwitch modelSwitch = new PageflowSwitch() { - public Object casePageflow(Pageflow object) { - return createPageflowAdapter(); - } - - public Object casePageflowNode(PageflowNode object) { - return createPageflowNodeAdapter(); - } - - public Object casePFLink(PageflowLink object) { - return createPFLinkAdapter(); - } - - public Object casePageflowElement(PageflowElement object) { - return createPageflowElementAdapter(); - } - - public Object casePFPage(PageflowPage object) { - return createPFPageAdapter(); - } - - public Object casePFLinkBendpoint(PageflowLinkBendpoint object) { - return createPFLinkBendpointAdapter(); - } - - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @param target - * the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter) modelSwitch.doSwitch((EObject) target); - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow <em>Pageflow</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow - * @generated - */ - public Adapter createPageflowAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode <em>Node</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode - * @generated - */ - public Adapter createPageflowNodeAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink <em>PF Link</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink - * @generated - */ - public Adapter createPFLinkAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement <em>Element</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement - * @generated - */ - public Adapter createPageflowElementAdapter() { - return null; - } - - /** - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @generated - */ - public Adapter createPFActionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage <em>PF Page</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage - * @generated - */ - public Adapter createPFPageAdapter() { - return null; - } - - /** - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @generated - */ - public Adapter createPFBeginAdapter() { - return null; - } - - /** - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @generated - */ - public Adapter createPFEndAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint <em>PF Link Bendpoint</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that - * we can easily ignore cases; it's useful to ignore a case when inheritance - * will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint - * @generated - */ - public Adapter createPFLinkBendpointAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. <!-- begin-user-doc --> This - * default implementation returns null. <!-- end-user-doc --> - * - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} -// PageflowAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowAnnotationUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowAnnotationUtil.java deleted file mode 100644 index b6a23620b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowAnnotationUtil.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.util.Iterator; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.IAnnotationEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PFValidator; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowLinkEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * This class can be used to add annotation for the current pageflow model and - * decoration for view. - * - * @author Xiao-guang Zhang - * - * - */ -public class PageflowAnnotationUtil { - - /** - * - * validate the pageflow and its edit part - * - * @param containerPart - - * it can be null, then the edit part will not be updated - */ - public static void validatePageflow(final GraphicalEditPart containerPart) { - if (containerPart == null) { - return; - } - - // removeAllAnnotations(containerPart); - - // validate the nodes including page and actions. - final Iterator iterChild = containerPart.getChildren().iterator(); - while (iterChild.hasNext()) { - - final PageflowElementEditPart element = (PageflowElementEditPart) iterChild - .next(); - // String errorMessage = null; - if (element instanceof PFValidator) { - ((PFValidator) element).validate(); - } - // if (element.getModel() instanceof PageflowPage) { - // errorMessage = PageflowValidation.getInstance().getNotifyMessage( - // (PageflowPage) element.getModel()); - // } - - // if (errorMessage != null) { - // addAnnotation(element, errorMessage); - // } else { - // removeAnnotation(element); - // } - - // validate the connections. - final Iterator iterLinks = element.getSourceConnections().iterator(); - while (iterLinks.hasNext()) { - final PageflowLinkEditPart link = (PageflowLinkEditPart) iterLinks - .next(); - link.validate(); - // validateLink(link); - } - } - - } - - /** - * validate the page based on model and its's edit part. - * - * @param pagePart - - * it can be null, then the edit part will not be updated - */ - public static void validatePage(final PageflowNodeEditPart pagePart) { - if (pagePart != null && pagePart.getParent() != null) { - return; - } - - String errorMessage = null; - - removeAnnotation(pagePart); - - errorMessage = PageflowValidation.getInstance().getNotifyMessage( - (PageflowPage) pagePart.getModel()); - - if (errorMessage != null) { - addAnnotation(pagePart, errorMessage); - } else { - removeAnnotation(pagePart); - } - - // validate the connections. - // Iterator iterLinks = pagePart.getSourceConnections().iterator(); - // while (iterLinks.hasNext()) { - // PageflowLinkEditPart link = (PageflowLinkEditPart) iterLinks.next(); - // - // validateLink(link); - // } - } - - /** - * validate the link based on model and its's edit part. - * - * @param linkPart - - * it can be null, then the edit part will not be updated - */ - public static void validateLink(final PageflowLinkEditPart linkPart) { - if (linkPart != null && linkPart.getParent() != null) { - String errorMessage = null; - - removeAnnotation(linkPart); - - errorMessage = PageflowValidation.getInstance().isValidLink( - (PageflowLink) linkPart.getModel()); - - if (errorMessage != null) { - addAnnotation(linkPart, errorMessage); - } else { - removeAnnotation(linkPart); - } - } - } - - /** - * add a marker with IMarker.PROBLEM type, IMarker.SEVERITY_ERROR severity, - * and message. - * - * @param editPart - * @param model - * @param message - */ - private static void addAnnotation(final GraphicalEditPart editPart, final String message) { - if (editPart != null && editPart instanceof IAnnotationEditPart) { - final Annotation annotation = new Annotation(IMarker.PROBLEM, false, - message); - ((IAnnotationEditPart) editPart).addAnnotation(annotation); - } - } - - /** - * remove a marker - * - * @param editPart - * @param model - */ - private static void removeAnnotation(final GraphicalEditPart editPart) { - if (editPart != null && editPart instanceof IAnnotationEditPart) { - ((IAnnotationEditPart) editPart).removeAnnotation(); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowModelManager.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowModelManager.java deleted file mode 100644 index 5e2689a92..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowModelManager.java +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl; - -/** - * Drives the model. Acts as the model entry point, including create, load, save - * operations. - * - * @author Xiao-guang Zhang - */ -public class PageflowModelManager { - /** - * In EMF, a resource provides the way to have access to the model content. - */ - private Resource resourcePageflow = null; - - /** - * the path of current pageflow model resource provides the way to have - * access to the model content. - */ - private IPath pathPageflow = null; - - /** - * Contains the factory associated with the model. - */ - private static PageflowFactory pageflowFactory = null; - - /** - * Gives access to the top level pageflow contained in the resource. - */ - private Pageflow pageflow = null; - - /** - * resource set - */ - private ResourceSet resourceSet = null; - - /** unicode encoding UTF-8 support */ - private static HashMap defaultSaveOptions = new HashMap(); - - static { - defaultSaveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$ - } - - /** - * Uses lazy initialization. - * - * @param path - - * pageflow file name - * @return the resource containing the pageflow - */ - public Resource getResource(IPath path) { - if (resourcePageflow == null) { - pathPageflow = path; - ResourceSet resSet = getResourceSet(); - resourcePageflow = resSet.getResource(URI.createPlatformResourceURI(path - .toString(), false), true); - } - - return resourcePageflow; - } - - /** - * - * @return the top level pageflow model - */ - public Pageflow getModel() { - if (null == pageflow) { - EList l = resourcePageflow.getContents(); - Iterator i = l.iterator(); - while (i.hasNext()) { - Object o = i.next(); - if (o instanceof Pageflow) { - pageflow = (Pageflow) o; - } - } - } - return pageflow; - } - - /** - * Creates a resource to contain the network. The resource file does not - * exist yet. - * - * @param path - * @return - */ - private Resource createResource(IPath path) { - if (resourcePageflow == null) { - pathPageflow = path; - ResourceSet resSet = getResourceSet(); - resourcePageflow = resSet.createResource(URI.createPlatformResourceURI(path - .toString(), false)); - } - return resourcePageflow; - } - - /** - * Returns the resource set. - * - * @param - * @return - */ - private ResourceSet getResourceSet() { - if (null == resourceSet) { - // Initialize the pageflow package, this line can not be removed. - PageflowPackageImpl.init(); - // Register the XML resource factory for the .pageflow extension - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - Map regMap = reg.getExtensionToFactoryMap(); - // m.put("pageflow", new XMIResourceFactoryImpl()); - regMap.put("pageflow", new PageflowResourceFactoryImpl()); //$NON-NLS-1$ - - resourceSet = new ResourceSetImpl(); - } - - return resourceSet; - } - - /** - * Returns the factory associated with the model. Object creation are made - * through that factory. - * - * @return - pageflow factory - */ - static public PageflowFactory getFactory() { - if (pageflowFactory == null) { - // Access the factory (needed to create instances) - Map registry = EPackage.Registry.INSTANCE; - String pageflowURI = PageflowPackage.eNS_URI; - PageflowPackage pageflowPackage = (PageflowPackage) registry - .get(pageflowURI); - pageflowFactory = pageflowPackage.getPageflowFactory(); - } - return pageflowFactory; - } - - /** - * Creates a new pageflow model with begin and end nodes. - * - * @param path - - * the new pageflow file name - * @return - new pageflow model - */ - public Pageflow createPageflow(IPath path) { - createResource(path); - // Create a new pageflow model - Map registry = EPackage.Registry.INSTANCE; - String pageflowURI = PageflowPackage.eNS_URI; - PageflowPackage nPackage = (PageflowPackage) registry.get(pageflowURI); - PageflowFactory nFactory = nPackage.getPageflowFactory(); - pageflow = nFactory.createPageflow(); - - resourcePageflow.getContents().add(pageflow); - return pageflow; - } - - /** - * Loads the content of the model from the file. - * - * @param path - */ - public void load(IPath path) { - getResource(path); - } - - /** - * reloads the content of the model from the file. - * - * @param path - */ - public void reload(IPath path) { - getResource(path).unload(); - load(path); - } - - /** - * Saves the content of the model to the file. - * - * @param path - * @throws IOException - */ - public void save(final IPath path) throws IOException { - if (!pathPageflow.toString().equalsIgnoreCase(path.toString())) { - pathPageflow = path; - URI fileURI = URI.createPlatformResourceURI(path.toString(), false); - resourcePageflow.setURI(fileURI); - } - resourcePageflow.save(defaultSaveOptions); - } - - /** - * get the file path of current pageflow resource - * - * @return - the file path - */ - public IPath getPath() { - return pathPageflow; - } - - /** - * @param webPath - * @return found page node according the web path. - */ - public PageflowPage foundPage(String webPath) { - PageflowPage page = null; - - if (getModel() != null) { - Iterator iterNodes = getModel().getNodes().iterator(); - while (iterNodes.hasNext()) { - PageflowNode node = (PageflowNode) iterNodes.next(); - if (node instanceof PageflowPage) { - if (((PageflowPage) node).getPath().equalsIgnoreCase(webPath)) { - page = (PageflowPage) node; - break; - } - } - } - } - - return page; - } - - /** - * - * Build a path for the resource in the .metadata directory given the path - * of the model resource. For example, given a model resource path of - * \test\folder\filename.ext the resulting Pageflow path name will be - * \test\.metadata\folder\filename.pageflow - * - * @param pathFacesConfig - - * faces-config file path. - * - * @return the ipath - */ - public static IPath makePageflowPath(IPath pathFacesConfig) { - IPath pageflowPath; - String[] segs = pathFacesConfig.removeFileExtension().segments(); - pageflowPath = new Path(segs[0]).makeAbsolute(); - pageflowPath = pageflowPath.append(".metadata"); //$NON-NLS-1$ - for (int i = 1; i < segs.length; i++) { - pageflowPath = pageflowPath.append(segs[i]); - } - // pageflowPath.removeFileExtension(); - pageflowPath = pageflowPath.addFileExtension("pageflow"); //$NON-NLS-1$ - return pageflowPath; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceFactory.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceFactory.java deleted file mode 100644 index 24f995ced..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceFactory.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import org.eclipse.core.resources.IResource; -import org.eclipse.gef.requests.CreationFactory; -import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; - -/** - * - * This is the Page Flow Resource Factory for resource drag and drop - * - * @author Xiao-guang Zhang - */ -public class PageflowResourceFactory implements CreationFactory { - /** resource */ - private IResource resource; - - /** - * @param resource - */ - public PageflowResourceFactory(IResource resource) { - this.resource = resource; - } - - /* - * (non-javadoc) - * - * @see Factory#getNewObject() - */ - public Object getNewObject() { - if (null == resource) { - return null; - } - - String strWebPath = WebrootUtil.getWebPath(resource.getFullPath()); - if (strWebPath.length() > 0) { - PageflowFactory factory = PageflowModelManager.getFactory(); - Object result = factory.createPFPage(); - PageflowPage page = (PageflowPage) result; - page.setPath(strWebPath); - page.setName(WebrootUtil.getPageNameFromWebPath(strWebPath)); - return page; - } - - EditorPlugin - .getAlerts() - .error( - "Pageflow.Error.DNDResourceTitle", //$NON-NLS-1$ - EditorPlugin - .getResourceString("Pageflow.Error.InvalidResource") //$NON-NLS-1$ - + resource.getName()); - - return null; - } - - /* - * (non-javadoc) - * - * @see Factory#getObjectType() - */ - public Object getObjectType() { - return resource; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceFactoryImpl.java deleted file mode 100644 index 1181474f8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceFactoryImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; - -/** - * The <b>Resource Factory</b> associated with the package. - * - * @author Xiao-guang Zhang - */ -public class PageflowResourceFactoryImpl extends XMLResourceFactoryImpl { - /** - * Creates an instance of the resource factory. - */ - public PageflowResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - */ - public Resource createResource(URI uri) { - Resource result = new PageflowResourceImpl(uri); - return result; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceImpl.java deleted file mode 100644 index 07e13ee12..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowResourceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * - * The <b>Resource </b> associated with the package. - * - * @author Xiao-guang Zhang - */ -public class PageflowResourceImpl extends XMLResourceImpl { - /** - * Creates an instance of the resource. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param uri - * the URI of the new resource. - * @generated - */ - public PageflowResourceImpl(URI uri) { - super(uri); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowSwitch.java deleted file mode 100644 index 3487f12c4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowSwitch.java +++ /dev/null @@ -1,262 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage; - -/** - * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance - * hierarchy. It supports the call {@link #doSwitch(EObject)} to invoke - * the <code>caseXXX</code> method for each class of the model, starting with - * the actual class of the object and proceeding up the inheritance hierarchy - * until a non-null result is returned, which is the result of the switch. <!-- - * end-user-doc --> - * - * @see org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage - * @generated - */ -public class PageflowSwitch { - /** - * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static PageflowPackage modelPackage; - - /** - * Creates an instance of the switch. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public PageflowSwitch() { - if (modelPackage == null) { - modelPackage = PageflowPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one - * returns a non null result; it yields that result. - * - * <!-- begin-user-doc --> - * @param theEObject - * - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * <!-- end-user-doc --> - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one - * returns a non null result; it yields that result. - * - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * <!-- end-user-doc --> - * - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch( - (EClass) eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one - * returns a non null result; it yields that result. - * - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * <!-- end-user-doc --> - * - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case PageflowPackage.PAGEFLOW: { - Pageflow pageflow = (Pageflow) theEObject; - Object result = casePageflow(pageflow); - if (result == null) - result = casePageflowElement(pageflow); - if (result == null) - result = defaultCase(theEObject); - return result; - } - case PageflowPackage.PF_LINK: { - PageflowLink pfLink = (PageflowLink) theEObject; - Object result = casePFLink(pfLink); - if (result == null) - result = casePageflowElement(pfLink); - if (result == null) - result = defaultCase(theEObject); - return result; - } - - case PageflowPackage.PF_PAGE: { - PageflowPage pfPage = (PageflowPage) theEObject; - Object result = casePFPage(pfPage); - if (result == null) - result = casePageflowNode(pfPage); - if (result == null) - result = casePageflowElement(pfPage); - if (result == null) - result = defaultCase(theEObject); - return result; - } - - case PageflowPackage.PF_LINK_BENDPOINT: { - PageflowLinkBendpoint pfLinkBendpoint = (PageflowLinkBendpoint) theEObject; - Object result = casePFLinkBendpoint(pfLinkBendpoint); - if (result == null) - result = defaultCase(theEObject); - return result; - } - default: - return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Pageflow</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Pageflow</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePageflow(Pageflow object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Node</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Node</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePageflowNode(PageflowNode object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>PF Link</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>PF Link</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePFLink(PageflowLink object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Element</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePageflowElement(PageflowElement object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>PF Page</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>PF Page</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePFPage(PageflowPage object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>PF Link Bendpoint</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>PF Link Bendpoint</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePFLinkBendpoint(PageflowLinkBendpoint object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a - * non-null result will terminate the switch, but this is the last case - * anyway. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} -// PageflowSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowTransform.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowTransform.java deleted file mode 100644 index 327af05c9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowTransform.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType; -import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType; -import org.eclipse.jst.jsf.facesconfig.emf.IconType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType; -import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; - -/** - * The tranform between pageflow and navigation rules in faces-config file. - * - * @author Xiao-guang Zhang - */ -public class PageflowTransform { - - /** The shared singleton instance. */ - private static PageflowTransform transform; - - private PageflowTransform() { - // private contructor - } - - /** - * Returns the shared singleton instance. - * @return the singleton transform instance - */ - public static PageflowTransform getInstance() { - if (transform == null) { - transform = new PageflowTransform(); - } - return transform; - } - - /** - * Update source PFPage with Faces-config model. - * - * @param sourcePage - * @param navigationRuleFC - * @author sfshi - */ - public void updatePageflowSourcePage(PageflowPage sourcePage, - NavigationRuleType navigationRuleFC) { - // set the descriiption of link - if (navigationRuleFC.getDescription() != null - && navigationRuleFC.getDescription().size() > 0) { - String description = ((DescriptionType) navigationRuleFC - .getDescription().get(0)).getTextContent(); - sourcePage.setComment(description); - } - // set the display-name of link - if (navigationRuleFC.getDisplayName() != null - && navigationRuleFC.getDisplayName().size() > 0) { - String displayName = ((DisplayNameType) navigationRuleFC - .getDisplayName().get(0)).getTextContent(); - sourcePage.setName(displayName); - } - - // Set the icon of link - if (navigationRuleFC.getIcon() != null - && navigationRuleFC.getIcon().size() > 0) { - boolean largeUpdated = false; - boolean smallUpdated = false; - for (int i = 0; i < navigationRuleFC.getIcon().size(); i++) { - IconType icon = (IconType) navigationRuleFC.getIcon().get(i); - if (!largeUpdated && icon.getLargeIcon() != null) { - sourcePage.setLargeicon(icon.getLargeIcon() - .getTextContent()); - largeUpdated = true; - } - - if (!smallUpdated && icon.getSmallIcon() != null) { - sourcePage.setSmallicon(icon.getSmallIcon() - .getTextContent()); - smallUpdated = true; - } - if (largeUpdated && smallUpdated) { - return; - } - } - } - } - - /** - * Update target PFPage with Faces-config model. - * - * @param targetPage - * @param navigationCaseFC - * @author sfshi - */ - public void updatePageflowTargetPage(PageflowPage targetPage, - NavigationCaseType navigationCaseFC) { - // set the descriiption of link - if (navigationCaseFC.getDescription() != null - && navigationCaseFC.getDescription().size() > 0) { - String description = ((DescriptionType) navigationCaseFC - .getDescription().get(0)).getTextContent(); - targetPage.setComment(description); - } - // set the display-name of link - if (navigationCaseFC.getDisplayName() != null - && navigationCaseFC.getDisplayName().size() > 0) { - String displayName = ((DisplayNameType) navigationCaseFC - .getDisplayName().get(0)).getTextContent(); - targetPage.setName(displayName); - } - - // Set the icon of link - if (navigationCaseFC.getIcon() != null - && navigationCaseFC.getIcon().size() > 0) { - boolean largeUpdated = false; - boolean smallUpdated = false; - for (int i = 0; i < navigationCaseFC.getIcon().size(); i++) { - IconType icon = (IconType) navigationCaseFC.getIcon().get(0); - if (!largeUpdated && icon.getLargeIcon() != null) { - targetPage.setLargeicon(icon.getLargeIcon() - .getTextContent()); - largeUpdated = true; - } - - if (!smallUpdated && icon.getSmallIcon() != null) { - targetPage.setSmallicon(icon.getSmallIcon() - .getTextContent()); - smallUpdated = true; - } - if (largeUpdated && smallUpdated) { - return; - } - } - } - } - - /** - * update the pageflow model 's information, including pageflow's name, - * description and related config file - * - * @param newPageflow - * @param oldPageflow - */ - public static void updatePageflowModelInfo(Pageflow newPageflow, - Pageflow oldPageflow) { - if (newPageflow == null || oldPageflow == null) { - return; - } - newPageflow.setName(oldPageflow.getName()); - newPageflow.setComment(oldPageflow.getComment()); - newPageflow.setConfigfile(oldPageflow.getConfigfile()); - - } -} -// PageflowTransform diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowValidation.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowValidation.java deleted file mode 100644 index 7f69a64ff..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/PageflowValidation.java +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.pageflow.util; - -import java.util.Iterator; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode; -import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage; -import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil; -import org.eclipse.osgi.util.NLS; - -/** - * Pageflow's validation functions - * - * @author Xiao-guang Zhang - */ -public class PageflowValidation { - /** PageflowValidation singleton instance */ - private static PageflowValidation instance; - - /** constructor */ - private PageflowValidation() { - // no external instantiation - } - - /** - * get the singleton instance of pageflow validation - * - * @return the singleton instance of pageflow validation - */ - public static PageflowValidation getInstance() { - if (instance == null) { - instance = new PageflowValidation(); - } - return instance; - } - - /** - * check whether the source and target pageflow node are allowed to create a - * new link NOT allowed source and target: 1. target node is Begin or source - * node is End 2. both of source and target node are Action. 3. double - * connection from the same source to target - * - * @param source - - * source pageflow node - * @param target - - * target pageflow node - * @return - is valid link or not. - * - */ - public boolean isValidLinkForCreation(PageflowNode source, - PageflowNode target) { - // Source and target must be pointing to some real pageflow node - if (source == null || target == null) { - return false; - } - return true; - } - - /** - * determine the pflink is valid or not for property souce. in our model, - * there are five types of invalid pflinke for property source. 1. link - * between page and action 2. the source of link is Begin or End node 3. the - * target of link is Begin or End node. - * @param link - * - * @return - valid link or not. - * - */ - public boolean isValidLinkForProperty(PageflowLink link) { - return true; - } - - /** - * determine the pflink is valid or not for face-config rule in our model, - * there are four types of invalid pflinke. 1. the source of link is Begin - * or End node 2. the target of link is Begin or End node. - * @param link - * - * @return - valid link or not. - * - */ - public boolean isValidLinkForNavigationRule(PageflowLink link) { - return true; - } - - /** - * determine the pflink is valid or not for face-config rule in our model, - * there are four types of invalid pflinke. - * @param link - * - * @return - valid link or not. - * - */ - public String isValidLink(PageflowLink link) { - String errorMessage = null; - // action-page style - // TODO: it should guarantee that outcome should be defined in the - // managed bean's method. - - if (link.getSource() instanceof PageflowPage - && link.getTarget() instanceof PageflowPage) { - String outcome = link.getOutcome(); - if (outcome != null && outcome.length() >= 0) { - // if (isValidServiceOutcome(outcome)) - // { - // return errorMessage; - // } - String webPath = ((PageflowPage) link.getSource()).getPath(); - if (webPath != null) { - String projectPath = WebrootUtil.getProjectPath(link, - webPath); - - Path resourcePath = new Path(projectPath); - IWorkspaceRoot workspaceRoot = ResourcesPlugin - .getWorkspace().getRoot(); - final IResource resource = workspaceRoot - .findMember(resourcePath); - - if (resource == null || !resource.exists()) { - // Pageflow.Validation.NotExistedSourcePage = The source - // page {0} is not existed. - errorMessage = NLS - .bind( - PageflowMessages.Pageflow_Validation_UndefinedOutcome, - outcome, webPath); - } - } else { - // Pageflow.Validation.MissingSourcePage = The source page - // should be specified. - errorMessage = PageflowMessages.Pageflow_Validation_MissingSourcePage; - } - } - } - return errorMessage; - } - - /** - * Check whether the page is already existed in the pageflow. - * - * @param pageflow - * @param page - * @return true if page exists (?) - */ - public boolean isExistedPage(Pageflow pageflow, PageflowPage page) { - if (pageflow == null || page == null || page.getPath() == null) { - return false; - } - - return isExistedPage(pageflow, page.getPath()); - } - - /** - * Check whether the page is already existed in the pageflow. - * - * @param pageflow - * @param pagePath - * @return true if pageflow's path is equal to pagePath - */ - public boolean isExistedPage(Pageflow pageflow, String pagePath) { - if (pageflow == null || pagePath == null) { - return false; - } - - Iterator iter = pageflow.getNodes().iterator(); - - while (iter.hasNext()) { - PageflowNode existedNode = (PageflowNode) iter.next(); - - if (existedNode instanceof PageflowPage) { - if (((PageflowPage) existedNode).getPath() != null - && ((PageflowPage) existedNode).getPath() - .equalsIgnoreCase(pagePath)) { - return true; - } - } - } - - return false; - } - - /** - * Check whether the page is valid or not validate page is : 1. if the page - * is general jsp page, it should physically existed. 2. if the page is in - * the form of /foldername/* (it contains the folder), the folder should be - * existed. - * - * @param page - * @return the notify message for page - */ - public String getNotifyMessage(PageflowPage page) { - String errorMessage = null; - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - String pagePath = page.getPath(); - - // Check the path is empty or not - if (pagePath != null && pagePath.length() > 0) { - String resourceName = WebrootUtil.getProjectPath(page, pagePath); - Path resourcePath = new Path(resourceName); - - final IResource resource = workspaceRoot.findMember(resourcePath); - - if (resource != null && resource.exists()) { - // This page is related with jsp file - if (resourcePath.getFileExtension() != null) { - if (!WebrootUtil.isValidWebFile(resourcePath)) { - // Pageflow.Validation.InvalidWebPage = the file {0} is - // not valid web file. - errorMessage = NLS - .bind( - PageflowMessages.Pageflow_Validation_InvalidWebPage, - pagePath); - } - } - } else { - // Pageflow.Validation.NotExitedWebPage = the web page {0} is - // not existed. - errorMessage = NLS.bind( - PageflowMessages.Pageflow_Validation_NotExitedWebPage, - pagePath); - } - } else { - // Pageflow.Validation.MissingWebPage = the web page's path should - // be specified. - errorMessage = PageflowMessages.Pageflow_Validation_MissingWebPage; - } - return errorMessage; - } - - /** - * check that the action is valid EL or not, - * - * @param actionEL - - * action string, it should be in the form of #{...} - * @return - True or False - */ - public static boolean isValidActionEL(String actionEL) { - if (actionEL != null && actionEL.length() > 3) { - // action is defined in JSF expression language, e.g, - // #{beanname.methodname} - if (actionEL.substring(0, 2).equalsIgnoreCase("#{")//$NON-NLS-1$ - && actionEL.substring(actionEL.length() - 1, - actionEL.length()).equalsIgnoreCase("}"))//$NON-NLS-1$ - { - // Check the bean is existed or not. - return true; - } - - } - return false; - } - - /** - * get the managed bean from action's expression, e.g., beanName.methodName. - * The return will be beanName. - * - * @param actionEL - * @return the managed bean name - */ - public static String getManagedBeanforAction(String actionEL) { - String managedBeanName = null; - if (isValidActionEL(actionEL)) { - actionEL = actionEL.substring(2, actionEL.length() - 1); - String[] actionParts = actionEL.split("[.]"); //$NON-NLS-1$ - managedBeanName = actionParts[0]; - } - - return managedBeanName; - } - -} |