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 2018/01/04 11:17:28 UTC
[GitHub] geertjanw closed pull request #277: Permit CLI --open-group to accept a substring of a group name as a convenience
geertjanw closed pull request #277: Permit CLI --open-group to accept a substring of a group name as a convenience
URL: https://github.com/apache/incubator-netbeans/pull/277
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/projectui/src/org/netbeans/modules/project/ui/groups/GroupOptionProcessor.java b/projectui/src/org/netbeans/modules/project/ui/groups/GroupOptionProcessor.java
index d58aa2d81..2a2867d8a 100644
--- a/projectui/src/org/netbeans/modules/project/ui/groups/GroupOptionProcessor.java
+++ b/projectui/src/org/netbeans/modules/project/ui/groups/GroupOptionProcessor.java
@@ -19,13 +19,7 @@
package org.netbeans.modules.project.ui.groups;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.io.PrintStream;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import org.netbeans.api.project.Project;
-import org.netbeans.api.project.ui.OpenProjects;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Env;
import org.openide.util.NbBundle.Messages;
@@ -33,8 +27,6 @@
import org.netbeans.spi.sendopts.Arg;
import org.netbeans.spi.sendopts.Description;
import org.netbeans.spi.sendopts.ArgsProcessor;
-import org.openide.util.Exceptions;
-import org.openide.util.RequestProcessor;
public class GroupOptionProcessor implements ArgsProcessor {
@Arg(longName="open-group")
@@ -44,7 +36,7 @@
)
@Messages({
"GroupOptionProcessor.open.name=--open-group NAME",
- "GroupOptionProcessor.open.desc=open a project group by name"
+ "GroupOptionProcessor.open.desc=open a project group by shortened or full name (or unique substring)"
})
public String openOption;
@Arg(longName="close-group")
@@ -68,14 +60,26 @@
})
@Override public void process(Env env) throws CommandException {
if (openOption != null) {
+ Group found = null;
for (Group g : Group.allGroups()) {
if (g.id.equals(openOption) || g.getName().equals(openOption)) {
- supressWinsysLazyLoading();
- Group.setActiveGroup(g, false);
- return;
+ found = g;
+ break;
}
}
- throw new CommandException(2, GroupOptionProcessor_no_such_group(openOption));
+ if (found == null) {
+ for (Group g : Group.allGroups()) {
+ if (g.id.contains(openOption) || g.getName().contains(openOption)) {
+ found = g;
+ break;
+ }
+ }
+ }
+ if (found == null) {
+ throw new CommandException(2, GroupOptionProcessor_no_such_group(openOption));
+ }
+ supressWinsysLazyLoading();
+ Group.setActiveGroup(found, false);
} else if (closeOption) {
supressWinsysLazyLoading();
Group.setActiveGroup(null, false);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
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