当前位置: 首页>>代码示例>>Java>>正文


Java NbMavenProjectImpl类代码示例

本文整理汇总了Java中org.netbeans.modules.maven.NbMavenProjectImpl的典型用法代码示例。如果您正苦于以下问题:Java NbMavenProjectImpl类的具体用法?Java NbMavenProjectImpl怎么用?Java NbMavenProjectImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NbMavenProjectImpl类属于org.netbeans.modules.maven包,在下文中一共展示了NbMavenProjectImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkChanges

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@Messages({
    "SG_Sources=Source Packages",
    "SG_Test_Sources=Test Packages"
})
private void checkChanges(boolean fireChanges, boolean checkAlsoNonJavaStuff) {        
    boolean changed = false;
    synchronized (lock) {
        NbMavenProjectImpl project = project();
        MavenProject mp = project.getOriginalMavenProject();
        NbMavenProject watcher = project.getProjectWatcher();
        File folder = FileUtilities.convertStringToFile(mp.getBuild().getSourceDirectory());
        changed = changed | checkSourceGroupCache(folder, NAME_SOURCE, SG_Sources(), javaGroup, watcher);
        folder = FileUtilities.convertStringToFile(mp.getBuild().getTestSourceDirectory());
        changed = changed | checkSourceGroupCache(folder, NAME_TESTSOURCE, SG_Test_Sources(), javaGroup, watcher);
        changed = changed | checkGeneratedGroupsCache();
        if (checkAlsoNonJavaStuff) {
            changed = changed | checkOtherGroupsCache(project.getOtherRoots(false), false);
            changed = changed | checkOtherGroupsCache(project.getOtherRoots(true), true);
        }
    }
    if (changed) {
        if (fireChanges) {
            cs.fireChange();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:MavenSourcesImpl.java

示例2: closed

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
public static void closed(NbMavenProjectImpl p) {
    File root;
    synchronized (roots) {
        root = roots.remove(p);
    }
    if (root == null) {
        return;
    }
    File basedir = p.getPOMFile().getParentFile();
    String path = FileUtilities.relativizeFile(root, basedir);
    if (path == null) {
        path = basedir.getAbsolutePath();
    }
    synchronized (reactors) {
        Reactor reactor = reactors.get(root);
        if (reactor != null) {
            reactor.unregister(path);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:BatchProblemNotifier.java

示例3: checkParentProject

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
private void checkParentProject(final NbMavenProjectImpl project, final String newName) throws IOException {
    Project[] prjs = OpenProjects.getDefault().getOpenProjects();
    for (Project prj : prjs) {
        if(prj.getProjectDirectory().equals(project.getProjectDirectory())) {
            continue;
        }
        final NbMavenProjectImpl parentProject = prj.getLookup().lookup(NbMavenProjectImpl.class);        
        if (parentProject != null) {
            List<String> modules = parentProject.getOriginalMavenProject().getModules();
            if(modules != null && !modules.isEmpty()) {
                String oldName = project.getProjectDirectory().getNameExt();                
                if(modules.contains(oldName)) {
                    rename(parentProject, oldName, newName);
                    return;
                } 
                File projectDir = project.getPOMFile().getParentFile();
                File parentDir = parentProject.getPOMFile().getParentFile();
                oldName = FileUtilities.relativizeFile(parentDir, projectDir);
                if(modules.contains(oldName)) {
                    String relNewName = FileUtilities.relativizeFile(parentDir, new File(projectDir.getParent(), newName));
                    rename(parentProject, oldName, relNewName);                    
                } 
            }
        }
    }                
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:RenameProjectPanel.java

示例4: testMultipleVersions

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
public void testMultipleVersions() throws Exception {
    File prj10 = new File(getWorkDir(), "prj10");
    TestFileUtils.writeFile(new File(prj10, "pom.xml"), "<project><modelVersion>4.0.0</modelVersion>"
            + "<groupId>test</groupId><artifactId>prj</artifactId>"
            + "<packaging>jar</packaging><version>1.0</version></project>");
    NbMavenProjectImpl p10 = (NbMavenProjectImpl) ProjectManager.getDefault().findProject(FileUtil.toFileObject(prj10));
    File prj11 = new File(getWorkDir(), "prj11");
    TestFileUtils.writeFile(new File(prj11, "pom.xml"), "<project><modelVersion>4.0.0</modelVersion>"
            + "<groupId>test</groupId><artifactId>prj</artifactId>"
            + "<packaging>jar</packaging><version>1.1</version></project>");
    NbMavenProjectImpl p11 = (NbMavenProjectImpl) ProjectManager.getDefault().findProject(FileUtil.toFileObject(prj11));
    MavenFileOwnerQueryImpl foq = MavenFileOwnerQueryImpl.getInstance();
    File repo = EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile();
    File art10 = new File(repo, "test/prj/1.0/prj-1.0.jar");
    File art11 = new File(repo, "test/prj/1.1/prj-1.1.jar");
    assertEquals(null, foq.getOwner(Utilities.toURI(art10)));
    assertEquals(null, foq.getOwner(Utilities.toURI(art11)));
    foq.registerProject(p10, true);
    assertEquals(p10, foq.getOwner(Utilities.toURI(art10)));
    assertEquals(null, foq.getOwner(Utilities.toURI(art11)));
    foq.registerProject(p11, true);
    assertEquals(p10, foq.getOwner(Utilities.toURI(art10)));
    assertEquals(p11, foq.getOwner(Utilities.toURI(art11)));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:MavenFileOwnerQueryImplTest.java

示例5: actionPerformed

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@Override public void actionPerformed(ActionEvent e) {
    for (NbMavenProjectImpl project : projects) {
        FileObject pom = FileUtil.toFileObject(project.getPOMFile());
        if (pom != null) {
            DataObject d;
            try {
                d = DataObject.find(pom);
            } catch (DataObjectNotFoundException x) {
                continue;
            }
            Openable o = d.getLookup().lookup(Openable.class);
            if (o != null) {
                o.open();
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:OpenPOMAction.java

示例6: ModulesChildFactory

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
ModulesChildFactory(NbMavenProjectImpl proj) {
    project = proj;
    NbMavenProject watcher = project.getProjectWatcher();
    listener = new PropertyChangeListener() {
                               @Override
                               public void propertyChange(PropertyChangeEvent evt) {
                                   if (NbMavenProject.PROP_PROJECT.equals(evt.getPropertyName())) {
                                       refresh(false);
                                   }
                               }
                           };
     
    watcher.addPropertyChangeListener(WeakListeners.propertyChange(listener, watcher));                       
    
 
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ModulesNode.java

示例7: DependenciesSet

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")       
DependenciesSet(NbMavenProjectImpl project, DependencyType type) {
    this.project = project;
    this.type = type;
    ModuleInfoSupport mis = null;
    switch (type) {   
        case COMPILE:
        case TEST:
            try {
                mis = new ModuleInfoSupport(project, type);
                break;
            } catch (LinkageError err) {
                LOG.log(Level.INFO, "Can't initialize dependencies", err);
                // fallthrough
            }
        default:
    }
    this.moduleInfoSupport = mis;
    
    NbMavenProject nbmp = project.getProjectWatcher();
    nbmp.addPropertyChangeListener(WeakListeners.propertyChange(this, nbmp));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:DependenciesNode.java

示例8: createContextAwareInstance

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
public @Override Action createContextAwareInstance(final Lookup context) {
    return new AbstractAction(BTN_Open_Project()) {
        public @Override void actionPerformed(ActionEvent e) {
            Set<Project> projects = new HashSet<Project>();
            for (Artifact art : context.lookupAll(Artifact.class)) {
                File f = art.getFile();
                if (f != null) {
                    Project p = FileOwnerQuery.getOwner(org.openide.util.Utilities.toURI(f));
                    if (p != null) {
                        projects.add(p);
                    }
                }
            }
            OpenProjects.getDefault().open(projects.toArray(new NbMavenProjectImpl[projects.size()]), false, true);
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:DependencyNode.java

示例9: getMavenProject

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@Override
public final synchronized MavenProject getMavenProject() {
    if (mp != null) {
        return mp;
    }
    Project prj = getProject();
    if (prj != null) {
        NbMavenProjectImpl impl = prj.getLookup().lookup(NbMavenProjectImpl.class);
        List<String> profiles = new ArrayList<String>();
        profiles.addAll(impl.getCurrentActiveProfiles());
        if (getActivatedProfiles() != null) {
            profiles.addAll(getActivatedProfiles());
        }
        Properties props = new Properties();
        if (getProperties() != null) {
            props.putAll(getProperties());
        }
        mp = impl.loadMavenProject(EmbedderFactory.getProjectEmbedder(), profiles, props);
    }
    return mp;
 }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:BeanRunConfig.java

示例10: showAddPropertyPopupMenu

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
public static void showAddPropertyPopupMenu(JButton btn, JTextComponent area, JTextField goalsField, @NullAllowed NbMavenProjectImpl project) {
    JPopupMenu menu = new JPopupMenu();
    menu.add(new SkipTestsAction(area));
    menu.add(new DebugMavenAction(area));
    menu.add(new EnvVarAction(area));
    menu.add(createJdkSubmenu(area));
    menu.add(createGlobalVarSubmenu(area));
    if (project != null) {
        menu.add(new PluginPropertyAction(area, goalsField, project));
    }
    menu.add(createFileSelectionSubmenu(area));
    menu.show(btn, btn.getSize().width, 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ActionMappings.java

示例11: actionPerformed

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@Override
public void actionPerformed( ActionEvent e ) {
        final FileObject pom = FileUtil.toFileObject(project.getLookup().lookup(NbMavenProjectImpl.class).getPOMFile());
        if (pom == null || !pom.isValid()) {
            return; //TODO
        }
        
                try {
            writeAll(handle2, project.getLookup().lookup(NbMavenProjectImpl.class));
                } catch (IOException ex) {
                    Exceptions.printStackTrace(ex);
                    //TODO error reporting on wrong model save
                }
            }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CustomizerProviderImpl.java

示例12: createCategory

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@Override
@Messages("TIT_Run=Run")
public Category createCategory(Lookup context) {
    NbMavenProjectImpl project = context.lookup(NbMavenProjectImpl.class);
    NbMavenProject watcher = project.getLookup().lookup(NbMavenProject.class);
    
    if (NbMavenProject.TYPE_JAR.equalsIgnoreCase(watcher.getPackagingType())) {
        return ProjectCustomizer.Category.create(
                ModelHandle2.PANEL_RUN,
                TIT_Run(),
                null);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:RunJarPanelProvider.java

示例13: createComponent

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
@Override
public JComponent createComponent(Category category, Lookup context) {
    ModelHandle2 handle = context.lookup(ModelHandle2.class);
    NbMavenProjectImpl project = context.lookup(NbMavenProjectImpl.class);
    final RunJarPanel panel = new RunJarPanel(handle, project, category);
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:RunJarPanelProvider.java

示例14: AddPropertyDialog

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
/** Creates new form AddPropertyDialog */
public AddPropertyDialog(NbMavenProjectImpl prj, String goalsText) {
    initComponents();
    manager = new ExplorerManager();
    //project can be null when invoked from Tools/Options
    project = prj;
    okbutton = new JButton(NbBundle.getMessage(AddPropertyDialog.class, "BTN_OK"));
    manager.setRootContext(Node.EMPTY);        
    tpDesc.setEditorKit(new HTMLEditorKit());
    tpDesc.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );
    
    manager.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Node[] nds = getExplorerManager().getSelectedNodes();
            if (nds.length != 1) {
                okbutton.setEnabled(false);
            } else {
                PluginIndexManager.ParameterDetail plg = nds[0].getLookup().lookup(PluginIndexManager.ParameterDetail.class);
                if (plg != null) {
                    okbutton.setEnabled(true);
                    tpDesc.setText(plg.getHtmlDetails(false));
                } else {
                    okbutton.setEnabled(false);
                    tpDesc.setText("");
                }
            }
        }
    });
    ((BeanTreeView)tvExpressions).setRootVisible(false);
    ((BeanTreeView)tvExpressions).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.goalsText = goalsText;
    RequestProcessor.getDefault().post(new Loader());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:AddPropertyDialog.java

示例15: ProblemReporterImpl

import org.netbeans.modules.maven.NbMavenProjectImpl; //导入依赖的package包/类
/** Creates a new instance of ProblemReporter */
public ProblemReporterImpl(NbMavenProjectImpl proj) {
    reports = new TreeSet<ProblemReport>(this);
    missingArtifacts = new HashSet<File>();
    nbproject = proj;
    projectPOMFile = nbproject.getPOMFile();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ProblemReporterImpl.java


注:本文中的org.netbeans.modules.maven.NbMavenProjectImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。