Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2011-04-21 17:08:26 -0400
committerVivian Kong2011-04-21 17:08:26 -0400
commita3fc8296c81f2d8a3cb8e86ae976fac0e0003231 (patch)
tree1fc96473b3dfb115486c1fc3e0a8515429c4df30 /build/org.eclipse.cdt.managedbuilder.ui
parent60e7c6cda07788b28d400fa5efccc7ceea815f96 (diff)
downloadorg.eclipse.cdt-a3fc8296c81f2d8a3cb8e86ae976fac0e0003231.tar.gz
org.eclipse.cdt-a3fc8296c81f2d8a3cb8e86ae976fac0e0003231.tar.xz
org.eclipse.cdt-a3fc8296c81f2d8a3cb8e86ae976fac0e0003231.zip
Bug 133881 - Make refreshing after building optional - UI changes
Work in progress.
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.ui')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyExceptionDialog.java115
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java12
4 files changed, 85 insertions, 50 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java
index a3cca00b84..7d4180d427 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java
@@ -211,6 +211,8 @@ public class Messages extends NLS {
public static String PropertyPageDefsTab_9;
public static String PropertyPageDefsTab_showIncludeFileTab;
public static String RefreshPolicyExceptionDialog_addDialogLabel;
+ public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_message;
+ public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_title;
public static String RefreshPolicyExceptionDialog_editDialogLabel;
public static String RefreshPolicyExceptionDialog_exceptionPropertiesGroupLabel;
public static String RefreshPolicyExceptionDialog_exceptionTypeDropdownLabel;
@@ -222,7 +224,7 @@ public class Messages extends NLS {
public static String RefreshPolicyTab_deleteConfirmationDialog_question_exception;
public static String RefreshPolicyTab_deleteConfirmationDialog_question_resource;
public static String RefreshPolicyTab_deleteConfirmationDialog_title;
- public static String RefreshPolicyTab_editButtonLabel;
+ public static String RefreshPolicyTab_editExceptionButtonLabel;
public static String RefreshPolicyTab_exceptionsLabel;
public static String RefreshPolicyTab_resourcesGroupLabel;
public static String RefreshPolicyTab_tabLabel;
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties
index e49908ecb5..ed842bcf3b 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties
@@ -200,6 +200,8 @@ NewBuildMacroDialog_label_list_title=Value of Build Variable
# ----------- Refresh Policy Tab and Exception Dialog -----------
RefreshPolicyExceptionDialog_addDialogLabel=Add Exception
+RefreshPolicyExceptionDialog_AddExceptionInfoDialog_message=Exceptions of all available exception types already exist for the selection. Please edit the existing exclusions instead.
+RefreshPolicyExceptionDialog_AddExceptionInfoDialog_title=Cannot Add Exception
RefreshPolicyExceptionDialog_editDialogLabel=Edit Exception
RefreshPolicyExceptionDialog_exceptionPropertiesGroupLabel=Exception Properties
RefreshPolicyExceptionDialog_exceptionTypeDropdownLabel=Exception Type:
@@ -211,7 +213,7 @@ RefreshPolicyTab_deleteButtonLabel=Delete...
RefreshPolicyTab_deleteConfirmationDialog_question_exception=You are removing an exception that has nested exceptions. Removing this exception will remove all nested exceptions. Do you want to continue?
RefreshPolicyTab_deleteConfirmationDialog_question_resource=You are removing a resource that has exceptions. Removing this resource will also remove all associated exceptions. Do you want to continue?
RefreshPolicyTab_deleteConfirmationDialog_title=Delete
-RefreshPolicyTab_editButtonLabel=Edit...
+RefreshPolicyTab_editExceptionButtonLabel=Edit Exception...
RefreshPolicyTab_exceptionsLabel=Exceptions
RefreshPolicyTab_resourcesGroupLabel=Resources
RefreshPolicyTab_tabLabel=The following resources will be refreshed after the project is built:
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyExceptionDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyExceptionDialog.java
index 5e27804c3f..6e8b64f6ca 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyExceptionDialog.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyExceptionDialog.java
@@ -11,6 +11,7 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.Iterator;
+import java.util.LinkedList;
import org.eclipse.cdt.core.resources.RefreshExclusion;
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
@@ -44,8 +45,9 @@ import org.eclipse.swt.widgets.Shell;
*/
public class RefreshPolicyExceptionDialog extends Dialog {
- private Combo exceptionTypeCombo;
- private Group exceptionPropertiesGroup;
+ private Combo fExceptionTypeCombo;
+ private Group fExceptionPropertiesGroup;
+ private Shell fShell;
private IResource fResourceRoot = null;
private RefreshExclusion fExclusionRoot = null;
@@ -60,7 +62,7 @@ public class RefreshPolicyExceptionDialog extends Dialog {
setShellStyle(getShellStyle());
fContrManager = RefreshExclusionContributionManager.getInstance();
fAddException = addException;
- fExclusionContributors = fContrManager.getContributors();
+ fExclusionContributors = new LinkedList<RefreshExclusionContributor>(fContrManager.getContributors());
}
public RefreshPolicyExceptionDialog(Shell parent, IResource resource, java.util.List<RefreshExclusion> exclusions, boolean addException) {
@@ -68,11 +70,29 @@ public class RefreshPolicyExceptionDialog extends Dialog {
//this is only called when an user is adding a RefreshException to a given resource
fResourceRoot = resource;
+ if (fAddException) {
+ removeExistingContributors(exclusions);
+ }
}
public RefreshPolicyExceptionDialog(Shell parent, RefreshExclusion exclusion, boolean addException) {
this(parent, addException);
- fExclusionRoot = exclusion;
+ fExclusionRoot = exclusion;
+ if (fAddException) {
+ removeExistingContributors(exclusion.getNestedExclusions());
+ }
+ }
+
+ private void removeExistingContributors(java.util.List<RefreshExclusion> exclusions) {
+ if (exclusions != null) {
+ Iterator<RefreshExclusion> iterator = exclusions.iterator();
+ while (iterator.hasNext()) {
+ RefreshExclusion exclusion = iterator.next();
+ RefreshExclusionContributor contributor = fContrManager.getContributor(exclusion.getContributorId());
+ if (fExclusionContributors.contains(contributor))
+ fExclusionContributors.remove(contributor);
+ }
+ }
}
/* (non-Javadoc)
@@ -85,6 +105,7 @@ public class RefreshPolicyExceptionDialog extends Dialog {
newShell.setText(Messages.RefreshPolicyExceptionDialog_addDialogLabel);
else
newShell.setText(Messages.RefreshPolicyExceptionDialog_editDialogLabel);
+ fShell = newShell;
}
/* (non-Javadoc)
@@ -96,55 +117,65 @@ public class RefreshPolicyExceptionDialog extends Dialog {
comp.setLayout(new GridLayout(2, false));
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
- Label exceptionType = new Label(comp, SWT.NONE);
- exceptionType.setText(Messages.RefreshPolicyExceptionDialog_exceptionTypeDropdownLabel);
-
- exceptionTypeCombo = new Combo(comp, SWT.READ_ONLY);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.grabExcessHorizontalSpace = true;
- exceptionTypeCombo.setLayoutData(gridData);
-
-
- if (fAddException) {
- Iterator<RefreshExclusionContributor> iterator = fExclusionContributors.iterator();
- while (iterator.hasNext()) {
- RefreshExclusionContributor contributor = iterator.next();
- exceptionTypeCombo.add(contributor.getName());
- }
+ if (fExclusionContributors.size() == 0) {
+ fShell.setText(Messages.RefreshPolicyExceptionDialog_AddExceptionInfoDialog_title);
+ Label information = new Label(comp, SWT.NONE);
+ information.setText(Messages.RefreshPolicyExceptionDialog_AddExceptionInfoDialog_message);
+ information = new Label(comp, SWT.NONE);
+ fNewExclusion = null;
+
} else {
- exceptionTypeCombo.add(fContrManager.getContributor(fExclusionRoot.getContributorId()).getName());
- }
- exceptionTypeCombo.select(0);
- exceptionTypeCombo.addSelectionListener(new SelectionAdapter() {
+ Label exceptionType = new Label(comp, SWT.NONE);
+ exceptionType.setText(Messages.RefreshPolicyExceptionDialog_exceptionTypeDropdownLabel);
+
+ fExceptionTypeCombo = new Combo(comp, SWT.READ_ONLY);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.grabExcessHorizontalSpace = true;
+ fExceptionTypeCombo.setLayoutData(gridData);
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (exceptionPropertiesGroup != null)
- exceptionPropertiesGroup.dispose();
-
- generateExceptionPropertiesGroup(comp, exceptionTypeCombo.getSelectionIndex());
- comp.layout();
+
+ if (fAddException) {
+ Iterator<RefreshExclusionContributor> iterator = fExclusionContributors.iterator();
+ while (iterator.hasNext()) {
+ RefreshExclusionContributor contributor = iterator.next();
+ fExceptionTypeCombo.add(contributor.getName());
+ }
+ } else {
+ fExceptionTypeCombo.add(fContrManager.getContributor(fExclusionRoot.getContributorId()).getName());
}
- });
-
- generateExceptionPropertiesGroup(comp, exceptionTypeCombo.getSelectionIndex());
+
+ fExceptionTypeCombo.select(0);
+ fExceptionTypeCombo.addSelectionListener(new SelectionAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fExceptionPropertiesGroup != null)
+ fExceptionPropertiesGroup.dispose();
+
+ generateExceptionPropertiesGroup(comp, fExceptionTypeCombo.getSelectionIndex());
+ comp.layout();
+ }
+ });
+
+ generateExceptionPropertiesGroup(comp, fExceptionTypeCombo.getSelectionIndex());
+
+ }
return comp;
}
private void generateExceptionPropertiesGroup(Composite parent, int selectionIndex) {
- exceptionPropertiesGroup = new Group(parent, SWT.NONE);
- exceptionPropertiesGroup.setText(Messages.RefreshPolicyExceptionDialog_exceptionPropertiesGroupLabel);
- exceptionPropertiesGroup.setLayout(new GridLayout(3, false));
+ fExceptionPropertiesGroup = new Group(parent, SWT.NONE);
+ fExceptionPropertiesGroup.setText(Messages.RefreshPolicyExceptionDialog_exceptionPropertiesGroupLabel);
+ fExceptionPropertiesGroup.setLayout(new GridLayout(3, false));
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
gd.verticalAlignment = GridData.FILL;
gd.horizontalSpan = 2;
- exceptionPropertiesGroup.setLayoutData(gd);
+ fExceptionPropertiesGroup.setLayoutData(gd);
if (fAddException) {
if (fNewExclusion == null || fNewExclusion.getContributorId() != fExclusionContributors.get(selectionIndex).getID()){
@@ -156,11 +187,11 @@ public class RefreshPolicyExceptionDialog extends Dialog {
fNewExclusion.setParentExclusion(fExclusionRoot);
}
- fExclusionContributors.get(selectionIndex).createProperiesUI(exceptionPropertiesGroup, fNewExclusion);
+ fExclusionContributors.get(selectionIndex).createProperiesUI(fExceptionPropertiesGroup, fNewExclusion);
} else { //edit an exception
- fContrManager.getContributor(fExclusionRoot.getContributorId()).createProperiesUI(exceptionPropertiesGroup, fExclusionRoot);
+ fContrManager.getContributor(fExclusionRoot.getContributorId()).createProperiesUI(fExceptionPropertiesGroup, fExclusionRoot);
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java
index 81205c2a1f..437292770f 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java
@@ -73,7 +73,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
private final static int IDX_ADD_RESOURCE = 0;
private final static int IDX_ADD_EXCEPTION = 1;
- private final static int IDX_EDIT = 2;
+ private final static int IDX_EDIT_EXCEPTION = 2;
private final static int IDX_DELETE = 3;
private TreeViewer fTree;
@@ -299,7 +299,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
parent.exclusion.removeExclusionInstance(instance);
parent.exclusion_instances.remove(this);
- if (parent.exclusion_instances.size() < 1) {
+ if (parent.exclusion_instances.size() < 1 && parent.exclusion.supportsExclusionInstances()) {
parent.remove();
}
}
@@ -318,7 +318,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
initButtons(new String[] {
Messages.RefreshPolicyTab_addResourceButtonLabel,
Messages.RefreshPolicyTab_addExceptionButtonLabel,
- Messages.RefreshPolicyTab_editButtonLabel,
+ Messages.RefreshPolicyTab_editExceptionButtonLabel,
Messages.RefreshPolicyTab_deleteButtonLabel}, 120);
usercomp.setLayout(new GridLayout(1, false));
@@ -465,7 +465,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
TreeItem[] sel = fTree.getTree().getSelection();
buttonSetEnabled(IDX_ADD_RESOURCE, true);
buttonSetEnabled(IDX_ADD_EXCEPTION, sel.length == 1 && sel[0].getData() instanceof _Entry);
- buttonSetEnabled(IDX_EDIT, sel.length == 1 && sel[0].getData() instanceof _Entry && ((_Entry) sel[0].getData()).isExclusion());
+ buttonSetEnabled(IDX_EDIT_EXCEPTION, sel.length == 1 && sel[0].getData() instanceof _Entry && ((_Entry) sel[0].getData()).isExclusion());
buttonSetEnabled(IDX_DELETE, sel.length == 1 && (sel[0].getData() instanceof _Entry || sel[0].getData() instanceof _Exclusion_Instance));
}
@@ -519,7 +519,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
fTree.expandAll();
break;
- case IDX_EDIT: //can only edit a refresh exclusion
+ case IDX_EDIT_EXCEPTION: //can only edit a refresh exclusion
if (selection == null)
break;
_Entry selectedExclusion = (_Entry) selection.getFirstElement();
@@ -566,7 +566,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
} else { //exclusion instance
_Exclusion_Instance sel1 = (_Exclusion_Instance) selection.getFirstElement();
boolean remove = false;
- if (sel1.parent.exclusion_instances.size() == 1 && sel1.parent.exceptions_node != null) {
+ if (sel1.parent.exclusion.supportsExclusionInstances() && sel1.parent.exclusion_instances.size() == 1 && sel1.parent.exceptions_node != null) {
//this is the only exclusion instance for an exclusion and the exclusion has nested exclusions
if (MessageDialog.openQuestion(shell, Messages.RefreshPolicyTab_deleteConfirmationDialog_title, Messages.RefreshPolicyTab_deleteConfirmationDialog_question_exception)) {
remove = true;

Back to the top