Java Code Examples for org.netbeans.modules.maven.api.NbMavenProject#getPackagingType()
The following examples show how to use
org.netbeans.modules.maven.api.NbMavenProject#getPackagingType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NbMavenProjectImpl.java From netbeans with Apache License 2.0 | 6 votes |
private void check() { //this call effectively calls project.getLookup(), when called in constructor will get back to the project's baselookup only. // but when called from propertyChange() then will call on entire composite lookup, is it a problem? #230469 NbMavenProject watcher = watcherRef.get(); String newPackaging = packaging != null ? packaging : NbMavenProject.TYPE_JAR; if (watcher != null) { newPackaging = watcher.getPackagingType(); if (newPackaging == null) { newPackaging = NbMavenProject.TYPE_JAR; } } if (!newPackaging.equals(packaging)) { packaging = newPackaging; Lookup pack = Lookups.forPath("Projects/org-netbeans-modules-maven/" + packaging + "/Lookup"); setLookups(general, pack); } }
Example 2
Source File: AbstractMavenActionsProvider.java From netbeans with Apache License 2.0 | 6 votes |
private NetbeansActionMapping findMapAction(Map<String, String> replaceMap, Project project, String actionName) throws XmlPullParserException, IOException { // TODO need some caching really badly here.. Reader read = performDynamicSubstitutions(replaceMap, getRawMappingsAsString()); ActionToGoalMapping mapping = reader.read(read); Iterator<NetbeansActionMapping> it = mapping.getActions().iterator(); NetbeansActionMapping action = null; NbMavenProject mp = project.getLookup().lookup(NbMavenProject.class); String prjPack = mp.getPackagingType(); while (it.hasNext()) { NetbeansActionMapping elem = it.next(); if (actionName.equals(elem.getActionName()) && (elem.getPackagings().contains(prjPack.trim()) || elem.getPackagings().contains("*") || elem.getPackagings().isEmpty())) {//NOI18N action = elem; break; } } return action; }
Example 3
Source File: PackagesPanelProvider.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Category createCategory(Lookup context) { Project project = context.lookup(Project.class); NbMavenProject watcher = project.getLookup().lookup(NbMavenProject.class); String effPackaging = watcher.getPackagingType(); String[] types = PluginPropertyUtils.getPluginPropertyList(project, OSGiConstants.GROUPID_FELIX, OSGiConstants.ARTIFACTID_BUNDLE_PLUGIN, "supportedProjectTypes", "supportedProjectType", /*"bundle" would not work for GlassFish parent POM*/null); if (types != null) { for (String type : types) { if (effPackaging.equals(type)) { effPackaging = NbMavenProject.TYPE_OSGI; } } } if (NbMavenProject.TYPE_OSGI.equalsIgnoreCase(effPackaging)) { return ProjectCustomizer.Category.create( ModelHandle2.PANEL_COMPILE, org.openide.util.NbBundle.getMessage(PackagesPanelProvider.class, "TIT_Packages"), null); } return null; }
Example 4
Source File: MicroActionsProvider.java From netbeans with Apache License 2.0 | 6 votes |
@Override public boolean isActionEnable(String action, Project project, Lookup lookup) { NbMavenProject nbMavenProject = project.getLookup().lookup(NbMavenProject.class); final String packagingType = nbMavenProject.getPackagingType(); if (!WAR_PACKAGING.equals(packagingType)) { return false; } switch (action) { case COMMAND_RUN: case COMMAND_DEBUG: case COMMAND_PROFILE: case RUN_SINGLE_ACTION: case DEBUG_SINGLE_ACTION: case PROFILE_SINGLE_ACTION: break; default: return false; } return MicroApplication.getInstance(project) != null; }
Example 5
Source File: MavenProjectRestSupport.java From netbeans with Apache License 2.0 | 6 votes |
@Override public int getProjectType() { NbMavenProject nbMavenProject = getProject().getLookup().lookup(NbMavenProject.class); if (nbMavenProject != null) { String packagingType = nbMavenProject.getPackagingType(); if (packagingType != null) if (NbMavenProject.TYPE_JAR.equals(packagingType)) { return PROJECT_TYPE_DESKTOP; } else if (NbMavenProject.TYPE_WAR.equals(packagingType)) { return PROJECT_TYPE_WEB; } else if (NbMavenProject.TYPE_NBM.equals(packagingType) || NbMavenProject.TYPE_NBM_APPLICATION.equals(packagingType)) { return PROJECT_TYPE_NB_MODULE; } } return PROJECT_TYPE_DESKTOP; }
Example 6
Source File: MissingModulesProblemProvider.java From netbeans with Apache License 2.0 | 5 votes |
public synchronized Collection<ProjectProblem> doIDEConfigChecks() { Collection<ProjectProblem> toRet = new ArrayList<ProjectProblem>(); NbMavenProject nbproject = project.getLookup().lookup(NbMavenProject.class); String packaging = nbproject.getPackagingType(); if (packagings.contains(packaging)) { //TODO check on lastpackaging to prevent re-calculation ModuleInfo moduleInfo = listener != null ? listener.info : findModule(moduleCodenameBase); boolean foundModule = moduleInfo != null && moduleInfo.isEnabled(); if (!foundModule) { if (listener == null) { ProjectProblem problem = ProjectProblem.createWarning(problemName, problemDescription, new InstallModulesResolver(kitCodeNameBase)); listener = new EnablementListener(moduleInfo, problem); listener.startListening(); } toRet.add(listener.problem); } else { if (listener != null) { listener.stopListening(); listener = null; } } } lastPackaging = packaging; return toRet; }
Example 7
Source File: NbmActionGoalProvider.java From netbeans with Apache License 2.0 | 5 votes |
private boolean isPlatformApp(Project p) { NbMavenProject watch = p.getLookup().lookup(NbMavenProject.class); String pack = watch.getPackagingType(); if (NbMavenProject.TYPE_NBM_APPLICATION.equals(pack)) { return true; } return false; }
Example 8
Source File: ProjectHookImpl.java From netbeans with Apache License 2.0 | 5 votes |
private String getProjectType() { NbMavenProject mavenProject = project.getLookup().lookup(NbMavenProject.class); if (mavenProject != null) { return mavenProject.getPackagingType(); } return null; }
Example 9
Source File: AbstractMavenActionsProvider.java From netbeans with Apache License 2.0 | 4 votes |
@Override public boolean isActionEnable(String action, Project project, Lookup lookup) { NbMavenProject mp = project.getLookup().lookup(NbMavenProject.class); String prjPack = mp.getPackagingType(); return isActionEnable(action, prjPack); }
Example 10
Source File: OSGILookupProvider.java From netbeans with Apache License 2.0 | 4 votes |
private void checkContent(Project prj, InstanceContent ic, AccessQueryImpl access, ForeignClassBundlerImpl bundler, RecommendedTemplates templates) { NbMavenProject nbprj = prj.getLookup().lookup(NbMavenProject.class); String effPackaging = nbprj.getPackagingType(); boolean needToCheckFelixProjectTypes = true; if(!nbprj.isMavenProjectLoaded()) { // issue #262646 // due to unfortunate ProjectManager.findPorjetc calls in awt, // speed is essential during project init, so lets try to avoid // maven project loading if we can get the info faster from raw model. needToCheckFelixProjectTypes = false; Model model; try { model = nbprj.getRawModel(); } catch (ModelBuildingException ex) { // whatever happend, we can't use the model, // lets try to follow up with loading the maven project model = null; Logger.getLogger(OSGILookupProvider.class.getName()).log(Level.FINE, null, ex); } Build build = model != null ? model.getBuild() : null; List<Plugin> plugins = build != null ? build.getPlugins() : null; if(plugins != null) { for (Plugin plugin : plugins) { if(OSGiConstants.GROUPID_FELIX.equals(plugin.getGroupId()) && OSGiConstants.ARTIFACTID_BUNDLE_PLUGIN.equals(plugin.getArtifactId())) { needToCheckFelixProjectTypes = true; break; } } } } if(needToCheckFelixProjectTypes) { String[] types = PluginPropertyUtils.getPluginPropertyList(prj, OSGiConstants.GROUPID_FELIX, OSGiConstants.ARTIFACTID_BUNDLE_PLUGIN, "supportedProjectTypes", "supportedProjectType", /*"bundle" would not work for GlassFish parent POM*/null); if (types != null) { for (String type : types) { if (effPackaging.equals(type)) { effPackaging = NbMavenProject.TYPE_OSGI; } } } } if (NbMavenProject.TYPE_OSGI.equals(effPackaging)) { ic.add(access); ic.add(bundler); ic.add(templates); } else { ic.remove(access); ic.remove(bundler); ic.remove(templates); } }