mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Some minor fixes for the Environment and Macros UI
This commit is contained in:
parent
30c47b2964
commit
cca981f045
5 changed files with 54 additions and 26 deletions
|
@ -1009,8 +1009,8 @@ public class EnvironmentBlock extends AbstractCOptionPage {
|
||||||
*/
|
*/
|
||||||
public void setVisible(boolean visible){
|
public void setVisible(boolean visible){
|
||||||
fVisible = visible;
|
fVisible = visible;
|
||||||
if(visible)
|
// if(visible)
|
||||||
updateValues();
|
// updateValues();
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
|
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -164,6 +165,11 @@ public class EnvironmentSetBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCurrentPage(ICOptionPage page) {
|
||||||
|
((EnvironmentBlock)page).updateValues();
|
||||||
|
super.setCurrentPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,6 +215,8 @@ public class EnvironmentSetBlock extends AbstractCOptionPage {
|
||||||
public void setVisible(boolean visible){
|
public void setVisible(boolean visible){
|
||||||
if(visible)
|
if(visible)
|
||||||
updateValues();
|
updateValues();
|
||||||
|
if(fEnvTabs != null)
|
||||||
|
fEnvTabs.setVisible(visible);
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -891,6 +891,8 @@ public class MacrosBlock extends AbstractCOptionPage {
|
||||||
* updates both user- and sytem- macros tables.
|
* updates both user- and sytem- macros tables.
|
||||||
*/
|
*/
|
||||||
public void updateValues(){
|
public void updateValues(){
|
||||||
|
if(fCurrentContextInfo == null)
|
||||||
|
return;
|
||||||
try{
|
try{
|
||||||
MacroResolver.checkIntegrity(fCurrentContextInfo,new MacroUIMacroSubstitutor(fCurrentContextInfo,null," "));//$NON-NLS-1$ //$NON-NLS-2$
|
MacroResolver.checkIntegrity(fCurrentContextInfo,new MacroUIMacroSubstitutor(fCurrentContextInfo,null," "));//$NON-NLS-1$ //$NON-NLS-2$
|
||||||
updateState(null);
|
updateState(null);
|
||||||
|
@ -898,7 +900,8 @@ public class MacrosBlock extends AbstractCOptionPage {
|
||||||
updateState(e);
|
updateState(e);
|
||||||
}
|
}
|
||||||
updateUserMacros();
|
updateUserMacros();
|
||||||
updateSystemMacros(); }
|
updateSystemMacros();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateState(BuildMacroException e){
|
private void updateState(BuildMacroException e){
|
||||||
ICOptionContainer container = getContainer();
|
ICOptionContainer container = getContainer();
|
||||||
|
@ -1094,8 +1097,8 @@ public class MacrosBlock extends AbstractCOptionPage {
|
||||||
*/
|
*/
|
||||||
public void setVisible(boolean visible){
|
public void setVisible(boolean visible){
|
||||||
fVisible = visible;
|
fVisible = visible;
|
||||||
if(visible)
|
// if(visible)
|
||||||
updateValues();
|
// updateValues();
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
|
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
||||||
|
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -53,8 +54,8 @@ import org.eclipse.swt.widgets.Group;
|
||||||
private static final String TAB_WORKSPACE = TAB + ".workspace"; //$NON-NLS-1$
|
private static final String TAB_WORKSPACE = TAB + ".workspace"; //$NON-NLS-1$
|
||||||
private static final String TAB_ECLIPSE = TAB + ".eclipse"; //$NON-NLS-1$
|
private static final String TAB_ECLIPSE = TAB + ".eclipse"; //$NON-NLS-1$
|
||||||
|
|
||||||
private MacrosTabFolder fEnvTabs;
|
private MacrosTabFolder fMacroTabs;
|
||||||
private MacrosBlock fEnvBlock;
|
private MacrosBlock fMacroBlock;
|
||||||
|
|
||||||
private ICOptionContainer fParentContainer;
|
private ICOptionContainer fParentContainer;
|
||||||
|
|
||||||
|
@ -167,6 +168,11 @@ import org.eclipse.swt.widgets.Group;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCurrentPage(ICOptionPage page) {
|
||||||
|
((MacrosBlock)page).updateValues();
|
||||||
|
super.setCurrentPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,13 +183,13 @@ import org.eclipse.swt.widgets.Group;
|
||||||
// fOptionBlock = optionBlock;
|
// fOptionBlock = optionBlock;
|
||||||
|
|
||||||
if(fParentContainer instanceof BuildPropertyPage)
|
if(fParentContainer instanceof BuildPropertyPage)
|
||||||
fEnvTabs = new MacrosTabFolder();
|
fMacroTabs = new MacrosTabFolder();
|
||||||
else {
|
else {
|
||||||
fEnvBlock = new MacrosBlock(fParentContainer,
|
fMacroBlock = new MacrosBlock(fParentContainer,
|
||||||
ManagedBuilderUIMessages.getResourceString(TAB_WORKSPACE),
|
ManagedBuilderUIMessages.getResourceString(TAB_WORKSPACE),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
fEnvBlock.displayParentMacros(true);
|
fMacroBlock.displayParentMacros(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +219,8 @@ import org.eclipse.swt.widgets.Group;
|
||||||
public void setVisible(boolean visible){
|
public void setVisible(boolean visible){
|
||||||
if(visible)
|
if(visible)
|
||||||
updateValues();
|
updateValues();
|
||||||
|
if(fMacroTabs != null)
|
||||||
|
fMacroTabs.setVisible(visible);
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +229,7 @@ import org.eclipse.swt.widgets.Group;
|
||||||
*/
|
*/
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
Control ctrl = null;
|
Control ctrl = null;
|
||||||
if(fEnvTabs != null){
|
if(fMacroTabs != null){
|
||||||
Group group = new Group(parent, SWT.NONE);
|
Group group = new Group(parent, SWT.NONE);
|
||||||
group.setFont(parent.getFont());
|
group.setFont(parent.getFont());
|
||||||
group.setText(ManagedBuilderUIMessages.getResourceString(MACROS_GROUP_LABEL));
|
group.setText(ManagedBuilderUIMessages.getResourceString(MACROS_GROUP_LABEL));
|
||||||
|
@ -230,14 +238,14 @@ import org.eclipse.swt.widgets.Group;
|
||||||
gl.marginHeight = 0;
|
gl.marginHeight = 0;
|
||||||
gl.marginWidth = 0;
|
gl.marginWidth = 0;
|
||||||
group.setLayout(gl);
|
group.setLayout(gl);
|
||||||
Control tabs = fEnvTabs.createContents(group);
|
Control tabs = fMacroTabs.createContents(group);
|
||||||
GridData gd = new GridData(GridData.FILL_BOTH);
|
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||||
tabs.setLayoutData(gd);
|
tabs.setLayoutData(gd);
|
||||||
ctrl = group;
|
ctrl = group;
|
||||||
}
|
}
|
||||||
else if(fEnvBlock != null){
|
else if(fMacroBlock != null){
|
||||||
fEnvBlock.createControl(parent);
|
fMacroBlock.createControl(parent);
|
||||||
ctrl = fEnvBlock.getControl();
|
ctrl = fMacroBlock.getControl();
|
||||||
ctrl.setLayoutData(new GridData(GridData.FILL_BOTH));
|
ctrl.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,19 +287,19 @@ import org.eclipse.swt.widgets.Group;
|
||||||
* returns the selected environment block
|
* returns the selected environment block
|
||||||
*/
|
*/
|
||||||
protected MacrosBlock getSelectedBlock(){
|
protected MacrosBlock getSelectedBlock(){
|
||||||
if(fEnvTabs != null)
|
if(fMacroTabs != null)
|
||||||
return (MacrosBlock)fEnvTabs.getCurrentPage();
|
return (MacrosBlock)fMacroTabs.getCurrentPage();
|
||||||
return fEnvBlock;
|
return fMacroBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* returns all available environment blocks
|
* returns all available environment blocks
|
||||||
*/
|
*/
|
||||||
protected MacrosBlock[] getAllBlocks(){
|
protected MacrosBlock[] getAllBlocks(){
|
||||||
if(fEnvTabs != null)
|
if(fMacroTabs != null)
|
||||||
return fEnvTabs.getTabs();
|
return fMacroTabs.getTabs();
|
||||||
else if(fEnvBlock != null)
|
else if(fMacroBlock != null)
|
||||||
return new MacrosBlock[]{fEnvBlock};
|
return new MacrosBlock[]{fMacroBlock};
|
||||||
return new MacrosBlock[0];
|
return new MacrosBlock[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,10 +307,10 @@ import org.eclipse.swt.widgets.Group;
|
||||||
* updates the context of each EnvironmentBlock
|
* updates the context of each EnvironmentBlock
|
||||||
*/
|
*/
|
||||||
protected void updateContexts(){
|
protected void updateContexts(){
|
||||||
if(fEnvTabs != null)
|
if(fMacroTabs != null)
|
||||||
fEnvTabs.updateContexts();
|
fMacroTabs.updateContexts();
|
||||||
else if(fEnvBlock != null)
|
else if(fMacroBlock != null)
|
||||||
fEnvBlock.setContext(IBuildMacroProvider.CONTEXT_WORKSPACE,ResourcesPlugin.getWorkspace());
|
fMacroBlock.setContext(IBuildMacroProvider.CONTEXT_WORKSPACE,ResourcesPlugin.getWorkspace());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -245,4 +245,13 @@ public class BuildPreferencePage extends PreferencePage
|
||||||
rebuildJob.schedule();
|
rebuildJob.schedule();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see DialogPage#setVisible(boolean)
|
||||||
|
*/
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
super.setVisible(visible);
|
||||||
|
fOptionBlock.setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue