Permalink
Browse files

'open' command implementation for JB protocol

  • Loading branch information...
bulenkov committed Jul 13, 2015
1 parent d2645a1 commit 9c762d305709afa51103dedd48e37c5c727fc80e
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2015 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.
+ */
+package com.intellij.openapi.project.impl;
+
+import com.intellij.ide.impl.ProjectUtil;
+import com.intellij.openapi.application.JBProtocolCommand;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import org.jetbrains.annotations.NotNull;
+
+import java.net.URLDecoder;
+import java.util.Map;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class JBProtocolOpenProjectCommand extends JBProtocolCommand {
+ @NotNull
+ @Override
+ public String getCommandName() {
+ return "open";
+ }
+
+ @Override
+ public void perform(String target, Map<String, String> parameters) {
+ String path = URLDecoder.decode(target);
+ if (path.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) {
+ path = path.substring(LocalFileSystem.PROTOCOL_PREFIX.length());
+ }
+ ProjectUtil.openProject(path, null, true);
+ }
+}
@@ -392,6 +392,6 @@
<actionPromoter implementation="com.intellij.ui.ToolbarDecoratorActionPromoter"/>
<ui.suitableFontProvider implementation="com.intellij.ui.SuitableFontProviderImpl"/>
-
+ <jbProtocolCommand implementation="com.intellij.openapi.project.impl.JBProtocolOpenProjectCommand"/>
</extensions>
</idea-plugin>

0 comments on commit 9c762d3

Please sign in to comment.