Author: fbricon
Date: 2012-02-10 04:43:28 -0500 (Fri, 10 Feb 2012)
New Revision: 38591
Added:
trunk/maven/features/org.jboss.tools.maven.profiles.feature/
trunk/maven/features/org.jboss.tools.maven.profiles.feature/.project
trunk/maven/features/org.jboss.tools.maven.profiles.feature/build.properties
trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.properties
trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.xml
trunk/maven/features/org.jboss.tools.maven.profiles.feature/license.html
trunk/maven/features/org.jboss.tools.maven.profiles.feature/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.classpath
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.project
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.m2e.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/about.html
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/build.properties
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/MavenProfilesCoreActivator.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/Messages.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/messages.properties
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/IProfileManager.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileState.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileStatus.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.classpath
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.project
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.m2e.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.html
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.ini
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.mappings
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.properties
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/build.properties
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/icons/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/icons/maven-profiles.gif
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/jboss_about.png
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Activator.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Messages.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveMavenProfilesNode.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesContentProvider.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesLabelProvider.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelection.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionHandler.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionStatus.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileUtil.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/SelectProfilesDialog.java
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/messages.properties
Removed:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/profiles/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/profiles/
trunk/maven/plugins/org.jboss.tools.maven.ui/icons/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/
Modified:
trunk/maven/features/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties
trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
trunk/maven/plugins/pom.xml
trunk/maven/site/site.xml
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/META-INF/MANIFEST.MF
Log:
JBIDE-10604 : move maven profile management to separate feature/plugins
Added: trunk/maven/features/org.jboss.tools.maven.profiles.feature/.project
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.profiles.feature/.project
(rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.profiles.feature/.project 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maven/features/org.jboss.tools.maven.profiles.feature/build.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.profiles.feature/build.properties
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.profiles.feature/build.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,4 @@
+bin.includes = feature*.*,\
+ license.html,\
+ p2.inf
+
\ No newline at end of file
Added: trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.properties
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,53 @@
+###############################################################################
+# Copyright (c) 2010-2011 Red Hat, Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+#
http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# JBoss by Red Hat - Initial implementation.
+##############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Maven Profiles Management
+
+# "providerName" property - name of the company that provides the feature
+providerName=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update site
+updateSiteName=JBossTools Update Site
+
+# "description" property - description of the feature
+description=The feature brings an enhanced user interface for management of Maven
profiles.
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=Copyright (c) 2010-2012 Red Hat, Inc. and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http\://www.eclipse.org/legal/epl-v10.html\n\nContributors\:\n\
+JBoss by Red Hat - Initial implementation.\n
+ ############### end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# START NON-TRANSLATABLE
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=Red Hat, Inc. licenses these features and plugins to you under \
+certain open source licenses (or aggregations of such licenses), which \
+in a particular case may include the Eclipse Public License, the GNU \
+Lesser General Public License, and/or certain other open source \
+licenses. For precise licensing details, consult the corresponding \
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive, \
+Raleigh NC 27606 USA.
+# END NON-TRANSLATABLE
+########### end of license property ##########################################
Added: trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.xml
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.xml
(rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.profiles.feature/feature.xml 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.maven.profiles.feature"
+ label="%featureName"
+ version="1.3.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.tools.maven.profiles.ui">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.eclipse.m2e.feature" version="1.0.0"
match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.jboss.tools.maven.profiles.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.maven.profiles.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/maven/features/org.jboss.tools.maven.profiles.feature/license.html
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.profiles.feature/license.html
(rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.profiles.feature/license.html 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+
+<body>
+<p>Red Hat, Inc. licenses these features and plugins to you under
+certain open source licenses (or aggregations of such licenses), which
+in a particular case may include the Eclipse Public License, the GNU
+Lesser General Public License, and/or certain other open source
+licenses. For precise licensing details, consult the corresponding
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
+Raleigh NC 27606 USA.
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/features/org.jboss.tools.maven.profiles.feature/pom.xml
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.profiles.feature/pom.xml
(rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.profiles.feature/pom.xml 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>features</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.features</groupId>
+ <artifactId>org.jboss.tools.maven.profiles.feature</artifactId>
+
+ <packaging>eclipse-feature</packaging>
+</project>
\ No newline at end of file
Modified: trunk/maven/features/pom.xml
===================================================================
--- trunk/maven/features/pom.xml 2012-02-10 09:15:16 UTC (rev 38590)
+++ trunk/maven/features/pom.xml 2012-02-10 09:43:28 UTC (rev 38591)
@@ -24,6 +24,7 @@
<module>org.jboss.tools.maven.jaxrs.feature</module>
<module>org.jboss.tools.maven.jbosspackaging.feature</module>
<module>org.jboss.tools.maven.jpa.feature</module>
+ <module>org.jboss.tools.maven.profiles.feature</module>
</modules>
</project>
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2012-02-10
09:15:16 UTC (rev 38590)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2012-02-10
09:43:28 UTC (rev 38591)
@@ -31,5 +31,4 @@
Export-Package: org.jboss.tools.maven.core,
org.jboss.tools.maven.core.internal.project.facet,
org.jboss.tools.maven.core.libprov,
- org.jboss.tools.maven.core.profiles,
org.jboss.tools.maven.core.xpl
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-02-10
09:15:16 UTC (rev 38590)
+++
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -70,8 +70,6 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.jboss.tools.maven.core.internal.profiles.ProfileManager;
-import org.jboss.tools.maven.core.profiles.IProfileManager;
import org.osgi.framework.BundleContext;
/**
@@ -94,8 +92,6 @@
public static final List<LibraryProviderOperationConfig>
libraryProviderOperationConfigs = new ArrayList<LibraryProviderOperationConfig>();
- private IProfileManager profileManager;
-
// The shared instance
private static MavenCoreActivator plugin;
@@ -114,7 +110,6 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
- profileManager = new ProfileManager();
}
/*
@@ -771,8 +766,4 @@
IMavenConstants.PLUGIN_ID, -1, msg, ex));
}
}
-
- public IProfileManager getProfileManager() {
- return profileManager;
- }
}
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.classpath
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.classpath 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.project
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.project 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.profiles.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.jdt.core.prefs 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,8 @@
+#Thu Feb 09 16:56:16 CET 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.m2e.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.m2e.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/.settings/org.eclipse.m2e.core.prefs 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,5 @@
+#Thu Feb 09 16:56:14 CET 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/META-INF/MANIFEST.MF 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.jboss.tools.maven.profiles.core; singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Localization: plugin
+Bundle-Activator: org.jboss.tools.maven.profiles.core.MavenProfilesCoreActivator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.m2e.core;bundle-version="[1.0.0,1.2.0)";visibility:=reexport,
+
org.eclipse.m2e.maven.runtime;bundle-version="[1.0.0,1.2.0)";visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %Bundle-Vendor
+Export-Package: org.jboss.tools.maven.profiles.core,
+ org.jboss.tools.maven.profiles.core.profiles
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/about.html
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/about.html 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>JBoss Maven Profile Management</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Maven Profile Management</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/build.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,4 @@
+#Properties file for org.jboss.tools.maven.profiles
+Bundle-Vendor = JBoss by Red Hat
+Bundle-Name = Maven Profiles Management
+JBoss_Maven_Integration=JBoss Maven Integration
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/plugin.xml 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+</plugin>
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.core/pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.core/pom.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.core/pom.xml 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>plugins</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.plugins</groupId>
+ <artifactId>org.jboss.tools.maven.profiles.core</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/MavenProfilesCoreActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/MavenProfilesCoreActivator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/MavenProfilesCoreActivator.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,88 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.maven.profiles.core.internal.profiles.ProfileManager;
+import org.jboss.tools.maven.profiles.core.profiles.IProfileManager;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class MavenProfilesCoreActivator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.profiles.core";
//$NON-NLS-1$
+
+ private IProfileManager profileManager;
+
+ // The shared instance
+ private static MavenProfilesCoreActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public MavenProfilesCoreActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ profileManager = new ProfileManager();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static MavenProfilesCoreActivator getDefault() {
+ return plugin;
+ }
+
+ public static IStatus getStatus(String message) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, message);
+ }
+
+ public static IStatus getStatus(String message, Throwable e) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, message,e);
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message);
+ getDefault().getLog().log(status);
+ }
+
+ public IProfileManager getProfileManager() {
+ return profileManager;
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/Messages.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/Messages.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/Messages.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,34 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.core;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author snjeza
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.maven.core.messages"; //$NON-NLS-1$
+ public static String
MavenFacetInstallDelegate_Internal_Error_creating_JBoss_Maven_Facet;
+ public static String MavenFacetInstallPage_The_artifactId_field_is_required;
+ public static String MavenFacetInstallPage_The_groupId_field_is_required;
+ public static String MavenFacetInstallPage_The_packaging_field_is_required;
+ public static String MavenFacetInstallPage_The_version_field_is_required;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/internal/profiles/ProfileManager.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,279 @@
+package org.jboss.tools.maven.profiles.core.internal.profiles;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Profile;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.SettingsUtils;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.IMaven;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.IProjectConfigurationManager;
+import org.eclipse.m2e.core.project.MavenUpdateRequest;
+import org.eclipse.m2e.core.project.ResolverConfiguration;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.maven.profiles.core.profiles.IProfileManager;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileState;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileStatus;
+
+public class ProfileManager implements IProfileManager {
+
+ public void updateActiveProfiles(final IMavenProjectFacade mavenProjectFacade,
+ final List<String> profiles,
+ final boolean isOffline,
+ final boolean isForceUpdate,
+ IProgressMonitor monitor) throws CoreException {
+ if (mavenProjectFacade == null) {
+ return;
+ }
+ final IProjectConfigurationManager configurationManager =
MavenPlugin.getProjectConfigurationManager();
+
+ IProject project = mavenProjectFacade.getProject();
+
+ final ResolverConfiguration configuration
=configurationManager.getResolverConfiguration(project);
+
+ final String profilesAsString = getAsString(profiles);
+ if (profilesAsString.equals(configuration.getActiveProfiles())) {
+ //Nothing changed
+ return;
+ }
+
+ configuration.setActiveProfiles(profilesAsString);
+ boolean isSet = configurationManager.setResolverConfiguration(project, configuration);
+ if (isSet) {
+ MavenUpdateRequest request = new MavenUpdateRequest(project, isOffline,
isForceUpdate);
+ configurationManager.updateProjectConfiguration(request, monitor);
+ }
+
+ }
+
+ private String getAsString(List<String> profiles) {
+ StringBuilder sb = new StringBuilder();
+ boolean addComma = false;
+ if (profiles != null){
+ for (String p : profiles) {
+ if (addComma) {
+ sb.append(", "); //$NON-NLS-1$
+ }
+ sb.append(p);
+ addComma = true;
+ }
+ }
+ return sb.toString();
+ }
+
+ public Map<Profile, Boolean> getAvailableSettingProfiles() throws CoreException {
+ Map<Profile, Boolean> settingsProfiles = new LinkedHashMap<Profile,
Boolean>();
+ Settings settings = MavenPlugin.getMaven().getSettings();
+ List<String> activeProfiles = settings.getActiveProfiles();
+
+ for (org.apache.maven.settings.Profile sp : settings.getProfiles()) {
+ Profile p = SettingsUtils.convertFromSettingsProfile(sp);
+ boolean isAutomaticallyActivated = isActive(sp, activeProfiles);
+ settingsProfiles.put(p, isAutomaticallyActivated);
+ }
+ return Collections.unmodifiableMap(settingsProfiles);
+ }
+
+ private boolean isActive(Profile p, List<Profile> activeProfiles) {
+ for (Profile activeProfile : activeProfiles) {
+ if (activeProfile.getId().equals(p.getId())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isActive(org.apache.maven.settings.Profile p, List<String>
activeProfiles) {
+ if (p.getActivation() != null && p.getActivation().isActiveByDefault()){
+ return true;
+ }
+ for (String activeProfile : activeProfiles) {
+ if (activeProfile.equals(p.getId())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public List<ProfileStatus> getProfilesStatuses(
+ IMavenProjectFacade facade,
+ IProgressMonitor monitor
+ ) throws CoreException {
+ if (facade == null) {
+ return Collections.emptyList();
+ }
+
+ ResolverConfiguration resolverConfiguration =
MavenPlugin.getProjectConfigurationManager()
+ .getResolverConfiguration(facade.getProject());
+
+ List<String> configuredProfiles = resolverConfiguration.getActiveProfileList();
+
+ MavenProject mavenProject = facade.getMavenProject(monitor);
+
+
+ List<Model> modelHierarchy = new ArrayList<Model>();
+ getModelHierarchy(modelHierarchy, mavenProject.getModel(), new NullProgressMonitor());
+
+ List<Profile> availableProfiles = collectAvailableProfiles(modelHierarchy, new
NullProgressMonitor());
+
+ final Map<Profile, Boolean> availableSettingsProfiles =
getAvailableSettingProfiles();
+ Set<Profile> settingsProfiles = new
HashSet<Profile>(availableSettingsProfiles.keySet());
+
+ List<ProfileStatus> statuses = new ArrayList<ProfileStatus>();
+
+ //First we put user configured profiles
+ for (String pId : configuredProfiles) {
+ if (StringUtils.isEmpty(pId)) continue;
+ boolean isDisabled = pId.startsWith("!");
+ String id = (isDisabled)?pId.substring(1):pId;
+ ProfileStatus status = new ProfileStatus(id);
+ status.setUserSelected(true);
+ ProfileState state = isDisabled?ProfileState.Disabled
+ :ProfileState.Active;
+ status.setActivationState(state);
+
+ Profile p = get(id, availableProfiles);
+
+ if (p == null){
+ p = get(id, settingsProfiles);
+ if(p != null){
+ status.setAutoActive(availableSettingsProfiles.get(p));
+ }
+ }
+
+ status.setSource(findSource(p, modelHierarchy));
+ statuses.add(status);
+ }
+
+ final List<Profile> activeProfiles = mavenProject.getActiveProfiles();
+ //Iterate on the remaining project profiles
+ addStatuses(statuses, availableProfiles, modelHierarchy, new ActivationPredicate() {
+ @Override
+ boolean isActive(Profile p) {
+ return ProfileManager.this.isActive(p, activeProfiles);
+ }
+ });
+
+ //Iterate on the remaining settings profiles
+ addStatuses(statuses, settingsProfiles, modelHierarchy, new ActivationPredicate() {
+ @Override
+ boolean isActive(Profile p) {
+ return availableSettingsProfiles.get(p);
+ }
+ });
+ return Collections.unmodifiableList(statuses);
+ }
+
+ private String findSource(Profile profile, List<Model> modelHierarchy) {
+ if (profile != null) {
+ if ("settings.xml".equals(profile.getSource())) { //$NON-NLS-1$
+ return profile.getSource();
+ }
+ for (Model m : modelHierarchy) {
+ for (Profile p : m.getProfiles()) {
+ if(p.equals(profile)) {
+ return //m.getGroupId()+ARTIFACT_SEPARATOR+
+ m.getArtifactId()
+ //+
(m.getVersion()==null?"":ARTIFACT_SEPARATOR+m.getVersion())//$NON-NLS-1$
+ ;
+ }
+ }
+ }
+ }
+ return "undefined"; //$NON-NLS-1$
+ }
+
+ protected List<Profile> collectAvailableProfiles(List<Model> models,
IProgressMonitor monitor) throws CoreException {
+ List<Profile> profiles = new ArrayList<Profile>();
+ for (Model m : models) {
+ profiles.addAll(m.getProfiles());
+ }
+ return profiles;
+ }
+
+ protected List<Model> getModelHierarchy(List<Model> models, Model
projectModel, IProgressMonitor monitor) throws CoreException {
+ if (projectModel == null) {
+ return null;
+ }
+ models.add(projectModel);
+ Parent p = projectModel.getParent();
+ if (p != null) {
+ Model parentModel = resolvePomModel(p.getGroupId(), p.getArtifactId(), p.getVersion(),
monitor);
+ if (parentModel != null) {
+ getModelHierarchy(models, parentModel, monitor);
+ }
+ }
+ return models;
+ }
+
+ private Model resolvePomModel(String groupId, String artifactId, String version,
IProgressMonitor monitor)
+ throws CoreException {
+ monitor.subTask(NLS.bind("Resolving {0}:{1}:{2}", new Object[] { groupId,
artifactId, version}));
+
+ IMavenProjectFacade facade =
MavenPlugin.getMavenProjectRegistry().getMavenProject(groupId, artifactId, version);
+ IMaven maven = MavenPlugin.getMaven();
+
+ if (facade != null) {
+ return facade.getMavenProject(monitor).getModel();
+ }
+
+ List<ArtifactRepository> repositories = maven.getArtifactRepositories();
+ Artifact artifact = maven.resolve(groupId, artifactId, version, "pom",
null, repositories, monitor); //$NON-NLS-1$
+ File file = artifact.getFile();
+ if(file == null) {
+ return null;
+ }
+
+ return maven.readModel(file);
+ }
+
+ private void addStatuses(List<ProfileStatus> statuses, Collection<Profile>
profiles, List<Model> modelHierarchy, ActivationPredicate predicate) {
+ for (Profile p : profiles) {
+ ProfileStatus status = new ProfileStatus(p.getId());
+ status.setSource(findSource(p, modelHierarchy));
+ boolean isActive = predicate.isActive(p);
+ ProfileState activationState = (isActive)?ProfileState.Active:ProfileState.Inactive;
+ status.setAutoActive(isActive);
+ status.setActivationState(activationState);
+ statuses.add(status);
+ }
+ }
+
+ private Profile get(String id, Collection<Profile> profiles) {
+ Iterator<Profile> ite = profiles.iterator();
+ Profile found = null;
+ while(ite.hasNext()) {
+ Profile p = ite.next();
+ if(p.getId().equals(id)) {
+ found = p;
+ ite.remove();
+ break;
+ }
+ }
+ return found;
+ }
+
+ private abstract class ActivationPredicate {
+ abstract boolean isActive(Profile p);
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/messages.properties
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/messages.properties
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/messages.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,6 @@
+MavenFacetInstallDelegate_Internal_Error_creating_JBoss_Maven_Facet=Internal Error
creating JBoss Maven Facet. Missing configuration
+MavenFacetInstallPage_The_artifactId_field_is_required=The artifactId field is required.
+MavenFacetInstallPage_The_groupId_field_is_required=The groupId field is required.
+MavenFacetInstallPage_The_packaging_field_is_required=The packaging field is required.
+MavenFacetInstallPage_The_version_field_is_required=The version field is required.
+
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/IProfileManager.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/IProfileManager.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/IProfileManager.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,42 @@
+package org.jboss.tools.maven.profiles.core.profiles;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Profile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+
+/**
+ * Retrieves and updates Maven profile informations for Maven projects
+ *
+ * @author Fred Bricon
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IProfileManager {
+
+ List<ProfileStatus> getProfilesStatuses(IMavenProjectFacade mavenProjectFacade,
IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Returns an unmodifiable Map of all the available profiles defined in the
+ * Maven settings.xml file.<br/>
+ * The value of each Map.Entry indicates if the profile is active.
+ * @return an unmodifiable Map of all the available profiles for a given project.
+ * @throws CoreException
+ */
+ Map<Profile, Boolean> getAvailableSettingProfiles() throws CoreException;
+
+ /**
+ * Update the profiles of the resolver configuration of a IMavenProjectFacade
synchronously.
+ * @param mavenProjectFacade a facade of the maven project
+ * @param profiles the profile ids to use in the project's resolver configuration
+ * @param isOffline indicates if the maven request must be executed offline
+ * @param isForceUpdate indicates if a check for updated releases and snapshots on
remote repositories must be forced.
+ * @param monitor a progress monitor
+ * @throws CoreException
+ */
+ void updateActiveProfiles(IMavenProjectFacade mavenProjectFacade,
+ List<String> profiles, boolean isOffline, boolean isForceUpdate,
IProgressMonitor monitor)
+ throws CoreException;
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileState.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileState.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileState.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,18 @@
+package org.jboss.tools.maven.profiles.core.profiles;
+
+public enum ProfileState {
+ Disabled(false),
+ Inactive(false),
+ Active(true);
+
+ private boolean active;
+
+ ProfileState(boolean active) {
+ this.active = active;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileStatus.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileStatus.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.core/src/org/jboss/tools/maven/profiles/core/profiles/ProfileStatus.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,100 @@
+package org.jboss.tools.maven.profiles.core.profiles;
+
+public class ProfileStatus {
+ private String id;
+ private boolean autoActive;
+ private boolean userSelected;
+ private ProfileState activationState;
+ private String source;
+
+ public ProfileStatus(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public boolean isAutoActive() {
+ return autoActive;
+ }
+
+ public void setAutoActive(boolean autoActive) {
+ this.autoActive = autoActive;
+ }
+
+ public ProfileState getActivationState() {
+ return activationState;
+ }
+ public void setActivationState(ProfileState activationState) {
+ this.activationState = activationState;
+ }
+ public String getSource() {
+ return source;
+ }
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public boolean isUserSelected() {
+ return userSelected;
+ }
+
+ public void setUserSelected(boolean userSelected) {
+ this.userSelected = userSelected;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((activationState == null) ? 0 : activationState.hashCode());
+ result = prime * result + (autoActive ? 1231 : 1237);
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((source == null) ? 0 : source.hashCode());
+ result = prime * result + (userSelected ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ProfileStatus other = (ProfileStatus) obj;
+ if (activationState != other.activationState)
+ return false;
+ if (autoActive != other.autoActive)
+ return false;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (source == null) {
+ if (other.source != null)
+ return false;
+ } else if (!source.equals(other.source))
+ return false;
+ if (userSelected != other.userSelected)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ProfileStatus [id=" + id + ", autoActive=" + autoActive
+ + ", userSelected=" + userSelected + ", activationState="
+ + activationState + ", source=" + source + "]";
+ }
+
+
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.classpath
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.classpath 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.project
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.project 2012-02-10 09:43:28 UTC
(rev 38591)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.profiles.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.jdt.core.prefs 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,8 @@
+#Thu Feb 09 16:56:17 CET 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.m2e.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.m2e.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/.settings/org.eclipse.m2e.core.prefs 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,5 @@
+#Thu Feb 09 16:56:14 CET 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/META-INF/MANIFEST.MF 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.jboss.tools.maven.profiles.ui;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Localization: plugin
+Bundle-Activator: org.jboss.tools.maven.profiles.ui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.wst.common.project.facet.ui,
+ org.eclipse.jst.common.project.facet.ui,
+ org.eclipse.wst.common.frameworks.ui,
+ org.eclipse.core.resources,
+ org.eclipse.m2e.core.ui;bundle-version="[1.0.0,1.2.0)",
+ org.eclipse.ui.ide,
+ org.eclipse.jface.text,
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.jdt;bundle-version="3.7.0",
+ org.jboss.tools.maven.profiles.core
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %Bundle-Vendor
+Export-Package: org.jboss.tools.maven.profiles.ui
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.html
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.html 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>JBoss Maven Integration</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Maven Integration</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.ini
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.ini
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.ini 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog
(translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which
the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.mappings
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.mappings
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.mappings 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/about.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,2 @@
+blurb=Maven Profiles Management UI\n\nVersion\: {featureVersion}\n\n(c) Copyright (c) Red
Hat, Inc., contributors and others 2004 - 2010. All rights reserved.\nVisit
http\://jboss.org/tools
+
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/build.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ jboss_about.png,\
+ about.properties,\
+ about.mappings,\
+ about.ini,\
+ about.html,\
+ plugin.properties,\
+ icons/
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/icons/maven-profiles.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/icons/maven-profiles.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/jboss_about.png
===================================================================
(Binary files differ)
Property changes on:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/jboss_about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,6 @@
+Bundle-Vendor = JBoss by Red Hat
+Bundle-Name = Maven Profiles Management UI
+
+#Maven Profile selection menu
+Select_Maven_Profiles_Cmd= Select Maven Profiles
+Select_Maven_Profiles_Menu= Select Maven Profiles...
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/plugin.xml 2012-02-10 09:43:28
UTC (rev 38591)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <!-- Maven Profile Selection-->
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.ui.category.window"
+ id="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ name="%Select_Maven_Profiles_Cmd">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+
class="org.jboss.tools.maven.profiles.ui.internal.ProfileSelectionHandler"
+
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="Ctrl+Alt+P">
+ </key>
+ </extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
id="org.jboss.tools.maven.ui.profiles.selectFromProject"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <action
id="org.jboss.tools.maven.ui.commands.selectMavenProfileAction"
+
class="org.jboss.tools.maven.ui.generic.GenericCommandActionDelegate:org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ label="%Select_Maven_Profiles_Menu"
+ style="push"
+
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ menubarPath="org.eclipse.m2e.core.mavenMenu/open"
+ enablesFor="+"/>
+ <visibility>
+ <and>
+ <objectState name="open" value="true"/>
+ <objectState name="nature"
value="org.eclipse.m2e.core.maven2Nature"/>
+ </and>
+ </visibility>
+ </objectContribution>
+
+ <objectContribution
id="org.jboss.tools.maven.ui.profiles.selectFromPom"
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true">
+ <action
id="org.jboss.tools.maven.ui.commands.selectMavenProfileAction"
+
class="org.jboss.tools.maven.ui.generic.GenericCommandActionDelegate:org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ label="%Select_Maven_Profiles_Menu"
+ style="push"
+
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ menubarPath="org.eclipse.m2e.core.fileMenu/open"
+ enablesFor="+"/>
+ <visibility>
+ <objectState name="name" value="pom.xml"/>
+ </visibility>
+ </objectContribution>
+
+ <objectContribution
id="org.jboss.tools.maven.ui.profiles.selectFromWorkingSet"
+ adaptable="true"
+ objectClass="org.eclipse.ui.IWorkingSet">
+ <action
id="org.jboss.tools.maven.ui.commands.selectMavenProfileAction"
+
class="org.jboss.tools.maven.ui.generic.GenericCommandActionDelegate:org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ label="%Select_Maven_Profiles_Menu"
+ style="push"
+
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ menubarPath="org.eclipse.m2e.core.workingSetMenu/open"
+ enablesFor="+"/>
+ </objectContribution>
+
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+
id="org.jboss.tools.maven.ui.toolbars.selectMavenProfilesToolbar">
+ <command
+
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
+ icon="icons/maven-profiles.gif"
+
id="org.jboss.tools.maven.ui.toolbars.selectMavenProfilesCommand"
+ tooltip="%Select_Maven_Profiles_Cmd">
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+</plugin>
Added: trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/pom.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/pom.xml 2012-02-10 09:43:28 UTC
(rev 38591)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>plugins</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.plugins</groupId>
+ <artifactId>org.jboss.tools.maven.profiles.ui</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Activator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Activator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Activator.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,70 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.profiles.ui";
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message);
+ getDefault().getLog().log(status);
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Messages.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Messages.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/Messages.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,59 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.maven.profiles.ui.messages"; //$NON-NLS-1$
+
+ public static String ProfileManager_Updating_maven_profiles;
+ public static String ProfileSelectionHandler_Loading_maven_profiles;
+ public static String ProfileSelectionHandler_Maven_Builder_still_processing;
+ public static String ProfileSelectionHandler_multiple_definitions;
+ public static String ProfileSelectionHandler_Select_some_maven_projects;
+ public static String ProfileSelectionHandler_Unable_to_open_profile_dialog;
+ public static String SelectProfilesDialog_autoactivated;
+ public static String SelectProfilesDialog_Activate_menu;
+ public static String SelectProfilesDialog_Active_Profiles_for_Project;
+ public static String SelectProfilesDialog_Available_profiles;
+ public static String SelectProfilesDialog_Warning_Common_profiles;
+ public static String SelectProfilesDialog_deactivated;
+ public static String SelectProfilesDialog_Deactivate_menu;
+ public static String SelectProfilesDialog_DeselectAll;
+ public static String SelectProfilesDialog_Force_update;
+ public static String SelectProfilesDialog_Maven_profile_selection;
+ public static String SelectProfilesDialog_Move_Down;
+ public static String SelectProfilesDialog_Move_Up;
+ public static String SelectProfilesDialog_No_Common_Profiles;
+ public static String SelectProfilesDialog_Offline;
+ public static String SelectProfilesDialog_Profile_id_header;
+ public static String SelectProfilesDialog_Profile_source_header;
+ public static String SelectProfilesDialog_Project_has_no_available_profiles;
+ public static String SelectProfilesDialog_Read_Only_profiles;
+ public static String SelectProfilesDialog_Select_active_profiles_for_selected_projects;
+ public static String SelectProfilesDialog_Select_Maven_profiles;
+ public static String SelectProfilesDialog_Select_the_active_Maven_profiles;
+ public static String SelectProfilesDialog_SelectAll;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveMavenProfilesNode.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveMavenProfilesNode.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveMavenProfilesNode.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,70 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.Profile;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.jboss.tools.maven.profiles.ui.Activator;
+
+
+/**
+ * Maven profile resource node
+ *
+ * @author Fred Bricon
+ */
+public class ActiveMavenProfilesNode implements IWorkbenchAdapter {
+
+ private Object[] ids = null;
+
+ public static ImageDescriptor icon =
Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID,
"icons/maven-profiles.png");
+
+
+ public ActiveMavenProfilesNode(List<Profile> profiles) {
+ ids = getProfileIds(profiles);
+ }
+
+ public Object[] getResources() {
+ return ids;
+ }
+
+ private Object[] getProfileIds(List<Profile> profiles) {
+ if(profiles != null && !profiles.isEmpty()) {
+ List<String> idList = new ArrayList<String>(profiles.size());
+ for (Profile p : profiles) {
+ idList.add(p.getId());
+ }
+ return idList.toArray();
+ }
+ return null;
+ }
+
+ public String getLabel(Object o) {
+ return "Active Maven profiles";
+ }
+
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return icon;
+ }
+
+ public Object getParent(Object o) {
+ return null;
+ }
+
+ public Object[] getChildren(Object o) {
+ return ids;
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesContentProvider.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesContentProvider.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesContentProvider.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,58 @@
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import java.util.List;
+
+import org.apache.maven.model.Profile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+
+public class ActiveProfilesContentProvider implements ITreeContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof IProject) {
+ IProject project = (IProject) inputElement;
+ try {
+ if (project.isAccessible() && project.hasNature(IMavenConstants.NATURE_ID))
{
+ IMavenProjectFacade facade =
MavenPlugin.getMavenProjectRegistry().getProject(project);
+ if (facade != null && facade.getMavenProject() != null) {
+ List<Profile> profiles = facade.getMavenProject().getActiveProfiles();
+ return new Object[] { new ActiveMavenProfilesNode(profiles)};
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return getElements(parentElement);
+ }
+
+ public Object getParent(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesLabelProvider.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesLabelProvider.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ActiveProfilesLabelProvider.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,56 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+public class ActiveProfilesLabelProvider implements ILabelProvider {
+
+ //public static ImageDescriptor icon =
Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID,
"icons/maven-profiles.png");
+
+ public Image image = null;
+
+ public ActiveProfilesLabelProvider() {
+ //image = icon.createImage();
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ if (image != null) {
+ image.dispose();
+ }
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public Image getImage(Object element) {
+ return image;
+ }
+
+ public String getText(Object element) {
+ if(element instanceof ActiveMavenProfilesNode) {
+ return ((ActiveMavenProfilesNode)element).getLabel(null);
+ } else if (element instanceof String) {
+ return element.toString();
+ }
+ return null;
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelection.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelection.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelection.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,59 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import org.jboss.tools.maven.profiles.core.profiles.ProfileState;
+
+public class ProfileSelection {
+ private String id;
+ private Boolean autoActive;
+ private Boolean selected;
+ private ProfileState activationState;
+ private String source;
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public Boolean getAutoActive() {
+ return autoActive;
+ }
+ public void setAutoActive(Boolean autoActive) {
+ this.autoActive = autoActive;
+ }
+ public Boolean getSelected() {
+ return selected;
+ }
+ public void setSelected(Boolean selected) {
+ this.selected = selected;
+ }
+ public ProfileState getActivationState() {
+ return activationState;
+ }
+ public void setActivationState(ProfileState activationState) {
+ this.activationState = activationState;
+ }
+ public String getSource() {
+ return source;
+ }
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public String toMavenString() {
+ String s = id;
+ if (ProfileState.Disabled == activationState) {
+ s = "!"+id;
+ }
+ return s;
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionHandler.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionHandler.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionHandler.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,390 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.maven.profiles.core.MavenProfilesCoreActivator;
+import org.jboss.tools.maven.profiles.core.profiles.IProfileManager;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileState;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileStatus;
+import org.jboss.tools.maven.profiles.ui.Activator;
+import org.jboss.tools.maven.profiles.ui.Messages;
+
+/**
+ * Handles profile selection commands.
+ */
+public class ProfileSelectionHandler extends AbstractHandler {
+
+ /**
+ * Opens the Maven profile selection Dialog window.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ Set<IMavenProjectFacade> facades = getSelectedMavenProjects(event);
+
+ if (facades.isEmpty()) {
+ display(window, Messages.ProfileSelectionHandler_Select_some_maven_projects);
+ return null;
+ }
+
+ final IProfileManager profileManager =
MavenProfilesCoreActivator.getDefault().getProfileManager();
+
+ GetProfilesJob getProfilesJob = new GetProfilesJob(facades, profileManager);
+ getProfilesJob.addJobChangeListener(onProfilesFetched(getProfilesJob, facades,
profileManager, window.getShell()));
+ getProfilesJob.setUser(true);
+ getProfilesJob.schedule();
+ return Status.OK_STATUS;
+ }
+
+ private IJobChangeListener onProfilesFetched(final GetProfilesJob getProfilesJob, final
Set<IMavenProjectFacade> facades, final IProfileManager profileManager, final Shell
shell) {
+ return new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ if (getProfilesJob.getResult().isOK()) {
+ shell.getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ List<ProfileSelection> sharedProfiles = getProfilesJob.getSharedProfiles();
+ Map<IMavenProjectFacade, List<ProfileStatus>> allProfiles =
getProfilesJob.getAllProfiles();
+ final SelectProfilesDialog dialog = new SelectProfilesDialog(shell,
+ facades,
+ sharedProfiles);
+ if(dialog.open() == Dialog.OK) {
+ Job job = new UpdateProfilesJob(allProfiles, sharedProfiles, profileManager,
dialog);
+ job.setRule( MavenPlugin.getProjectConfigurationManager().getRule());
+ job.schedule();
+ }
+ }
+ });
+
+ }
+ }
+ };
+ }
+
+ private void display(IWorkbenchWindow window, String message) {
+ MessageDialog.openInformation(
+ window.getShell(),
+ Messages.SelectProfilesDialog_Select_Maven_profiles,
+ message);
+ }
+
+ /**
+ * Returns an IMavenProjectFacade from the selected IResource, or from the
+ * active editor
+ *
+ * @param event
+ * @return the selected IMavenProjectFacade
+ */
+ private Set<IMavenProjectFacade> getSelectedMavenProjects(ExecutionEvent event) {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ IProject[] projects = getSelectedProjects(selection);
+ Set<IMavenProjectFacade> facades = new HashSet<IMavenProjectFacade>();
+ try {
+ if (projects.length == 0) {
+ IEditorInput input = HandlerUtil.getActiveEditorInput(event);
+ if (input instanceof IFileEditorInput) {
+ IFileEditorInput fileInput = (IFileEditorInput) input;
+ projects = new IProject[] { fileInput.getFile().getProject() };
+ }
+ }
+ IProgressMonitor monitor = new NullProgressMonitor();
+ for (IProject p : projects) {
+ if (p != null && p.isAccessible() &&
p.hasNature(IMavenConstants.NATURE_ID)) {
+ IFile pom = p.getFile(IMavenConstants.POM_FILE_NAME);
+ IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(pom, true,
monitor);
+ facades.add(facade);
+ }
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+
+ return facades;
+ }
+
+ private IProject[] getSelectedProjects(ISelection selection) {
+ Set<IProject> projects = new HashSet<IProject>();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Iterator<?> it = structuredSelection.iterator();
+ while (it.hasNext()) {
+ Object o = it.next();
+ if (o instanceof IResource) {
+ projects.add(((IResource) o).getProject());
+ } else if (o instanceof IWorkingSet) {
+ IAdaptable[] elements = ((IWorkingSet) o).getElements();
+ if (elements != null) {
+ for (IAdaptable e : elements) {
+ IProject p = (IProject) e.getAdapter(IProject.class);
+ if (p != null) {
+ projects.add(p);
+ }
+ }
+ }
+ } else if (o instanceof IAdaptable) {
+ IProject p = (IProject)((IAdaptable) o).getAdapter(IProject.class);
+ if (p != null) {
+ projects.add(p);
+ }
+ }
+ }
+ }
+ IProject[] array = new IProject[projects.size()];
+ projects.toArray(array);
+ return array;
+ }
+
+ class GetProfilesJob extends Job {
+
+ private IProfileManager profileManager;
+ private Set<IMavenProjectFacade> facades;
+ private Map<IMavenProjectFacade, List<ProfileStatus>> allProfiles;
+ private List<ProfileSelection> sharedProfiles;
+
+ private GetProfilesJob(final Set<IMavenProjectFacade> facades, IProfileManager
profileManager) {
+ super(Messages.ProfileSelectionHandler_Loading_maven_profiles);
+ this.facades = facades;
+ this.profileManager = profileManager;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ this.allProfiles = getAllProfiles(facades, profileManager);
+ this.sharedProfiles = getSharedProfiles(allProfiles);
+ } catch (CoreException e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ Messages.ProfileSelectionHandler_Unable_to_open_profile_dialog, e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ private List<ProfileSelection> getSharedProfiles(
+ Map<IMavenProjectFacade, List<ProfileStatus>> projectProfilesMap) {
+
+ List<ProfileStatus> currentSelection = null;
+ List<List<ProfileStatus>> projectProfiles = new
ArrayList<List<ProfileStatus>>(projectProfilesMap.values());
+ int smallestSize = Integer.MAX_VALUE;
+ for (List<ProfileStatus> profiles : projectProfiles) {
+ int size = profiles.size();
+ if (size < smallestSize) {
+ smallestSize = size;
+ currentSelection = profiles;
+ }
+ }
+ projectProfiles.remove(currentSelection);
+
+ // Init the smallest profiles selection possible
+ List<ProfileSelection> selection = new ArrayList<ProfileSelection>();
+ for (ProfileStatus p : currentSelection) {
+ ProfileSelection ps = new ProfileSelection();
+ ps.setId(p.getId());
+ ps.setActivationState(p.getActivationState());
+ ps.setAutoActive(p.isAutoActive());
+ ps.setSource(p.getSource());
+ ps.setSelected(p.isUserSelected());
+ selection.add(ps);
+ }
+
+ if (!projectProfiles.isEmpty()) {
+ // Restrict to the common profiles only
+ Iterator<ProfileSelection> ite = selection.iterator();
+
+ while (ite.hasNext()) {
+ ProfileSelection p = ite.next();
+ for (List<ProfileStatus> statuses : projectProfiles) {
+ ProfileStatus s = hasProfile(p.getId(), statuses);
+ if (s == null) {
+ // remove any non-common profile selection
+ ite.remove();
+ break;
+ }
+ // reset non common settings
+ if (p.getAutoActive() != null &&
!p.getAutoActive().equals(s.isAutoActive())) {
+ p.setAutoActive(null);
+ }
+ if (p.getSource() != null && !p.getSource().equals(s.getSource())) {
+ p.setSource(Messages.ProfileSelectionHandler_multiple_definitions);
+ }
+ if (p.getSelected() != null && !p.getSelected().equals(s.isUserSelected()))
{
+ p.setSelected(null);
+ }
+ if (p.getActivationState() != null &&
!p.getActivationState().equals(s.getActivationState())) {
+ p.setActivationState(null);
+ p.setAutoActive(null);
+ }
+ }
+ }
+ }
+
+ return selection;
+ }
+
+ private ProfileStatus hasProfile(String id, List<ProfileStatus> statuses) {
+ for (ProfileStatus p : statuses) {
+ if (id.equals(p.getId())) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ private Map<IMavenProjectFacade, List<ProfileStatus>> getAllProfiles(final
Set<IMavenProjectFacade> facades,
+ final IProfileManager profileManager) throws CoreException {
+ Map<IMavenProjectFacade, List<ProfileStatus>> allProfiles =
+ new HashMap<IMavenProjectFacade, List<ProfileStatus>>(facades.size());
+ IProgressMonitor monitor = new NullProgressMonitor();
+ for (IMavenProjectFacade facade : facades) {
+ allProfiles.put(facade, profileManager.getProfilesStatuses(facade, monitor));
+ }
+ return allProfiles;
+ }
+
+ public List<ProfileSelection> getSharedProfiles() {
+ return sharedProfiles;
+ }
+
+ public Map<IMavenProjectFacade, List<ProfileStatus>> getAllProfiles() {
+ return allProfiles;
+ }
+ }
+
+ class UpdateProfilesJob extends WorkspaceJob {
+
+ private Map<IMavenProjectFacade, List<ProfileStatus>> allProfiles;
+ private List<ProfileSelection> sharedProfiles;
+ private IProfileManager profileManager;
+ private SelectProfilesDialog dialog;
+
+ private UpdateProfilesJob(Map<IMavenProjectFacade, List<ProfileStatus>>
allProfiles,
+ List<ProfileSelection> sharedProfiles, IProfileManager profileManager,
SelectProfilesDialog dialog) {
+ super(Messages.ProfileManager_Updating_maven_profiles);
+ this.allProfiles = allProfiles;
+ this.sharedProfiles = sharedProfiles;
+ this.profileManager = profileManager;
+ this.dialog = dialog;
+ }
+
+ public IStatus runInWorkspace(IProgressMonitor monitor) {
+ try {
+ SubMonitor progress = SubMonitor.convert(monitor,
Messages.ProfileManager_Updating_maven_profiles, 100);
+ SubMonitor subProgress = SubMonitor.convert(progress.newChild(5), allProfiles.size()
* 100);
+ for (Map.Entry<IMavenProjectFacade, List<ProfileStatus>> entry :
allProfiles.entrySet()) {
+ if (progress.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ IMavenProjectFacade facade = entry.getKey();
+ List<String> activeProfiles = getActiveProfiles(sharedProfiles,
entry.getValue());
+
+ profileManager.updateActiveProfiles(facade, activeProfiles,
+ dialog.isOffline(), dialog.isForceUpdate(), subProgress.newChild(100));
+ }
+ } catch (CoreException ex) {
+ Activator.log(ex);
+ return ex.getStatus();
+ }
+ return Status.OK_STATUS;
+ }
+
+ private List<String> getActiveProfiles(
+ List<ProfileSelection> sharedProfiles,
+ List<ProfileStatus> availableProfiles) {
+ List<String> ids = new ArrayList<String>();
+
+ for (ProfileStatus st : availableProfiles) {
+ ProfileSelection selection = findSelectedProfile(st.getId(), sharedProfiles);
+ String id = null;
+ boolean isDisabled = false;
+ if (selection == null) {
+ // was not displayed. Use existing value.
+ if (st.isUserSelected()) {
+ id = st.getId();
+ isDisabled = st.getActivationState().equals(ProfileState.Disabled);
+ }
+ } else {
+ if (null == selection.getSelected()) {
+ // Value was displayed but its state is unknown, use
+ // previous state
+ if (st.isUserSelected()) {
+ id = st.getId();
+ isDisabled = st.getActivationState().equals(ProfileState.Disabled);
+ }
+ } else {
+ // Value was displayed and is consistent
+ if (Boolean.TRUE.equals(selection.getSelected())) {
+ id = selection.getId();
+ isDisabled = selection.getActivationState().equals(ProfileState.Disabled);
+ }
+ }
+ }
+
+ if (id != null) {
+ if (isDisabled) {
+ id = "!" + id; //$NON-NLS-1$
+ }
+ ids.add(id);
+ }
+ }
+ return ids;
+ }
+
+ private ProfileSelection findSelectedProfile(String id,
+ List<ProfileSelection> sharedProfiles) {
+ for (ProfileSelection sel : sharedProfiles) {
+ if (id.equals(sel.getId())) {
+ return sel;
+ }
+ }
+ return null;
+ }
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionStatus.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionStatus.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileSelectionStatus.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,15 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui.internal;
+
+public enum ProfileSelectionStatus {
+ Undefined, Inactivated, Activated, Disabled
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileUtil.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileUtil.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/ProfileUtil.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,27 @@
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import java.util.Collection;
+
+public class ProfileUtil {
+
+ private ProfileUtil(){}
+
+ private static final String COMMA = ", ";
+
+ public static String toString(Collection<ProfileSelection> profiles) {
+ StringBuilder sb = new StringBuilder();
+ if(profiles != null && !profiles.isEmpty()) {
+ boolean addComma = false;
+ for (ProfileSelection ps : profiles) {
+ if (Boolean.TRUE.equals(ps.getSelected())) {
+ if (addComma) {
+ sb.append(COMMA);
+ }
+ sb.append(ps.toMavenString());
+ addComma = true;
+ }
+ }
+ }
+ return sb.toString();
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/SelectProfilesDialog.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/SelectProfilesDialog.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/internal/SelectProfilesDialog.java 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,609 @@
+/*************************************************************************************
+ * Copyright (c) 2009-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.profiles.ui.internal;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableFontProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.maven.profiles.core.profiles.ProfileState;
+import org.jboss.tools.maven.profiles.ui.Messages;
+
+public class SelectProfilesDialog extends TitleAreaDialog implements
+ IMenuListener {
+
+ private static int PROFILE_ID_COLUMN = 0;
+ private static int SOURCE_COLUMN = 1;
+
+ private CheckboxTableViewer profileTableViewer;
+ private Button offlineModeBtn;
+ private Button forceUpdateBtn;
+ //private ITextViewer profilesTextViewer;
+ private Text profilesText;
+
+ private boolean offlineMode ;
+ private boolean forceUpdate;
+
+ List<ProfileSelection> sharedProfiles;
+ Set<IMavenProjectFacade> facades;
+ IMavenProjectFacade facade;
+
+ final Action activationAction = new ChangeProfileStateAction(ProfileState.Active);
+
+ final Action deActivationAction = new ChangeProfileStateAction(ProfileState.Disabled);
+ private Label warningImg;
+ private Label warningLabel;
+
+ public SelectProfilesDialog(Shell parentShell, Set<IMavenProjectFacade> facades,
+ List<ProfileSelection> sharedProfiles) {
+ super(parentShell);
+ setShellStyle(super.getShellStyle() | SWT.RESIZE | SWT.MODELESS);
+ offlineMode = MavenPlugin.getMavenConfiguration().isOffline();
+ this.facades = facades;
+ if(facades.size() == 1){
+ facade = facades.iterator().next();
+ }
+ this.sharedProfiles = sharedProfiles;
+ }
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(Messages.SelectProfilesDialog_Select_Maven_profiles);
+ }
+
+
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite area = (Composite) super.createDialogArea(parent);
+
+ Composite container = new Composite(area, SWT.NONE);
+ container.setEnabled(true);
+
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginLeft = 12;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ setTitle(Messages.SelectProfilesDialog_Maven_profile_selection);
+ String text;
+ boolean hasProfiles = !sharedProfiles.isEmpty();
+ if (facade == null) {
+ text =
NLS.bind(Messages.SelectProfilesDialog_Select_active_profiles_for_selected_projects,
+ facades.size()
+ );
+ } else {
+ text = NLS.bind(
+ Messages.SelectProfilesDialog_Select_the_active_Maven_profiles,
+ facade.getProject().getName());
+ if (hasProfiles) {
+ displayProfilesAsText(container);
+ }
+ }
+ setMessage(text);
+
+ if (hasProfiles && facade == null) {
+ displayWarning(container);
+ }
+
+ Label lblAvailable = new Label(container, SWT.NONE);
+ lblAvailable.setLayoutData(new GridData(SWT.WRAP, SWT.CENTER, true,
+ false, 2, 1));
+
+ String textLabel = getAvailableText(hasProfiles);
+ lblAvailable.setText(textLabel);
+
+ if (hasProfiles) {
+
+ displayProfilesTable(container);
+
+ addSelectionButton(container, Messages.SelectProfilesDialog_SelectAll, true);
+ addSelectionButton(container, Messages.SelectProfilesDialog_DeselectAll, false);
+ addActivationButton(container, "Activate", ProfileState.Active);
+ addActivationButton(container, "Deactivate", ProfileState.Disabled);
+ offlineModeBtn = addCheckButton(container, Messages.SelectProfilesDialog_Offline,
offlineMode);
+ forceUpdateBtn = addCheckButton(container, Messages.SelectProfilesDialog_Force_update,
forceUpdate);
+ }
+
+ return area;
+ }
+
+ private void displayWarning(Composite container) {
+ warningImg = new Label(container, SWT.CENTER);
+ warningLabel = new Label(container, SWT.NONE);
+ warningLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningImg);
+ warningImg.setImage(JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING));
+ warningLabel.setText( Messages.SelectProfilesDialog_Warning_Common_profiles);
+ }
+
+ private String getAvailableText(boolean hasProfiles) {
+ String textLabel;
+ if (hasProfiles) {
+ textLabel = Messages.SelectProfilesDialog_Available_profiles;
+ } else {
+ if (facade == null) {
+ textLabel = NLS.bind(Messages.SelectProfilesDialog_No_Common_Profiles,
+ facades.size());
+ } else {
+ textLabel =
+ NLS.bind(Messages.SelectProfilesDialog_Project_has_no_available_profiles,
+ facade.getProject().getName());
+ }
+ }
+ return textLabel;
+ }
+
+ private void displayProfilesTable(Composite container) {
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 4);
+ gd.heightHint = 200;
+ gd.widthHint = 500;
+
+ profileTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER |
SWT.MULTI);
+ Table table = profileTableViewer.getTable();
+ table.setFocus();
+ table.setLayoutData(gd);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+
+ TableColumn profileColumn = new TableColumn(table, SWT.NONE);
+ profileColumn.setText(Messages.SelectProfilesDialog_Profile_id_header);
+ profileColumn.setWidth(350);
+
+ TableColumn sourceColumn = new TableColumn(table, SWT.NONE);
+ sourceColumn.setText(Messages.SelectProfilesDialog_Profile_source_header);
+ sourceColumn.setWidth(120);
+
+
+ profileTableViewer.setContentProvider(ArrayContentProvider.getInstance());
+
+ profileTableViewer.setLabelProvider(new ProfileLabelProvider(container
+ .getFont()));
+
+
+ profileTableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ ProfileSelection profile = (ProfileSelection) event.getElement();
+ if (profileTableViewer.getGrayed(profile)) {
+ profileTableViewer.setGrayed(profile, false);
+ }
+ profile.setSelected(profileTableViewer.getChecked(profile));
+ if (Boolean.FALSE.equals(profile.getSelected())
+ || profile.getActivationState() == null) {
+ profile.setActivationState(ProfileState.Active);
+ }
+
+ updateProfilesAsText();
+ profileTableViewer.refresh();
+ }
+ });
+
+ profileTableViewer.setInput(sharedProfiles);
+
+ createMenu();
+ }
+
+ private void displayProfilesAsText(Composite container) {
+ Label profilesLabel = new Label(container, SWT.NONE);
+ profilesLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
+ profilesLabel.setText(NLS.bind(Messages.SelectProfilesDialog_Active_Profiles_for_Project,
+ facade.getProject().getName()));
+
+ profilesText = new Text(container, SWT.BORDER);
+ profilesText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+ profilesText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY));
+ profilesText.setEditable(false);
+ profilesText.setToolTipText(Messages.SelectProfilesDialog_Read_Only_profiles);
+
+ updateProfilesAsText();
+ }
+
+ private void updateProfilesAsText() {
+ if (profilesText != null) {
+ profilesText.setText(ProfileUtil.toString(sharedProfiles));
+ }
+ }
+
+ private Button addCheckButton(Composite container, String label, boolean selected) {
+ Button checkBtn = new Button(container, SWT.CHECK);
+ checkBtn.setText(label);
+ checkBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER,
+ true, false, 2, 1));
+ checkBtn.setSelection(selected);
+ return checkBtn;
+ }
+
+ private Button addSelectionButton(Composite container, String label, final boolean
ischecked) {
+ Button button = new Button(container, SWT.NONE);
+ button.setLayoutData(new GridData(SWT.FILL, SWT.UP,
+ false, false, 1, 1));
+ button.setText(label);
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ profileTableViewer.setAllGrayed(false);
+ for (ProfileSelection profile : sharedProfiles) {
+ profileTableViewer.setChecked(profile, ischecked);
+ profile.setSelected(ischecked);
+ if (!ischecked || profile.getActivationState() == null) {
+ profile.setActivationState(ProfileState.Active);
+ }
+ }
+ refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ return button;
+ }
+
+ private Button addActivationButton(Composite container, String label, final ProfileState
state) {
+ Button button = new Button(container, SWT.NONE);
+ button.setLayoutData(new GridData(SWT.FILL, SWT.UP,
+ false, false, 1, 1));
+ button.setText(label);
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ ISelection s = profileTableViewer.getSelection();
+ if (s instanceof IStructuredSelection) {
+ IStructuredSelection sel = (IStructuredSelection) s;
+ setActivationState(sel, state);
+ }
+ refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ return button;
+ }
+
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ if (profileTableViewer != null) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ }
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
false);
+ }
+
+ @Override
+ protected void okPressed() {
+ if (profileTableViewer != null) {
+ offlineMode = offlineModeBtn.getSelection();
+ forceUpdate = forceUpdateBtn.getSelection();
+ }
+ super.okPressed();
+ }
+
+ private void createMenu() {
+ MenuManager menuMgr = new MenuManager();
+ Menu contextMenu = menuMgr.createContextMenu(profileTableViewer
+ .getControl());
+ menuMgr.addMenuListener(this);
+ profileTableViewer.getControl().setMenu(contextMenu);
+ menuMgr.setRemoveAllWhenShown(true);
+
+ for (ProfileSelection p : sharedProfiles) {
+ Boolean selected = p.getSelected();
+ if (selected ==null || p.getActivationState() == null) {
+ profileTableViewer.setGrayed(p, true);
+ profileTableViewer.setChecked(p, true);
+ } else if(selected != null) {
+ profileTableViewer.setChecked(p, selected );
+ }
+ }
+ }
+
+ public void menuAboutToShow(IMenuManager manager) {
+
+ IStructuredSelection selection = (IStructuredSelection) profileTableViewer
+ .getSelection();
+ if (!selection.isEmpty()) {
+ boolean multiSelection = selection.size() > 1;
+ ProfileState state = null;
+ String selectionText;
+ String text;
+ if (multiSelection) {
+ selectionText = "selected profiles";
+ } else {
+ ProfileSelection entry = (ProfileSelection) selection.getFirstElement();
+ state = entry.getActivationState();
+ selectionText = entry.getId();
+ }
+
+ if ( state == null || ProfileState.Disabled.equals(state)) {
+ text = Messages.SelectProfilesDialog_Activate_menu;
+ activationAction.setText(NLS.bind(text, selectionText));
+ manager.add(activationAction);
+ }
+ if( !ProfileState.Disabled.equals(state)) {
+ text = Messages.SelectProfilesDialog_Deactivate_menu;
+ deActivationAction.setText(NLS.bind(text, selectionText));
+ manager.add(deActivationAction);
+ }
+ }
+ }
+
+ public boolean isOffline() {
+ return offlineMode;
+ }
+
+ public boolean isForceUpdate() {
+ return forceUpdate;
+ }
+
+
+ /* TODO add content assist to the profiles input text
+ private ITextViewer createTextInput(Composite container) {
+ ITextViewer textViewer = new TextViewer(container, SWT.BORDER | SWT.FILL);
+ textViewer.setDocument(new Document());
+ final ContentAssistant contentAssistant = new ContentAssistant();
+ contentAssistant.enableAutoActivation(true);
+ contentAssistant.setAutoActivationDelay(100);
+ contentAssistant.enableAutoInsert(true);
+ contentAssistant.setContentAssistProcessor(new
ProfileContentAssistProcessor(sharedProfiles),
+ IDocument.DEFAULT_CONTENT_TYPE);
+
+ textViewer.getTextWidget().addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if ( (e.character == ' ') && ((e.stateMask & SWT.CTRL)
!= 0) ) {
+ contentAssistant.showPossibleCompletions();
+ }
+ }
+ });
+
+
+ contentAssistant.install(textViewer );
+ return textViewer;
+ }
+
+ private final class ProfileContentAssistProcessor implements
+ IContentAssistProcessor {
+
+ private List<String> profileIds;
+
+ public ProfileContentAssistProcessor(
+ List<ProfileSelection> possibleProfiles) {
+ assert possibleProfiles != null;
+ profileIds = new ArrayList<String>(possibleProfiles.size());
+ for (ProfileSelection ps : possibleProfiles) {
+ profileIds.add(ps.getId());
+ }
+ }
+
+ public String getErrorMessage() {
+ return null;
+ }
+
+ public IContextInformationValidator getContextInformationValidator() {
+ return null;
+ }
+
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return new char[]{','};
+ }
+
+ public IContextInformation[] computeContextInformation(ITextViewer viewer,
+ int offset) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+ int documentOffset) {
+ IDocument document = viewer.getDocument();
+ int currOffset = documentOffset -1;
+ ICompletionProposal[] proposals = null;
+ try {
+ String currentWord = getCurrentWord(document, currOffset);
+ System.err.println(currOffset + " - Current word "+currentWord);
//$NON-NLS-1$
+
+ int currentWordLength = currentWord.length();
+ List<ICompletionProposal> suggestions = new
ArrayList<ICompletionProposal>(profileIds.size());
+ for (String id : profileIds) {
+ if (!id.startsWith(currentWord)) {
+ continue;
+ }
+
+ ICompletionProposal proposal = new CompletionProposal(id,
+ documentOffset - currentWordLength,
+ currentWordLength,
+ id.length());
+
+ suggestions.add(proposal);
+ }
+ if (!suggestions.isEmpty()) {
+ proposals = new ICompletionProposal[suggestions.size()];
+ suggestions.toArray(proposals);
+ }
+ } catch (BadLocationException e) {
+ System.err.println(e);
+ }
+ return proposals;
+ }
+
+
+ private String getCurrentWord(IDocument document, int currOffset)
+ throws BadLocationException {
+ StringBuilder currWord = new StringBuilder();
+ char currChar;
+
+ while (currOffset > -1
+ && !Character.isWhitespace(currChar = document
+ .getChar(currOffset))
+ && ',' != currChar) {
+ currWord.insert(0, currChar);
+ currOffset--;
+ }
+ return currWord.toString();
+ }
+ }
+ */
+
+ private void setActivationState(final IStructuredSelection sel, ProfileState state) {
+ if (sel == null) return;
+ Iterator<?> ite = sel.iterator();
+ while (ite.hasNext()) {
+ Object o = ite.next();
+ if (o instanceof ProfileSelection) {
+ ProfileSelection ps = (ProfileSelection) o;
+ ps.setActivationState(state);
+ profileTableViewer.setGrayed(ps, false);
+ if (ProfileState.Disabled.equals(state)) {
+ profileTableViewer.setChecked(ps, true);
+ ps.setSelected(true);
+ }
+ }
+ }
+ }
+
+
+ private void refresh() {
+ profileTableViewer.refresh();
+ updateProfilesAsText();
+ }
+
+
+ private class ChangeProfileStateAction extends Action {
+
+ private final ProfileState state;
+
+ public ChangeProfileStateAction(ProfileState state) {
+ this.state = state;
+ }
+
+ @Override
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection) profileTableViewer
+ .getSelection();
+ if (!selection.isEmpty()) {
+ setActivationState(selection, state);
+ refresh();
+ }
+ super.run();
+ }
+ }
+
+ private class ProfileLabelProvider extends LabelProvider implements
+ ITableLabelProvider, ITableFontProvider, ITableColorProvider {
+
+ private Font implicitActivationFont;
+
+ private Color inactiveColor;
+
+ public ProfileLabelProvider(Font defaultFont) {
+ FontData[] fds = defaultFont.getFontData();
+ for (FontData fd : fds) {
+ fd.setStyle(SWT.ITALIC);
+ }
+ implicitActivationFont = new Font(defaultFont.getDevice(), fds);
+ inactiveColor = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
+ }
+
+ public Font getFont(Object element, int columnIndex) {
+ ProfileSelection entry = (ProfileSelection) element;
+ Font font = null;
+ if (Boolean.TRUE.equals(entry.getAutoActive())
+ && PROFILE_ID_COLUMN == columnIndex) {
+ font = implicitActivationFont;
+ }
+ return font;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ ProfileSelection entry = (ProfileSelection) element;
+ if (ProfileState.Disabled.equals(entry.getActivationState())) {
+ return inactiveColor;
+ }
+ return null;
+ }
+
+ public Color getBackground(Object element, int columnIndex) {
+ return null;
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ ProfileSelection entry = (ProfileSelection) element;
+ StringBuilder text = new StringBuilder();
+ if (entry != null) {
+ if (columnIndex == PROFILE_ID_COLUMN) {
+ text.append(entry.getId());
+ ProfileState state = entry.getActivationState();
+ if (Boolean.TRUE.equals(entry.getSelected())
+ && state == ProfileState.Disabled) {
+ text.append(Messages.SelectProfilesDialog_deactivated);
+ } else if (Boolean.TRUE.equals(entry.getAutoActive())) {
+ text.append(Messages.SelectProfilesDialog_autoactivated);
+ }
+ } else if (columnIndex == SOURCE_COLUMN) {
+ text.append(entry.getSource());
+ }
+ }
+ return text.toString();
+ }
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/messages.properties
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/messages.properties
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.profiles.ui/src/org/jboss/tools/maven/profiles/ui/messages.properties 2012-02-10
09:43:28 UTC (rev 38591)
@@ -0,0 +1,28 @@
+ProfileManager_Updating_maven_profiles=Updating maven profiles
+ProfileSelectionHandler_Loading_maven_profiles=Loading project profiles
+ProfileSelectionHandler_Maven_Builder_still_processing=The maven builder has not finished
processing the selected project(s) yet.
+ProfileSelectionHandler_multiple_definitions=multiple definitions
+ProfileSelectionHandler_Select_some_maven_projects=You must select at least one active
Maven project
+ProfileSelectionHandler_Unable_to_open_profile_dialog=Unable to open the Maven Profile
selection dialog
+SelectProfilesDialog_Activate_menu=Activate {0}
+SelectProfilesDialog_Active_Profiles_for_Project=Active profiles for {0} :
+SelectProfilesDialog_autoactivated=\ (auto activated)
+SelectProfilesDialog_Available_profiles=Available profiles :
+SelectProfilesDialog_Warning_Common_profiles=Only the profiles common to all selected
projects are displayed. Other profiles will not be affected.
+SelectProfilesDialog_Deactivate_menu=Deactivate {0}
+SelectProfilesDialog_deactivated=\ (deactivated)
+SelectProfilesDialog_DeselectAll=Deselect all
+SelectProfilesDialog_Force_update=Force update
+SelectProfilesDialog_Maven_profile_selection=Maven Profile selection
+SelectProfilesDialog_Move_Down=Move Down
+SelectProfilesDialog_Move_Up=Move Up
+SelectProfilesDialog_No_Common_Profiles=There are no common profiles for the {0} selected
projects.
+SelectProfilesDialog_Offline=Offline
+SelectProfilesDialog_Profile_id_header=Profile id
+SelectProfilesDialog_Profile_source_header=Source
+SelectProfilesDialog_Project_has_no_available_profiles=Project {0} has no available
profiles
+SelectProfilesDialog_Read_Only_profiles=Active profiles area is read-only
+SelectProfilesDialog_Select_active_profiles_for_selected_projects=Select the active Maven
profiles for the {0} selected projects. Right-click to (de)activate a profile.
+SelectProfilesDialog_Select_Maven_profiles=Select Maven profiles
+SelectProfilesDialog_Select_the_active_Maven_profiles=Select the active Maven profiles
for project {0}. Right-click to (de)activate a profile.
+SelectProfilesDialog_SelectAll=Select All
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties 2012-02-10 09:15:16 UTC
(rev 38590)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/build.properties 2012-02-10 09:43:28 UTC
(rev 38591)
@@ -8,5 +8,4 @@
about.mappings,\
about.ini,\
about.html,\
- plugin.properties,\
- icons/
+ plugin.properties
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2012-02-10 09:15:16 UTC (rev
38590)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2012-02-10 09:43:28 UTC (rev
38591)
@@ -28,98 +28,7 @@
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.jboss.tools.maven.ui.preferences.ConfiguratorPreferencesInitializer"/>
</extension>
-
- <!-- Maven Profile Selection-->
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.ui.category.window"
- id="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- name="%Select_Maven_Profiles_Cmd">
- </command>
- </extension>
-
- <extension
- point="org.eclipse.ui.handlers">
- <handler
-
class="org.jboss.tools.maven.ui.internal.profiles.ProfileSelectionHandler"
-
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand">
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <key
-
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- contextId="org.eclipse.ui.contexts.window"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="Ctrl+Alt+P">
- </key>
- </extension>
-
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
id="org.jboss.tools.maven.ui.profiles.selectFromProject"
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true">
- <action
id="org.jboss.tools.maven.ui.commands.selectMavenProfileAction"
-
class="org.jboss.tools.maven.ui.generic.GenericCommandActionDelegate:org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- label="%Select_Maven_Profiles_Menu"
- style="push"
-
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- menubarPath="org.eclipse.m2e.core.mavenMenu/open"
- enablesFor="+"/>
- <visibility>
- <and>
- <objectState name="open" value="true"/>
- <objectState name="nature"
value="org.eclipse.m2e.core.maven2Nature"/>
- </and>
- </visibility>
- </objectContribution>
-
- <objectContribution
id="org.jboss.tools.maven.ui.profiles.selectFromPom"
- objectClass="org.eclipse.core.resources.IFile"
- adaptable="true">
- <action
id="org.jboss.tools.maven.ui.commands.selectMavenProfileAction"
-
class="org.jboss.tools.maven.ui.generic.GenericCommandActionDelegate:org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- label="%Select_Maven_Profiles_Menu"
- style="push"
-
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- menubarPath="org.eclipse.m2e.core.fileMenu/open"
- enablesFor="+"/>
- <visibility>
- <objectState name="name" value="pom.xml"/>
- </visibility>
- </objectContribution>
-
- <objectContribution
id="org.jboss.tools.maven.ui.profiles.selectFromWorkingSet"
- adaptable="true"
- objectClass="org.eclipse.ui.IWorkingSet">
- <action
id="org.jboss.tools.maven.ui.commands.selectMavenProfileAction"
-
class="org.jboss.tools.maven.ui.generic.GenericCommandActionDelegate:org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- label="%Select_Maven_Profiles_Menu"
- style="push"
-
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- menubarPath="org.eclipse.m2e.core.workingSetMenu/open"
- enablesFor="+"/>
- </objectContribution>
-
- </extension>
-
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
-
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
- <toolbar
-
id="org.jboss.tools.maven.ui.toolbars.selectMavenProfilesToolbar">
- <command
-
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- icon="icons/maven-profiles.gif"
-
id="org.jboss.tools.maven.ui.toolbars.selectMavenProfilesCommand"
- tooltip="%Select_Maven_Profiles_Cmd">
- </command>
- </toolbar>
- </menuContribution>
- </extension>
-
+
<extension point="org.eclipse.ui.editors.templates">
<template
id="org.jboss.tools.maven.editor.xml.templates.repository.jboss.public"
contextTypeId="org.eclipse.m2e.editor.xml.templates.contextType.repositories"
Modified: trunk/maven/plugins/pom.xml
===================================================================
--- trunk/maven/plugins/pom.xml 2012-02-10 09:15:16 UTC (rev 38590)
+++ trunk/maven/plugins/pom.xml 2012-02-10 09:43:28 UTC (rev 38591)
@@ -24,6 +24,8 @@
<module>org.jboss.tools.maven.jaxrs</module>
<module>org.jboss.tools.maven.jbosspackaging</module>
<module>org.jboss.tools.maven.jpa</module>
+ <module>org.jboss.tools.maven.profiles.core</module>
+ <module>org.jboss.tools.maven.profiles.ui</module>
</modules>
</project>
Modified: trunk/maven/site/site.xml
===================================================================
--- trunk/maven/site/site.xml 2012-02-10 09:15:16 UTC (rev 38590)
+++ trunk/maven/site/site.xml 2012-02-10 09:43:28 UTC (rev 38591)
@@ -38,4 +38,7 @@
<feature url="features/org.jboss.tools.maven.test.feature_0.0.0.jar"
id="org.jboss.tools.maven.test.feature" version="0.0.0">
<category name="JBoss Tools maven Nightly Build Update Site"/>
</feature>
+ <feature url="features/org.jboss.tools.maven.profiles.feature_0.0.0.jar"
id="org.jboss.tools.maven.profiles.feature" version="0.0.0">
+ <category name="JBoss Tools maven Nightly Build Update Site"/>
+ </feature>
</site>
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/META-INF/MANIFEST.MF 2012-02-10
09:15:16 UTC (rev 38590)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/META-INF/MANIFEST.MF 2012-02-10
09:43:28 UTC (rev 38591)
@@ -23,7 +23,9 @@
org.eclipse.wst.server.core,
org.jboss.tools.seam.core,
org.eclipse.datatools.connectivity,
- org.eclipse.datatools.connectivity.db.generic
+ org.eclipse.datatools.connectivity.db.generic,
+ org.jboss.tools.maven.profiles.core,
+ org.jboss.tools.maven.profiles.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Eclipse-RegisterBuddy: org.apache.log4j