JBoss Tools SVN: r32820 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 15:07:00 -0400 (Mon, 11 Jul 2011)
New Revision: 32820
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
Log:
[JBIDE-9215] implemented runtime version -> service version mapping
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-07-11 14:59:24 UTC (rev 32819)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-07-11 19:07:00 UTC (rev 32820)
@@ -27,7 +27,7 @@
}
private static String getRequiredVersion(IServer server) {
- String id = server.getRuntime().getId();
+ String id = server.getRuntime().getRuntimeType().getId();
if (JBOSS7_RUNTIME.equals(id)) {
return IJBoss7ManagerService.AS_VERSION_700;
}
14 years, 9 months
JBoss Tools SVN: r32819 - in trunk/maven/plugins: org.jboss.tools.maven.core/src/org/jboss/tools/maven/core and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-07-11 10:59:24 -0400 (Mon, 11 Jul 2011)
New Revision: 32819
Added:
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/internal/profiles/ProfileManager.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/profiles/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/profiles/IProfileManager.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/profiles/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/profiles/handlers/
Removed:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/IProfileManager.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileManager.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/handlers/
Modified:
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/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Messages.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/messages.properties
Log:
JBIDE-8969 : Refactored Maven Profile Management logic to the core plugin.
Added a source column to the profile selection UI
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 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2011-07-11 14:59:24 UTC (rev 32819)
@@ -30,4 +30,5 @@
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 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -70,6 +70,8 @@
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;
/**
@@ -92,6 +94,8 @@
public static final List<LibraryProviderOperationConfig> libraryProviderOperationConfigs = new ArrayList<LibraryProviderOperationConfig>();
+ private IProfileManager profileManager;
+
// The shared instance
private static MavenCoreActivator plugin;
@@ -110,6 +114,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ profileManager = new ProfileManager();
}
/*
@@ -762,4 +767,8 @@
IMavenConstants.PLUGIN_ID, -1, msg, ex));
}
}
+
+ public IProfileManager getProfileManager() {
+ return profileManager;
+ }
}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/profiles/ProfileManager.java (from rev 32782, trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileManager.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/profiles/ProfileManager.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/profiles/ProfileManager.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -0,0 +1,120 @@
+package org.jboss.tools.maven.core.internal.profiles;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Profile;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.SettingsUtils;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.m2e.core.MavenPlugin;
+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.jboss.tools.maven.core.profiles.IProfileManager;
+
+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 {
+
+ final IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
+ final ResolverConfiguration configuration =configurationManager
+ .getResolverConfiguration(mavenProjectFacade.getProject());
+
+ final String profilesAsString = getAsString(profiles);
+ if (profilesAsString.equals(configuration.getActiveProfiles())) {
+ //Nothing changed
+ return;
+ }
+
+ IProject project = mavenProjectFacade.getProject();
+
+ 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> getAvailableProfiles(IMavenProjectFacade facade) throws CoreException {
+ if (facade == null) {
+ return Collections.emptyMap();
+ }
+ List<Profile> modelProfiles = facade.getMavenProject().getModel().getProfiles();
+ if (modelProfiles == null || modelProfiles.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ ResolverConfiguration resolverConfiguration = MavenPlugin.getProjectConfigurationManager()
+ .getResolverConfiguration(facade.getProject());
+
+ Map<Profile, Boolean> projectProfiles = new LinkedHashMap<Profile, Boolean>(modelProfiles.size());
+ List<Profile> activeProfiles = facade.getMavenProject().getActiveProfiles();
+
+ for (Profile p : modelProfiles) {
+ boolean isAutomaticallyActivated = isActive(p, activeProfiles)
+ && !resolverConfiguration.getActiveProfileList().contains(p.getId());
+ projectProfiles.put(p, isAutomaticallyActivated);
+ }
+ return Collections.unmodifiableMap(projectProfiles);
+ }
+
+
+ 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 = isActive2(p, 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 isActive2(Profile p, List<String> activeProfiles) {
+ for (String activeProfile : activeProfiles) {
+ if (activeProfile.equals(p.getId())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/profiles/IProfileManager.java (from rev 32782, trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/IProfileManager.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/profiles/IProfileManager.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/profiles/IProfileManager.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -0,0 +1,49 @@
+package org.jboss.tools.maven.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 {
+
+ /**
+ * Returns an unmodifiable Map of all the available profiles for a given project.
+ * The value of each Map.Entry indicates if the profile is active.
+ * @param mavenProjectFacade a facade of the maven project
+ * @return an unmodifiable Map of all the available profiles for a given project.
+ * @throws CoreException
+ */
+ Map<Profile, Boolean> getAvailableProfiles(IMavenProjectFacade mavenProjectFacade) 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;
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2011-07-11 14:59:24 UTC (rev 32819)
@@ -46,7 +46,7 @@
<extension
point="org.eclipse.ui.handlers">
<handler
- class="org.jboss.tools.maven.ui.internal.profiles.handlers.ProfileSelectionHandler"
+ class="org.jboss.tools.maven.ui.internal.profiles.ProfileSelectionHandler"
commandId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand">
</handler>
</extension>
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Messages.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Messages.java 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Messages.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -65,6 +65,8 @@
public static String SelectProfilesDialog_Force_update;
public static String SelectProfilesDialog_Maven_profile_selection;
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_Select_Maven_profiles;
public static String SelectProfilesDialog_Select_the_active_Maven_profiles;
Deleted: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/IProfileManager.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/IProfileManager.java 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/IProfileManager.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -1,19 +0,0 @@
-package org.jboss.tools.maven.ui.internal.profiles;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.model.Profile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-
-public interface IProfileManager {
-
- Map<Profile, Boolean> getAvailableProfiles(IMavenProjectFacade project) throws CoreException;
-
- Map<Profile, Boolean> getAvailableSettingProfiles() throws CoreException;
-
- void updateActiveProfiles(IMavenProjectFacade mavenProjectFacade,
- List<String> profiles, boolean isOffline, boolean isForceUpdate)
- throws CoreException;
-}
Deleted: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileManager.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileManager.java 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileManager.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -1,136 +0,0 @@
-package org.jboss.tools.maven.ui.internal.profiles;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.model.Profile;
-import org.apache.maven.settings.Settings;
-import org.apache.maven.settings.SettingsUtils;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.m2e.core.MavenPlugin;
-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.jboss.tools.maven.ui.Messages;
-
-public class ProfileManager implements IProfileManager {
-
- public void updateActiveProfiles(final IMavenProjectFacade mavenProjectFacade,
- final List<String> profiles,
- final boolean isOffline,
- final boolean isForceUpdate) throws CoreException {
-
- final IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
- final ResolverConfiguration configuration =configurationManager
- .getResolverConfiguration(mavenProjectFacade.getProject());
-
- final String profilesAsString = getAsString(profiles);
- if (profilesAsString.equals(configuration.getActiveProfiles())) {
- //Nothing changed
- return;
- }
-
- WorkspaceJob job = new WorkspaceJob(Messages.ProfileManager_Updating_maven_profiles) {
-
- public IStatus runInWorkspace(IProgressMonitor monitor) {
- try {
-
- IProject project = mavenProjectFacade.getProject();
-
- configuration.setActiveProfiles(profilesAsString);
- boolean isSet = configurationManager.setResolverConfiguration(project, configuration);
- if (isSet) {
- MavenUpdateRequest request = new MavenUpdateRequest(project, isOffline, isForceUpdate);
- configurationManager.updateProjectConfiguration(request, monitor);
- }
-
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- return Status.OK_STATUS;
- }
- };
- job.setRule(configurationManager.getRule());
- job.schedule();
- }
-
- 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> getAvailableProfiles(IMavenProjectFacade facade) throws CoreException {
- if (facade == null) {
- return Collections.emptyMap();
- }
- List<Profile> modelProfiles = facade.getMavenProject().getModel().getProfiles();
- if (modelProfiles == null || modelProfiles.isEmpty()) {
- return Collections.emptyMap();
- }
-
- ResolverConfiguration resolverConfiguration = MavenPlugin.getProjectConfigurationManager()
- .getResolverConfiguration(facade.getProject());
-
- Map<Profile, Boolean> projectProfiles = new LinkedHashMap<Profile, Boolean>(modelProfiles.size());
- List<Profile> activeProfiles = facade.getMavenProject().getActiveProfiles();
-
- for (Profile p : modelProfiles) {
- boolean isAutomaticallyActivated = isActive(p, activeProfiles)
- && !resolverConfiguration.getActiveProfileList().contains(p.getId());
- projectProfiles.put(p, isAutomaticallyActivated);
- }
- System.err.println(projectProfiles);
- return Collections.unmodifiableMap(projectProfiles);
- }
-
-
- 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 = isActive2(p, 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 isActive2(Profile p, List<String> activeProfiles) {
- for (String activeProfile : activeProfiles) {
- if (activeProfile.equals(p.getId())) {
- return true;
- }
- }
- return false;
- }
-
-}
Copied: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java (from rev 32782, trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/handlers/ProfileSelectionHandler.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -0,0 +1,120 @@
+package org.jboss.tools.maven.ui.internal.profiles;
+
+import java.util.Map;
+
+import org.apache.maven.model.Profile;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.profiles.IProfileManager;
+import org.jboss.tools.maven.ui.Activator;
+import org.jboss.tools.maven.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);
+ final IMavenProjectFacade facade = getSelectedMavenProject(event);
+ if (facade != null) {
+
+ final IProfileManager profileManager = MavenCoreActivator.getDefault().getProfileManager();
+
+ Map<Profile, Boolean> availableProfiles;
+ Map<Profile, Boolean> availableSettingsProfiles;
+ facade.getMavenProject().getActiveProfiles();
+ try {
+ availableProfiles = profileManager.getAvailableProfiles(facade);
+
+ availableSettingsProfiles = profileManager.getAvailableSettingProfiles();
+
+ } catch (CoreException e) {
+ throw new ExecutionException("Unable to open the Maven Profile selection dialog", e);
+ }
+ final SelectProfilesDialog dialog = new SelectProfilesDialog(window.getShell(),
+ facade,
+ availableProfiles,
+ availableSettingsProfiles);
+ if(dialog.open() == Window.OK) {
+ WorkspaceJob job = new WorkspaceJob(Messages.ProfileManager_Updating_maven_profiles) {
+
+ public IStatus runInWorkspace(IProgressMonitor monitor) {
+ try {
+
+ profileManager.updateActiveProfiles(facade, dialog.getSelectedProfiles(),
+ dialog.isOffline(), dialog.isForceUpdate(), monitor);
+ } catch (CoreException ex) {
+ Activator.log(ex);
+ return ex.getStatus();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setRule( MavenPlugin.getProjectConfigurationManager().getRule());
+ job.schedule();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns an IMavenProjectFacade from the selected IResource, or from the active editor
+ * @param event
+ * @return the selected IMavenProjectFacade
+ */
+ private IMavenProjectFacade getSelectedMavenProject(ExecutionEvent event) {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ IProject project = getSelectedProject(selection);
+ try {
+ if (project == null) {
+ IEditorInput input = HandlerUtil.getActiveEditorInput(event);
+ if(input instanceof IFileEditorInput) {
+ IFileEditorInput fileInput = (IFileEditorInput) input;
+ project = fileInput.getFile().getProject();
+ }
+ }
+ if (project != null && project.hasNature(IMavenConstants.NATURE_ID)) {
+ return MavenPlugin.getMavenProjectRegistry().getProject(project);
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+
+ return null;
+ }
+
+ private IProject getSelectedProject(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object firstElement = structuredSelection.getFirstElement();
+ if (firstElement instanceof IResource) {
+ return ((IResource) firstElement).getProject();
+ }
+ }
+ return null;
+ }
+
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java 2011-07-11 14:59:24 UTC (rev 32819)
@@ -28,18 +28,21 @@
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.jface.viewers.Viewer;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.core.project.ResolverConfiguration;
+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;
@@ -49,335 +52,351 @@
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.jboss.tools.maven.ui.Messages;
-public class SelectProfilesDialog extends TitleAreaDialog implements IMenuListener {
+public class SelectProfilesDialog extends TitleAreaDialog implements
+ IMenuListener {
- private CheckboxTableViewer profileTableViewer;
+ private static int PROFILE_ID_COLUMN = 0;
+ private static int SOURCE_COLUMN = 1;
- private Button offlineModeBtn;
+ private CheckboxTableViewer profileTableViewer;
+ private Button offlineModeBtn;
+ private Button forceUpdateBtn;
- private Button forceUpdateBtn;
+ private final IMavenProjectFacade facade;
- private final IMavenProjectFacade facade;
+ private List<Map.Entry<Profile, Boolean>> availableProfiles;
+ private List<String> initialInactiveProfileIds = new ArrayList<String>();
+ private List<String> initialActiveProfileIds = new ArrayList<String>();
+ private List<String> inactiveProfileIds = new ArrayList<String>();
+ private List<String> selectedProfiles;
- private List<Map.Entry<Profile, Boolean>> availableProfiles;
-
- private List<String> initialInactiveProfileIds = new ArrayList<String>();
- private List<String> initialActiveProfileIds = new ArrayList<String>();
- private List<String> inactiveProfileIds = new ArrayList<String>();
-
- private List<String> selectedProfiles;
-
- private boolean offlineMode;
+ private boolean offlineMode ;
+ private boolean forceUpdate;
- private boolean forceUpdate;
+ public SelectProfilesDialog(Shell parentShell, IMavenProjectFacade facade,
+ Map<Profile, Boolean> availableProjectProfiles,
+ Map<Profile, Boolean> availableSettingsProfiles) {
+ super(parentShell);
+ this.facade = facade;
- public SelectProfilesDialog(Shell parentShell, IMavenProjectFacade facade,
- Map<Profile, Boolean> availableProjectProfiles,
- Map<Profile, Boolean> availableSettingsProfiles) {
- super(parentShell);
- this.facade = facade;
+ availableProfiles = new ArrayList<Map.Entry<Profile, Boolean>>(availableProjectProfiles.entrySet());
+ availableProfiles.addAll(availableSettingsProfiles.entrySet());
- availableProfiles = new ArrayList<Map.Entry<Profile,Boolean>>(availableProjectProfiles.entrySet());
- availableProfiles.addAll(availableSettingsProfiles.entrySet());
-
- offlineMode = MavenPlugin.getMavenConfiguration().isOffline();
- forceUpdate = false;
-
- final IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
- final ResolverConfiguration configuration =configurationManager.getResolverConfiguration(facade.getProject());
- for (String p : configuration.getActiveProfileList()) {
- if (p.startsWith("!")) { //$NON-NLS-1$
- initialInactiveProfileIds.add(p.substring(1));
- } else {
- initialActiveProfileIds.add(p);
+ offlineMode = MavenPlugin.getMavenConfiguration().isOffline();
+
+ final IProjectConfigurationManager configurationManager = MavenPlugin
+ .getProjectConfigurationManager();
+ final ResolverConfiguration configuration = configurationManager
+ .getResolverConfiguration(facade.getProject());
+ for (String p : configuration.getActiveProfileList()) {
+ if (p.startsWith("!")) { //$NON-NLS-1$
+ initialInactiveProfileIds.add(p.substring(1));
+ } else {
+ initialActiveProfileIds.add(p);
+ }
}
+ inactiveProfileIds.addAll(initialInactiveProfileIds);
}
- inactiveProfileIds.addAll(initialInactiveProfileIds);
- }
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(Messages.SelectProfilesDialog_Select_Maven_profiles);
- }
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(Messages.SelectProfilesDialog_Select_Maven_profiles);
+ }
- /**
- * Create contents of the dialog.
- * @param parent
- */
- @Override
- @SuppressWarnings("rawtypes")
- protected Control createDialogArea(Composite parent) {
- Composite area = (Composite) super.createDialogArea(parent);
- Composite container = new Composite(area, SWT.NONE);
-
- GridLayout layout = new GridLayout(2, false);
- layout.marginLeft = 12;
- container.setLayout(layout);
- container.setLayoutData(new GridData(GridData.FILL_BOTH));
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite container = new Composite(area, SWT.NONE);
- setTitle(Messages.SelectProfilesDialog_Maven_profile_selection);
- setMessage(Messages.SelectProfilesDialog_Select_the_active_Maven_profiles+facade.getProject().getName());
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginLeft = 12;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
- boolean hasProfiles = !availableProfiles.isEmpty();
- Label lblAvailable = new Label(container, SWT.NONE);
- if (hasProfiles) {
- lblAvailable.setText(Messages.SelectProfilesDialog_Available_profiles);
- } else {
- lblAvailable.setText(Messages.SelectProfilesDialog_Project_has_no_available_profiles+facade.getProject().getName() +"' has no available profiles"); //$NON-NLS-2$
- }
- lblAvailable.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
+ setTitle(Messages.SelectProfilesDialog_Maven_profile_selection);
+ setMessage(NLS.bind(
+ Messages.SelectProfilesDialog_Select_the_active_Maven_profiles,
+ facade.getProject().getName()));
- if (hasProfiles) {
- profileTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
- profileTableViewer.setContentProvider(new IStructuredContentProvider() {
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // nothing to do
- }
-
- public void dispose() {
- // nothing to do
- }
-
- public Object[] getElements(Object input) {
- if(input instanceof Collection) {
- return ((Collection) input).toArray();
- }
- return null;
- }
- });
-
- profileTableViewer.setLabelProvider(new ProfileLabelProvider(this));
+ boolean hasProfiles = !availableProfiles.isEmpty();
+ Label lblAvailable = new Label(container, SWT.NONE);
+ String textLabel;
+ if (hasProfiles) {
+ textLabel = Messages.SelectProfilesDialog_Available_profiles;
+ } else {
+ textLabel = Messages.SelectProfilesDialog_Project_has_no_available_profiles;
+ }
+ lblAvailable.setText(NLS.bind(textLabel, facade.getProject().getName()));
+ lblAvailable.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
+ false, 2, 1));
- profileTableViewer.setInput(availableProfiles);
+ if (hasProfiles) {
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4);
- gd.heightHint = 200;
- gd.widthHint = 200;
- profileTableViewer.getTable().setLayoutData(gd);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4);
+ gd.heightHint = 150;
+ gd.widthHint = 500;
- Button selectAllBtn = new Button(container, SWT.NONE);
- selectAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
- selectAllBtn.setText(Messages.SelectProfilesDialog_SelectAll);
- selectAllBtn.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- for(Map.Entry<Profile, Boolean> entry: availableProfiles) {
- profileTableViewer.setChecked(entry, true);
- }
- }
+ profileTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
+ Table table = profileTableViewer.getTable();
+ table.setLayoutData(gd);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
- public void widgetDefaultSelected(SelectionEvent e) {
+ 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);
- Button deselectAllBtn = new Button(container, SWT.NONE);
- deselectAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
- deselectAllBtn.setText(Messages.SelectProfilesDialog_DeselectAll);
- deselectAllBtn.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- for(Map.Entry<Profile, Boolean> entry: availableProfiles) {
- profileTableViewer.setChecked(entry, false);
- }
- }
+ profileTableViewer
+ .setContentProvider(new IStructuredContentProvider() {
- public void widgetDefaultSelected(SelectionEvent e) {
+ public void inputChanged(Viewer viewer,
+ Object oldInput, Object newInput) {
+ // nothing to do
+ }
- }
- });
+ public void dispose() {
+ // nothing to do
+ }
- offlineModeBtn = new Button(container, SWT.CHECK);
- offlineModeBtn.setText(Messages.SelectProfilesDialog_Offline);
- offlineModeBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
- offlineModeBtn.setSelection(offlineMode);
+ @SuppressWarnings("rawtypes")
+ public Object[] getElements(Object input) {
+ if (input instanceof Collection) {
+ return ((Collection) input).toArray();
+ }
+ return null;
+ }
+ });
- forceUpdateBtn = new Button(container, SWT.CHECK);
- forceUpdateBtn.setText(Messages.SelectProfilesDialog_Force_update);
- forceUpdateBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
- forceUpdateBtn.setSelection(forceUpdate);
+ profileTableViewer.setLabelProvider(new ProfileLabelProvider(parent
+ .getFont()));
- createMenu();
+ profileTableViewer.setInput(availableProfiles);
- }
+ addSelectionButton(container, Messages.SelectProfilesDialog_SelectAll, true);
- return area;
- }
+ addSelectionButton(container, Messages.SelectProfilesDialog_DeselectAll, true);
-
- private class ProfileLabelProvider extends LabelProvider implements ITableFontProvider, ITableColorProvider{
-
- private final SelectProfilesDialog selectProfilesDialog;
+ offlineModeBtn = addCheckButton(container, Messages.SelectProfilesDialog_Offline, offlineMode);
- private Font implicitActivationFont;
-
- private Color inactiveColor;
-
- public ProfileLabelProvider(SelectProfilesDialog selectProfilesDialog) {
- this.selectProfilesDialog = selectProfilesDialog;
+ forceUpdateBtn = addCheckButton(container, Messages.SelectProfilesDialog_Force_update, forceUpdate);
- Font defaultFont = selectProfilesDialog.profileTableViewer.getTable().getFont();
- FontData[] fds = defaultFont.getFontData();
- for(FontData fd : fds) {
- fd.setStyle(SWT.ITALIC);
+ createMenu();
+
}
- implicitActivationFont = new Font(defaultFont.getDevice(), fds);
- inactiveColor = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
+
+ return area;
}
- public String getText(Object element) {
- Entry<Profile, Boolean> entry = getEntry(element);
- StringBuilder text = new StringBuilder();
- if (entry!= null) {
- boolean isDeactivated = isDeactivated(entry);
- Profile profile = entry.getKey();
- text.append(profile.getId());
- if (isDeactivated) {
- text.append(Messages.SelectProfilesDialog_deactivated);
- } else if (Boolean.TRUE.equals(entry.getValue())) {
- text.append(Messages.SelectProfilesDialog_autoactivated);
- }
- }
- return text.toString();
- }
-
-
-
- public Font getFont(Object element, int columnIndex) {
- Entry<Profile, Boolean> entry = getEntry(element);
- Font font = null;
- if (entry!=null && Boolean.TRUE.equals(entry.getValue())) {
- font = implicitActivationFont;
- }
- return font;
+ 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;
}
-
- public Color getForeground(Object element, int columnIndex) {
- Entry<Profile, Boolean> entry = getEntry(element);
- if (isDeactivated(entry)) {
- return inactiveColor;
- }
- return null;
+
+ private Button addSelectionButton(Composite container, String label, final boolean ischecked) {
+ Button button = new Button(container, SWT.NONE);
+ button.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ false, false, 1, 1));
+ button.setText(label);
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ for (Map.Entry<Profile, Boolean> entry : availableProfiles) {
+ profileTableViewer.setChecked(entry, ischecked);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ return button;
}
- public Color getBackground(Object element, int columnIndex) {
- return null;
- }
-
- }
-
- private Map.Entry<Profile, Boolean> getEntry(Object o) {
- if (o instanceof Map.Entry<?,?>) {
- return (Map.Entry<Profile, Boolean> )o;
+ @SuppressWarnings("unchecked")
+ private Map.Entry<Profile, Boolean> getEntry(Object o) {
+ if (o instanceof Map.Entry<?, ?>) {
+ return (Map.Entry<Profile, Boolean>) o;
}
return null;
}
-
+
private boolean isDeactivated(Entry<Profile, Boolean> entry) {
- return entry != null && inactiveProfileIds.contains(entry.getKey().getId());
+ return entry != null
+ && inactiveProfileIds.contains(entry.getKey().getId());
}
-
- /**
- * Create contents of the button bar.
- * @param parent
- */
- @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);
- }
- protected void okPressed() {
- if (profileTableViewer != null) {
- Object[] obj = profileTableViewer.getCheckedElements();
- List<String> selectedProfiles = new ArrayList<String>(obj.length);
- for(int i = 0; i < obj.length; i++ ) {
- Map.Entry<Profile, Boolean> entry = (Map.Entry<Profile, Boolean>) obj[i];
- String id = entry.getKey().getId();
- if (isDeactivated(entry)) {
- selectedProfiles.add("!"+id); //$NON-NLS-1$
- } else {
- selectedProfiles.add(id);
- }
- }
- this.selectedProfiles = selectedProfiles;
-
- offlineMode = offlineModeBtn.getSelection();
- forceUpdate = forceUpdateBtn.getSelection();
+ @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);
}
- super.okPressed();
- }
- public List<String> getSelectedProfiles() {
- return selectedProfiles;
- }
+ @Override
+ protected void okPressed() {
+ if (profileTableViewer != null) {
+ Object[] obj = profileTableViewer.getCheckedElements();
+ List<String> selectedProfiles = new ArrayList<String>(obj.length);
+ for (int i = 0; i < obj.length; i++) {
+ @SuppressWarnings("unchecked")
+ Map.Entry<Profile, Boolean> entry = (Map.Entry<Profile, Boolean>) obj[i];
+ String id = entry.getKey().getId();
+ if (isDeactivated(entry)) {
+ selectedProfiles.add("!" + id); //$NON-NLS-1$
+ } else {
+ selectedProfiles.add(id);
+ }
+ }
+ this.selectedProfiles = selectedProfiles;
- public boolean isOffline() {
- return offlineMode;
- }
+ offlineMode = offlineModeBtn.getSelection();
+ forceUpdate = forceUpdateBtn.getSelection();
+ }
+ super.okPressed();
+ }
- public boolean isForceUpdate() {
- return forceUpdate;
- }
+ private void createMenu() {
+ MenuManager menuMgr = new MenuManager();
+ Menu contextMenu = menuMgr.createContextMenu(profileTableViewer
+ .getControl());
+ menuMgr.addMenuListener(this);
+ profileTableViewer.getControl().setMenu(contextMenu);
+ menuMgr.setRemoveAllWhenShown(true);
- private void createMenu() {
- MenuManager menuMgr = new MenuManager();
- Menu contextMenu = menuMgr.createContextMenu(profileTableViewer.getControl());
- menuMgr.addMenuListener(this);
- profileTableViewer.getControl().setMenu(contextMenu);
- menuMgr.setRemoveAllWhenShown(true);
+ for (Map.Entry<Profile, Boolean> entry : availableProfiles) {
+ String id = entry.getKey().getId();
+ boolean isSelected = initialActiveProfileIds.contains(id)
+ || inactiveProfileIds.contains(id);
+ profileTableViewer.setChecked(entry, isSelected);
+ }
+ }
- for(Map.Entry<Profile, Boolean> entry: availableProfiles) {
- String id = entry.getKey().getId();
- boolean isSelected = initialActiveProfileIds.contains(id) || inactiveProfileIds.contains(id);
- profileTableViewer.setChecked(entry, isSelected);
- }
- }
-
- final Action activationAction = new Action("") { //$NON-NLS-1$
+ final Action activationAction = new Action("") { //$NON-NLS-1$
@Override
public void run() {
- IStructuredSelection selection = (IStructuredSelection) profileTableViewer.getSelection();
- if (!selection.isEmpty()) {
- final Map.Entry<Profile, Boolean> entry = getEntry(selection.getFirstElement());
- final boolean isDeactivated = isDeactivated(entry);
+ IStructuredSelection selection = (IStructuredSelection) profileTableViewer
+ .getSelection();
+ if (!selection.isEmpty()) {
+ final Map.Entry<Profile, Boolean> entry = getEntry(selection.getFirstElement());
+ final boolean isDeactivated = isDeactivated(entry);
- if (isDeactivated) {
- inactiveProfileIds.remove(entry.getKey().getId());
- } else {
- inactiveProfileIds.add(entry.getKey().getId());
- profileTableViewer.setChecked(entry, true);
+ if (isDeactivated) {
+ inactiveProfileIds.remove(entry.getKey().getId());
+ } else {
+ inactiveProfileIds.add(entry.getKey().getId());
+ profileTableViewer.setChecked(entry, true);
+ }
+ profileTableViewer.refresh();
}
- profileTableViewer.refresh();
- }
super.run();
}
- };
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- public void menuAboutToShow(IMenuManager manager) {
-
- IStructuredSelection selection = (IStructuredSelection) profileTableViewer.getSelection();
+ };
+
+ public void menuAboutToShow(IMenuManager manager) {
+
+ IStructuredSelection selection = (IStructuredSelection) profileTableViewer
+ .getSelection();
if (!selection.isEmpty()) {
- final Map.Entry<Profile, Boolean> entry = getEntry(selection.getFirstElement());
+ final Map.Entry<Profile, Boolean> entry = getEntry(selection
+ .getFirstElement());
final boolean isDeactivated = isDeactivated(entry);
+ String text;
if (isDeactivated) {
- activationAction.setText(Messages.SelectProfilesDialog_Activate_menu+ entry.getKey().getId());
+ text = Messages.SelectProfilesDialog_Activate_menu;
} else {
- activationAction.setText(Messages.SelectProfilesDialog_Deactivate_menu+ entry.getKey().getId());
+ text = Messages.SelectProfilesDialog_Deactivate_menu;
}
+ activationAction.setText(NLS.bind(text, entry.getKey().getId()));
manager.add(activationAction);
}
-
- }
-
-
+ }
+ public List<String> getSelectedProfiles() {
+ return selectedProfiles;
+ }
+
+ public boolean isOffline() {
+ return offlineMode;
+ }
+
+ public boolean isForceUpdate() {
+ return forceUpdate;
+ }
+
+ 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) {
+ Entry<Profile, Boolean> entry = getEntry(element);
+ Font font = null;
+ if (entry != null && Boolean.TRUE.equals(entry.getValue())
+ && PROFILE_ID_COLUMN == columnIndex) {
+ font = implicitActivationFont;
+ }
+ return font;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ Entry<Profile, Boolean> entry = getEntry(element);
+ if (isDeactivated(entry)) {
+ 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) {
+ Entry<Profile, Boolean> entry = getEntry(element);
+ StringBuilder text = new StringBuilder();
+ if (entry != null) {
+ boolean isDeactivated = isDeactivated(entry);
+ Profile profile = entry.getKey();
+ if (columnIndex == PROFILE_ID_COLUMN) {
+ text.append(profile.getId());
+ if (isDeactivated) {
+ text.append(Messages.SelectProfilesDialog_deactivated);
+ } else if (Boolean.TRUE.equals(entry.getValue())) {
+ text.append(Messages.SelectProfilesDialog_autoactivated);
+ }
+ } else if (columnIndex == SOURCE_COLUMN) {
+ text.append(profile.getSource());
+ }
+ }
+ return text.toString();
+ }
+ }
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/messages.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/messages.properties 2011-07-11 14:44:53 UTC (rev 32818)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/messages.properties 2011-07-11 14:59:24 UTC (rev 32819)
@@ -35,16 +35,18 @@
ConfiguratorPreferencePage_When_importing_Maven_projects_configure_the_following=When importing Maven projects configure the following:
ProfileManager_Updating_maven_profiles=Updating maven profiles
-SelectProfilesDialog_Activate_menu=Activate
+SelectProfilesDialog_Activate_menu=Activate {0}
SelectProfilesDialog_autoactivated=\ (auto activated)
SelectProfilesDialog_Available_profiles=Available profiles
-SelectProfilesDialog_Deactivate_menu=Deactivate
+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_Offline=Offline
-SelectProfilesDialog_Project_has_no_available_profiles=Project '
+SelectProfilesDialog_Profile_id_header=Profile id
+SelectProfilesDialog_Profile_source_header=Source
+SelectProfilesDialog_Project_has_no_available_profiles=Project {0} has no available profiles
SelectProfilesDialog_Select_Maven_profiles=Select Maven profiles
-SelectProfilesDialog_Select_the_active_Maven_profiles=Select the active Maven profiles for
+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
14 years, 9 months
JBoss Tools SVN: r32818 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 10:44:53 -0400 (Mon, 11 Jul 2011)
New Revision: 32818
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
Log:
[JBIDE-9215] implemented runtime version -> service version mapping
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-07-11 14:07:41 UTC (rev 32817)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-07-11 14:44:53 UTC (rev 32818)
@@ -17,6 +17,8 @@
public class JBoss7ManagerUtil {
+ private static final String JBOSS7_RUNTIME = "org.jboss.ide.eclipse.as.runtime.70"; //$NON-NLS-1$
+
public static IJBoss7ManagerService getService(IServer server) throws Exception {
BundleContext context = JBossServerCorePlugin.getContext();
JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context, getRequiredVersion(server));
@@ -25,6 +27,10 @@
}
private static String getRequiredVersion(IServer server) {
- return IJBoss7ManagerService.AS_VERSION_700;
+ String id = server.getRuntime().getId();
+ if (JBOSS7_RUNTIME.equals(id)) {
+ return IJBoss7ManagerService.AS_VERSION_700;
+ }
+ return null;
}
}
14 years, 9 months
JBoss Tools SVN: r32817 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 10:07:41 -0400 (Mon, 11 Jul 2011)
New Revision: 32817
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
Log:
[JBIDE-9215] moved #lauchPingThread to super class
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java 2011-07-11 14:06:18 UTC (rev 32816)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java 2011-07-11 14:07:41 UTC (rev 32817)
@@ -24,9 +24,11 @@
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
import org.eclipse.rse.services.shells.IHostShellOutputListener;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.launch.AbstractJBossStartLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchSetupParticipant;
+import org.jboss.ide.eclipse.as.core.util.ThreadUtils;
import org.jboss.ide.eclipse.as.rse.core.RSEHostShellModel.ServerShellModel;
public abstract class AbstractRSELaunchDelegate extends AbstractJBossStartLaunchConfiguration
@@ -60,4 +62,10 @@
};
// shell.addOutputListener(listener);
}
+
+ protected void launchPingThread(DeployableServerBehavior beh) {
+ // TODO do it properly here
+ ThreadUtils.sleepFor(30000);
+ beh.setServerStarted();
+ }
}
14 years, 9 months
JBoss Tools SVN: r32816 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 10:06:18 -0400 (Mon, 11 Jul 2011)
New Revision: 32816
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBossStartLaunchDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
Log:
[JBIDE-9215] moved #lauchPingThread to super class
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java 2011-07-11 13:03:16 UTC (rev 32815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java 2011-07-11 14:06:18 UTC (rev 32816)
@@ -54,13 +54,6 @@
launchPingThread(beh);
}
- private void launchPingThread(DelegatingServerBehavior beh) {
- // TODO do it properly here
- // ThreadUtils.sleepFor(30000);
- // beh.setServerStarted();
- this.pollThread = PollThreadUtils.pollServer(true, this.pollThread, beh);
- }
-
public void preLaunch(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBossStartLaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBossStartLaunchDelegate.java 2011-07-11 13:03:16 UTC (rev 32815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBossStartLaunchDelegate.java 2011-07-11 14:06:18 UTC (rev 32816)
@@ -29,7 +29,6 @@
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.IJBossBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
@@ -41,7 +40,6 @@
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
-import org.jboss.ide.eclipse.as.core.util.ThreadUtils;
import org.jboss.ide.eclipse.as.rse.core.RSEHostShellModel.ServerShellModel;
public class RSEJBossStartLaunchDelegate extends AbstractRSELaunchDelegate {
@@ -60,12 +58,6 @@
launchPingThread(beh);
}
- private void launchPingThread(DeployableServerBehavior beh) {
- // TODO do it properly here
- ThreadUtils.sleepFor(30000);
- beh.setServerStarted();
- }
-
/**
*
* @deprecated
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-11 13:03:16 UTC (rev 32815)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-11 14:06:18 UTC (rev 32816)
@@ -29,7 +29,6 @@
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.IJBossBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
@@ -41,7 +40,6 @@
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
-import org.jboss.ide.eclipse.as.core.util.ThreadUtils;
import org.jboss.ide.eclipse.as.rse.core.RSEHostShellModel.ServerShellModel;
/**
@@ -64,12 +62,6 @@
launchPingThread(beh);
}
- private void launchPingThread(DeployableServerBehavior beh) {
- // TODO do it properly here
- ThreadUtils.sleepFor(30000);
- beh.setServerStarted();
- }
-
/**
*
* @deprecated
14 years, 9 months
JBoss Tools SVN: r32815 - in trunk/as/plugins: org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 09:03:16 -0400 (Mon, 11 Jul 2011)
New Revision: 32815
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java
Log:
[JBIDE-9215] extracted method to util class
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java 2011-07-11 13:00:35 UTC (rev 32814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java 2011-07-11 13:03:16 UTC (rev 32815)
@@ -12,6 +12,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
@@ -23,6 +24,7 @@
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.launch.RunJarContainerWrapper;
+import org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.JBossLaunchConfigProperties;
/**
* @author André Dietisheim
@@ -85,6 +87,20 @@
return list;
}
+ public static String classpathUserClassesToString(ILaunchConfiguration config) throws CoreException {
+ StringBuilder builder = new StringBuilder();
+ List<String> classpath = JBossLaunchConfigProperties.getClasspath(config);
+ for(String entry : classpath) {
+ IRuntimeClasspathEntry runtimeEntry = JavaRuntime.newRuntimeClasspathEntry(entry);
+ int classpathProperty = runtimeEntry.getClasspathProperty();
+ if (classpathProperty == IRuntimeClasspathEntry.USER_CLASSES) {
+ builder.append(runtimeEntry.getLocation());
+ builder.append(IJBossRuntimeConstants.SPACE);
+ }
+ }
+ return builder.toString();
+ }
+
public static IRuntimeClasspathEntry getRunJarRuntimeCPEntry(IServer server) throws CoreException {
// TODO: improve/avoid server version check
// if (server.getServerType().getId().endsWith("70")) { //$NON-NLS-1$
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java 2011-07-11 13:00:35 UTC (rev 32814)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java 2011-07-11 13:03:16 UTC (rev 32815)
@@ -33,6 +33,7 @@
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
+import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
@@ -109,7 +110,7 @@
String rseHome = RSEUtils.getRSEHomeDir(jbossServer.getServer());
String currentArgs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
String currentVMArgs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$
- String jarArg = getJarArg(config);
+ String jarArg = LaunchConfigUtils.classpathUserClassesToString(config);
String cmd = "java "
+ currentVMArgs
@@ -121,17 +122,4 @@
+ "&";
return cmd;
}
-
- private String getJarArg(ILaunchConfiguration config) throws CoreException {
- StringBuilder builder = new StringBuilder();
- List<String> classpath = JBossLaunchConfigProperties.getClasspath(config);
- for(String entry : classpath) {
- IRuntimeClasspathEntry runtimeEntry = JavaRuntime.newRuntimeClasspathEntry(entry);
- int classpathProperty = runtimeEntry.getClasspathProperty();
- if (classpathProperty == IRuntimeClasspathEntry.USER_CLASSES) {
- builder.append(runtimeEntry.getLocation());
- }
- }
- return builder.toString();
- }
}
14 years, 9 months
JBoss Tools SVN: r32814 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 09:00:35 -0400 (Mon, 11 Jul 2011)
New Revision: 32814
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java
Log:
[JBIDE-9215] removed swallowing exception when converting classpath to a string
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2011-07-11 12:56:35 UTC (rev 32813)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2011-07-11 13:00:35 UTC (rev 32814)
@@ -170,7 +170,7 @@
}
@Deprecated
- public static ArrayList<String> convertClasspath(List<IRuntimeClasspathEntry> cp) {
+ public static ArrayList<String> convertClasspath(List<IRuntimeClasspathEntry> cp) throws CoreException {
return (ArrayList) LaunchConfigUtils.toStrings(cp);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java 2011-07-11 12:56:35 UTC (rev 32813)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchConfigUtils.java 2011-07-11 13:00:35 UTC (rev 32814)
@@ -74,44 +74,17 @@
addCPEntry(serverHome.append(relative), list);
}
- public static List<String> toStrings(List<?> cp) {
- Iterator<?> cpi = cp.iterator();
- ArrayList<String> list = new ArrayList<String>();
- while (cpi.hasNext()) {
- Object entry = cpi.next();
- if (entry instanceof IRuntimeClasspathEntry) {
- try {
- list.add(((IRuntimeClasspathEntry) entry).getMemento());
- } catch (Exception e) {
- // Trace.trace(Trace.SEVERE, "Could not resolve classpath entry:
- // " + entry, e);
- }
- } else if (entry instanceof String) {
- list.add((String) entry);
- } else if (entry != null){
- list.add(entry.toString());
- }
- }
-
- return list;
- }
-
- public static List<String> toString(List<IRuntimeClasspathEntry> cp) {
+ public static List<String> toStrings(List<IRuntimeClasspathEntry> cp) throws CoreException {
Iterator<IRuntimeClasspathEntry> cpi = cp.iterator();
ArrayList<String> list = new ArrayList<String>();
while (cpi.hasNext()) {
IRuntimeClasspathEntry entry = cpi.next();
- try {
list.add(entry.getMemento());
- } catch (Exception e) {
- // Trace.trace(Trace.SEVERE, "Could not resolve classpath entry:
- // " + entry, e);
- }
}
return list;
}
-
+
public static IRuntimeClasspathEntry getRunJarRuntimeCPEntry(IServer server) throws CoreException {
// TODO: improve/avoid server version check
// if (server.getServerType().getId().endsWith("70")) { //$NON-NLS-1$
14 years, 9 months
JBoss Tools SVN: r32813 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 08:56:35 -0400 (Mon, 11 Jul 2011)
New Revision: 32813
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java
Log:
[JBIDE-9215] fixing launch command for remote as7 launch
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java 2011-07-11 12:56:05 UTC (rev 32812)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEJBoss7StartLaunchDelegate.java 2011-07-11 12:56:35 UTC (rev 32813)
@@ -12,6 +12,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.rse.core;
+import java.util.List;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -19,20 +21,24 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
import org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.JBossLaunchConfigProperties;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
+import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.core.util.ThreadUtils;
public class RSEJBoss7StartLaunchDelegate extends AbstractRSELaunchDelegate {
+ private PollThread pollThread;
+
public void actualLaunch(DelegatingStartLaunchConfiguration launchConfig,
ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor) throws CoreException {
@@ -46,11 +52,12 @@
executeRemoteCommand(command, beh);
launchPingThread(beh);
}
-
- private void launchPingThread(DeployableServerBehavior beh) {
+
+ private void launchPingThread(DelegatingServerBehavior beh) {
// TODO do it properly here
- ThreadUtils.sleepFor(30000);
- beh.setServerStarted();
+ // ThreadUtils.sleepFor(30000);
+ // beh.setServerStarted();
+ this.pollThread = PollThreadUtils.pollServer(true, this.pollThread, beh);
}
public void preLaunch(ILaunchConfiguration configuration, String mode,
@@ -65,27 +72,9 @@
throws CoreException {
new RSELaunchConfigurator(getDefaultLaunchCommand(workingCopy), getDefaultStopCommand(server))
.configure(workingCopy);
- /*
- * /usr/lib/jvm/jre/bin/java -Dprogram.name=run.sh -server -Xms1530M
- * -Xmx1530M -XX:PermSize=425M -XX:MaxPermSize=425M
- * -Dorg.jboss.resolver.warning=true
- * -Dsun.rmi.dgc.client.gcInterval=3600000
- * -Dsun.rmi.dgc.server.gcInterval=3600000
- * -Djboss.partition.udpGroup=228.1.2.3
- * -Djboss.webpartition.mcast_port=45577
- * -Djboss.hapartition.mcast_port=45566
- * -Djboss.ejb3entitypartition.mcast_port=43333
- * -Djboss.ejb3sfsbpartition.mcast_port=45551
- * -Djboss.jvmRoute=node-10.209.183.100 -Djboss.gossip_port=12001
- * -Djboss.gossip_refresh=5000 -Djava.awt.headless=true
- * -Djava.net.preferIPv4Stack=true
- * -Djava.endorsed.dirs=/opt/jboss-eap-5.1.0.Beta/jboss-as/lib/endorsed
- * -classpath /opt/jboss-eap-5.1.0.Beta/jboss-as/bin/run.jar
- * org.jboss.Main -c default -b 10.209.183.100
- */
}
- private String getDefaultStopCommand(IServer server) {
+ private String getDefaultStopCommand(IServer server) {
try {
return getDefaultStopCommand(server, false);
} catch (CoreException ce) {/* ignore, INTENTIONAL */
@@ -98,17 +87,51 @@
}
private String getDefaultLaunchCommand(ILaunchConfiguration config) throws CoreException {
+ /*
+ * -server -Xms64m -Xmx512m -XX:MaxPermSize=256m
+ * -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true
+ * -Dsun.rmi.dgc.client.gcInterval=3600000
+ * -Dsun.rmi.dgc.server.gcInterval=3600000
+ * -Dorg.jboss.boot.log.file=/home
+ * /adietish/jboss-runtimes/jboss-7.0.0.CR1/standalone/log/boot.log
+ * -Dlogging
+ * .configuration=file:/home/adietish/jboss-runtimes/jboss-7.0.0
+ * .CR1/standalone/configuration/logging.properties -jar
+ * /home/adietish/jboss-runtimes/jboss-7.0.0.CR1/jboss-modules.jar
+ * (!!!!!!!!!MISSING) -mp
+ * /home/adietish/jboss-runtimes/jboss-7.0.0.CR1/modules -logmodule
+ * org.jboss.logmanager -jaxpmodule javax.xml.jaxp-provider
+ * org.jboss.as.standalone
+ * -Djboss.home.dir=/home/adietish/jboss-runtimes/jboss-7.0.0.CR1
+ */
String serverId = JBossLaunchConfigProperties.getServerId(config);
JBossServer jbossServer = ServerConverter.checkedFindJBossServer(serverId);
String rseHome = RSEUtils.getRSEHomeDir(jbossServer.getServer());
- // initialize startup command to something reasonable
String currentArgs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
String currentVMArgs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$
+ String jarArg = getJarArg(config);
- String cmd = "java " + currentVMArgs + " -classpath " +
- new Path(rseHome).append(IJBossRuntimeResourceConstants.BIN).append(
- IJBossRuntimeResourceConstants.START_JAR).toString() + IJBossRuntimeConstants.SPACE +
- IJBossRuntimeConstants.START_MAIN_TYPE + IJBossRuntimeConstants.SPACE + currentArgs + "&";
+ String cmd = "java "
+ + currentVMArgs
+ + " -classpath "
+ + new Path(rseHome).append(IJBossRuntimeResourceConstants.BIN).append(
+ IJBossRuntimeResourceConstants.START_JAR).toString()
+ + " -jar " + jarArg + " "
+ + IJBossRuntimeConstants.SPACE + currentArgs
+ + "&";
return cmd;
}
+
+ private String getJarArg(ILaunchConfiguration config) throws CoreException {
+ StringBuilder builder = new StringBuilder();
+ List<String> classpath = JBossLaunchConfigProperties.getClasspath(config);
+ for(String entry : classpath) {
+ IRuntimeClasspathEntry runtimeEntry = JavaRuntime.newRuntimeClasspathEntry(entry);
+ int classpathProperty = runtimeEntry.getClasspathProperty();
+ if (classpathProperty == IRuntimeClasspathEntry.USER_CLASSES) {
+ builder.append(runtimeEntry.getLocation());
+ }
+ }
+ return builder.toString();
+ }
}
14 years, 9 months
JBoss Tools SVN: r32812 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 08:56:05 -0400 (Mon, 11 Jul 2011)
New Revision: 32812
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
Log:
[JBIDE-9215] corrected error reporting (was: twice the root cause, now: user error & the root cause)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java 2011-07-11 12:24:59 UTC (rev 32811)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java 2011-07-11 12:56:05 UTC (rev 32812)
@@ -12,6 +12,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.rse.core;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -41,7 +43,7 @@
behavior.setServerStopped();
throw new CoreException(new Status(IStatus.ERROR,
org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
- sme.getMessage(), sme));
+ MessageFormat.format("Could not execute command on remote server {0}", behavior.getServer().getName()), sme));
}
}
// Only for debugging
14 years, 9 months
JBoss Tools SVN: r32811 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-11 08:24:59 -0400 (Mon, 11 Jul 2011)
New Revision: 32811
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java
Log:
[JBIDE-9215] replaced "new ArrayList" by Collections.emptyList()
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java 2011-07-11 12:05:48 UTC (rev 32810)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java 2011-07-11 12:24:59 UTC (rev 32811)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -236,7 +236,7 @@
@SuppressWarnings("unchecked")
public static List<String> getClasspath(ILaunchConfiguration launchConfig) throws CoreException {
return (List<String>) launchConfig.getAttribute(
- IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<String>());
+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, Collections.emptyList());
}
private static boolean isSet(String value) {
14 years, 9 months