Package org.netbeans.api.project

Examples of org.netbeans.api.project.Project


    private static final String AUTO_COMPLETE_FILE_NAME = "__l4_auto_complete__"; // NOI18N
    private static final String AUTO_COMPLETE_FILE = AUTO_COMPLETE_FILE_NAME + ".php"; // NOI18N
    private static final String AUTO_COMPLETE_TEMPLATE_PATH = "org-nbphpcouncil-modules-php-laravel4/__l4_auto_complete__.php"; // NOI18N

    public static void generateAutoCompletionFile(PhpModule phpModule) {
        Project project = PhpProjectSupport.getProject(phpModule.getSourceDirectory());
        FileObject projectDirectory = project.getProjectDirectory();
        FileObject nbProjectDirectory = PhpProjectSupport.getNbProjectDirectory(projectDirectory);

        if (nbProjectDirectory != null) {
            FileObject autoCompleteTemplateFile = FileUtil.getConfigFile(AUTO_COMPLETE_TEMPLATE_PATH);
View Full Code Here


            }
        }
    }

    public static void removeAutoCompletionFile(PhpModule phpModule) {
        Project project = PhpProjectSupport.getProject(phpModule.getSourceDirectory());
        FileObject projectDirectory = project.getProjectDirectory();
        FileObject nbProjectDirectory = PhpProjectSupport.getNbProjectDirectory(projectDirectory);

        if (nbProjectDirectory != null) {
            try {
                FileObject autoCompleteDirectory = getAutoCompleteDirectory(nbProjectDirectory);
View Full Code Here

    }

    public static FileObject getProjectDirectory(FileObject fo) {
        FileObject projectDirectory = null;

        Project project = getProject(fo);

        if (project != null) {
            projectDirectory = project.getProjectDirectory();
        }

        return projectDirectory;
    }
View Full Code Here

            selectionModel.clearSelection();
            Set rootsFromOtherProjects = new HashSet ();
            Set rootsFromRelatedSourceRoots = new HashSet();
out:        for( int i = 0; i < files.length; i++ ) {
                File normalizedFile = FileUtil.normalizeFile(files[i]);
                Project p;
                if (ownedFolders.contains(normalizedFile)) {
                    Vector dataVector = rootsModel.getDataVector();
                    for (int j=0; j<dataVector.size();j++) {
                        //Sequential search in this minor case is faster than update of positions during each modification
                        File f = (File )((Vector)dataVector.elementAt(j)).elementAt(0);
                        if (f.equals(normalizedFile)) {
                            selectionModel.addSelectionInterval(j,j);
                        }
                    }
                }
                else if (this.relatedEditMediator != null && this.relatedEditMediator.ownedFolders.contains(normalizedFile)) {
                    rootsFromRelatedSourceRoots.add (normalizedFile);
                    continue;
                }
                if ((p=FileOwnerQuery.getOwner(normalizedFile.toURI()))!=null && !p.getProjectDirectory().equals(project.getProjectDirectory())) {
                    final Sources sources = (Sources) p.getLookup().lookup (Sources.class);
                    if (sources == null) {
                        rootsFromOtherProjects.add (normalizedFile);
                        continue;
                    }
                    final SourceGroup[] sourceGroups = sources.getSourceGroups(Sources.TYPE_GENERIC);
                    final SourceGroup[] javaGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
                    final SourceGroup[] groups = new SourceGroup [sourceGroups.length + javaGroups.length];
                    System.arraycopy(sourceGroups,0,groups,0,sourceGroups.length);
                    System.arraycopy(javaGroups,0,groups,sourceGroups.length,javaGroups.length);
                    final FileObject projectDirectory = p.getProjectDirectory();
                    final FileObject fileObject = FileUtil.toFileObject(normalizedFile);
                    if (projectDirectory == null || fileObject == null) {
                        rootsFromOtherProjects.add (normalizedFile);
                        continue;
                    }
View Full Code Here

            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                File f = (File) value;
                String message = f.getAbsolutePath();
                if (projectConflict) {
                    Project p = FileOwnerQuery.getOwner(f.toURI());
                    if (p!=null) {
                        ProjectInformation pi = ProjectUtils.getInformation(p);
                        String projectName = pi.getDisplayName();
                        message = MessageFormat.format (NbBundle.getMessage(J2SESourceRootsUi.class,"TXT_RootOwnedByProject"), new Object[] {
                            message,
View Full Code Here

    public void propertyChange(PropertyChangeEvent e) {
        if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(e.getPropertyName())) {
            // We have to update the Accessory
            JFileChooser chooser = (JFileChooser) e.getSource();
            File dir = chooser.getSelectedFile(); // may be null (#46744)
            Project project = getProject(dir); // may be null
            populateAccessory(project);
        }
    }
View Full Code Here

             
        if ( option == JFileChooser.APPROVE_OPTION ) {

            File dir = chooser.getSelectedFile();
            dir = FileUtil.normalizeFile (dir);
            Project selectedProject = accessory.getProject( dir );

            if ( selectedProject == null ) {
                return null;
            }
           
            if ( selectedProject.getProjectDirectory().equals( master.getProjectDirectory() ) ) {
                DialogDisplayer.getDefault().notify( new NotifyDescriptor.Message(
                    NbBundle.getMessage( AntArtifactChooser.class, "MSG_AACH_RefToItself" ),
                    NotifyDescriptor.INFORMATION_MESSAGE ) );
                return null;
            }
View Full Code Here

  if (null == activeTC) {
      return null;
  }

  DataObject dataObject = activeTC.getLookup().lookup(DataObject.class);
  Project project = activeTC.getLookup().lookup(Project.class);
  Node node = activeTC.getLookup().lookup(Node.class);
  FileObject fileObject = activeTC.getLookup().lookup(FileObject.class);
  //                showInStatusBar(project);

  String projectName = null;
View Full Code Here

  return string;
    }

    private String getProjectDirectory(final FileObject primaryFile) {
  try {
      Project project = ProjectUtils.getInformation(FileOwnerQuery.getOwner(primaryFile)).getProject();
      return getProjectDirectory(project);
  } catch (Exception e) {
      //ignore the exception
      return null;
  }
View Full Code Here

    private void updateProjectCombo() {
        Collection<Project> projects = ProjectUtils.getOpenProjects();
        ((ProjectComboBoxModel) projectCombo.getModel()).addAll(projects);
        if (!projects.isEmpty()) {
            final Project selected = ProjectUtils.getSelectedProject();
            if (selected != null) {
                projectCombo.setSelectedItem(selected);
            } else {
                projectCombo.setSelectedIndex(0);
            }
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.