package floobits;

import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JOptionPane;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.InputValidator;
import com.intellij.openapi.util.text.StringUtil;


public class JoinWorkspace extends AnAction {

    private static class URLInputValidator implements InputValidator {
        @Override
        public boolean canClose(String inputString) {
            return true;
        }

        @Override
        public boolean checkInput(String inputString) {
            try {
                final URL url = new URL(inputString);
                return StringUtil.isNotEmpty(url.getHost());
            } catch (MalformedURLException e) {
                return false;
            }
        }
    }

    public void actionPerformed(AnActionEvent e) {
        String inputValue = JOptionPane.showInputDialog("Workspace URL", "https://floobits.com/");
        Flog.info(inputValue);
        FloobitsPlugin.joinWorkspace(inputValue);
    }
}

@@ -1003,16 +1003,80 @@
 com/%22);%0A
+        if (inputValue == null) %7B%0A            return;%0A        %7D%0A
         

Return null on cancel join workspace. Closes #19