Package intellijcoder.main

Examples of intellijcoder.main.IntelliJCoderException


            @SuppressWarnings({"deprecation"})
            DataContext dataContext = DataManager.getInstance().getDataContext();
            project = DataKeys.PROJECT.getData(dataContext);
        }
        if(project == null) {
            throw new IntelliJCoderException("There is no opened project.");
        }
        return project;
    }
View Full Code Here


    }

    private String getClassSource(Project project, String className) throws IntelliJCoderException {
        Module module = ModuleManager.getInstance(project).findModuleByName(className);
        if(module == null) {
            throw new IntelliJCoderException("Cannot find module '" + className + "'.");
        }
        VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
        if(sourceRoots.length == 0) {
            throw new IntelliJCoderException("Module '" + className + "' has no source roots.");
        }

        VirtualFile source = sourceRoots[0].findChild(classFileName(className));
        if(source == null) {
            throw new IntelliJCoderException("Cannot find file '" + classFileName(className) + "'.");
        }
        PsiFile psiFile = PsiManager.getInstance(project).findFile(source);
        assert psiFile != null;
        return psiFile.getText();
    }
View Full Code Here

    private void checkIfModuleRootDirectoryAlreadyExists(Project project, String moduleName) throws IntelliJCoderException {
        @SuppressWarnings({"ConstantConditions"})
        PsiDirectory projectRoot = PsiManager.getInstance(project).findDirectory(project.getBaseDir());
        if(hasSubdirectory(projectRoot, moduleName)) {
            throw new IntelliJCoderException("Directory '" + moduleName + "' already exists.");
        }
    }
View Full Code Here

    }

    private void checkModuleStructure(Module m, String moduleName) throws IntelliJCoderException {
        VirtualFile[] sourceRoots = ModuleRootManager.getInstance(m).getSourceRoots();
        if(sourceRoots.length == 0) {
            throw new IntelliJCoderException("Module '" + moduleName + "' exists but doesn't have a source root.");
        }
        VirtualFile source = sourceRoots[0].findChild(classFileName(moduleName));
        if(source == null) {
            throw new IntelliJCoderException("Module '" + moduleName + "' exists but doesn't have '" + moduleName + "' class.");
        }
    }
View Full Code Here

    public int start() throws IntelliJCoderException {
        final ServerSocket serverSocket;
        try {
            serverSocket = network.bindServerSocket(0);
        } catch (IOException e) {
            throw new IntelliJCoderException(FAILED_TO_START_SERVER_MESSAGE, e);
        }
        new Thread(new ServerCycle(serverSocket)).start();
        return serverSocket.getLocalPort();
    }
View Full Code Here

    @Test
    public void showsErrorMessageIfErrorOccuredWhileCreatingProblemWorkspace() throws Exception {
        context.checking(new Expectations(){{
            allowing(workspaceManager).createProblemWorkspace(with(any(Problem.class)));
                    will(throwException(new IntelliJCoderException("exception message", null)));
            oneOf(messagePanel).showErrorMessage("exception message");
        }});
        arenaPlugin.setProblemComponent(someProblemComponentModel(), JavaLanguage.JAVA_LANGUAGE, null);
    }
View Full Code Here

    @Test
    public void showsErrorMessageAndReturnsEmptyStringIfErrorOccuredWhileGettingSource() throws Exception {
        context.checking(new Expectations(){{
            allowing(workspaceManager).createProblemWorkspace(with(any(Problem.class)));
            allowing(workspaceManager).getSolutionSource(with(any(String.class)));
                    will(throwException(new IntelliJCoderException("exception message", null)));
            oneOf(messagePanel).showInfoMessage(with(any(String.class)));
            oneOf(messagePanel).showErrorMessage("exception message");
        }});
        arenaPlugin.setProblemComponent(someProblemComponentModel(), JavaLanguage.JAVA_LANGUAGE, null);
        String source = arenaPlugin.getSource();
View Full Code Here

                socket.close();
            }
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new IntelliJCoderException(SERVER_COMMUNICATION_ERROR_MESSAGE, e);
        }
    }
View Full Code Here

    private Socket openSocket() throws IntelliJCoderException {
        try {
            return network.getLocalhostSocket(port);
        } catch (IOException e) {
            throw new IntelliJCoderException(FAILED_TO_CONNECT_ERROR_MESSAGE, e);
        }
    }
View Full Code Here

            parseJars(d, appletInfo);
            parseMainClass(d, appletInfo);
            parseArguments(d, appletInfo);
            return appletInfo;
        } catch (Exception e) {
            throw new IntelliJCoderException("Failed to parse TopCoder jnlp file ", e);
        }
    }
View Full Code Here

TOP

Related Classes of intellijcoder.main.IntelliJCoderException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.