Package org.netbeans.api.project

Examples of org.netbeans.api.project.Project


                                                 JavaPlatformManager.getDefault()));
           
            List<FileObject> allSourceRoots = new ArrayList<FileObject>();
            Set<FileObject> preferredRoots = new HashSet<FileObject>();
            Set<FileObject> addedBinaryRoots = new HashSet<FileObject>();
            Project mainProject = OpenProjects.getDefault().getMainProject();
            if (mainProject != null) {
                SourceGroup[] sgs = ProjectUtils.getSources(mainProject).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
                for (SourceGroup sg : sgs) {
                    ClassPath ecp = ClassPath.getClassPath(sg.getRootFolder(), ClassPath.EXECUTE);
                    if (ecp == null) {
View Full Code Here


        } else
        if (o instanceof String) {
            File f = new File ((String) o);
            if (f.exists ()) {
                FileObject fo = FileUtil.toFileObject (f);
                Project p = FileOwnerQuery.getOwner (fo);
                if (p != null) {
                    ProjectInformation pi = (ProjectInformation) p.getLookup ().
                        lookup (ProjectInformation.class);
                    return java.text.MessageFormat.format(NbBundle.getBundle(SourcesNodeModel.class).getString(
                            "CTL_SourcesModel_Column_Name_ProjectSources"), new Object [] { f.getPath(), pi.getDisplayName() });
                }
                return java.text.MessageFormat.format(NbBundle.getBundle(SourcesNodeModel.class).getString(
View Full Code Here

    }
   
    private boolean shouldBeEnabled () {
       
        // check if current project supports this action
        Project p = MainProjectManager.getDefault ().getMainProject ();
        if (p == null) return false;
        ActionProvider actionProvider = (ActionProvider) p.getLookup ().
            lookup (ActionProvider.class);
        if (actionProvider == null) return false;
        String[] sa = actionProvider.getSupportedActions ();
        int i, k = sa.length;
        for (i = 0; i < k; i++)
View Full Code Here

   
    private boolean shouldBeEnabled () {
        // check if current debugger supports this action
        if (!debugger.canFixClasses()) return false;
        // check if current project supports this action
        Project p = getCurrentProject();
        if (p == null) return false;
        ActionProvider actionProvider = (ActionProvider) p.getLookup ().
            lookup (ActionProvider.class);
        if (actionProvider == null) return false;
        String[] sa = actionProvider.getSupportedActions ();
        int i, k = sa.length;
        for (i = 0; i < k; i++)
            if (JavaProjectConstants.COMMAND_DEBUG_FIX.equals (sa [i]))
                break;
        if (i == k) return false;

        // check if this action should be enabled
        return ((ActionProvider) p.getLookup ().lookup (
                ActionProvider.class
            )).isActionEnabled (
                JavaProjectConstants.COMMAND_DEBUG_FIX,
                getLookup ()
            );
View Full Code Here

    private boolean shouldBeEnabled () {
        if (editor.getCurrentLineNumber () < 0) return false;
        if (!editor.getCurrentURL ().endsWith (".scala")) return false;
       
        // check if current project supports this action
        Project p = MainProjectManager.getDefault ().getMainProject ();
        if (p == null) return false;
        ActionProvider actionProvider = (ActionProvider) p.getLookup ().
            lookup (ActionProvider.class);
        if (actionProvider == null) return false;
        String[] sa = actionProvider.getSupportedActions ();
        int i, k = sa.length;
        for (i = 0; i < k; i++)
            if (ActionProvider.COMMAND_DEBUG.equals (sa [i]))
                break;
        if (i == k) return false;

        // check if this action should be enabled
        return ((ActionProvider) p.getLookup ().lookup (
                ActionProvider.class
            )).isActionEnabled (
                ActionProvider.COMMAND_DEBUG,
                MainProjectManager.getDefault ().getMainProject ().getLookup ()
            );
View Full Code Here

    }
   
    private static boolean isJ2SEProject(File dir) {
        FileObject projdir = FileUtil.toFileObject(FileUtil.normalizeFile(dir));
        try {
            Project proj = ProjectManager.getDefault().findProject(projdir);
            if (proj != null) {
                // Check if it is a J2SEProject.
                return proj.getLookup().lookup(J2SEProject.class) != null;
            }
        } catch (IOException e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
        return false;
View Full Code Here

    public UpdateHelper getUpdateHelper() {
        return helper;
    }
   
    public Node findPath(Node root, Object target) {
        Project prj = root.getLookup().lookup(Project.class);
        if (prj == null) {
            return null;
        }
       
        if (target instanceof FileObject) {
            FileObject fo = (FileObject) target;
            Project owner = FileOwnerQuery.getOwner(fo);
            if (!prj.equals(owner)) {
                return null; // Don't waste time if project does not own the fo
            }
           
            for (Node n : root.getChildren().getNodes(true)) {
View Full Code Here

                        text), true);
                FileUtil.refreshFor(clazzfile);
                FileObject file = FileUtil.toFileObject(clazzfile);
                String newclazz = clazz;
                if (file != null) {
                    Project prj = FileOwnerQuery.getOwner(file);
                    if (prj != null) {
                        Sources srcs = ProjectUtils.getSources(prj);
                        if (srcs != null) {
                            for (SourceGroup grp : srcs.getSourceGroups(ScalaSourcesImpl.TYPE_SCALA)) {
                                if (FileUtil.isParentOf(grp.getRootFolder(), file)) {
View Full Code Here

public class CoffeeScriptUtils {

    public static void writeJS(final String js, String name, FileObject folder, Charset encoding) {
        String outputFolder = CoffeeScriptSettings.get().getOutputFolder();
        try {
            Project project = FileOwnerQuery.getOwner(folder);
            if (outputFolder != null && outputFolder.trim().length() > 0) {
                if (project != null) {
                    FileObject projectDirectory = project.getProjectDirectory();
                    String projectPath = projectDirectory.getPath();
                    String path = folder.getPath().replace(projectPath, outputFolder);
                    File pathFolder = new File(path);
                    if(!pathFolder.exists()) {
                        pathFolder.mkdirs();
View Full Code Here

    public void perform (Project p) {
    }

    public boolean enable (Project p) {
        if (mainProject == p) return true;
        Project o = mainProject;
        mainProject = p;
        pcs.firePropertyChange ("mainProject", o, mainProject);
        return true;
    }
View Full Code Here

TOP

Related Classes of org.netbeans.api.project.Project

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.