You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/12/09 14:42:17 UTC
[GitHub] [netbeans] neilcsmith-net commented on a change in pull request #3349: Rich HTML UI for (now only for) VSCode Refactorings
neilcsmith-net commented on a change in pull request #3349:
URL: https://github.com/apache/netbeans/pull/3349#discussion_r765854604
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/refactoring/ChangeMethodParametersRefactoringAction.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.java.lsp.server.refactoring;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import org.netbeans.api.java.source.ElementHandle;
+import org.netbeans.api.java.source.JavaSource;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionRegistration;
+import org.openide.filesystems.FileObject;
+import org.openide.util.NbBundle.Messages;
+
+@ActionID(
+ category = "Refactoring",
+ id = "org.netbeans.modules.java.lsp.server.refactoring.ChangeMethodParametersRefactoringAction"
+)
+@ActionRegistration(
+ iconBase = "org/netbeans/modules/java/lsp/server/refactoring/newHTML.png",
+ displayName = "#CTL_ChangeMethodParametersRefactoringAction"
+)
+@ActionReference(path = "Menu/Refactoring", position = 1120)
+@Messages("CTL_ChangeMethodParametersRefactoringAction=Change Method Parameters Refactoring")
+public final class ChangeMethodParametersRefactoringAction implements ActionListener {
+ private final FileObject file;
+
+ public ChangeMethodParametersRefactoringAction(FileObject file) {
+ this.file = file;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ JavaSource js = JavaSource.forFileObject(file);
+ if (js != null) {
+ try {
+ js.runUserActionTask(ci -> {
+ ci.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
+ ExecutableElement method = null;
+ METHOD: for (Element type : ci.getTopLevelElements()) {
+ for (Element e : type.getEnclosedElements()) {
+ System.err.println("e: " + e);
+ if (e.getKind() == ElementKind.METHOD) {
+ method = (ExecutableElement) e;
+ break METHOD;
+ }
+ }
+ }
+ if (method != null) {
+ ElementHandle<ExecutableElement> handle = ElementHandle.create(method);
+ ChangeMethodParameterUI[] model = {null};
Review comment:
+1 to using for VSCode. -1 to using in NetBeans IDE. Not unless we get at least a presenter we can ship with, is more stable, and integrates properly with the L&F.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists