summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Beauchamp2013-09-25 12:08:47 (EDT)
committerAndrew Gvozdev2013-10-03 11:47:10 (EDT)
commit02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9 (patch)
tree0befedd7dc1644e1b0701a359eea7f2e8fffee49
parent15b11f611afe73f06b297ab51fd4bf4fcbfa69b1 (diff)
downloadorg.eclipse.cdt-02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9.zip
org.eclipse.cdt-02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9.tar.gz
org.eclipse.cdt-02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9.tar.bz2
Bug 406545 - Restore Defaults/Apply buttons disappear in [Allrefs/changes/70/16770/6
configurations] mode from Project Properties Change-Id: Iac29cd3f6d3b06bf2baae8c3bbc16cbff9c73d2e Signed-off-by: Serge Beauchamp <sergebeauchamp@mac.com> Reviewed-on: https://git.eclipse.org/r/16770 Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com> IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com> Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com>
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java11
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolChainEditTab.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java59
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java28
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java8
8 files changed, 132 insertions, 12 deletions
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 7f3746e..5b3b47e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 IBM Corporation and others.
+ * Copyright (c) 2011, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties;
@@ -530,6 +531,14 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
}
+ /**
+ * @since 8.2
+ */
+ @Override
+ public boolean canSupportMultiCfg() {
+ return false;
+ }
+
@Override
protected void updateButtons() {
TreeItem[] sel = fTree.getTree().getSelection();
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolChainEditTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolChainEditTab.java
index 5e5a79d..a6242b4 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolChainEditTab.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolChainEditTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties;
@@ -197,6 +198,14 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
updateData();
}
+ /**
+ * @since 8.2
+ */
+ @Override
+ public boolean canSupportMultiCfg() {
+ return false;
+ }
+
private void updateData() {
showErrorMessage();
fillToolChainCombo();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java
index d01dfcc..91851f7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsEntriesTab.java
@@ -8,6 +8,7 @@
* Contributors:
* Andrew Gvozdev - Initial API and implementation
* Tom Hochstein (Freescale) - Bug 412601 - Preprocessor Entries properties tab should list languages
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.internal.ui.language.settings.providers;
@@ -1150,6 +1151,11 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
}
@Override
+ public boolean canSupportMultiCfg() {
+ return false;
+ }
+
+ @Override
protected void performDefaults() {
// This page restores defaults for file/folder only.
// Project and Preferences page are restored by LanguageSettingsProviderTab.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java
index ddd9791..df4c821 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Intel Corporation and others.
+ * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* Intel Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
* James Blackburn (Broadcom Corp.)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -561,16 +562,29 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
}
break;
case ICPropertyTab.UPDATE:
- if (canBeVisible()) configChanged((ICResourceDescription)data);
+ if (canSupportMultiCfg() || !page.isMultiCfg()) {
+ if (canBeVisible()) {
+ setButtonVisible(true);
+ configChanged((ICResourceDescription)data);
+ }
+ }
+ else
+ setAllVisible(false, null);
break;
case ICPropertyTab.DISPOSE:
dispose();
break;
case ICPropertyTab.VISIBLE:
- if (canBeVisible())
- setVisible(data != null);
+ if (canSupportMultiCfg() || !page.isMultiCfg()) {
+ if (canBeVisible()) {
+ setVisible(data != null);
+ setButtonVisible(data != null);
+ }
+ else
+ setVisible(false);
+ }
else
- setVisible(false);
+ setAllVisible(false, null);
break;
case ICPropertyTab.SET_ICON:
icon = (Image)data;
@@ -588,6 +602,30 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
}
/**
+ * Method to be implemented by inherited classes to indicate whether or not the tab supports displaying
+ * and editing settings for multiple configuration selection.
+ *
+ * Default implementation returns true.
+ *
+ * @return true if the tab supports multiple configurations, false otherwise
+ * @since 5.7
+ */
+ public boolean canSupportMultiCfg() {
+ return true;
+ }
+
+ /**
+ * Returns true if this tab is the one currently selected in the UI.
+ *
+ * @return true if this tab is the one selected in the UI, false otherwise.
+ * @since 5.7
+ */
+ public boolean isTabSelected() {
+ if (page instanceof ICPropertyProvider2)
+ return ((ICPropertyProvider2) page).getSelectedTab() == this;
+ return false;
+ }
+ /**
* Added to avoid usage PixelConverter class.
* @param control
* @return FontMetrics
@@ -678,7 +716,16 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
} else {
pageBook.showPage(userdata);
}
- if (page != null) {
+ setButtonVisible(visible);
+ }
+
+ /**
+ * Utility method to show/hide the 'Apply' and 'Restore Defaults' buttons
+ * @param visible - true or false
+ * @since 5.7
+ */
+ protected void setButtonVisible(boolean visible) {
+ if (page != null && isTabSelected()) {
Button b = page.getAButton();
if (b != null)
b.setVisible(visible);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
index 5827973..19ab697 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation, QNX Software Systems, and others.
+ * Copyright (c) 2007, 2013 Intel Corporation, QNX Software Systems, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
* Andrew Gvozdev
* QNX Software Systems - [271628] NPE in configs for project that failed to convert
* James Blackburn (Broadcom Corp.)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -124,7 +125,7 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
public abstract class AbstractPage extends PropertyPage
implements
IPreferencePageContainer, // dynamic pages
- ICPropertyProvider // utility methods for tabs
+ ICPropertyProvider2 // utility methods for tabs
{
private static ICResourceDescription resd = null;
private static ICConfigurationDescription[] cfgDescs = null;
@@ -1365,4 +1366,12 @@ implements
}
}
+ /**
+ * @since 5.7
+ */
+ @Override
+ public ICPropertyTab getSelectedTab() {
+ return currentTab;
+ }
+
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java
index 810020d..ca17cbf 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -302,6 +303,11 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
updateButtons();
}
+ @Override
+ public boolean canSupportMultiCfg() {
+ return false;
+ }
+
protected abstract ICExclusionPatternPathEntry[] getEntries(ICResourceDescription cfgd);
protected abstract void setEntries (ICResourceDescription cfgd, ICExclusionPatternPathEntry[] data);
protected abstract ICExclusionPatternPathEntry newEntry(IPath p, IPath[] ex, boolean workspacePath);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java
new file mode 100644
index 0000000..a1497b1
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Freescale Semiconductor and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Serge Beauchamp (Freescale Semiconductor) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.ui.newui;
+
+
+/**
+ * Interface provides an additional method to the CDT model property page.
+ *
+ * @see ICPropertyProvider
+ * @since 5.7
+ */
+
+public interface ICPropertyProvider2 extends ICPropertyProvider {
+
+ /**
+ * Return the selected tab, or null if the select tab isn't initialized
+ * @return the select tab in the page
+ */
+ ICPropertyTab getSelectedTab();
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java
index df8c516..b45d1d0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Intel Corporation and others.
+ * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* Intel Corporation - initial API and implementation
* IBM Corporation
* James Blackburn (Broadcom Corp.)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -194,6 +195,11 @@ public class RefsTab extends AbstractCPropertyTab {
}
}
+ @Override
+ public boolean canSupportMultiCfg() {
+ return false;
+ }
+
/**
* Persist the checked configurations
*/