Author: fbricon
Date: 2011-07-22 10:00:57 -0400 (Fri, 22 Jul 2011)
New Revision: 33137
Modified:
trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties
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 : fixed
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties 2011-07-22 13:32:25 UTC
(rev 33136)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties 2011-07-22 14:00:57 UTC
(rev 33137)
@@ -1,8 +1,12 @@
Bundle-Vendor = JBoss by Red Hat
Bundle-Name = JBoss Maven Integration
JBoss_Maven_Integration = JBoss Maven Integration
-Maven_Profiles = Maven Profiles
-Select_Maven_Profiles= Select Maven Profiles
+
+#Maven Profile selection menu
+Select_Maven_Profiles_Cmd= Select Maven Profiles
+Select_Maven_Profiles_Menu= Select Maven Profiles...
+
+#JBoss Public repo description for the <repository> template
JBoss_Public_Repo_name=JBoss Public repository
JBoss_Public_Repo_description=The JBoss Public repository is a composite repository of
several major repositories
JBoss_Releases_Repo_name=JBoss Releases repository
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2011-07-22 13:32:25 UTC (rev
33136)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2011-07-22 14:00:57 UTC (rev
33137)
@@ -32,14 +32,10 @@
<!-- Maven Profile Selection-->
<extension
point="org.eclipse.ui.commands">
- <category
- id="org.jboss.tools.maven.ui.commands.profiles"
- name="%Maven_Profiles">
- </category>
<command
- categoryId="org.jboss.tools.maven.ui.commands.profiles"
+ categoryId="org.eclipse.ui.category.window"
id="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
- name="%Select_Maven_Profiles">
+ name="%Select_Maven_Profiles_Cmd">
</command>
</extension>
@@ -66,7 +62,7 @@
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"
+ label="%Select_Maven_Profiles_Menu"
style="push"
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
menubarPath="org.eclipse.m2e.core.mavenMenu/open"
@@ -84,8 +80,9 @@
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"
+ label="%Select_Maven_Profiles_Menu"
style="push"
+
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
menubarPath="org.eclipse.m2e.core.fileMenu/open"
enablesFor="+"/>
<visibility>
@@ -98,8 +95,9 @@
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"
+ label="%Select_Maven_Profiles_Menu"
style="push"
+
definitionId="org.jboss.tools.maven.ui.commands.selectMavenProfileCommand"
menubarPath="org.eclipse.m2e.core.workingSetMenu/open"
enablesFor="+"/>
</objectContribution>
@@ -116,7 +114,7 @@
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">
+ tooltip="%Select_Maven_Profiles_Cmd">
</command>
</toolbar>
</menuContribution>
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-22
13:32:25 UTC (rev 33136)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/Messages.java 2011-07-22
14:00:57 UTC (rev 33137)
@@ -63,7 +63,7 @@
public static String SelectProfilesDialog_Activate_menu;
public static String SelectProfilesDialog_Active_Profiles_for_Project;
public static String SelectProfilesDialog_Available_profiles;
- public static String SelectProfilesDialog_Common_profiles;
+ public static String SelectProfilesDialog_Warning_Common_profiles;
public static String SelectProfilesDialog_deactivated;
public static String SelectProfilesDialog_Deactivate_menu;
public static String SelectProfilesDialog_DeselectAll;
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-22
13:32:25 UTC (rev 33136)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java 2011-07-22
14:00:57 UTC (rev 33137)
@@ -74,13 +74,11 @@
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) {
@@ -122,113 +120,129 @@
text = NLS.bind(
Messages.SelectProfilesDialog_Select_the_active_Maven_profiles,
facade.getProject().getName());
+
+ displayProfilesAsText(container);
}
setMessage(text);
- if (facade != null) {
+ boolean hasProfiles = !sharedProfiles.isEmpty();
+
+ 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);
- Label profilesLabel = new Label(container, SWT.NONE);
- profilesLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1,
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, 2, 1));
- profilesText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY));
- profilesText.setEditable(false);
- profilesText.setToolTipText(Messages.SelectProfilesDialog_Read_Only_profiles);
- updateProfilesText();
+ offlineModeBtn = addCheckButton(container, Messages.SelectProfilesDialog_Offline,
offlineMode);
+ forceUpdateBtn = addCheckButton(container, Messages.SelectProfilesDialog_Force_update,
forceUpdate);
}
- boolean hasProfiles = !sharedProfiles.isEmpty();
- Label warningLabel = new Label(container, SWT.CENTER);
- warningLabel.setVisible(false);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningLabel);
- Label lblAvailable = new Label(container, SWT.NONE);
+ 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) {
- if (facade == null) {
- textLabel = Messages.SelectProfilesDialog_Common_profiles;
- warningLabel.setImage(JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING));
- warningLabel.setVisible(true);
- } else {
- textLabel = Messages.SelectProfilesDialog_Available_profiles;
- }
+ textLabel = Messages.SelectProfilesDialog_Available_profiles;
} else {
if (facade == null) {
textLabel = Messages.SelectProfilesDialog_No_Common_Profiles;
} else {
textLabel =
- NLS.bind(Messages.SelectProfilesDialog_Project_has_no_available_profiles,
facade.getProject().getName());
+ NLS.bind(Messages.SelectProfilesDialog_Project_has_no_available_profiles,
+ facade.getProject().getName());
}
}
- lblAvailable.setText(textLabel);
- lblAvailable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false, 2, 1));
+ return textLabel;
+ }
- if (hasProfiles) {
+ private void displayProfilesTable(Composite container) {
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 4);
+ gd.heightHint = 200;
+ gd.widthHint = 500;
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 4);
- gd.heightHint = 200;
- gd.widthHint = 500;
+ profileTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
+ Table table = profileTableViewer.getTable();
+ table.setFocus();
+ table.setLayoutData(gd);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
- profileTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
- 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);
+
- 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.setContentProvider(ArrayContentProvider.getInstance());
+ profileTableViewer.setLabelProvider(new ProfileLabelProvider(container
+ .getFont()));
- profileTableViewer.setLabelProvider(new ProfileLabelProvider(parent
- .getFont()));
-
+
+ profileTableViewer.addCheckStateListener(new ICheckStateListener() {
- 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);
+ }
- 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);
- }
-
- updateProfilesText();
- profileTableViewer.refresh();
- }
- });
-
- profileTableViewer.setInput(sharedProfiles);
+ updateProfilesAsText();
+ profileTableViewer.refresh();
+ }
+ });
+
+ profileTableViewer.setInput(sharedProfiles);
+
+ createMenu();
+ }
- addSelectionButton(container, Messages.SelectProfilesDialog_SelectAll, true);
-
- addSelectionButton(container, Messages.SelectProfilesDialog_DeselectAll, false);
-
- offlineModeBtn = addCheckButton(container, Messages.SelectProfilesDialog_Offline,
offlineMode);
-
- forceUpdateBtn = addCheckButton(container, Messages.SelectProfilesDialog_Force_update,
forceUpdate);
-
- createMenu();
- }
-
- return area;
+ 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 updateProfilesText() {
+ private void updateProfilesAsText() {
if (profilesText != null) {
profilesText.setText(ProfileUtil.toString(sharedProfiles));
}
@@ -253,13 +267,13 @@
profileTableViewer.setAllGrayed(false);
for (ProfileSelection profile : sharedProfiles) {
profileTableViewer.setChecked(profile, ischecked);
-
- profile.setSelected(profileTableViewer.getChecked(profile));
- if (profile.getActivationState() == null) {
+ profile.setSelected(ischecked);
+ if (!ischecked || profile.getActivationState() == null) {
profile.setActivationState(ProfileState.Active);
}
}
- updateProfilesText();
+ profileTableViewer.refresh();
+ updateProfilesAsText();
}
public void widgetDefaultSelected(SelectionEvent e) {
@@ -468,7 +482,7 @@
if (ProfileState.Disabled.equals(state)) {
entry.setSelected(true);
}
- updateProfilesText();
+ updateProfilesAsText();
profileTableViewer.refresh();
}
super.run();
@@ -523,9 +537,9 @@
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) {
+ 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);
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-22
13:32:25 UTC (rev 33136)
+++
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/messages.properties 2011-07-22
14:00:57 UTC (rev 33137)
@@ -34,6 +34,7 @@
ConfiguratorPreferencePage_Configure_Seam_when_importing_Maven_projects=Seam
ConfiguratorPreferencePage_When_importing_Maven_projects_configure_the_following=When
importing Maven projects configure the following:
+
ProfileManager_Updating_maven_profiles=Updating maven profiles
ProfileSelectionHandler_Maven_Builder_still_processing=The maven builder has not finished
processing the selected project(s) yet.
ProfileSelectionHandler_Select_some_maven_projects=You must select at least one active
Maven project
@@ -41,8 +42,8 @@
SelectProfilesDialog_Activate_menu=Activate {0}
SelectProfilesDialog_Active_Profiles_for_Project=Active profiles for {0} :
SelectProfilesDialog_autoactivated=\ (auto activated)
-SelectProfilesDialog_Available_profiles=Available profiles
-SelectProfilesDialog_Common_profiles=Common profiles for selected projects. Profiles
specific to each project will not be affected.
+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