This is an automated email from the ASF dual-hosted git repository.
thurka pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 9972b4a07e allow to copy OCID to clipboard
new dbf92bd3ab Merge pull request #6804 from thurka/copy_ocid
9972b4a07e is described below
commit 9972b4a07e48cdd9b7aacffbe143013ea25db5a1
Author: Tomas Hurka <[email protected]>
AuthorDate: Wed Dec 6 17:07:58 2023 +0100
allow to copy OCID to clipboard
---
.../cloud/oracle/actions/CopyOCIDAction.java | 73 ++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git
a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/CopyOCIDAction.java
b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/CopyOCIDAction.java
new file mode 100644
index 0000000000..ad0a507d58
--- /dev/null
+++
b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/CopyOCIDAction.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.cloud.oracle.actions;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import org.netbeans.modules.cloud.oracle.items.OCIItem;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.awt.StatusDisplayer;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.datatransfer.ExClipboard;
+
+/**
+ *
+ * @author Tomas Hurka
+ */
+@ActionID(
+ category = "Tools",
+ id = "org.netbeans.modules.cloud.oracle.actions.CopyOCIDAction"
+)
+@ActionRegistration(displayName = "#CTL_CopyOCIDAction")
+@ActionReferences(value = {
+ @ActionReference(path = "Cloud/Oracle/Common/Actions", position = 300)
+})
[email protected]("CTL_CopyOCIDAction=Copy OCID")
+public class CopyOCIDAction implements ActionListener {
+
+ private final OCIItem context;
+
+ public CopyOCIDAction(OCIItem context) {
+ this.context = context;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ setClipboardContents(context.getKey().getValue());
+ }
+
+ @NbBundle.Messages("MSG_OCID_placed_in_clipboard=OCID was placed in
clipboard")
+ private void setClipboardContents(String content) {
+ Clipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class);
+ if (clipboard == null) {
+ clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ }
+ if (clipboard != null) {
+ clipboard.setContents(new StringSelection(content), null);
+
StatusDisplayer.getDefault().setStatusText(Bundle.MSG_OCID_placed_in_clipboard());
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists