Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHimanshu Mishra2014-10-01 13:30:32 +0000
committerVikas Chandra2014-10-01 13:30:32 +0000
commitc58d74124333a31c440be7cad13859b47a3149c7 (patch)
treec3f5e275a2bf8f0639275a8fd42a306e25c92c0b
parent7d0f9a712c8c85d9ac72a263e143ad1b4b2f9ee3 (diff)
downloadeclipse.pde.ui-c58d74124333a31c440be7cad13859b47a3149c7.tar.gz
eclipse.pde.ui-c58d74124333a31c440be7cad13859b47a3149c7.tar.xz
eclipse.pde.ui-c58d74124333a31c440be7cad13859b47a3149c7.zip
Bug 361123 - [patch] Feature editor won't allow copy and paste for
license Signed-off-by: Himanshu Mishra <h.mishra@samsung.com>
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java2
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditorContributor.java20
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/InfoSection.java4
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/LicenseFeatureSection.java45
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties1
5 files changed, 64 insertions, 8 deletions
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
index 90fe03ced0..6d3a7aa947 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
@@ -1,4 +1,5 @@
/*******************************************************************************
+ * Copyright (c) 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1439,6 +1440,7 @@ public class PDEUIMessages extends NLS {
public static String EditorActions_cut;
public static String EditorActions_copy;
public static String EditorActions_paste;
+ public static String EditorActions_selectall;
public static String EditorActions_revert;
public static String Actions_open_label;
public static String Actions_delete_label;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditorContributor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditorContributor.java
index 395ea1156c..7ee6a75e21 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditorContributor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditorContributor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,8 +11,6 @@
*******************************************************************************/
package org.eclipse.pde.internal.ui.editor;
-import org.eclipse.jface.action.Action;
-
import java.util.Hashtable;
import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.ISelection;
@@ -43,6 +41,8 @@ public class PDEFormEditorContributor extends MultiPageEditorActionBarContributo
private ClipboardAction fPasteAction;
+ private SelectAllAction fSelectAllAction;
+
private Hashtable<String, Action> fGlobalActions = new Hashtable<String, Action>();
private ISharedImages fSharedImages;
@@ -123,6 +123,15 @@ public class PDEFormEditorContributor extends MultiPageEditorActionBarContributo
}
}
+ class SelectAllAction extends ClipboardAction {
+ public SelectAllAction() {
+ super(ActionFactory.SELECT_ALL.getId());
+ setText(PDEUIMessages.EditorActions_selectall);
+ setActionDefinitionId(ActionFactory.SELECT_ALL.getCommandId());
+ setEnabled(true);
+ }
+ }
+
class SaveAction extends Action implements IUpdate {
public SaveAction() {
}
@@ -169,6 +178,8 @@ public class PDEFormEditorContributor extends MultiPageEditorActionBarContributo
mng.add(fCopyAction);
mng.add(fPasteAction);
mng.add(new Separator());
+ mng.add(fSelectAllAction);
+ mng.add(new Separator());
mng.add(fRevertAction);
}
@@ -221,6 +232,7 @@ public class PDEFormEditorContributor extends MultiPageEditorActionBarContributo
fCutAction = new CutAction();
fCopyAction = new CopyAction();
fPasteAction = new PasteAction();
+ fSelectAllAction = new SelectAllAction();
addGlobalAction(ActionFactory.CUT.getId(), fCutAction);
addGlobalAction(ActionFactory.COPY.getId(), fCopyAction);
addGlobalAction(ActionFactory.PASTE.getId(), fPasteAction);
@@ -229,7 +241,7 @@ public class PDEFormEditorContributor extends MultiPageEditorActionBarContributo
addGlobalAction(ActionFactory.UNDO.getId());
addGlobalAction(ActionFactory.REDO.getId());
// select/find
- addGlobalAction(ActionFactory.SELECT_ALL.getId());
+ addGlobalAction(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
addGlobalAction(ActionFactory.FIND.getId());
// bookmark
addGlobalAction(IDEActionFactory.BOOKMARK.getId());
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/InfoSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/InfoSection.java
index 6fcf90cd04..dc498bd3ae 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/InfoSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/InfoSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -248,6 +248,8 @@ public class InfoSection extends PDESection {
} else if (actionId.equals(ActionFactory.REDO.getId())) {
fSourceViewer.doOperation(ITextOperationTarget.REDO);
return true;
+ } else if (actionId.equals(ActionFactory.SELECT_ALL.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.SELECT_ALL);
}
return false;
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/LicenseFeatureSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/LicenseFeatureSection.java
index d31917871b..0be106fc73 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/LicenseFeatureSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/LicenseFeatureSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 IBM Corporation and others.
+ * Copyright (c) 2010, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,14 +10,13 @@
*******************************************************************************/
package org.eclipse.pde.internal.ui.editor.feature;
-import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
-
import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.jface.viewers.*;
import org.eclipse.jface.window.Window;
import org.eclipse.pde.core.IEditable;
import org.eclipse.pde.internal.core.PDECore;
@@ -29,10 +28,12 @@ import org.eclipse.pde.internal.ui.editor.context.XMLDocumentSetupParticpant;
import org.eclipse.pde.internal.ui.editor.text.XMLConfiguration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.*;
+import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.*;
@@ -175,6 +176,11 @@ public class LicenseFeatureSection extends PDESection {
fSourceViewer = new SourceViewer(localLicenseComposite, null, styles);
fSourceViewer.configure(fSourceConfiguration);
fSourceViewer.setDocument(fDocument);
+ fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateSelection(event.getSelection());
+ }
+ });
StyledText styledText = fSourceViewer.getTextWidget();
styledText.setFont(JFaceResources.getTextFont());
styledText.setMenu(getPage().getPDEEditor().getContextMenu());
@@ -330,4 +336,37 @@ public class LicenseFeatureSection extends PDESection {
}
super.commit(onSave);
}
+
+ public boolean doGlobalAction(String actionId) {
+ if (actionId.equals(ActionFactory.CUT.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.CUT);
+ return true;
+ } else if (actionId.equals(ActionFactory.COPY.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.COPY);
+ return true;
+ } else if (actionId.equals(ActionFactory.PASTE.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.PASTE);
+ return true;
+ } else if (actionId.equals(ActionFactory.DELETE.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.DELETE);
+ return true;
+ } else if (actionId.equals(ActionFactory.UNDO.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.UNDO);
+ return true;
+ } else if (actionId.equals(ActionFactory.REDO.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.REDO);
+ return true;
+ } else if (actionId.equals(ActionFactory.SELECT_ALL.getId())) {
+ fSourceViewer.doOperation(ITextOperationTarget.SELECT_ALL);
+ }
+ return false;
+ }
+
+ public boolean canPaste(Clipboard clipboard) {
+ return fSourceViewer.canDoOperation(ITextOperationTarget.PASTE);
+ }
+
+ private void updateSelection(ISelection selection) {
+ getPage().getPDEEditor().setSelection(selection);
+ }
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
index 94a118988a..4ef29ab340 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
@@ -1187,6 +1187,7 @@ EditorActions_save = &Save
EditorActions_cut = Cu&t
EditorActions_copy = &Copy
EditorActions_paste = &Paste
+EditorActions_selectall = Select &All
EditorActions_revert = Re&vert
Actions_open_label = &Open
Actions_delete_label = &Delete

Back to the top