mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup - notnull
GitOrigin-RevId: 8e7186bd62c257a64315fa83e7cf9fc8f4e9ed33
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bbf47d6b25
commit
1290e08ceb
@@ -25,7 +25,7 @@ import com.intellij.openapi.wm.IdeFocusManager
|
||||
import java.io.File
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class JBProtocolNavigateCommand : JBProtocolCommand(NAVIGATE_COMMAND) {
|
||||
internal class JBProtocolNavigateCommand : JBProtocolCommand(NAVIGATE_COMMAND) {
|
||||
override fun perform(target: String, parameters: Map<String, String>) {
|
||||
// handles URLs of the following types:
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -25,7 +11,7 @@ import java.util.Map;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class JBProtocolCommand {
|
||||
public static final ExtensionPointName<JBProtocolCommand> EP_NAME = new ExtensionPointName<>("com.intellij.jbProtocolCommand");
|
||||
private static final ExtensionPointName<JBProtocolCommand> EP_NAME = new ExtensionPointName<>("com.intellij.jbProtocolCommand");
|
||||
private final String myCommand;
|
||||
|
||||
public JBProtocolCommand(@NotNull String command) {
|
||||
@@ -37,12 +23,12 @@ public abstract class JBProtocolCommand {
|
||||
return myCommand;
|
||||
}
|
||||
|
||||
public abstract void perform(String target, Map<String, String> parameters);
|
||||
public abstract void perform(String target, @NotNull Map<String, String> parameters);
|
||||
|
||||
@Nullable
|
||||
public static JBProtocolCommand findCommand(@Nullable String commandName) {
|
||||
if (commandName != null) {
|
||||
for (JBProtocolCommand command : EP_NAME.getExtensions()) {
|
||||
for (JBProtocolCommand command : EP_NAME.getExtensionList()) {
|
||||
if (command.getCommandName().equals(commandName)) {
|
||||
return command;
|
||||
}
|
||||
|
||||
+7
-20
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
@@ -20,23 +6,24 @@ import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JBProtocolShutdownCommand extends JBProtocolCommand {
|
||||
|
||||
public JBProtocolShutdownCommand() {
|
||||
final class JBProtocolShutdownCommand extends JBProtocolCommand {
|
||||
JBProtocolShutdownCommand() {
|
||||
super("shutdown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(String target, Map<String, String> parameters) {
|
||||
public void perform(String target, @NotNull Map<String, String> parameters) {
|
||||
if (StringUtil.isEmpty(target)) {
|
||||
ApplicationManager.getApplication().exit();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
MessageDialogBuilder.YesNo confirmExitDialog = MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), target)
|
||||
.yesText(ApplicationBundle.message("command.exit")).noText(
|
||||
CommonBundle.message("button.cancel"));
|
||||
|
||||
+15
-19
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.project.impl;
|
||||
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
@@ -21,21 +7,31 @@ import com.intellij.openapi.application.JBProtocolCommand;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JBProtocolOpenProjectCommand extends JBProtocolCommand {
|
||||
public JBProtocolOpenProjectCommand() {
|
||||
final class JBProtocolOpenProjectCommand extends JBProtocolCommand {
|
||||
JBProtocolOpenProjectCommand() {
|
||||
super("open");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(String target, Map<String, String> parameters) {
|
||||
String path = URLDecoder.decode(target);
|
||||
public void perform(String target, @NotNull Map<String, String> parameters) {
|
||||
String path;
|
||||
try {
|
||||
path = URLDecoder.decode(target, StandardCharsets.UTF_8.name());
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
String projectPath = StringUtil.trimStart(path, LocalFileSystem.PROTOCOL_PREFIX);
|
||||
ApplicationManager.getApplication().invokeLater(
|
||||
() -> ProjectUtil.openProject(projectPath, null, true), ModalityState.NON_MODAL);
|
||||
|
||||
@@ -1,22 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -64,7 +51,8 @@ public class JetBrainsProtocolHandler {
|
||||
} else {
|
||||
ourParameters.put(key, value);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ourParameters.put(keyValue, "");
|
||||
}
|
||||
}
|
||||
@@ -102,6 +90,7 @@ public class JetBrainsProtocolHandler {
|
||||
ourCommand = null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Map<String, String> getParameters() {
|
||||
init();
|
||||
return Collections.unmodifiableMap(ourParameters);
|
||||
|
||||
+5
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.vcs.checkout;
|
||||
|
||||
import com.intellij.openapi.application.JBProtocolCommand;
|
||||
@@ -23,22 +9,23 @@ import com.intellij.openapi.vcs.CheckoutProvider;
|
||||
import com.intellij.openapi.vcs.CheckoutProviderEx;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.ui.AppIcon;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JBProtocolCheckoutCommand extends JBProtocolCommand {
|
||||
final class JBProtocolCheckoutCommand extends JBProtocolCommand {
|
||||
private static final String REPOSITORY_NAME_KEY = "checkout.repo";
|
||||
|
||||
public JBProtocolCheckoutCommand() {
|
||||
JBProtocolCheckoutCommand() {
|
||||
super("checkout");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void perform(String vcsId, Map<String, String> parameters) {
|
||||
public void perform(String vcsId, @NotNull Map<String, String> parameters) {
|
||||
String repository = parameters.get(REPOSITORY_NAME_KEY);
|
||||
|
||||
if (StringUtil.isEmpty(repository)) {
|
||||
|
||||
Reference in New Issue
Block a user