diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PasteAction.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PasteAction.java | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PasteAction.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PasteAction.java index a98e5047d..17067ef6b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PasteAction.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/scriptpad/actions/PasteAction.java @@ -1,68 +1,68 @@ -/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.tcf.te.tcf.ui.views.scriptpad.ScriptPad;
-
-/**
- * Script Pad paste action handler implementation.
- */
-public class PasteAction extends Action {
- // Reference to the parent view
- private final ScriptPad view;
-
- /**
- * Constructor.
- *
- * @param view The parent Script Pad view. Must not be <code>null</code>.
- */
- public PasteAction(ScriptPad view) {
- super();
-
- Assert.isNotNull(view);
- this.view = view;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- if (view.getStyledText() == null || view.getStyledText().isDisposed()) return;
- view.getStyledText().paste();
- view.updateActionEnablements();
- }
-
- /**
- * Updates the actions enabled action.
- */
- public void updateEnabledState() {
- boolean canPaste = false;
- if (view.getStyledText() != null && view.getStyledText().getEditable()) {
- Clipboard clipboard = new Clipboard(view.getStyledText().getDisplay());
- TransferData[] td = clipboard.getAvailableTypes();
- for (int i = 0; i < td.length; ++i) {
- if (TextTransfer.getInstance().isSupportedType(td[i])) {
- canPaste = true;
- break;
- }
- }
-
- clipboard.dispose();
- }
-
- setEnabled(canPaste);
- }
-}
+/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River Systems, 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.ui.views.scriptpad.actions; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.action.Action; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.TransferData; +import org.eclipse.tcf.te.tcf.ui.views.scriptpad.ScriptPad; + +/** + * Script Pad paste action handler implementation. + */ +public class PasteAction extends Action { + // Reference to the parent view + private final ScriptPad view; + + /** + * Constructor. + * + * @param view The parent Script Pad view. Must not be <code>null</code>. + */ + public PasteAction(ScriptPad view) { + super(); + + Assert.isNotNull(view); + this.view = view; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.Action#run() + */ + @Override + public void run() { + if (view.getStyledText() == null || view.getStyledText().isDisposed()) return; + view.getStyledText().paste(); + view.updateActionEnablements(); + } + + /** + * Updates the actions enabled action. + */ + public void updateEnabledState() { + boolean canPaste = false; + if (view.getStyledText() != null && view.getStyledText().getEditable()) { + Clipboard clipboard = new Clipboard(view.getStyledText().getDisplay()); + TransferData[] td = clipboard.getAvailableTypes(); + for (int i = 0; i < td.length; ++i) { + if (TextTransfer.getInstance().isSupportedType(td[i])) { + canPaste = true; + break; + } + } + + clipboard.dispose(); + } + + setEnabled(canPaste); + } +} |