Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions')
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.java42
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.properties44
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ChangeStyleAction.java206
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DataBindingViewAction.java59
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignActionBarFactory.java122
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignPageActionContributor.java237
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerStyleActionGroup.java243
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerUndoRedoAction.java109
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ManageSkinsAction.java181
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/OutlineViewAction.java35
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PageDesignerActionBarContributor2.java350
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PaletteViewAction.java111
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PropertiesViewAction.java34
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/RelatedViewActionGroup.java148
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ShowViewAction.java60
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SkinsMenuItemBuilder.java233
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SourcePageActionContributor.java100
17 files changed, 0 insertions, 2314 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.java
deleted file mode 100644
index b5da9485e..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class ActionsMessages {
- private static final String BUNDLE_NAME = "org.eclipse.jst.pagedesigner.editors.actions.ActionsMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private ActionsMessages() {
- // no external instantiation
- }
-
- /**
- * @param key
- * @return the resource for the key
- */
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.properties b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.properties
deleted file mode 100644
index d57d3c14f..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.properties
+++ /dev/null
@@ -1,44 +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
-###############################################################################
-DesignActionBarFactory.Underline=Underline
-DesignActionBarFactory.Italic=Italic
-DesignActionBarFactory.Bold=Bold
-DesignActionBarFactory.Small=Small
-DesignActionBarFactory.Big=Big
-DesignActionBarFactory.Paragraph=Paragraph
-DesignActionBarFactory.Underline.Text=Underline
-DesignActionBarFactory.Italic.Text=Italic
-DesignActionBarFactory.Bold.Text=Bold
-DesignActionBarFactory.Small.Text=Small
-DesignActionBarFactory.Big.Text=Big
-PaletteViewAction.Menu.PaletteView=Palette
-RelatedViewActionGroup.Menu.ShowView=Show
-PropertiesViewAction.Menu.Properties=Properties
-DataBindingViewAction.Menu.DataBinding=DataBinding
-OutlineViewAction.Menu.OutlineView=Outline
-DesignerStyleActionGroup.CommandLabel.V=V
-DesignerStyleActionGroup.CommandLabel.H=H
-DesignerStyleActionGroup.CommandLabel.D=D
-DesignerStyleActionGroup.CommandLabel.S=S
-DesignerStyleActionGroup.CommandLabel.V.Tooltip=Show Design Page and Source Page as Horizontal Panes
-DesignerStyleActionGroup.CommandLabel.H.Tooltip=Show Design Page and Source Page as Vertical Panes
-DesignerStyleActionGroup.CommandLabel.D.Tooltip=Only Show Design Page
-DesignerStyleActionGroup.CommandLabel.S.Tooltip=Only Show Source Page
-DesignerUndoRedoAction.UNDO=Undo
-DesignerUndoRedoAction.REDO=Redo
-DesignerUndoRedoAction.UNDO_LABEL=Undo {0}
-DesignerUndoRedoAction.REDO_LABEL=Redo {0}
-Select.Menu=Select
-Edit.Menu=Edit
-Navigate.Menu=Navigate
-Style.Menu=Style
-Insert.Menu=Insert
-ManageSkinsAction.Text=Manage Skins
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ChangeStyleAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ChangeStyleAction.java
deleted file mode 100644
index 70e5a6813..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ChangeStyleAction.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jst.pagedesigner.commands.DesignerCommand;
-import org.eclipse.jst.pagedesigner.commands.range.ApplyStyleCommand;
-import org.eclipse.jst.pagedesigner.range.RangeUtil;
-import org.eclipse.jst.pagedesigner.viewer.DesignRange;
-import org.eclipse.jst.pagedesigner.viewer.HTMLGraphicalViewerListenenerAdapter;
-import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer;
-import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewerListener;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * @author mengbo
- */
-public abstract class ChangeStyleAction extends Action implements IUpdate {
- private IHTMLGraphicalViewer _viewer;
-
- private String _expectedTag;
-
- private IHTMLGraphicalViewerListener _listener = new HTMLGraphicalViewerListenenerAdapter()
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewerListener#selectionChangeFinished()
- */
- public void selectionChangeFinished() {
- update();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- update();
- }
- };
-
- /**
- * @param text
- * @param name
- * @param image
- * @param style
- */
- public ChangeStyleAction(String text, String name, ImageDescriptor image,
- int style) {
- super(text, style);
- _expectedTag = name;
- this.setImageDescriptor(image);
- }
-
- /**
- * @param viewer
- */
- public void setViewer(IHTMLGraphicalViewer viewer) {
- if (viewer == _viewer) {
- return;
- }
- if (_viewer != null) {
- _viewer.removeHTMLViewerListener(_listener);
- }
- _viewer = viewer;
- if (_viewer != null) {
- _viewer.addHTMLViewerListener(_listener);
- }
- update();
- }
-
- /**
- *
- */
- public void update()
- {
- boolean update = checkForUpdateAndMaybeDisableState();
-
- if (update)
- {
- updateState();
- }
- }
-
- /**
- * Update the state
- */
- protected void updateState()
- {
- DesignRange range = _viewer.getRangeSelection();
- updateStatus(RangeUtil.normalize(range));
- }
-
- /**
- * Update the checked/enabled state
- * @return true if we should update status
- */
- protected final boolean checkForUpdateAndMaybeDisableState()
- {
- if (_viewer == null) {
- this.setChecked(false);
- this.setEnabled(false);
- return false;
- }
- if (!_viewer.isInRangeMode()) {
- // XXX: later we may support in range mode.
- this.setChecked(false);
- this.setEnabled(false);
- return false;
- }
- DesignRange range = _viewer.getRangeSelection();
- if (range == null || !range.isValid()) {
- this.setChecked(false);
- this.setEnabled(false);
- return false;
- }
- return true;
- }
-
-
- /**
- * @return the viewer's current design range
- */
- protected final DesignRange getDesignRange()
- {
- return _viewer.getRangeSelection();
- }
- /**
- * @param range
- */
- private void updateStatus(DesignRange range) {
- if (range.isEmpty()) {
- this.setEnabled(false);
- this.setChecked(false); // FIXME: not handling checked status yet.
- } else {
- this.setEnabled(true);
- this.setChecked(false);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- if (_viewer == null || !_viewer.isInRangeMode()) {
- return;
- }
- DesignRange range = _viewer.getRangeSelection();
- if (range == null || !range.isValid()) {
- return;
- }
- if (range.isEmpty())
- return; // nothing to do to empty range.
-
- // if currently checked, means unapply the style. If current not
- // checked, means apply the style
- boolean apply = !this.isChecked();
- if (apply) {
- applyStyle();
- } else {
- // not supported yet.
- }
- }
-
- /**
- *
- */
- private void applyStyle() {
- DesignerCommand command = new ApplyStyleCommand(_viewer,
- getExpectedTag(), getExpectedCSSProperty(),
- getExpectedCSSPropertyValue());
- command.execute();
- }
-
- /**
- * @return the expected property value
- */
- protected abstract String getExpectedCSSPropertyValue();
-
- /**
- * @return the expected property
- */
- protected abstract String getExpectedCSSProperty();
-
- /**
- * @return the expected tag
- */
- protected String getExpectedTag() {
- return _expectedTag;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DataBindingViewAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DataBindingViewAction.java
deleted file mode 100644
index 1b2032d68..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DataBindingViewAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class DataBindingViewAction extends Action {
-
- private static Logger _log = PDPlugin
- .getLogger(DataBindingViewAction.class);
-
- /**
- * Default constructor
- */
- public DataBindingViewAction() {
- setText(ActionsMessages
- .getString("DataBindingViewAction.Menu.DataBinding")); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- try {
- getPage().showView(
- "org.eclipse.jst.pagedesigner.databinding.ui.views.DataBindingsView");//$NON-NLS-1$
- } catch (PartInitException e) {
- _log.error("Error opening the DataBindingView"); //$NON-NLS-1$
- }
- }
-
- private IWorkbenchPage getPage() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- return window.getActivePage();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignActionBarFactory.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignActionBarFactory.java
deleted file mode 100644
index 1a3c1b430..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignActionBarFactory.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jst.pagedesigner.IHTMLConstants;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.actions.range.ChangeStyleAction;
-import org.eclipse.jst.pagedesigner.actions.range.DesignerToolBarAction;
-import org.eclipse.jst.pagedesigner.actions.range.HTagsInsertGroupAction;
-
-/**
- * @author mengbo
- */
-public class DesignActionBarFactory {
-
- private static final String TOOLBAR_PARAGRAPH_IMAGE_FILE = "PD_Toolbar_paragraph.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_LARGEFONT_DISABLED_IMAGE_FILE = "PD_Toolbar_largefont_disabled.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_LARGEFONT_IMAGE_FILE = "PD_Toolbar_largefont.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_SMALLFONT_DISABLED_IMAGE_FILE = "PD_Toolbar_smallfont_disabled.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_SMALLFONT_IMAGE_FILE = "PD_Toolbar_smallfont.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_BOLD_DISABLED_IMAGE_FILE = "PD_Toolbar_bold_disabled.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_BOLD_IMAGE_FILE = "PD_Toolbar_bold.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_ITALIC_DISABLED_IMAGE_FILE = "PD_Toolbar_italic_disabled.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_ITALIC_IMAGE_FILE = "PD_Toolbar_italic.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_UNDERLINE_DISABLED_IMAGE_FILE = "PD_Toolbar_underline_disabled.gif"; //$NON-NLS-1$
- private static final String TOOLBAR_UNDERLINE_IMAGE_FILE = "PD_Toolbar_underline.gif"; //$NON-NLS-1$
-
- private static DesignActionBarFactory _instance;
-
- private DesignActionBarFactory() {
- // no external instantiation
- }
-
- /**
- * @return get the factory singleton
- */
- public static DesignActionBarFactory getInstance() {
- if (_instance == null) {
- _instance = new DesignActionBarFactory();
- }
- return _instance;
- }
-
- /**
- * @param name
- * @return the tool bar action
- */
- public DesignerToolBarAction getStyleAction(String name) {
- DesignerToolBarAction action = null;
-
- if (name.equals(IHTMLConstants.TAG_U)) {
- action = new ChangeStyleAction(ActionsMessages
- .getString("DesignActionBarFactory.Underline.Text"), name, //$NON-NLS-1$
- PDPlugin.getDefault().getImageDescriptor(
- TOOLBAR_UNDERLINE_IMAGE_FILE), PDPlugin.getDefault()
- .getImageDescriptor(
- TOOLBAR_UNDERLINE_DISABLED_IMAGE_FILE),
- IAction.AS_CHECK_BOX);
- action.setToolTipText(ActionsMessages
- .getString("DesignActionBarFactory.Underline")); //$NON-NLS-1$
- } else if (name.equals(IHTMLConstants.TAG_I)) {
- action = new ChangeStyleAction(ActionsMessages
- .getString("DesignActionBarFactory.Italic.Text"), name, //$NON-NLS-1$
- PDPlugin.getDefault().getImageDescriptor(
- TOOLBAR_ITALIC_IMAGE_FILE), PDPlugin.getDefault()
- .getImageDescriptor(
- TOOLBAR_ITALIC_DISABLED_IMAGE_FILE),
- IAction.AS_CHECK_BOX);
- action.setToolTipText(ActionsMessages
- .getString("DesignActionBarFactory.Italic")); //$NON-NLS-1$
- } else if (name.equals(IHTMLConstants.TAG_B)) {
- action = new ChangeStyleAction(ActionsMessages
- .getString("DesignActionBarFactory.Bold.Text"), name, //$NON-NLS-1$
- PDPlugin.getDefault().getImageDescriptor(
- TOOLBAR_BOLD_IMAGE_FILE),
- PDPlugin.getDefault().getImageDescriptor(
- TOOLBAR_BOLD_DISABLED_IMAGE_FILE),
- IAction.AS_CHECK_BOX);
- action.setToolTipText(ActionsMessages
- .getString("DesignActionBarFactory.Bold")); //$NON-NLS-1$
- } else if (name.equals(IHTMLConstants.TAG_SMALL)) {
- action = new ChangeStyleAction(ActionsMessages
- .getString("DesignActionBarFactory.Small.Text"), name, //$NON-NLS-1$
- PDPlugin.getDefault().getImageDescriptor(
- TOOLBAR_SMALLFONT_IMAGE_FILE), PDPlugin.getDefault()
- .getImageDescriptor(
- TOOLBAR_SMALLFONT_DISABLED_IMAGE_FILE),
- IAction.AS_CHECK_BOX);
- action.setToolTipText(ActionsMessages
- .getString("DesignActionBarFactory.Small")); //$NON-NLS-1$
- } else if (name.equals(IHTMLConstants.TAG_BIG)) {
- action = new ChangeStyleAction(ActionsMessages
- .getString("DesignActionBarFactory.Big.Text"), name, //$NON-NLS-1$
- PDPlugin.getDefault().getImageDescriptor(
- TOOLBAR_LARGEFONT_IMAGE_FILE), PDPlugin.getDefault()
- .getImageDescriptor(
- TOOLBAR_LARGEFONT_DISABLED_IMAGE_FILE),
- IAction.AS_CHECK_BOX);
- action.setToolTipText(ActionsMessages
- .getString("DesignActionBarFactory.Big")); //$NON-NLS-1$
- } else if (name
- .equalsIgnoreCase(DesignPageActionContributor.PARAGRAPH_ACTION_ID)) {
- action = new HTagsInsertGroupAction(PDPlugin.getDefault()
- .getImageDescriptor(TOOLBAR_PARAGRAPH_IMAGE_FILE),
- IAction.AS_DROP_DOWN_MENU);
- action.setToolTipText(ActionsMessages
- .getString("DesignActionBarFactory.Paragraph")); //$NON-NLS-1$
- }
-
- return action;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignPageActionContributor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignPageActionContributor.java
deleted file mode 100644
index a1782ec5d..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignPageActionContributor.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
-import org.eclipse.jst.pagedesigner.IHTMLConstants;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.actions.range.DesignerToolBarAction;
-import org.eclipse.jst.pagedesigner.editors.HTMLEditor;
-import org.eclipse.jst.pagedesigner.editors.IDesignViewer;
-import org.eclipse.jst.pagedesigner.editors.SimpleGraphicalEditor;
-import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchCommandConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * sub action contributor for the designer page.
- *
- * @author mengbo
- */
-public class DesignPageActionContributor extends EditorActionBarContributor {
- private static final Logger _log = PDPlugin
- .getLogger(DesignPageActionContributor.class);
-
- /**
- * paragraph
- */
- public static final String PARAGRAPH_ACTION_ID = "paragraph"; //$NON-NLS-1$
-
- private IEditorPart _editorPart;
-
- /**
- * @param manager
- * @param id
- */
- protected void doRemove(IContributionManager manager, String id) {
- try {
- if (manager.find(id) != null) {
- manager.remove(id);
- }
- } catch (Exception e) {
- _log.info("Error:", e); //$NON-NLS-1$
- }
- }
-
- public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars);
- init(bars);
- }
-
- public void init(IActionBars bars) {
- IToolBarManager toolbar = bars.getToolBarManager();
- initToolbar(toolbar);
- }
-
- /**
- * @param toolbar
- */
- private void initToolbar(IToolBarManager toolbar) {
- DesignActionBarFactory factory = DesignActionBarFactory.getInstance();
-
- Action action = factory.getStyleAction(IHTMLConstants.TAG_U);
- toolbar.add(action);
-
- action = factory.getStyleAction(IHTMLConstants.TAG_B);
- toolbar.add(action);
-
- action = factory.getStyleAction(IHTMLConstants.TAG_I);
- toolbar.add(action);
-
- action = factory.getStyleAction(IHTMLConstants.TAG_SMALL);
- toolbar.add(action);
-
- action = factory.getStyleAction(IHTMLConstants.TAG_BIG);
- toolbar.add(action);
- // action = factory.getStyleAction(PARAGRAPH_ACTION_ID);
- // toolbar.add(action);
- }
-
- /**
- * @param menuManager
- * @param action
- * @param id
- */
- protected void addActionWithId(IMenuManager menuManager, Action action,
- String id) {
- action.setId(id);
- menuManager.add(action);
- }
-
- /**
- * @param enabled
- */
- public void setViewerSpecificContributionsEnabled(boolean enabled) {
- HTMLEditor htmlEditor = null;
- if (_editorPart instanceof HTMLEditor) {
- htmlEditor = (HTMLEditor) _editorPart;
- } else if (_editorPart instanceof SimpleGraphicalEditor) {
- htmlEditor = ((SimpleGraphicalEditor) _editorPart).getHTMLEditor();
- }
-
- if (htmlEditor == null)
- return;
-
- SimpleGraphicalEditor graphicalEditor = (SimpleGraphicalEditor) htmlEditor
- .getDesignViewer();
- IWorkbenchPartSite site = htmlEditor.getSite();
- if (site instanceof IEditorSite) {
- IActionBars actionBars = ((IEditorSite) site).getActionBars();
-
- if (enabled) {
- // // we always let the text editor to handle UNDO and REDO
- // actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO,
- // textEditor
- // .getAction(ITextEditorActionConstants.UNDO));
- // actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO,
- // textEditor
- // .getAction(ITextEditorActionConstants.REDO));
- // lium: the above behavior changed, since we now use
- // DesignerUndoRedoAction.
- // see comments in DesignerUndoRedoAction
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.UNDO, graphicalEditor
- .getAction(IWorkbenchCommandConstants.EDIT_UNDO));
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.REDO, graphicalEditor
- .getAction(IWorkbenchCommandConstants.EDIT_REDO));
-
- // cut/copy/paste is delegated to design actions
- actionBars
- .setGlobalActionHandler(
- ITextEditorActionConstants.DELETE,
- graphicalEditor
- .getAction(IWorkbenchCommandConstants.EDIT_DELETE));
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.CUT, graphicalEditor
- .getAction(IWorkbenchCommandConstants.EDIT_CUT));
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.COPY, graphicalEditor
- .getAction(IWorkbenchCommandConstants.EDIT_COPY));
- actionBars
- .setGlobalActionHandler(
- ITextEditorActionConstants.PASTE,
- graphicalEditor
- .getAction(IWorkbenchCommandConstants.EDIT_PASTE));
- } else {
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.UNDO, null);
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.REDO, null);
-
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.DELETE, null);
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.CUT, null);
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.COPY, null);
- actionBars.setGlobalActionHandler(
- ITextEditorActionConstants.PASTE, null);
- }
- }
- }
-
- /**
- * The active editor passed in could be the following: HTMLEditor,
- * SimpleGraphicalEditor, null.
- */
- public void setActiveEditor(IEditorPart targetEditor) {
- _editorPart = targetEditor;
-
- // temp code.
- if (targetEditor instanceof SimpleGraphicalEditor) {
- IHTMLGraphicalViewer graphicalViewer = ((SimpleGraphicalEditor) targetEditor).getGraphicViewer();
- setViewerOnActions(graphicalViewer);
- } else if (targetEditor instanceof HTMLEditor) {
- //Bug 264080 - getDesignViewer may return null
- IDesignViewer designViewer = ((HTMLEditor) targetEditor).getDesignViewer();
- if (designViewer != null) {
- IHTMLGraphicalViewer graphicalViewer = designViewer.getGraphicViewer();
- setViewerOnActions(graphicalViewer);
- }
- } else {
- setViewerOnActions(null);
- }
-
- // TODO... uncomment this and investigate NPE
- //
- // add the cut/copy/paste for text fields
- // ActionHandlerPlugin.connectPart(editorPart);
- }
-
- private void setViewerOnActions(IHTMLGraphicalViewer viewer) {
- IContributionItem[] items = getActionBars().getToolBarManager()
- .getItems();
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem) items[i])
- .getAction();
- if (action instanceof DesignerToolBarAction) {
- ((DesignerToolBarAction) action).setViewer(viewer);
- }
- }
- }
- }
-
- }
-
- /**
- * @see org.eclipse.ui.IEditorActionBarContributor#dispose()
- */
- public void dispose() {
- // TODO: anything to dispose?
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerStyleActionGroup.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerStyleActionGroup.java
deleted file mode 100644
index 6c121dfb8..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerStyleActionGroup.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.commands.ActionHandler;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.editors.HTMLEditor;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class DesignerStyleActionGroup extends ActionGroup
-{
- private static HashMap IMAGE_NAMES = new HashMap();
-
- private static final String VERTICAL = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.V"); //$NON-NLS-1$
-
- private static final String HORIZONTAL = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.H"); //$NON-NLS-1$
-
- private static final String DESIGN = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.D"); //$NON-NLS-1$
-
- private static final String SOURCE = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.S"); //$NON-NLS-1$
-
- private static final String VERTICAL_TOOLTIP = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.V.Tooltip"); //$NON-NLS-1$
-
- private static final String HORIZONTAL_TOOLTIP = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.H.Tooltip"); //$NON-NLS-1$
-
- private static final String DESIGN_TOOLTIP = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.D.Tooltip"); //$NON-NLS-1$
-
- private static final String SOURCE_TOOLTIP = ActionsMessages
- .getString("DesignerStyleActionGroup.CommandLabel.S.Tooltip"); //$NON-NLS-1$
- static {
- IMAGE_NAMES.put(VERTICAL, "PD_Toolbar_vsplit.gif"); //$NON-NLS-1$
- IMAGE_NAMES.put(HORIZONTAL, "PD_Toolbar_hsplit.gif"); //$NON-NLS-1$
- IMAGE_NAMES.put(DESIGN, "PD_Toolbar_designer.gif"); //$NON-NLS-1$
- IMAGE_NAMES.put(SOURCE, "PD_Toolbar_source.gif"); //$NON-NLS-1$
- }
-
- private class ChangeDesignerStyleAction extends Action {
- int _mode;
-
- ChangeDesignerStyleAction(String actionId, String text, ImageDescriptor image, int mode) {
- super(text, IAction.AS_RADIO_BUTTON);
- this.setImageDescriptor(image);
- _mode = mode;
- setId(actionId);
- }
-
- /**
- * @return the mode
- */
- public int getMode() {
- return _mode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- //final IWorkbenchPart editorPart = getActivePart();
- if (_htmlEditor != null) {
- _htmlEditor.setDesignerMode(_mode);
- updateActionBars();
- }
- }
-
- };
-
- private HTMLEditor _htmlEditor;
-
- private final ChangeDesignerStyleAction[] _actions;
-
- private final List<ActionHandler> _actionHandlers;
-
- private final List<IHandlerActivation> _handlers;
-
- /**
- * constructor
- */
- public DesignerStyleActionGroup()
- {
- ChangeDesignerStyleAction verAction = new ChangeDesignerStyleAction(
- "org.eclipse.jst.pagedesigner.vertical", //$NON-NLS-1$
- VERTICAL, PDPlugin.getDefault().getImageDescriptor(
- (String) IMAGE_NAMES.get(VERTICAL)),
- HTMLEditor.MODE_SASH_VERTICAL);
- verAction
- .setActionDefinitionId("org.eclipse.jst.pagedesigner.vertical"); //$NON-NLS-1$
- verAction.setToolTipText(VERTICAL_TOOLTIP);
-
- ChangeDesignerStyleAction horAction = new ChangeDesignerStyleAction(
- "org.eclipse.jst.pagedesigner.horizotal", //$NON-NLS-1$
- HORIZONTAL, PDPlugin.getDefault().getImageDescriptor(
- (String) IMAGE_NAMES.get(HORIZONTAL)),
- HTMLEditor.MODE_SASH_HORIZONTAL);
- horAction
- .setActionDefinitionId("org.eclipse.jst.pagedesigner.horizotal"); //$NON-NLS-1$
- horAction.setToolTipText(HORIZONTAL_TOOLTIP);
-
- ChangeDesignerStyleAction designAction = new ChangeDesignerStyleAction(
- "org.eclipse.jst.pagedesigner.design", //$NON-NLS-1$
- DESIGN, PDPlugin.getDefault().getImageDescriptor(
- (String) IMAGE_NAMES.get(DESIGN)),
- HTMLEditor.MODE_DESIGNER);
- designAction
- .setActionDefinitionId("org.eclipse.jst.pagedesigner.design"); //$NON-NLS-1$
- designAction.setToolTipText(DESIGN_TOOLTIP);
-
- ChangeDesignerStyleAction sourceAction = new ChangeDesignerStyleAction(
- "org.eclipse.jst.pagedesigner.source", //$NON-NLS-1$
- SOURCE, PDPlugin.getDefault().getImageDescriptor(
- (String) IMAGE_NAMES.get(SOURCE)),
- HTMLEditor.MODE_SOURCE);
- sourceAction
- .setActionDefinitionId("org.eclipse.jst.pagedesigner.source"); //$NON-NLS-1$
- sourceAction.setToolTipText(SOURCE_TOOLTIP);
-
- _actions = new ChangeDesignerStyleAction[] { verAction, horAction,
- designAction, sourceAction };
- _actionHandlers = new ArrayList<ActionHandler>();
- for (int i = 0; i < _actions.length; i++)
- {
- _actionHandlers.add(new ActionHandler(_actions[i]));
- }
- _handlers = new ArrayList<IHandlerActivation>();
- }
-
-
- public void updateActionBars() {
- if (_htmlEditor == null) {
- for (int i = 0; i < _actions.length; i++) {
- _actions[i].setEnabled(false);
- }
- } else {
- for (int i = 0; i < _actions.length; i++) {
- _actions[i].setEnabled(true);
- _actions[i].setChecked(_actions[i].getMode() == _htmlEditor
- .getDesignerMode());
- }
- }
- }
-
- /**
- * @param editor
- */
- public void setHTMLEditor(HTMLEditor editor)
- {
- if (_htmlEditor != editor)
- {
- if (_htmlEditor != null)
- {
- deactivateHandlers();
- }
-
- this._htmlEditor = editor;
- if (_htmlEditor != null)
- {
- activateHandlers();
- }
- updateActionBars();
- }
- }
-
- private void deactivateHandlers()
- {
- final IHandlerService service = (IHandlerService) _htmlEditor.getSite()
- .getService(IHandlerService.class);
- if (service != null)
- {
- for (final IHandlerActivation activation : _handlers)
- {
- service.deactivateHandler(activation);
- }
- }
- _handlers.clear();
- }
-
- private void activateHandlers()
- {
- final IHandlerService service = (IHandlerService) _htmlEditor.getSite()
- .getService(IHandlerService.class);
- for (int i = 0; i < _actions.length; i++)
- {
- _handlers.add(service.activateHandler(_actions[i].getId(), _actionHandlers.get(i)));
- }
- }
-
- /**
- * @param actionBars
- */
- public void fillActionBars(IActionBars actionBars)
- {
- IToolBarManager toolbar = actionBars.getToolBarManager();
- for (int i = 0; i < _actions.length; i++)
- {
- toolbar.add(_actions[i]);
- }
- toolbar.add(new Separator());
- }
-
- /**
- * dispose the action
- */
- public void dispose()
- {
- for (final ActionHandler actionHandler : _actionHandlers)
- {
- actionHandler.dispose();
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerUndoRedoAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerUndoRedoAction.java
deleted file mode 100644
index 3d563acdf..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerUndoRedoAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import java.text.MessageFormat;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.gef.ui.actions.UpdateAction;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jst.pagedesigner.editors.SimpleGraphicalEditor;
-import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;
-
-/**
- * SSE has a IDocumentSelectionMediator mechanism, basically it let the viewer
- * that invoke the redo/undo to reset the selection after redo/undo.
- *
- * To utilize this feature, we can't directly use the undo/redo action of the
- * text editor for the designer, since in that way it will be the TextEditor to
- * handle selection after redo/undo.
- *
- * @author mengbo
- * @version 1.5
- */
-public class DesignerUndoRedoAction extends Action implements UpdateAction {
- private boolean _undo = true; // if false means redo
-
- private final SimpleGraphicalEditor _designer;
-
- /**
- * @param undo
- * @param designer
- *
- */
- public DesignerUndoRedoAction(boolean undo, SimpleGraphicalEditor designer) {
- this._undo = undo;
- this._designer = designer;
-
- if (undo) {
- setText(ActionsMessages.getString("DesignerUndoRedoAction.UNDO")); //$NON-NLS-1$
- } else {
- setText(ActionsMessages.getString("DesignerUndoRedoAction.REDO")); //$NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.ui.actions.UpdateAction#update()
- */
- public void update() {
- IStructuredTextUndoManager undoManager = _designer.getHTMLEditor()
- .getModel().getUndoManager();
- if (_undo) {
- Command c = undoManager.getUndoCommand();
- this.setEnabled(undoManager.undoable());
- if (c != null) {
- String label = c.getLabel();
- this
- .setText(MessageFormat
- .format(
- ActionsMessages
- .getString("DesignerUndoRedoAction.UNDO_LABEL"), new Object[] { label })); //$NON-NLS-1$
- } else {
- this.setText(ActionsMessages
- .getString("DesignerUndoRedoAction.UNDO")); //$NON-NLS-1$
- }
- } else {
- Command c = undoManager.getRedoCommand();
- this.setEnabled(undoManager.redoable());
- if (c != null) {
- String label = c.getLabel();
- this
- .setText(MessageFormat
- .format(
- ActionsMessages
- .getString("DesignerUndoRedoAction.REDO_LABEL"), new Object[] { label })); //$NON-NLS-1$
- } else {
- this.setText(ActionsMessages
- .getString("DesignerUndoRedoAction.REDO")); //$NON-NLS-1$
- }
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- IStructuredTextUndoManager undoManager = _designer.getHTMLEditor()
- .getModel().getUndoManager();
- if (_undo) {
- undoManager.undo(_designer);
- } else {
- undoManager.redo(_designer);
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ManageSkinsAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ManageSkinsAction.java
deleted file mode 100644
index 4a9a79d44..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ManageSkinsAction.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.jst.pagedesigner.editors.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.editors.HTMLEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.internal.Workbench;
-
-/**
- * Action to change the current DT skin.
- *
- * @author Ian Trimble - Oracle
- */
-public class ManageSkinsAction extends Action {
-
- /**
- * Constructs an instance.
- */
- public ManageSkinsAction() {
- super(ActionsMessages.getString("ManageSkinsAction.Text"), AS_DROP_DOWN_MENU); //$NON-NLS-1$
- setImageDescriptor(PDPlugin.getDefault().getImageDescriptor("skin.png")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- IEditorPart editorPart = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (editorPart instanceof HTMLEditor) {
- IEditorInput editorInput = editorPart.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)editorInput).getFile();
- IProject project = file.getProject();
- if (project != null) {
- SelectionProvider selectionProvider = new SelectionProvider();
- selectionProvider.setSelection(new StructuredSelection(project));
- PropertyDialogAction propertyDialogAction = new PropertyDialogAction(editorPart.getEditorSite(), selectionProvider);
- PreferenceDialog dialog = propertyDialogAction.createDialog();
- if (dialog != null) {
- dialog.setSelectedNode("org.eclipse.jst.pagedesigner.WPEPropertyPage"); //$NON-NLS-1$
- //yes, we create AGAIN - cannot find another way to get the selected node to stick
- dialog = propertyDialogAction.createDialog();
- if (dialog != null) {
- dialog.open();
- }
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#getMenuCreator()
- */
- @Override
- public IMenuCreator getMenuCreator() {
- return new MenuCreator();
- }
-
-
-
- /**
- * Simple selection provider for creation of the property dialog.
- */
- private class SelectionProvider implements ISelectionProvider {
- private ISelection selection;
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- //do nothing - we don't care here
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- //do nothing - we don't care here
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return selection;
- }
- }
-
-
-
- /**
- * Store last created menu so we can dispose on next creation.
- */
- private static Menu lastMenu;
- /**
- * Menu creator for the drop-down button.
- */
- private class MenuCreator implements IMenuCreator {
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (lastMenu != null) {
- lastMenu.dispose();
- }
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control control) {
- dispose();
- lastMenu = new Menu(control);
- buildMenu(lastMenu);
- return lastMenu;
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu menu) {
- dispose();
- lastMenu = new Menu(menu);
- buildMenu(lastMenu);
- return lastMenu;
- }
- private void buildMenu(Menu menu) {
- MenuItem menuItem = new MenuItem(lastMenu, SWT.PUSH);
- menuItem.setText(ActionsMessages.getString("ManageSkinsAction.Text")); //$NON-NLS-1$
- menuItem.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- run();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- widgetSelected(event);
- }
- });
- IEditorPart editorPart = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (editorPart instanceof HTMLEditor) {
- IEditorInput editorInput = editorPart.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)editorInput).getFile();
- IProject project = file.getProject();
- if (project != null) {
- SkinsMenuItemBuilder skinsMenuItemBuilder =
- new SkinsMenuItemBuilder(project);
- skinsMenuItemBuilder.buildMenuItems(menu);
- }
- }
- }
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/OutlineViewAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/OutlineViewAction.java
deleted file mode 100644
index b22073ef8..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/OutlineViewAction.java
+++ /dev/null
@@ -1,35 +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.pagedesigner.editors.actions;
-
-import org.eclipse.ui.IPageLayout;
-
-/**
- * A show view action that shows the outline view
- *
- */
-public class OutlineViewAction extends ShowViewAction
-{
- /**
- * the action id
- */
- public final static String ID = "org.eclipse.jst.pagedesigner.editors.actions.OutlineViewAction"; //$NON-NLS-1$
-
- /**
- * Default constructor
- */
- public OutlineViewAction()
- {
- super(ActionsMessages
- .getString("OutlineViewAction.Menu.OutlineView") //$NON-NLS-1$
- , IPageLayout.ID_OUTLINE);
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PageDesignerActionBarContributor2.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PageDesignerActionBarContributor2.java
deleted file mode 100644
index b081c16fa..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PageDesignerActionBarContributor2.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jst.pagedesigner.IJMTConstants;
-import org.eclipse.jst.pagedesigner.editors.HTMLEditor;
-import org.eclipse.jst.pagedesigner.editors.SimpleGraphicalEditor;
-import org.eclipse.jst.pagedesigner.ui.common.sash.NestedEditorActionBarContributor;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder;
-import org.eclipse.wst.sse.ui.internal.IExtendedContributor;
-import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor;
-
-/**
- * This is the actionbar contributor for HTML Editor. As HTMLEditor is
- * multipaged, so this contributor will also handle on which page currently is
- * activated.
- *
- * @author mengbo
- */
-public class PageDesignerActionBarContributor2 extends
- NestedEditorActionBarContributor implements IExtendedContributor {
-
- private DesignPageActionContributor _designViewerActionBarContributor = null;
-
- private ISourceViewerActionBarContributor _sourceViewerActionContributor = null;
-
- private HTMLEditor _htmlEditor = null;
-
- // EditorExtension
- private static final String EDITOR_ID = IJMTConstants.EDITORID_HTML;
-
- private IExtendedContributor _extendedContributor;
-
- private DesignerStyleActionGroup _group = new DesignerStyleActionGroup();
-
- /**
- * Default constructor
- */
- public PageDesignerActionBarContributor2() {
- super();
-
- _sourceViewerActionContributor = new SourcePageActionContributor();
- _designViewerActionBarContributor = new DesignPageActionContributor();
-
- // Read action extensions.
- ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
- _extendedContributor = builder.readActionExtensions(EDITOR_ID);
- }
-
- public void init(IActionBars actionBars) {
- super.init(actionBars);
-
- if (actionBars != null) {
- initCommonActionBarContributor(actionBars);
- actionBars.getToolBarManager().add(new ManageSkinsAction());
- actionBars.getToolBarManager().add(new Separator());
- initDesignViewerActionBarContributor(actionBars);
- initSourceViewerActionContributor(actionBars);
- }
- }
-
- /**
- * @param actionBars
- */
- private void initCommonActionBarContributor(IActionBars actionBars) {
- _group.fillActionBars(actionBars);
- }
-
- /**
- * @param actionBars
- */
- protected void initDesignViewerActionBarContributor(IActionBars actionBars) {
- if (_designViewerActionBarContributor != null)
- _designViewerActionBarContributor.init(actionBars, getPage());
- }
-
- /**
- * @param actionBars
- */
- protected void initSourceViewerActionContributor(IActionBars actionBars) {
- if (_sourceViewerActionContributor != null)
- _sourceViewerActionContributor.init(actionBars, getPage());
- }
-
- public void dispose() {
- super.dispose();
- if (_designViewerActionBarContributor != null) {
- _designViewerActionBarContributor.dispose();
- }
- if (_sourceViewerActionContributor != null) {
- _sourceViewerActionContributor.dispose();
- }
- if (_extendedContributor != null) {
- _extendedContributor.dispose();
- }
- if (_group != null) {
- _group.dispose();
- }
- }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager)
- */
- public final void contributeToMenu(IMenuManager menu) {
- super.contributeToMenu(menu);
- addToMenu(menu);
- if (_extendedContributor != null)
- _extendedContributor.contributeToMenu(menu);
- }
-
- private void addToMenu(IMenuManager menu) {
- // IMenuManager menuMgr = new MenuManager(PD_EDITOR_MENU_LABEL,
- // IJMTConstants.PD_EDITOR_MENU_ID);
- // menu.insertBefore(IWorkbenchActionConstants.M_NAVIGATE, menuMgr);
- //
- // menuMgr.add(action);
- // menuMgr.setRemoveAllWhenShown(true);
- //
- // menuMgr.addMenuListener(new IMenuListener()
- // {
- // public void menuAboutToShow(IMenuManager menuMgr)
- // {
- // PageDesignerActionConstants.addStandardActionGroups(menuMgr);
- // RelatedViewActionGroup viewMenu = new RelatedViewActionGroup();
- // viewMenu.fillContextMenu(menuMgr);
- // updateEditorMenu(menuMgr);
- // }
- // });
- }
-
- /**
- * @see IExtendedContributor#contributeToPopupMenu(IMenuManager)
- */
- public final void contributeToPopupMenu(IMenuManager menu) {
- // TODO: this method is empty addToPopupMenu(menu);
- if (_extendedContributor != null)
- _extendedContributor.contributeToPopupMenu(menu);
- }
-
-// protected void addToPopupMenu(IMenuManager menu) {
-// // do nothing
-// }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(IToolBarManager)
- */
- public final void contributeToToolBar(IToolBarManager toolBarManager) {
- super.contributeToToolBar(toolBarManager);
- // TODO: this method is empty addToToolBar(toolBarManager);
- if (_extendedContributor != null)
- _extendedContributor.contributeToToolBar(toolBarManager);
- }
-
-// protected void addToToolBar(IToolBarManager toolBarManager) {
-// }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToStatusLine(IStatusLineManager)
- */
- public final void contributeToStatusLine(IStatusLineManager manager) {
- super.contributeToStatusLine(manager);
- // TODO: this method does nothing addToStatusLine(manager);
- if (_extendedContributor != null)
- _extendedContributor.contributeToStatusLine(manager);
- }
-
-// protected void addToStatusLine(IStatusLineManager manager) {
-// }
-
- /**
- * @see IExtendedContributor#updateToolbarActions()
- */
- public void updateToolbarActions() {
- if (_extendedContributor != null) {
- _extendedContributor.updateToolbarActions();
- }
- _group.setHTMLEditor(_htmlEditor);
- }
-
- public void setActiveEditor(IEditorPart targetEditor) {
- if (targetEditor instanceof HTMLEditor) {
- _htmlEditor = (HTMLEditor) targetEditor;
- //StructuredTextEditor textEditor = _htmlEditor.getTextEditor();
- // TODO: never read this._model = textEditor.getModel();
- }
- super.setActiveEditor(targetEditor);
- updateToolbarActions();
- if (_extendedContributor != null)
- _extendedContributor.setActiveEditor(targetEditor);
- }
-
- public void setInnerActivePage(IEditorPart activeEditor) {
- // This contributor is designed for StructuredTextMultiPageEditorPart.
- // To safe-guard this from problems caused by unexpected usage by
- // other editors, the following
- // check is added.
- if (_htmlEditor != null) {
- if (activeEditor instanceof StructuredTextEditor) {
- activateSourcePage((StructuredTextEditor) activeEditor);
- } else if (activeEditor instanceof SimpleGraphicalEditor) {
- //SimpleGraphicalEditor graphEditor = (SimpleGraphicalEditor) activeEditor;
- activateDesignPage((SimpleGraphicalEditor) activeEditor);
- // TODO: never read this._viewer = graphEditor.getGraphicViewer();
- } else {
- // currently we don't have special action for preview.
- deactivateSourceAndDesignPage(activeEditor);
- // TODO: never read this._viewer = null;
- }
- }
-
- updateToolbarActions();
-
- IActionBars actionBars = getActionBars();
- if (actionBars != null) {
- // update menu bar and tool bar
- actionBars.updateActionBars();
- }
- }
-
- /**
- * @param activeEditor
- *
- */
- protected void deactivateSourceAndDesignPage(IEditorPart activeEditor) {
- if (_designViewerActionBarContributor != null) {
- _designViewerActionBarContributor.setActiveEditor(_htmlEditor);
- _designViewerActionBarContributor
- .setViewerSpecificContributionsEnabled(false);
- }
- if (_sourceViewerActionContributor != null) {
- _sourceViewerActionContributor.setActiveEditor(_htmlEditor);
- _sourceViewerActionContributor
- .setViewerSpecificContributionsEnabled(false);
- }
- }
-
- /**
- * @param activeEditor
- */
- protected void activateDesignPage(SimpleGraphicalEditor activeEditor) {
-
- if (_sourceViewerActionContributor != null /*
- * &&
- * _sourceViewerActionContributor
- * instanceof
- * ISourceViewerActionBarContributor
- */) {
- // previously I was trying setActiveEditor(null) here. But as in the
- // super class will
- // compare the editor with original one, if same then directly
- // return. So will not disable
- // those actions. (lium)
- _sourceViewerActionContributor.setActiveEditor(_htmlEditor);
- _sourceViewerActionContributor
- .setViewerSpecificContributionsEnabled(false);
- }
-
- if (_designViewerActionBarContributor != null) {
- _designViewerActionBarContributor.setActiveEditor(activeEditor);
- _designViewerActionBarContributor
- .setViewerSpecificContributionsEnabled(true);
- }
- }
-
- /**
- * @param activeEditor
- */
- protected void activateSourcePage(StructuredTextEditor activeEditor) {
- if (_designViewerActionBarContributor != null /*
- * &&
- * _designViewerActionBarContributor
- * instanceof
- * IDesignViewerActionBarContributor
- */) {
- // _designViewerActionBarContributor only recogonize HTMLEditor and
- // its own GraphicEditor. so not setting source editor to it.
- _designViewerActionBarContributor.setActiveEditor(_htmlEditor);
- _designViewerActionBarContributor
- .setViewerSpecificContributionsEnabled(false);
- }
-
- if (_sourceViewerActionContributor != null /*
- * &&
- * _sourceViewerActionContributor
- * instanceof
- * ISourceViewerActionBarContributor
- */) {
- _sourceViewerActionContributor.setActiveEditor(activeEditor);
- _sourceViewerActionContributor.setViewerSpecificContributionsEnabled(true);
- }
- }
-
- // TODO: dead?
-// private void updateEditorMenu(IMenuManager menuMgr) {
-// if (this._viewer == null) {
-// return;
-// } else {
-// if (menuMgr != null) {
-// ContainerActionGroup containerActionGroup = new ContainerActionGroup();
-// ActionContext context = new ActionContext(this._viewer
-// .getSelection());
-// context.setInput(this._viewer);
-// containerActionGroup.setContext(context);
-// containerActionGroup.fillContextMenu(menuMgr);
-// containerActionGroup.setContext(null);
-//
-// RangeActionGroup rangeActionGroup = new RangeActionGroup();
-// context = new ActionContext(this._viewer.getSelection());
-// context.setInput(this._viewer);
-// rangeActionGroup.setContext(context);
-// rangeActionGroup.fillContextMenu(menuMgr);
-// rangeActionGroup.setContext(null);
-//
-// SingleElementActionGroup singleActionGroup = new SingleElementActionGroup();
-// singleActionGroup.setContext(new ActionContext(this._viewer
-// .getSelection()));
-// singleActionGroup.fillContextMenu(menuMgr);
-// singleActionGroup.setContext(null);
-//
-// if (this._model != null) {
-// CustomedContextMenuActionGroup customedMenu = new CustomedContextMenuActionGroup();
-// customedMenu.setContext(new ActionContext(_viewer
-// .getSelection()));
-// customedMenu.setModel(_model);
-// customedMenu.setParentControl(_viewer.getControl());
-// customedMenu.fillContextMenu(menuMgr);
-// customedMenu.setContext(null);
-// customedMenu.setParentControl(null);
-// customedMenu.setModel(null);
-// }
-// }
-// }
-// }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PaletteViewAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PaletteViewAction.java
deleted file mode 100644
index 45cd989be..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PaletteViewAction.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.gef.EditDomain;
-import org.eclipse.gef.ui.views.palette.PaletteView;
-import org.w3c.dom.Element;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class PaletteViewAction extends ShowViewAction {
- /**
- * the action id
- */
- public final static String ID = "org.eclipse.jst.pagedesigner.editors.actions.PaletteViewAction"; //$NON-NLS-1$
-
- /**
- * @param element
- * @param editDomain
- */
- public PaletteViewAction(Element element, EditDomain editDomain) {
- super(ActionsMessages.getString("PaletteViewAction.Menu.PaletteView") //$NON-NLS-1$
- , PaletteView.ID);
- //_element = element;
- //_editDomain = editDomain;
- }
-
- /**
- * Add to default behavior because pallete view doesn't automatically track
- * selection to currently selected edit part
- */
- public void run()
- {
- super.run();
-
- //TODO: for some reason getting a palette item to select doesn't work
-// if (_element != null && _editDomain != null)
-// {
-// PaletteItemManager manager = PaletteItemManager
-// .getInstance(getProject(_element));
-// if (manager != null) {
-// IPaletteItemCategory category = manager.findOrCreateCategory(CMUtil
-// .getElementNamespaceURI(_element), null);
-//
-// if (category != null) {
-// String name = _element.getLocalName();
-// if (category.getURI().equals(IJMTConstants.URI_JSP)) {
-// name = _element.getTagName();
-// }
-// IPaletteItemDescriptor descriptor = category
-// .getItemByTagName(name);
-// if (descriptor != null)
-// {
-// PaletteEntry paletteEntry = descriptor.getPaletteEntry();
-// final RootEditPart editPart =
-// _editDomain.getPaletteViewer().getRootEditPart();
-// EditPart newSelection = findMatchingPart(editPart.getContents(), paletteEntry);
-//
-// if (newSelection != null)
-// {
-// _editDomain.getPaletteViewer().setSelection(new StructuredSelection(newSelection));
-// }
-// }
-// }
-// }
-// }
- }
-
-// private EditPart findMatchingPart(EditPart curPart, PaletteEntry paletteEntry)
-// {
-// EditPart match = null;
-//
-// if (curPart.getModel() == paletteEntry)
-// {
-// return curPart;
-// }
-//
-// for (final Iterator it = curPart.getChildren().iterator(); it.hasNext();)
-// {
-// match = findMatchingPart((EditPart)it.next(), paletteEntry);
-//
-// if (match != null)
-// {
-// break;
-// }
-// }
-//
-// return match;
-// }
-// private IProject getProject(Element element) {
-// if (element instanceof IDOMElement) {
-// IDOMModel model = ((IDOMElement) element).getModel();
-// IFile file = StructuredModelUtil.getFileFor(model);
-// if (file != null) {
-// return file.getProject();
-// }
-// }
-// return null;
-// }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PropertiesViewAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PropertiesViewAction.java
deleted file mode 100644
index bf4098b57..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PropertiesViewAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.ui.IPageLayout;
-
-/**
- * @author mengbo
- */
-public class PropertiesViewAction extends ShowViewAction {
- /**
- * the id
- */
- public final static String ID = "org.eclipse.jst.pagedesigner.editors.actions.PropertiesViewAction"; //$NON-NLS-1$
-
- /**
- * Default constructor
- */
- public PropertiesViewAction()
- {
- super(ActionsMessages
- .getString("PropertiesViewAction.Menu.Properties") //$NON-NLS-1$
- , IPageLayout.ID_PROP_SHEET);
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/RelatedViewActionGroup.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/RelatedViewActionGroup.java
deleted file mode 100644
index d4e70ad28..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/RelatedViewActionGroup.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.gef.EditDomain;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.pagedesigner.editors.PageDesignerActionConstants;
-import org.eclipse.jst.pagedesigner.parts.ElementEditPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.w3c.dom.Element;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class RelatedViewActionGroup extends ActionGroup
-{
- private final EditDomain _editDomain;
-
- /**
- * @param editDomain
- */
- public RelatedViewActionGroup(EditDomain editDomain)
- {
- _editDomain = editDomain;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- super.fillContextMenu(menu);
-
- final IMenuManager viewMgr = new MenuManager(ActionsMessages
- .getString("RelatedViewActionGroup.Menu.ShowView"),//$NON-NLS-1$
- PageDesignerActionConstants.SHOWVIEW_SUBMENU_ID);
- viewMgr.add(new Action() {
- // add noop action; TODO: why?
- });
- viewMgr.setRemoveAllWhenShown(true);
- final ActionContext context = getContext();
- viewMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- // TODO: don't like this at all
- String[] views = { "org.eclipse.ui.views.PropertySheet", //$NON-NLS-1$
- "org.eclipse.gef.ui.palette_view", "org.eclipse.ui.views.ContentOutline"}; //$NON-NLS-1$ //$NON-NLS-2$
-
- Map icons = getIconForView(views);
- // TODO: is this the best way to do this?
- if (manager.find(PropertiesViewAction.ID) == null) {
- Action action = new PropertiesViewAction();
- action.setId(PropertiesViewAction.ID);
- action.setImageDescriptor((ImageDescriptor) icons
- .get(views[0]));
- manager.add(action);
- }
- ISelection selection = context.getSelection();
- if (manager.find(PaletteViewAction.ID) == null) {
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection strucSelection =
- (IStructuredSelection) selection;
- Action action = null;
-
- if (strucSelection.getFirstElement() instanceof ElementEditPart)
- {
- Element selectedElem = (Element)
- ((ElementEditPart) strucSelection.getFirstElement()).getModel();
- action = new PaletteViewAction(selectedElem, _editDomain);
- }
- else
- {
- // if can't determine, just default open the palette
- action = new PaletteViewAction(null, null);
- }
- action.setId(PaletteViewAction.ID);
- action.setImageDescriptor((ImageDescriptor) icons
- .get(views[1]));
- manager.add(action);
- }
- }
- if (manager.find(OutlineViewAction.ID) == null)
- {
- Action action = new OutlineViewAction();
- action.setId(OutlineViewAction.ID);
- action.setImageDescriptor((ImageDescriptor) icons
- .get(views[2]));
- manager.add(action);
- }
-
- }
- });
- menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, viewMgr);
- }
-
- private Map getIconForView(String[] viewids) {
- List views = Arrays.asList(viewids);
- Map icons = new HashMap();
-
- 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) && views.contains(id)) { //$NON-NLS-1$
- String iconPath = elements[i].getAttribute("icon"); //$NON-NLS-1$
- if (iconPath != null) {
- icons.put(id, AbstractUIPlugin.imageDescriptorFromPlugin(
- elements[i].getDeclaringExtension().getContributor().getName(),
- iconPath));
- } else {
- icons.put(id, null);
- }
- if (icons.size() == viewids.length) {
- break;
- }
- }
- }
- return icons;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ShowViewAction.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ShowViewAction.java
deleted file mode 100644
index 33bc222f8..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ShowViewAction.java
+++ /dev/null
@@ -1,60 +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.pagedesigner.editors.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * TODO: isn't there a workbench registry action for this?
- * @author cbateman
- *
- */
-public class ShowViewAction extends Action {
- private static Logger _log = PDPlugin.getLogger(PropertiesViewAction.class);
- private final String _viewId;
-
- /**
- * @param text
- * @param viewId
- */
- public ShowViewAction(String text, String viewId)
- {
- _viewId = viewId;
- setText(text);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- try {
- getPage().showView(_viewId);
- } catch (PartInitException e) {
- _log.info("Open the view: "+_viewId, e); //$NON-NLS-1$
- }
-
- }
-
- private IWorkbenchPage getPage() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- return window.getActivePage();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SkinsMenuItemBuilder.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SkinsMenuItemBuilder.java
deleted file mode 100644
index 78ea5b1b6..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SkinsMenuItemBuilder.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.pagedesigner.editors.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jst.jsf.common.metadata.Model;
-import org.eclipse.jst.jsf.common.metadata.Trait;
-import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper;
-import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext;
-import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper;
-import org.eclipse.jst.pagedesigner.dtresourceprovider.DTResourceProviderFactory;
-import org.eclipse.jst.pagedesigner.dtresourceprovider.DTSkinManager;
-import org.eclipse.jst.pagedesigner.dtresourceprovider.IDTResourceProvider;
-import org.eclipse.jst.pagedesigner.dtresourceprovider.IDTSkin;
-import org.eclipse.jst.pagedesigner.utils.EditorUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-/**
- * Builds menu items for managing skins.
- *
- * @author Ian Trimble - Oracle
- */
-public class SkinsMenuItemBuilder {
-
- private static final String DATAKEY_DTSKIN = "DATAKEY_DTSKIN"; //$NON-NLS-1$
- private static final String DATAKEY_NSURI = "DTATKEY_NSURI"; //$NON-NLS-1$
-
- private static List<Menu> menuList = new ArrayList<Menu>();
-
- private IProject project;
-
- /**
- * Constructs an instance.
- *
- * @param project IProject instance for which to get skin information.
- */
- public SkinsMenuItemBuilder(IProject project) {
- this.project = project;
- }
-
- /**
- * Builds menu items (adds a separator and then menu items to end of
- * specified menu.
- *
- * @param menu Menu instance to which to add menu items.
- */
- public void buildMenuItems(Menu menu) {
- for (Menu oldMenu: menuList) {
- oldMenu.dispose();
- }
- if (menu != null) {
- List<TaglibData> taglibDataList = getTaglibDataList();
- if (taglibDataList.size() > 0) {
- new MenuItem(menu, SWT.SEPARATOR);
- }
- for (TaglibData taglibData: taglibDataList) {
- String nsURI = taglibData.getNSURI();
- DTSkinManager dtSkinManager = DTSkinManager.getInstance(project);
- IDTSkin currentDTSkin = dtSkinManager.getCurrentSkin(nsURI);
- MenuItem menuItem = new MenuItem(menu, SWT.CASCADE);
- menuItem.setText(taglibData.getName());
- Menu skinMenu = new Menu(menuItem);
- menuList.add(skinMenu);
- menuItem.setMenu(skinMenu);
- List<IDTSkin> dtSkins = dtSkinManager.getSkins(nsURI);
- for (IDTSkin dtSkin: dtSkins) {
- MenuItem skinMenuItem;
- if (currentDTSkin == dtSkin) {
- skinMenuItem = new MenuItem(skinMenu, SWT.CHECK);
- skinMenuItem.setSelection(true);
- } else {
- skinMenuItem = new MenuItem(skinMenu, SWT.PUSH);
- }
- skinMenuItem.setText(dtSkin.getName());
- skinMenuItem.setData(DATAKEY_DTSKIN, dtSkin);
- skinMenuItem.setData(DATAKEY_NSURI, nsURI);
- skinMenuItem.addSelectionListener(new SkinSelectionListener());
- }
- }
- }
- }
-
- /**
- * Builds menu managers.
- *
- * @param parent Parent menu manager to which to append new menu managers.
- */
- public void buildMenuManagers(IMenuManager parent) {
- List<TaglibData> taglibDataList = getTaglibDataList();
- if (taglibDataList.size() > 0) {
- parent.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
- }
- for (TaglibData taglibData: taglibDataList) {
- String nsURI = taglibData.getNSURI();
- MenuManager newMgr = new MenuManager(taglibData.getName());
- DTSkinManager dtSkinManager = DTSkinManager.getInstance(project);
- IDTSkin currentDTSkin = dtSkinManager.getCurrentSkin(nsURI);
- List<IDTSkin> dtSkins = dtSkinManager.getSkins(nsURI);
- for (IDTSkin dtSkin: dtSkins) {
- newMgr.add(new ChangeCurrentSkinAction(nsURI, dtSkin, dtSkin == currentDTSkin));
- }
- parent.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, newMgr);
- }
- }
-
- private List<TaglibData> getTaglibDataList() {
- List<TaglibData> taglibDataList = new ArrayList<TaglibData>();
- List<IDTResourceProvider> dtResourceProviders =
- DTResourceProviderFactory.getInstance().getActiveDTResourceProviders(project);
- for (IDTResourceProvider dtResourceProvider: dtResourceProviders) {
- TaglibData taglibData = new TaglibData(dtResourceProvider.getId());
- if (!taglibDataList.contains(taglibData)) {
- taglibDataList.add(taglibData);
- }
- }
- return taglibDataList;
- }
-
-
-
- /**
- * Used to hold and pass taglib-related data.
- */
- private class TaglibData {
- private String nsURI;
- private String name;
- public TaglibData(String nsURI) {
- this.nsURI = nsURI;
- ITaglibDomainMetaDataModelContext modelContext = TaglibDomainMetaDataQueryHelper.createMetaDataModelContext(project, nsURI);
- Model model = TaglibDomainMetaDataQueryHelper.getModel(modelContext);
- Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(model, "display-label"); //$NON-NLS-1$
- this.name = TraitValueHelper.getValueAsString(trait);
- }
- public String getNSURI() {
- return nsURI;
- }
- public String getName() {
- return name;
- }
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- int nsURIHashCode = 0;
- if (nsURI != null) {
- nsURIHashCode = nsURI.hashCode();
- }
- int nameHashCode = 0;
- if (name != null) {
- nameHashCode = name.hashCode();
- }
- return nameHashCode | nsURIHashCode ;
- }
- }
-
-
-
- /**
- * Selection listener for skin menu items.
- */
- private class SkinSelectionListener implements SelectionListener {
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent event) {
- String nsURI = (String)event.widget.getData(DATAKEY_NSURI);
- IDTSkin dtSkin = (IDTSkin)event.widget.getData(DATAKEY_DTSKIN);
- DTSkinManager.getInstance(project).setCurrentSkin(nsURI, dtSkin);
- EditorUtil.refreshAllWPEDesignViewers();
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent event) {
- widgetSelected(event);
- }
- }
-
-
-
- /**
- * Action for changing current skin.
- */
- private class ChangeCurrentSkinAction extends Action {
- private String nsURI;
- private IDTSkin dtSkin;
- /**
- * Creates an instance.
- *
- * @param nsURI NSURI of taglib.
- * @param dtSkin IDTSkin instance.
- * @param checked true if IDTSkin instance is current for nsURI.
- */
- public ChangeCurrentSkinAction(String nsURI, IDTSkin dtSkin, boolean checked) {
- super(dtSkin.getName());
- this.nsURI = nsURI;
- this.dtSkin = dtSkin;
- setChecked(checked);
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- DTSkinManager.getInstance(project).setCurrentSkin(nsURI, dtSkin);
- EditorUtil.refreshAllWPEDesignViewers();
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SourcePageActionContributor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SourcePageActionContributor.java
deleted file mode 100644
index 7d48737e4..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SourcePageActionContributor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.pagedesigner.editors.actions;
-
-import org.eclipse.jst.pagedesigner.editors.HTMLEditor;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.wst.xml.ui.internal.actions.ActionContributorXML;
-
-/**
- * SourcePageActionContributor
- *
- * This class is for multi page editor's source page contributor.
- *
- * Use XMLEditorActionContributor for single page editor.
- */
-public class SourcePageActionContributor extends ActionContributorXML {
-
- private IActionBars fBars;
-
- /**
- * This method calls:
- * <ul>
- * <li><code>contributeToMenu</code> with <code>bars</code>' menu
- * manager</li>
- * <li><code>contributeToToolBar</code> with <code>bars</code>' tool
- * bar manager</li>
- * <li><code>contributeToStatusLine</code> with <code>bars</code>'
- * status line manager</li>
- * </ul>
- * The given action bars are also remembered and made accessible via
- * <code>getActionBars</code>.
- *
- * @param bars
- * the action bars
- *
- */
- public void init(IActionBars bars) {
- fBars = bars;
- contributeToMenu(bars.getMenuManager());
- contributeToToolBar(bars.getToolBarManager());
- contributeToStatusLine(bars.getStatusLineManager());
- }
-
- /**
- * Returns this contributor's action bars.
- *
- * @return the action bars
- */
- public IActionBars getActionBars() {
- return fBars;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor#setViewerSpecificContributionsEnabled(boolean)
- */
- public void setViewerSpecificContributionsEnabled(boolean enabled) {
- super.setViewerSpecificContributionsEnabled(enabled);
- IEditorPart editor = getActiveEditorPart();
- ITextEditor targetEditor = null;
- if (editor instanceof ITextEditor) {
- targetEditor = (ITextEditor) editor;
- } else if (editor instanceof HTMLEditor) {
- targetEditor = ((HTMLEditor) editor).getTextEditor();
- }
- if (targetEditor != null) {
- if (enabled) {
- getActionBars()
- .setGlobalActionHandler(
- ITextEditorActionConstants.UNDO,
- targetEditor
- .getAction(ITextEditorActionConstants.UNDO));
- getActionBars()
- .setGlobalActionHandler(
- ITextEditorActionConstants.REDO,
- targetEditor
- .getAction(ITextEditorActionConstants.REDO));
- } else {
- getActionBars().setGlobalActionHandler(
- ITextEditorActionConstants.UNDO, null);
- getActionBars().setGlobalActionHandler(
- ITextEditorActionConstants.REDO, null);
- }
-
- }
- }
-}

Back to the top