Package org.netbeans.gradle.project

Examples of org.netbeans.gradle.project.NbGradleProject$OpenHook


        return getUnloadedProject(projectDir);
    }

    private NbGradleProject toLoadedProject(Project project) throws IOException {
        try {
            final NbGradleProject gradleProject = project.getLookup().lookup(NbGradleProject.class);
            if (gradleProject == null) {
                throw new IllegalArgumentException("Not a Gradle project: " + project.getProjectDirectory());
            }

            gradleProject.ensureLoadRequested();

            return gradleProject;
        } catch (Throwable ex) {
            throw Exceptions.throwUnchecked(ex);
        }
View Full Code Here


        assertNull("JavaExtension must be disabled and its lookup must not be visible.", cpProvider);
    }

    @Test
    public void testNoDependenciesNode() throws Exception {
        final NbGradleProject project = rootProject;

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                LogicalViewProvider view = project.getLookup().lookup(LogicalViewProvider.class);
                Node root = view.createLogicalView();

                Node[] children = root.getChildren().getNodes();
                for (Node child: children) {
                    if (child instanceof JavaDependenciesNode) {
View Full Code Here

        }
    }

    @Test
    public void testNoJavaActionsAreAdded() throws Exception {
        final NbGradleProject project = rootProject;

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                LogicalViewProvider view = project.getLookup().lookup(LogicalViewProvider.class);
                Node root = view.createLogicalView();

                verifyNoJavaActions(root.getActions(false));
                verifyNoJavaActions(root.getActions(true));
            }
View Full Code Here

                entry.getProject().getProjectDirectory());
    }

    @Test
    public void testClassPath() throws Exception {
        NbGradleProject project = rootProject;

        FileObject foProjectSrc = project.getProjectDirectory().getFileObject("src/main/java/org/netbeans/gradle/Sample.java");

        // get the classpath
        verifyClasspath(project, foProjectSrc, ClassPath.SOURCE, "gradle-sample/src/main/java");
        // need to add some test here
        // verifyClasspath(prj, foProjectSrc, ClassPath.BOOT, "android.jar", "annotations.jar");
View Full Code Here

        };
    }

    @Test
    public void testSingleCommandsEnabledForJava() throws Exception {
        NbGradleProject project = rootProject;

        ActionProvider actionProvider = project.getLookup().lookup(ActionProvider.class);
        Set<String> supportedActions = new HashSet<>(Arrays.asList(actionProvider.getSupportedActions()));

        FileObject javaFile = project.getProjectDirectory().getFileObject(
                "src/main/java/org/netbeans/gradle/Sample.java");
        for (String command: getSingleCommands()) {
            Lookup lookup = Lookups.fixed(javaFile);
            boolean actionEnabled = actionProvider.isActionEnabled(command, lookup);
            assertTrue(actionEnabled);
View Full Code Here

        checkNotOnLookup(lookup, GradleJavaBuiltInCommands.class);
    }

    @Test
    public void testHasProperNodes() throws Exception {
        final NbGradleProject project = rootProject;

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                LogicalViewProvider view = project.getLookup().lookup(LogicalViewProvider.class);
                Node root = view.createLogicalView();

                Lookup children = Lookups.fixed((Object[])root.getChildren().getNodes());
                JavaDependenciesNode dependenciesNode = children.lookup(JavaDependenciesNode.class);
                BuildScriptsNode buildScriptsNode = children.lookup(BuildScriptsNode.class);
View Full Code Here

        fail("Could not find javadoc command.");
    }

    @Test
    public void testJavadocActionIsAdded() throws Exception {
        final NbGradleProject project = rootProject;

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                LogicalViewProvider view = project.getLookup().lookup(LogicalViewProvider.class);
                Node root = view.createLogicalView();

                verifyJavaDocActionIsAdded(root.getActions(false));
                verifyJavaDocActionIsAdded(root.getActions(true));
            }
View Full Code Here

        modelChanges.fireChange();
    }

    private static ProjectInfoManager getProjectInfoManager(Project project) {
        // TODO: In the future this should be a public API.
        NbGradleProject gradleProject = project.getLookup().lookup(NbGradleProject.class);
        if (gradleProject == null) {
            throw new IllegalStateException("project is not an " + NbGradleProject.class.getSimpleName() + ": " + project.getProjectDirectory());
        }

        return gradleProject.getProjectInfoManager();
    }
View Full Code Here

        return NbStrings.getDependenciesNodeCaption();
    }

    @Override
    public Action[] getActions(boolean context) {
        NbGradleProject project = javaExt.getProject().getLookup().lookup(NbGradleProject.class);
        return new Action[]{
            new DownloadSourcesAction(project)
        };
    }
View Full Code Here

    private static GradleModelCache getCache() {
        if (CACHE_INIT.compareAndSet(false, true)) {
            GradleModelCache.getDefault().addModelUpdateListener(new ProjectModelUpdatedListener() {
                @Override
                public void onUpdateProject(NbGradleModel newModel) {
                    NbGradleProject project = tryFindGradleProject(newModel.getProjectDir());
                    if (project != null) {
                        updateProjectFromCacheIfNeeded(project, newModel);
                    }
                }
            });
View Full Code Here

TOP

Related Classes of org.netbeans.gradle.project.NbGradleProject$OpenHook

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.