Author: yradtsevich
Date: 2009-01-14 16:01:01 -0500 (Wed, 14 Jan 2009)
New Revision: 13045
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/ReplaceAction.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java
Log:
CODING IN PROGRESS - issue JBIDE-3519: Ctrl+Z (Undo) doesn't work properly for
"Replace With" operation from context menu.
https://jira.jboss.org/jira/browse/JBIDE-3519
- the issue has been fixed
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java 2009-01-14
17:48:10 UTC (rev 13044)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java 2009-01-14
21:01:01 UTC (rev 13045)
@@ -44,7 +44,6 @@
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.menu.BaseActionManager.MyMenuManager;
import org.jboss.tools.vpe.editor.menu.action.InsertAction;
-import org.jboss.tools.vpe.editor.menu.action.ReplaceAction;
import org.jboss.tools.vpe.editor.menu.action.VpeMenuListener;
import org.jboss.tools.vpe.editor.menu.action.VpeTextOperationAction;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
@@ -508,7 +507,7 @@
*/
private void createReplaceAction(MenuManager menu, Point region, XModelObject item){
String tagName = getTagName(menu, region, item);
- menu.add(new ReplaceAction(tagName, region, item, pageContext, sourceEditor));
+ menu.add(new InsertAction(tagName, region, item, pageContext, sourceEditor, true));
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java 2009-01-14
17:48:10 UTC (rev 13044)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java 2009-01-14
21:01:01 UTC (rev 13045)
@@ -30,14 +30,12 @@
* @author Igor Zhukov (izhukov(a)exadel.com)
*/
public class InsertAction extends Action {
-
private XModelObject item;
private Point region;
+ private VpePageContext pageContext;
+ private StructuredTextEditor sourceEditor;
+ private boolean replace;
- private VpePageContext pageContext = null;
- private StructuredTextEditor sourceEditor = null;
- private boolean replace= false;
-
/**
* Constructor.
*
@@ -49,11 +47,7 @@
*/
public InsertAction(String title, Point region, XModelObject item, VpePageContext
pageContext,
StructuredTextEditor sourceEditor) {
- super(title);
- this.item = item;
- this.region = region;
- this.pageContext = pageContext;
- this.sourceEditor = sourceEditor;
+ this(title, region, item, pageContext, sourceEditor, false);
}
/**
@@ -97,15 +91,14 @@
String startText = Constants.EMPTY + item.getAttributeValue("start text");
//$NON-NLS-1$
String endText = Constants.EMPTY + item.getAttributeValue("end text");
//$NON-NLS-1$
- if (this.replace) {
- getSourceEditor().getTextViewer().getTextWidget().replaceTextRange(
- region.x, region.y, ""); //$NON-NLS-1$
- region.y = 0;
- }
-
if (region != null) {
- // set source selection
- SelectionUtil.setSourceSelection(pageContext, region.x, region.y);
+ if (this.replace) {
+ getSourceEditor().getTextViewer().getTextWidget().replaceTextRange(
+ region.x, region.y, ""); //$NON-NLS-1$
+ } else {
+ // set source selection
+ SelectionUtil.setSourceSelection(pageContext, region.x, region.y);
+ }
}
// Gets source editor's selection provider with updated text selection.
@@ -131,13 +124,6 @@
}
/**
- * @return the region
- */
- protected Point getRegion() {
- return region;
- }
-
- /**
* @return the pageContext
*/
protected VpePageContext getPageContext() {
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/ReplaceAction.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/ReplaceAction.java 2009-01-14
17:48:10 UTC (rev 13044)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/ReplaceAction.java 2009-01-14
21:01:01 UTC (rev 13045)
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.menu.action;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-
-/**
- * Replace Action for visual editor from content menu
- * @author mareshkau
- *
- */
-public class ReplaceAction extends InsertAction{
-
- /**
- *
- * @param title
- * @param region
- * @param item
- * @param pageContext
- * @param sourceEditor
- */
- public ReplaceAction(String title, Point region, XModelObject item,
- VpePageContext pageContext, StructuredTextEditor sourceEditor) {
- super(title, region, item, pageContext, sourceEditor);
- }
-
- @Override
- public void run() {
- getSourceEditor().getTextViewer().getTextWidget().replaceTextRange(getRegion().x,
getRegion().y, ""); //$NON-NLS-1$
- getRegion().y=0;
- super.run();
- }
-
-
-}