mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Bug # 182450: allow changing settings for multimple configs simultaneously
This commit is contained in:
parent
0658cb9937
commit
7157df9421
49 changed files with 3763 additions and 278 deletions
|
@ -8,22 +8,20 @@
|
|||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||
package org.eclipse.cdt.managedbuilder.core;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.ui.newui.CDTListComparator;
|
||||
|
||||
/**
|
||||
* This class is intended to compare MBS-specific classes
|
||||
*/
|
||||
public class BuildListComparator extends CDTListComparator {
|
||||
private static BuildListComparator comparator = null;
|
||||
private static final String EMPTY = ""; //$NON-NLS-1$
|
||||
|
||||
public static CDTListComparator getInstance() {
|
||||
public static Comparator getInstance() {
|
||||
if (comparator == null)
|
||||
comparator = new BuildListComparator();
|
||||
return comparator;
|
|
@ -0,0 +1,37 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.core;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
|
||||
public interface IMultiConfiguration extends IConfiguration, ICMultiItemsHolder {
|
||||
|
||||
boolean getParallelDef();
|
||||
void setParallelDef(boolean def);
|
||||
|
||||
int getParallelNumber();
|
||||
void setParallelNumber(int num);
|
||||
|
||||
boolean getInternalBuilderParallel();
|
||||
|
||||
boolean isInternalBuilderEnabled();
|
||||
boolean canEnableInternalBuilder(boolean v);
|
||||
void enableInternalBuilder(boolean v);
|
||||
|
||||
void setOutputPrefixForPrimaryOutput(String pref);
|
||||
String getToolOutputPrefix();
|
||||
|
||||
IBuildProperty getBuildProperty(String id);
|
||||
void setBuildProperty(String id, String val);
|
||||
IBuildPropertyValue[] getSupportedValues(String id);
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -83,6 +83,7 @@ Preferred.toolchains=Preferred toolchains
|
|||
Wizard.defaults=Wizard defaults
|
||||
PropertyPage.defaults=Property page settings
|
||||
MBSPerProjectProfile.name=Managed Build System - per project scanner info profile
|
||||
multicfg=Multiple configurations edit
|
||||
|
||||
# menu labels
|
||||
Configurations.menu=Build Configurations
|
||||
|
|
|
@ -68,6 +68,12 @@
|
|||
class="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_PropertyPage"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_PropertyPage"
|
||||
name="%propSettingsPrefName"/>
|
||||
<page
|
||||
category="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_PropertyPage"
|
||||
class="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_MultiConfig"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_MultiConfig"
|
||||
name="%multicfg">
|
||||
</page>
|
||||
</extension>
|
||||
|
||||
<!-- Action for Project Converter in context menu -->
|
||||
|
@ -397,6 +403,11 @@
|
|||
class="org.eclipse.cdt.managedbuilder.ui.preferences.PropertyPageDefsTab"
|
||||
name="%PropertyPage.defaults"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_PropertyPage"/>
|
||||
<tab
|
||||
class="org.eclipse.cdt.managedbuilder.ui.preferences.PropertyMultiCfgTab"
|
||||
name="%multicfg"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_MultiConfig">
|
||||
</tab>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.ui.preferences;
|
||||
|
||||
public class PrefPage_MultiConfig extends PrefPage_PropertyPage {
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.ui.preferences;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
||||
|
||||
private static final int SPACING = 5; // for radio buttons layout
|
||||
private static final Color RED = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_RED);
|
||||
private static final Color BLUE = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_BLUE);
|
||||
|
||||
private Button enable_multi;
|
||||
private Button enable_3state;
|
||||
private Group dGrp;
|
||||
private Group wGrp;
|
||||
private Button d_0;
|
||||
private Button d_1;
|
||||
private Button d_2;
|
||||
|
||||
private Button w_0;
|
||||
private Button w_1;
|
||||
|
||||
|
||||
public void createControls(Composite parent) {
|
||||
super.createControls(parent);
|
||||
GridLayout g = new GridLayout(1, false);
|
||||
g.verticalSpacing = SPACING;
|
||||
usercomp.setLayout(g);
|
||||
|
||||
Label l = new Label(usercomp, SWT.CENTER | SWT.BORDER);
|
||||
l.setText("* This functionality is experimental *");
|
||||
l.setForeground(RED);
|
||||
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
|
||||
|
||||
enable_multi = new Button(usercomp, SWT.CHECK);
|
||||
enable_multi.setText("Enable multiple configurations setting");
|
||||
enable_multi.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
enable_multi.addSelectionListener(new SelectionAdapter () {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
setStates();
|
||||
}});
|
||||
|
||||
enable_3state = new Button(usercomp, SWT.CHECK);
|
||||
enable_3state.setText("Use 3-state checkboxes where possible");
|
||||
enable_3state.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
dGrp = new Group(usercomp, SWT.NONE);
|
||||
dGrp.setText("String list Display mode");
|
||||
dGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
FillLayout fl = new FillLayout(SWT.VERTICAL);
|
||||
fl.spacing = SPACING;
|
||||
fl.marginWidth = SPACING;
|
||||
dGrp.setLayout(fl);
|
||||
|
||||
l = new Label(dGrp, SWT.WRAP | SWT.CENTER);
|
||||
l.setText(
|
||||
"Define how string lists from different configurations\nshould be combined for display, when lists are not equal"
|
||||
);
|
||||
l.setForeground(BLUE);
|
||||
d_0 = new Button(dGrp, SWT.RADIO);
|
||||
d_0.setText("Show empty list");
|
||||
d_1 = new Button(dGrp, SWT.RADIO);
|
||||
d_1.setText("Show common elements (conjunction)");
|
||||
d_2 = new Button(dGrp, SWT.RADIO);
|
||||
d_2.setText("Show all elements except doubles (disjunction)");
|
||||
|
||||
wGrp = new Group(usercomp, SWT.NONE);
|
||||
wGrp.setText("String list Write mode");
|
||||
wGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
fl = new FillLayout(SWT.VERTICAL);
|
||||
fl.spacing = SPACING;
|
||||
fl.marginWidth = SPACING;
|
||||
wGrp.setLayout(fl);
|
||||
|
||||
l = new Label(wGrp, SWT.WRAP | SWT.CENTER);
|
||||
l.setText(
|
||||
"Define how to save changes in string lists \nfor different configurations"
|
||||
);
|
||||
l.setForeground(BLUE);
|
||||
w_0 = new Button(wGrp, SWT.RADIO);
|
||||
w_0.setText("Add/remove/change affected elements, do not touch others");
|
||||
w_1 = new Button(wGrp, SWT.RADIO);
|
||||
w_1.setText("Replace existing string lists with string list shown to user");
|
||||
|
||||
enable_multi.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
|
||||
enable_3state.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_3STATE));
|
||||
|
||||
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) {
|
||||
case CDTPrefUtil.DMODE_EMPTY: d_0.setSelection(true); break;
|
||||
case CDTPrefUtil.DMODE_CONJUNCTION: d_1.setSelection(true); break;
|
||||
case CDTPrefUtil.DMODE_DISJUNCTION: d_2.setSelection(true); break;
|
||||
default: d_1.setSelection(true); break;
|
||||
}
|
||||
|
||||
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE)) {
|
||||
case CDTPrefUtil.WMODE_MODIFY: w_0.setSelection(true); break;
|
||||
case CDTPrefUtil.WMODE_REPLACE: w_1.setSelection(true); break;
|
||||
default: w_0.setSelection(true); break;
|
||||
}
|
||||
|
||||
setStates();
|
||||
}
|
||||
|
||||
protected void performOK() {
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, enable_multi.getSelection());
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_3STATE,enable_3state.getSelection());
|
||||
int x = 0;
|
||||
if (d_0.getSelection())
|
||||
x = CDTPrefUtil.DMODE_EMPTY;
|
||||
else if (d_1.getSelection())
|
||||
x = CDTPrefUtil.DMODE_CONJUNCTION;
|
||||
else if (d_2.getSelection())
|
||||
x = CDTPrefUtil.DMODE_DISJUNCTION;
|
||||
CDTPrefUtil.setInt(CDTPrefUtil.KEY_DMODE, x);
|
||||
|
||||
if (w_0.getSelection())
|
||||
x = CDTPrefUtil.WMODE_MODIFY;
|
||||
else if (w_1.getSelection())
|
||||
x = CDTPrefUtil.WMODE_REPLACE;
|
||||
CDTPrefUtil.setInt(CDTPrefUtil.KEY_WMODE, x);
|
||||
}
|
||||
|
||||
protected void performDefaults() {
|
||||
enable_multi.setSelection(false);
|
||||
enable_3state.setSelection(false);
|
||||
d_0.setSelection(false);
|
||||
d_1.setSelection(true);
|
||||
d_2.setSelection(false);
|
||||
w_0.setSelection(true);
|
||||
w_1.setSelection(false);
|
||||
}
|
||||
|
||||
private void setStates() {
|
||||
boolean b = enable_multi.getSelection();
|
||||
enable_3state.setEnabled(b);
|
||||
d_0.setEnabled(b);
|
||||
d_1.setEnabled(b);
|
||||
d_2.setEnabled(b);
|
||||
w_0.setEnabled(b);
|
||||
w_1.setEnabled(b);
|
||||
dGrp.setEnabled(b);
|
||||
wGrp.setEnabled(b);
|
||||
}
|
||||
|
||||
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
|
||||
protected void updateData(ICResourceDescription cfg) {} // Do nothing. Data is read once after creation
|
||||
protected void updateButtons() {} // Do nothing. No buttons to update
|
||||
}
|
|
@ -27,7 +27,6 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
|||
private static final int SPACING = 5; // for radio buttons layout
|
||||
|
||||
private Button show_tree;
|
||||
// private Button show_mul;
|
||||
private Button show_mng;
|
||||
private Button show_tool;
|
||||
private Button show_exp;
|
||||
|
@ -41,7 +40,6 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
|||
private Button s_1;
|
||||
private Button s_2;
|
||||
|
||||
|
||||
public void createControls(Composite parent) {
|
||||
super.createControls(parent);
|
||||
usercomp.setLayout(new GridLayout(1, false));
|
||||
|
@ -50,10 +48,6 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
|||
show_mng.setText(UIMessages.getString("PropertyPageDefsTab.0")); //$NON-NLS-1$
|
||||
show_mng.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
// show_mul = new Button(usercomp, SWT.CHECK);
|
||||
// show_mul.setText(UIMessages.getString("PropertyPageDefsTab.2")); //$NON-NLS-1$
|
||||
// show_mul.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
show_tree = new Button(usercomp, SWT.CHECK);
|
||||
show_tree.setText(UIMessages.getString("PropertyPageDefsTab.1")); //$NON-NLS-1$
|
||||
show_tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
@ -101,7 +95,6 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
|||
b_3.setText(UIMessages.getString("PropertyPageDefsTab.9")); //$NON-NLS-1$
|
||||
|
||||
show_tree.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE));
|
||||
// show_mul.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
|
||||
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
|
||||
show_tool.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOTOOLM));
|
||||
show_exp.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT));
|
||||
|
@ -122,7 +115,6 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
|||
|
||||
protected void performOK() {
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_DTREE, show_tree.getSelection());
|
||||
// CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, show_mul.getSelection());
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOTOOLM, !show_tool.getSelection());
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_EXPORT, show_exp.getSelection());
|
||||
|
@ -140,7 +132,6 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
|||
|
||||
protected void performDefaults() {
|
||||
show_tree.setSelection(false);
|
||||
// show_mul.setSelection(false);
|
||||
show_mng.setSelection(true);
|
||||
show_tool.setSelection(true);
|
||||
show_exp.setSelection(false);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
|
@ -19,6 +20,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
|||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
@ -45,7 +47,14 @@ public abstract class AbstractCBuildPropertyTab extends AbstractCPropertyTab {
|
|||
return getCfg(getResDesc().getConfiguration());
|
||||
}
|
||||
public IConfiguration getCfg(ICConfigurationDescription cfgd) {
|
||||
return ManagedBuildManager.getConfigurationForDescription(cfgd);
|
||||
if (cfgd instanceof ICMultiConfigDescription) {
|
||||
ICConfigurationDescription[] cfds = (ICConfigurationDescription[])((ICMultiConfigDescription)cfgd).getItems();
|
||||
IConfiguration[] cfs = new IConfiguration[cfds.length];
|
||||
for (int i=0; i<cfds.length; i++)
|
||||
cfs[i] = ManagedBuildManager.getConfigurationForDescription(cfds[i]);
|
||||
return new MultiConfiguration(cfs, 9);
|
||||
} else
|
||||
return ManagedBuildManager.getConfigurationForDescription(cfgd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
@ -41,9 +43,9 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
|
|||
private Combo c1;
|
||||
private int savedPos = -1; // current project type
|
||||
private IConfiguration fCfg;
|
||||
private IBuildObjectProperties fProp;
|
||||
private IBuildObjectProperties fProperties;
|
||||
private IBuildPropertyValue[] values;
|
||||
private ITool targetTool;
|
||||
private ITool tTool;
|
||||
|
||||
public void createControls(Composite parent) {
|
||||
super.createControls(parent);
|
||||
|
@ -85,19 +87,26 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
|
|||
t4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
t4.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if(targetTool != null)
|
||||
targetTool.setOutputPrefixForPrimaryOutput(t4.getText());
|
||||
if(tTool != null)
|
||||
tTool.setOutputPrefixForPrimaryOutput(t4.getText());
|
||||
else if (fCfg instanceof IMultiConfiguration)
|
||||
((IMultiConfiguration)fCfg).setOutputPrefixForPrimaryOutput(t4.getText());
|
||||
|
||||
}} );
|
||||
updateData(getResDesc());
|
||||
}
|
||||
|
||||
private void typeChanged() {
|
||||
if (fProp == null) return;
|
||||
int n = c1.getSelectionIndex();
|
||||
if (n != savedPos) {
|
||||
savedPos = n;
|
||||
try {
|
||||
fProp.setProperty(PROPERTY, values[n].getId());
|
||||
if (fCfg instanceof IMultiConfiguration) {
|
||||
((IMultiConfiguration)fCfg).setBuildProperty(PROPERTY, values[n].getId());
|
||||
} else {
|
||||
if (fProperties == null) return;
|
||||
fProperties.setProperty(PROPERTY, values[n].getId());
|
||||
}
|
||||
} catch (CoreException ex) {
|
||||
ManagedBuilderUIPlugin.log(ex);
|
||||
}
|
||||
|
@ -108,16 +117,22 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
|
|||
public void updateData(ICResourceDescription cfgd) {
|
||||
if (cfgd == null) return;
|
||||
fCfg = getCfg();
|
||||
|
||||
fProp = fCfg.getBuildProperties();
|
||||
values = fProp.getSupportedValues(PROPERTY);
|
||||
if (page.isMultiCfg()) {
|
||||
fProperties = null;
|
||||
values = ((IMultiConfiguration)fCfg).getSupportedValues(PROPERTY);
|
||||
} else {
|
||||
fProperties = fCfg.getBuildProperties();
|
||||
values = fProperties.getSupportedValues(PROPERTY);
|
||||
}
|
||||
c1.removeAll();
|
||||
c1.setData(values);
|
||||
for (int i=0; i<values.length; i++) {
|
||||
c1.add(values[i].getName());
|
||||
}
|
||||
c1.setText(EMPTY_STR);
|
||||
IBuildProperty pr = fProp.getProperty(PROPERTY);
|
||||
IBuildProperty pr = (page.isMultiCfg()) ?
|
||||
((IMultiConfiguration)fCfg).getBuildProperty(PROPERTY) :
|
||||
fProperties.getProperty(PROPERTY);
|
||||
if (pr != null) {
|
||||
String s = pr.getValue().getId();
|
||||
for (int i=0; i<values.length; i++) {
|
||||
|
@ -135,14 +150,21 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
|
|||
getCfg().setArtifactName(CWizardHandler.removeSpaces(s));
|
||||
}
|
||||
t2.setText(s);
|
||||
|
||||
t3.setText(fCfg.getArtifactExtension());
|
||||
|
||||
targetTool = fCfg.calculateTargetTool();
|
||||
if(targetTool != null){
|
||||
tTool = fCfg.calculateTargetTool();
|
||||
if(tTool != null){
|
||||
if (l4 != null) l4.setVisible(true);
|
||||
if (t4 != null) {
|
||||
t4.setVisible(true);
|
||||
t4.setText(targetTool.getOutputPrefix());
|
||||
t4.setText(tTool.getOutputPrefix());
|
||||
}
|
||||
} else if (page.isMultiCfg()) {
|
||||
if (l4 != null) l4.setVisible(true);
|
||||
if (t4 != null) {
|
||||
t4.setVisible(true);
|
||||
t4.setText(((IMultiConfiguration)fCfg).getToolOutputPrefix());
|
||||
}
|
||||
} else {
|
||||
if (l4 != null) l4.setVisible(false);
|
||||
|
@ -178,14 +200,26 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
|
|||
public void performDefaults() {
|
||||
fCfg.setArtifactName(fCfg.getManagedProject().getDefaultArtifactName());
|
||||
fCfg.setArtifactExtension(null);
|
||||
if (targetTool != null)
|
||||
targetTool.setOutputPrefixForPrimaryOutput(null);
|
||||
if (tTool != null)
|
||||
tTool.setOutputPrefixForPrimaryOutput(null);
|
||||
else if (fCfg instanceof IMultiConfiguration)
|
||||
((IMultiConfiguration)fCfg).setOutputPrefixForPrimaryOutput(null);
|
||||
updateData(getResDesc());
|
||||
}
|
||||
|
||||
public boolean canBeVisible() {
|
||||
if (page.isForProject())
|
||||
return getCfg().getBuilder().isManagedBuildOn();
|
||||
if (page.isForProject()) {
|
||||
if (page.isMultiCfg()) {
|
||||
ICMultiItemsHolder mih = (ICMultiItemsHolder)getCfg();
|
||||
IConfiguration[] cfs = (IConfiguration[])mih.getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
if (cfs[i].getBuilder().isManagedBuildOn())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else
|
||||
return getCfg().getBuilder().isManagedBuildOn();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -14,9 +14,11 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
|||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildProcessManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.newmake.core.IMakeBuilderInfo;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.TriButton;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -57,9 +59,9 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
private Button b_cmdClean;
|
||||
private Text t_cmdClean;
|
||||
|
||||
private IBuilder bld;
|
||||
private Configuration cfg;
|
||||
|
||||
private IBuilder bldr;
|
||||
private IConfiguration icfg;
|
||||
|
||||
protected final int cpuNumber = BuildProcessManager.checkCPUNumber();
|
||||
|
||||
public void createControls(Composite parent) {
|
||||
|
@ -111,7 +113,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
((GridData)(b_parallelOpt.getLayoutData())).horizontalIndent = 15;
|
||||
b_parallelOpt.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
cfg.setParallelDef(b_parallelOpt.getSelection());
|
||||
setParallelDef(b_parallelOpt.getSelection());
|
||||
updateButtons();
|
||||
}});
|
||||
|
||||
|
@ -121,7 +123,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
((GridData)(b_parallelNum.getLayoutData())).horizontalIndent = 15;
|
||||
b_parallelNum.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
cfg.setParallelDef(!b_parallelNum.getSelection());
|
||||
setParallelDef(!b_parallelNum.getSelection());
|
||||
updateButtons();
|
||||
}});
|
||||
|
||||
|
@ -130,7 +132,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
parallelProcesses.setValues(cpuNumber, 1, 10000, 0, 1, 10);
|
||||
parallelProcesses.addSelectionListener(new SelectionAdapter () {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
cfg.setParallelNumber(parallelProcesses.getSelection());
|
||||
setParallelNumber(parallelProcesses.getSelection());
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
|
@ -148,9 +150,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
t_autoBuild = setupBlock(g4, b_autoBuild);
|
||||
t_autoBuild.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
try {
|
||||
bld.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, t_autoBuild.getText());
|
||||
} catch (CoreException ex) {}
|
||||
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, t_autoBuild.getText());
|
||||
}} );
|
||||
t_autoBuild.getAccessible().addAccessibleListener(makeTargetLabelAccessibleListener);
|
||||
setupLabel(g4, Messages.getString("BuilderSettingsTab.18"), 3, GridData.BEGINNING); //$NON-NLS-1$
|
||||
|
@ -158,18 +158,14 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
t_cmdBuild = setupBlock(g4, b_cmdBuild);
|
||||
t_cmdBuild.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
try {
|
||||
bld.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, t_cmdBuild.getText());
|
||||
} catch (CoreException ex) {}
|
||||
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, t_cmdBuild.getText());
|
||||
}} );
|
||||
t_cmdBuild.getAccessible().addAccessibleListener(makeTargetLabelAccessibleListener);
|
||||
b_cmdClean = setupCheck(g4, Messages.getString("BuilderSettingsTab.20"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
t_cmdClean = setupBlock(g4, b_cmdClean);
|
||||
t_cmdClean.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
try {
|
||||
bld.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, t_cmdClean.getText());
|
||||
} catch (CoreException ex) {}
|
||||
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, t_cmdClean.getText());
|
||||
}} );
|
||||
t_cmdClean.getAccessible().addAccessibleListener(makeTargetLabelAccessibleListener);
|
||||
}
|
||||
|
@ -178,33 +174,33 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
* sets widgets states
|
||||
*/
|
||||
protected void updateButtons() {
|
||||
bld = cfg.getEditableBuilder();
|
||||
bldr = icfg.getEditableBuilder();
|
||||
|
||||
b_stopOnError.setSelection(bld.isStopOnError());
|
||||
b_stopOnError.setSelection(bldr.isStopOnError());
|
||||
b_stopOnError.setEnabled(
|
||||
bld.supportsStopOnError(true) &&
|
||||
bld.supportsStopOnError(false));
|
||||
bldr.supportsStopOnError(true) &&
|
||||
bldr.supportsStopOnError(false));
|
||||
// parallel
|
||||
b_parallel.setSelection(cfg.getInternalBuilderParallel());
|
||||
b_parallelOpt.setSelection(cfg.getParallelDef());
|
||||
b_parallelNum.setSelection(!cfg.getParallelDef());
|
||||
int n = cfg.getParallelNumber();
|
||||
b_parallel.setSelection(getInternalBuilderParallel());
|
||||
b_parallelOpt.setSelection(getParallelDef());
|
||||
b_parallelNum.setSelection(!getParallelDef());
|
||||
int n = getParallelNumber();
|
||||
if (n < 0) n = -n;
|
||||
parallelProcesses.setSelection(n);
|
||||
|
||||
b_parallel.setVisible(bld.supportsParallelBuild());
|
||||
b_parallelOpt.setVisible(bld.supportsParallelBuild());
|
||||
b_parallelNum.setVisible(bld.supportsParallelBuild());
|
||||
parallelProcesses.setVisible(bld.supportsParallelBuild());
|
||||
b_parallel.setVisible(bldr.supportsParallelBuild());
|
||||
b_parallelOpt.setVisible(bldr.supportsParallelBuild());
|
||||
b_parallelNum.setVisible(bldr.supportsParallelBuild());
|
||||
parallelProcesses.setVisible(bldr.supportsParallelBuild());
|
||||
|
||||
b_autoBuild.setSelection(bld.isAutoBuildEnable());
|
||||
t_autoBuild.setText(bld.getBuildAttribute(IBuilder.BUILD_TARGET_AUTO, EMPTY_STR));
|
||||
b_cmdBuild.setSelection(bld.isIncrementalBuildEnabled());
|
||||
t_cmdBuild.setText(bld.getBuildAttribute(IBuilder.BUILD_TARGET_INCREMENTAL, EMPTY_STR));
|
||||
b_cmdClean.setSelection(bld.isCleanBuildEnabled());
|
||||
t_cmdClean.setText(bld.getBuildAttribute(IBuilder.BUILD_TARGET_CLEAN, EMPTY_STR));
|
||||
b_autoBuild.setSelection(bldr.isAutoBuildEnable());
|
||||
t_autoBuild.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_AUTO, EMPTY_STR));
|
||||
b_cmdBuild.setSelection(bldr.isIncrementalBuildEnabled());
|
||||
t_cmdBuild.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_INCREMENTAL, EMPTY_STR));
|
||||
b_cmdClean.setSelection(bldr.isCleanBuildEnabled());
|
||||
t_cmdClean.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_CLEAN, EMPTY_STR));
|
||||
|
||||
boolean external = ! cfg.isInternalBuilderEnabled();
|
||||
boolean external = ! isInternalBuilderEnabled();
|
||||
boolean parallel = b_parallel.getSelection();
|
||||
|
||||
b_parallelNum.setEnabled(parallel);
|
||||
|
@ -275,19 +271,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
c.setEnabled(val);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (b == b_autoBuild) {
|
||||
bld.setAutoBuildEnable(val);
|
||||
} else if (b == b_cmdBuild) {
|
||||
bld.setIncrementalBuildEnable(val);
|
||||
} else if (b == b_cmdClean) {
|
||||
bld.setCleanBuildEnable(val);
|
||||
} else if (b == b_stopOnError) {
|
||||
bld.setStopOnError(val);
|
||||
} else if (b == b_parallel) {
|
||||
bld.setParallelBuildOn(val);
|
||||
}
|
||||
} catch (CoreException e) {}
|
||||
setValue(b, val);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -298,9 +282,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
public void updateData(ICResourceDescription cfgd) {
|
||||
if (cfgd == null) return;
|
||||
IConfiguration icfg = getCfg(cfgd.getConfiguration());
|
||||
if (!(icfg instanceof Configuration)) return;
|
||||
cfg = (Configuration)icfg;
|
||||
icfg = getCfg(cfgd.getConfiguration());
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
|
@ -321,7 +303,111 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
}
|
||||
|
||||
protected void performDefaults() {
|
||||
BuilderSettingsTab.copyBuilders(bld.getSuperClass(), bld);
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
BuilderSettingsTab.copyBuilders(b.getSuperClass(), b);
|
||||
}
|
||||
} else
|
||||
BuilderSettingsTab.copyBuilders(bldr.getSuperClass(), bldr);
|
||||
updateData(getResDesc());
|
||||
}
|
||||
|
||||
private boolean getParallelDef() {
|
||||
if (icfg instanceof Configuration)
|
||||
return ((Configuration)icfg).getParallelDef();
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
return ((IMultiConfiguration)icfg).getParallelDef();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setParallelDef(boolean def) {
|
||||
if (icfg instanceof Configuration)
|
||||
((Configuration)icfg).setParallelDef(def);
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
((IMultiConfiguration)icfg).setParallelDef(def);
|
||||
}
|
||||
|
||||
private int getParallelNumber() {
|
||||
if (icfg instanceof Configuration)
|
||||
return ((Configuration)icfg).getParallelNumber();
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
return ((IMultiConfiguration)icfg).getParallelNumber();
|
||||
return 0;
|
||||
}
|
||||
private void setParallelNumber(int num) {
|
||||
if (icfg instanceof Configuration)
|
||||
((Configuration)icfg).setParallelNumber(num);
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
((IMultiConfiguration)icfg).setParallelNumber(num);
|
||||
}
|
||||
|
||||
private boolean getInternalBuilderParallel() {
|
||||
if (icfg instanceof Configuration)
|
||||
return ((Configuration)icfg).getInternalBuilderParallel();
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
return ((IMultiConfiguration)icfg).getInternalBuilderParallel();
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInternalBuilderEnabled() {
|
||||
if (icfg instanceof Configuration)
|
||||
return ((Configuration)icfg).isInternalBuilderEnabled();
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
return ((IMultiConfiguration)icfg).isInternalBuilderEnabled();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setBuildAttribute(String name, String value) {
|
||||
try {
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
b.setBuildAttribute(name, value);
|
||||
}
|
||||
} else {
|
||||
icfg.getEditableBuilder().setBuildAttribute(name, value);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setValue(Control b, boolean val) {
|
||||
try {
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder bld = cfs[i].getEditableBuilder();
|
||||
if (b == b_autoBuild) {
|
||||
bld.setAutoBuildEnable(val);
|
||||
} else if (b == b_cmdBuild) {
|
||||
bld.setIncrementalBuildEnable(val);
|
||||
} else if (b == b_cmdClean) {
|
||||
bld.setCleanBuildEnable(val);
|
||||
} else if (b == b_stopOnError) {
|
||||
bld.setStopOnError(val);
|
||||
} else if (b == b_parallel) {
|
||||
bld.setParallelBuildOn(val);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (b == b_autoBuild) {
|
||||
bldr.setAutoBuildEnable(val);
|
||||
} else if (b == b_cmdBuild) {
|
||||
bldr.setIncrementalBuildEnable(val);
|
||||
} else if (b == b_cmdClean) {
|
||||
bldr.setCleanBuildEnable(val);
|
||||
} else if (b == b_stopOnError) {
|
||||
bldr.setStopOnError(val);
|
||||
} else if (b == b_parallel) {
|
||||
bldr.setParallelBuildOn(val);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
|
@ -344,8 +345,18 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
// This page can be displayed for managed project only
|
||||
public boolean canBeVisible() {
|
||||
if (page.isForProject() || page.isForFile())
|
||||
return getCfg().getBuilder().isManagedBuildOn();
|
||||
if (page.isForProject() || page.isForFile()) {
|
||||
if (page.isMultiCfg()) {
|
||||
ICMultiItemsHolder mih = (ICMultiItemsHolder)getCfg();
|
||||
IConfiguration[] cfs = (IConfiguration[])mih.getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
if (cfs[i].getBuilder().isManagedBuildOn())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else
|
||||
return getCfg().getBuilder().isManagedBuildOn();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -14,8 +14,10 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
|||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.TriButton;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -50,9 +52,10 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
private Button b_dirWsp;
|
||||
private Button b_dirFile;
|
||||
private Button b_dirVars;
|
||||
private Group group_dir;
|
||||
|
||||
IBuilder bld;
|
||||
Configuration cfg;
|
||||
private IBuilder bldr;
|
||||
private IConfiguration icfg;
|
||||
|
||||
public void createControls(Composite parent) {
|
||||
super.createControls(parent);
|
||||
|
@ -67,7 +70,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
c_builderType.add(Messages.getString("BuilderSettingsTab.3")); //$NON-NLS-1$
|
||||
c_builderType.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
cfg.enableInternalBuilder(c_builderType.getSelectionIndex() == 1);
|
||||
enableInternalBuilder(c_builderType.getSelectionIndex() == 1);
|
||||
updateButtons();
|
||||
}});
|
||||
|
||||
|
@ -80,10 +83,10 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
String fullCommand = t_buildCmd.getText().trim();
|
||||
String buildCommand = parseMakeCommand(fullCommand);
|
||||
String buildArgs = fullCommand.substring(buildCommand.length()).trim();
|
||||
if(!buildCommand.equals(bld.getCommand())
|
||||
|| !buildArgs.equals(bld.getArguments())){
|
||||
bld.setCommand(buildCommand);
|
||||
bld.setArguments(buildArgs);
|
||||
if(!buildCommand.equals(bldr.getCommand())
|
||||
|| !buildArgs.equals(bldr.getArguments())){
|
||||
setCommand(buildCommand);
|
||||
setArguments(buildArgs);
|
||||
}
|
||||
}});
|
||||
|
||||
|
@ -94,14 +97,14 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
b_expandVars = setupTri(g2, Messages.getString("BuilderSettingsTab.8"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
|
||||
// Build location group
|
||||
Group g5 = setupGroup(usercomp, Messages.getString("BuilderSettingsTab.21"), 2, GridData.FILL_HORIZONTAL); //$NON-NLS-1$
|
||||
setupLabel(g5, Messages.getString("BuilderSettingsTab.22"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
t_dir = setupText(g5, 1, GridData.FILL_HORIZONTAL);
|
||||
group_dir = setupGroup(usercomp, Messages.getString("BuilderSettingsTab.21"), 2, GridData.FILL_HORIZONTAL); //$NON-NLS-1$
|
||||
setupLabel(group_dir, Messages.getString("BuilderSettingsTab.22"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
t_dir = setupText(group_dir, 1, GridData.FILL_HORIZONTAL);
|
||||
t_dir.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
bld.setBuildPath(t_dir.getText());
|
||||
setBuildPath(t_dir.getText());
|
||||
}} );
|
||||
Composite c = new Composite(g5, SWT.NONE);
|
||||
Composite c = new Composite(group_dir, SWT.NONE);
|
||||
setupControl(c, 2, GridData.FILL_HORIZONTAL);
|
||||
GridLayout f = new GridLayout(4, false);
|
||||
c.setLayout(f);
|
||||
|
@ -113,52 +116,53 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
}
|
||||
|
||||
void setManagedBuild(boolean enable) {
|
||||
try {
|
||||
bld.setManagedBuildOn(enable);
|
||||
page.informPages(MANAGEDBUILDSTATE, null);
|
||||
updateButtons();
|
||||
} catch (CoreException ex) {}
|
||||
setManagedBuildOn(enable);
|
||||
page.informPages(MANAGEDBUILDSTATE, null);
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* sets widgets states
|
||||
*/
|
||||
protected void updateButtons() {
|
||||
bld = cfg.getEditableBuilder();
|
||||
bldr = icfg.getEditableBuilder();
|
||||
|
||||
b_genMakefileAuto.setEnabled(cfg.supportsBuild(true));
|
||||
b_genMakefileAuto.setSelection(bld.isManagedBuildOn());
|
||||
b_useDefault.setSelection(bld.isDefaultBuildCmd());
|
||||
b_genMakefileAuto.setEnabled(icfg.supportsBuild(true));
|
||||
b_genMakefileAuto.setSelection(bldr.isManagedBuildOn());
|
||||
b_useDefault.setSelection(bldr.isDefaultBuildCmd());
|
||||
|
||||
c_builderType.select(cfg.isInternalBuilderEnabled() ? 1 : 0);
|
||||
c_builderType.select(isInternalBuilderEnabled() ? 1 : 0);
|
||||
c_builderType.setEnabled(
|
||||
cfg.canEnableInternalBuilder(true) &&
|
||||
cfg.canEnableInternalBuilder(false));
|
||||
canEnableInternalBuilder(true) &&
|
||||
canEnableInternalBuilder(false));
|
||||
|
||||
t_buildCmd.setText(getMC());
|
||||
|
||||
if(!bld.canKeepEnvironmentVariablesInBuildfile())
|
||||
if(!bldr.canKeepEnvironmentVariablesInBuildfile())
|
||||
b_expandVars.setEnabled(false);
|
||||
else {
|
||||
b_expandVars.setEnabled(true);
|
||||
b_expandVars.setSelection(!bld.keepEnvironmentVariablesInBuildfile());
|
||||
b_expandVars.setSelection(!bldr.keepEnvironmentVariablesInBuildfile());
|
||||
}
|
||||
t_dir.setText(bld.getBuildPath());
|
||||
// cfg.getBuildData().getBuilderCWD().toOSString());
|
||||
|
||||
boolean mbOn = bld.isManagedBuildOn();
|
||||
t_dir.setEnabled(!mbOn);
|
||||
b_dirVars.setEnabled(!mbOn);
|
||||
b_dirWsp.setEnabled(!mbOn);
|
||||
b_dirFile.setEnabled(!mbOn);
|
||||
|
||||
if (page.isMultiCfg()) {
|
||||
group_dir.setVisible(false);
|
||||
} else {
|
||||
group_dir.setVisible(true);
|
||||
t_dir.setText(bldr.getBuildPath());
|
||||
boolean mbOn = bldr.isManagedBuildOn();
|
||||
t_dir.setEnabled(!mbOn);
|
||||
b_dirVars.setEnabled(!mbOn);
|
||||
b_dirWsp.setEnabled(!mbOn);
|
||||
b_dirFile.setEnabled(!mbOn);
|
||||
}
|
||||
boolean external = (c_builderType.getSelectionIndex() == 0);
|
||||
|
||||
b_useDefault.setEnabled(external);
|
||||
t_buildCmd.setEnabled(external);
|
||||
((Control)t_buildCmd.getData()).setEnabled(external & ! b_useDefault.getSelection());
|
||||
|
||||
b_genMakefileAuto.setEnabled(external && cfg.supportsBuild(true));
|
||||
b_genMakefileAuto.setEnabled(external && icfg.supportsBuild(true));
|
||||
b_expandVars.setEnabled(external && b_genMakefileAuto.getSelection());
|
||||
|
||||
if (external) {
|
||||
|
@ -239,16 +243,14 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
c.setEnabled(val);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (b == b_useDefault) {
|
||||
bld.setUseDefaultBuildCmd(!val);
|
||||
} else if (b == b_genMakefileAuto) {
|
||||
setManagedBuild(val);
|
||||
} else if (b == b_expandVars) {
|
||||
if(bld.canKeepEnvironmentVariablesInBuildfile())
|
||||
bld.setKeepEnvironmentVariablesInBuildfile(!val);
|
||||
}
|
||||
} catch (CoreException e) {}
|
||||
if (b == b_useDefault) {
|
||||
setUseDefaultBuildCmd(!val);
|
||||
} else if (b == b_genMakefileAuto) {
|
||||
setManagedBuild(val);
|
||||
} else if (b == b_expandVars) {
|
||||
if(bldr.canKeepEnvironmentVariablesInBuildfile())
|
||||
setKeepEnvironmentVariablesInBuildfile(!val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,8 +258,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
* @return
|
||||
*/
|
||||
private String getMC() {
|
||||
String makeCommand = bld.getCommand();
|
||||
String makeArgs = bld.getArguments();
|
||||
String makeCommand = bldr.getCommand();
|
||||
String makeArgs = bldr.getArguments();
|
||||
if (makeArgs != null) { makeCommand += " " + makeArgs; } //$NON-NLS-1$
|
||||
return makeCommand;
|
||||
}
|
||||
|
@ -269,9 +271,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
public void updateData(ICResourceDescription cfgd) {
|
||||
if (cfgd == null) return;
|
||||
IConfiguration icfg = getCfg(cfgd.getConfiguration());
|
||||
if (!(icfg instanceof Configuration)) return;
|
||||
cfg = (Configuration)icfg;
|
||||
icfg = getCfg(cfgd.getConfiguration());
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,96 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
}
|
||||
|
||||
protected void performDefaults() {
|
||||
copyBuilders(bld.getSuperClass(), bld);
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
copyBuilders(b.getSuperClass(), b);
|
||||
}
|
||||
} else
|
||||
copyBuilders(bldr.getSuperClass(), bldr);
|
||||
updateData(getResDesc());
|
||||
}
|
||||
|
||||
private boolean canEnableInternalBuilder(boolean v) {
|
||||
if (icfg instanceof Configuration)
|
||||
return ((Configuration)icfg).canEnableInternalBuilder(v);
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
return ((IMultiConfiguration)icfg).canEnableInternalBuilder(v);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void enableInternalBuilder(boolean v) {
|
||||
if (icfg instanceof Configuration)
|
||||
((Configuration)icfg).enableInternalBuilder(v);
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
((IMultiConfiguration)icfg).enableInternalBuilder(v);
|
||||
}
|
||||
|
||||
private boolean isInternalBuilderEnabled() {
|
||||
if (icfg instanceof Configuration)
|
||||
return ((Configuration)icfg).isInternalBuilderEnabled();
|
||||
if (icfg instanceof IMultiConfiguration)
|
||||
return ((IMultiConfiguration)icfg).isInternalBuilderEnabled();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setUseDefaultBuildCmd(boolean val) {
|
||||
|
||||
}
|
||||
private void setKeepEnvironmentVariablesInBuildfile(boolean val) {
|
||||
|
||||
}
|
||||
|
||||
private void setCommand(String buildCommand) {
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
b.setCommand(buildCommand);
|
||||
}
|
||||
} else {
|
||||
icfg.getEditableBuilder().setCommand(buildCommand);
|
||||
}
|
||||
}
|
||||
|
||||
private void setArguments(String makeArgs) {
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
b.setArguments(makeArgs);
|
||||
}
|
||||
} else {
|
||||
icfg.getEditableBuilder().setArguments(makeArgs);
|
||||
}
|
||||
}
|
||||
|
||||
private void setBuildPath(String path) {
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
b.setBuildPath(path);
|
||||
}
|
||||
} else {
|
||||
icfg.getEditableBuilder().setBuildPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
private void setManagedBuildOn(boolean on) {
|
||||
try {
|
||||
if (icfg instanceof IMultiConfiguration) {
|
||||
IConfiguration[] cfs = (IConfiguration[])((IMultiConfiguration)icfg).getItems();
|
||||
for (int i=0; i<cfs.length; i++) {
|
||||
IBuilder b = cfs[i].getEditableBuilder();
|
||||
b.setManagedBuildOn(on);
|
||||
}
|
||||
} else {
|
||||
icfg.getEditableBuilder().setManagedBuildOn(on);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.ui.newui.CLocationOutputTab;
|
||||
|
@ -20,7 +21,11 @@ import org.eclipse.cdt.ui.newui.CLocationOutputTab;
|
|||
public class CBuildLocationOutputTab extends CLocationOutputTab {
|
||||
|
||||
public boolean canBeVisible() {
|
||||
if (!page.isForProject()) return false;
|
||||
if (!page.isForProject())
|
||||
return false; // for project only
|
||||
if (getResDesc() instanceof ICMultiItemsHolder)
|
||||
return false; // multi cfgs not supported for now
|
||||
|
||||
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(getResDesc().getConfiguration());
|
||||
return !cfg.getBuilder().isManagedBuildOn();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -21,7 +22,9 @@ import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
|||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariableStatus;
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.EclipseVariablesVariableSupplier;
|
||||
|
@ -29,7 +32,7 @@ import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
|
|||
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
|
||||
import org.eclipse.cdt.internal.core.cdtvariables.UserDefinedVariableSupplier;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.CDTListComparator;
|
||||
import org.eclipse.cdt.ui.newui.AbstractPage;
|
||||
import org.eclipse.cdt.ui.newui.PrefPage_Abstract;
|
||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
||||
|
@ -109,8 +112,9 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
|
||||
private static final String VALUE_DELIMITER = " || "; //$NON-NLS-1$
|
||||
|
||||
private static final ICdtVariableManager mgr = CCorePlugin.getDefault().getCdtVariableManager();
|
||||
private static final UserDefinedVariableSupplier fUserSupplier = CdtVariableManager.fUserDefinedMacroSupplier;
|
||||
private static final ICdtVariableManager vmgr = CCorePlugin.getDefault().getCdtVariableManager();
|
||||
private static final UserDefinedVariableSupplier fUserSup = CdtVariableManager.fUserDefinedMacroSupplier;
|
||||
private static final EnvCmp comparator = new EnvCmp();
|
||||
|
||||
private ICConfigurationDescription cfgd = null;
|
||||
private StorableCdtVariables vars = null;
|
||||
|
@ -243,7 +247,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
public void buttonPressed(int index){
|
||||
switch(index){
|
||||
case 0:{
|
||||
NewVarDialog dlg = new NewVarDialog(usercomp.getShell(), null, cfgd, mgr.getVariables(cfgd));
|
||||
NewVarDialog dlg = new NewVarDialog(usercomp.getShell(), null, cfgd, getVariables());
|
||||
if(dlg.open() == Dialog.OK){
|
||||
ICdtVariable macro = dlg.getDefinedMacro();
|
||||
if(canCreate(macro)) {
|
||||
|
@ -251,9 +255,15 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
if (dlg.isForAllCfgs) {
|
||||
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
|
||||
for (int k=0; k<cfgs.length; k++)
|
||||
fUserSupplier.createMacro(macro, CONTEXT, cfgs[k]);
|
||||
} else
|
||||
fUserSupplier.createMacro(macro, CONTEXT, cfgd);
|
||||
fUserSup.createMacro(macro, CONTEXT, cfgs[k]);
|
||||
} else {
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
|
||||
for (int k=0; k<cfs.length; k++)
|
||||
fUserSup.createMacro(macro, CONTEXT, cfs[k]);
|
||||
} else
|
||||
fUserSup.createMacro(macro, CONTEXT, cfgd);
|
||||
}
|
||||
}
|
||||
else if (vars != null)
|
||||
vars.createMacro(macro);
|
||||
|
@ -265,12 +275,18 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
case 1:{
|
||||
ICdtVariable _vars[] = getSelectedUserMacros();
|
||||
if(_vars != null && _vars.length == 1){
|
||||
NewVarDialog dlg = new NewVarDialog(usercomp.getShell() ,_vars[0], cfgd, mgr.getVariables(cfgd));
|
||||
NewVarDialog dlg = new NewVarDialog(usercomp.getShell() ,_vars[0], cfgd, getVariables());
|
||||
if(dlg.open() == Dialog.OK){
|
||||
ICdtVariable macro = dlg.getDefinedMacro();
|
||||
if(canCreate(macro)) {
|
||||
if (cfgd != null)
|
||||
fUserSupplier.createMacro(macro, CONTEXT, cfgd);
|
||||
if (cfgd != null) {
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
|
||||
for (int k=0; k<cfs.length; k++)
|
||||
fUserSup.createMacro(macro, CONTEXT, cfs[k]);
|
||||
} else
|
||||
fUserSup.createMacro(macro, CONTEXT, cfgd);
|
||||
}
|
||||
else if (vars != null)
|
||||
vars.createMacro(macro);
|
||||
updateData();
|
||||
|
@ -286,8 +302,15 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
UIMessages.getString(DELETE_CONFIRM_TITLE),
|
||||
UIMessages.getString(DELETE_CONFIRM_MESSAGE))){
|
||||
for(int i = 0; i < macros.length; i++){
|
||||
if (cfgd != null)
|
||||
fUserSupplier.deleteMacro(macros[i].getName(), CONTEXT, cfgd);
|
||||
if (cfgd != null) {
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
|
||||
for (int k=0; k<cfs.length; k++)
|
||||
fUserSup.deleteMacro(macros[i].getName(), CONTEXT, cfs[k]);
|
||||
}
|
||||
else
|
||||
fUserSup.deleteMacro(macros[i].getName(), CONTEXT, cfgd);
|
||||
}
|
||||
else if (vars != null)
|
||||
vars.deleteMacro(macros[i].getName());
|
||||
}
|
||||
|
@ -315,8 +338,14 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
if(MessageDialog.openQuestion(usercomp.getShell(),
|
||||
UIMessages.getString(DELETE_ALL_CONFIRM_TITLE),
|
||||
UIMessages.getString(DELETE_ALL_CONFIRM_MESSAGE))){
|
||||
if (cfgd != null)
|
||||
fUserSupplier.deleteAll(CONTEXT, cfgd);
|
||||
if (cfgd != null) {
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
fUserSup.deleteAll(CONTEXT, cfs[i]);
|
||||
} else
|
||||
fUserSup.deleteAll(CONTEXT, cfgd);
|
||||
}
|
||||
else if (vars != null)
|
||||
vars.deleteAll();
|
||||
updateData();
|
||||
|
@ -420,7 +449,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
if (_cfgd == null) {
|
||||
cfgd = null;
|
||||
if (vars == null)
|
||||
vars = fUserSupplier.getWorkspaceVariablesCopy();
|
||||
vars = fUserSup.getWorkspaceVariablesCopy();
|
||||
} else {
|
||||
cfgd = _cfgd.getConfiguration();
|
||||
vars = null;
|
||||
|
@ -428,18 +457,41 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
updateData();
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
if(tv == null) return;
|
||||
|
||||
// check integrity
|
||||
private void checkVariableIntegrity() {
|
||||
try{
|
||||
mgr.checkVariableIntegrity(cfgd);
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
vmgr.checkVariableIntegrity(cfs[i]);
|
||||
} else
|
||||
vmgr.checkVariableIntegrity(cfgd);
|
||||
updateState(null);
|
||||
} catch (CdtVariableException e){
|
||||
updateState(e);
|
||||
}
|
||||
}
|
||||
|
||||
private ICdtVariable[] getVariables() {
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICMultiItemsHolder mih = (ICMultiItemsHolder)cfgd;
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])mih.getItems();
|
||||
ICdtVariable[][] vs = new ICdtVariable[cfs.length][];
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
vs[i] = vmgr.getVariables(cfs[i]);
|
||||
Object[] obs = mih.getListForDisplay(vs, comparator);
|
||||
ICdtVariable[] v = new ICdtVariable[obs.length];
|
||||
System.arraycopy(obs, 0, v, 0, obs.length);
|
||||
return v;
|
||||
} else
|
||||
return vmgr.getVariables(cfgd);
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
if(tv == null) return;
|
||||
|
||||
checkVariableIntegrity();
|
||||
// get variables
|
||||
ICdtVariable[] _vars = mgr.getVariables(cfgd);
|
||||
ICdtVariable[] _vars = getVariables();
|
||||
if (_vars == null) return;
|
||||
if (cfgd == null) {
|
||||
if (fShowSysMacros) {
|
||||
|
@ -456,7 +508,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
}
|
||||
// add system vars not rewritten by user's
|
||||
for (int j=0; j<_vars.length; j++) {
|
||||
if (_vars[j] != null && !mgr.isUserVariable(_vars[j], null))
|
||||
if (_vars[j] != null && !vmgr.isUserVariable(_vars[j], null))
|
||||
lst.add(_vars[j]);
|
||||
}
|
||||
_vars = (ICdtVariable[])lst.toArray(new ICdtVariable[lst.size()]);
|
||||
|
@ -491,8 +543,22 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
fStatusLabel.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether variable is user's
|
||||
* @param v - variable to check
|
||||
* @return
|
||||
*/
|
||||
private boolean isUserVar(ICdtVariable v) {
|
||||
return cfgd != null ? mgr.isUserVariable(v, cfgd) : vars.contains(v);
|
||||
if (cfgd == null)
|
||||
return vars.contains(v);
|
||||
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
|
||||
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
if (vmgr.isUserVariable(v, cfs[i]))
|
||||
return true;
|
||||
return false;
|
||||
} else
|
||||
return vmgr.isUserVariable(v, cfgd);
|
||||
}
|
||||
|
||||
/* check whether variable is dynamic */
|
||||
|
@ -512,7 +578,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
String value = EMPTY_STR;
|
||||
try {
|
||||
if (CdtVariableResolver.isStringListVariable(v.getValueType()))
|
||||
value = mgr.convertStringListToString(v.getStringListValue(), VALUE_DELIMITER);
|
||||
value = vmgr.convertStringListToString(v.getStringListValue(), VALUE_DELIMITER);
|
||||
else
|
||||
value = v.getStringValue();
|
||||
} catch (CdtVariableException e1) {}
|
||||
|
@ -520,11 +586,27 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
public void performApply(ICResourceDescription src, ICResourceDescription dst) {
|
||||
if (cfgd != null) {// only for project, not for prefs
|
||||
ICdtVariable[] vs = fUserSupplier.getMacros(CONTEXT, src.getConfiguration());
|
||||
fUserSupplier.setMacros(vs, CONTEXT, dst.getConfiguration());
|
||||
if (cfgd != null) {// only for project, not for prefs
|
||||
if (page.isMultiCfg()) {
|
||||
if (src instanceof ICMultiItemsHolder &&
|
||||
dst instanceof ICMultiItemsHolder) {
|
||||
ICMultiItemsHolder s = (ICMultiItemsHolder)src;
|
||||
ICMultiItemsHolder d = (ICMultiItemsHolder)dst;
|
||||
ICResourceDescription[] r0 = (ICResourceDescription[])s.getItems();
|
||||
ICResourceDescription[] r1 = (ICResourceDescription[])d.getItems();
|
||||
if (r0.length != r1.length)
|
||||
return; // unprobable
|
||||
for (int i=0; i<r0.length; i++) {
|
||||
ICdtVariable[] vs = fUserSup.getMacros(CONTEXT, r0[i].getConfiguration());
|
||||
fUserSup.setMacros(vs, CONTEXT, r1[i].getConfiguration());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ICdtVariable[] vs = fUserSup.getMacros(CONTEXT, src.getConfiguration());
|
||||
fUserSup.setMacros(vs, CONTEXT, dst.getConfiguration());
|
||||
}
|
||||
} else if (vars != null)
|
||||
fUserSupplier.storeWorkspaceVariables(true);
|
||||
fUserSup.storeWorkspaceVariables(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -533,13 +615,14 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
*/
|
||||
protected void performOK() {
|
||||
if (vars != null) try {
|
||||
if (fUserSupplier.setWorkspaceVariables(vars))
|
||||
if (fUserSup.setWorkspaceVariables(vars))
|
||||
if (page instanceof PrefPage_Abstract)
|
||||
PrefPage_Abstract.isChanged = true;
|
||||
} catch (CoreException e) {}
|
||||
vars = null;
|
||||
super.performOK();
|
||||
}
|
||||
|
||||
protected void performCancel() {
|
||||
vars = null;
|
||||
super.performCancel();
|
||||
|
@ -549,4 +632,27 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
|||
public boolean canBeVisible() {
|
||||
return page.isForProject() || page.isForPrefs();
|
||||
}
|
||||
|
||||
private static class EnvCmp implements Comparator {
|
||||
|
||||
public int compare(Object a0, Object a1) {
|
||||
if (a0 == null || a1 == null)
|
||||
return 0;
|
||||
if (a0 instanceof ICdtVariable &&
|
||||
a1 instanceof ICdtVariable) {
|
||||
ICdtVariable x0 = (ICdtVariable)a0;
|
||||
ICdtVariable x1 = (ICdtVariable)a1;
|
||||
String s0 = x0.getName();
|
||||
if (s0 == null)
|
||||
s0 = AbstractPage.EMPTY_STR;
|
||||
String s1 = x1.getName();
|
||||
if (s1 == null)
|
||||
s1 = AbstractPage.EMPTY_STR;
|
||||
return(s0.compareTo(s1));
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
|||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
|
@ -34,7 +35,6 @@ import org.eclipse.cdt.managedbuilder.core.IInputType;
|
|||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.CDTListComparator;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||
|
@ -60,19 +60,19 @@ import org.eclipse.swt.widgets.TableItem;
|
|||
|
||||
public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInfoContainer {
|
||||
|
||||
private static final String NAMESPACE = "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
|
||||
private static final String POINT = "DiscoveryProfilePage"; //$NON-NLS-1$
|
||||
protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
|
||||
private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$
|
||||
private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$
|
||||
private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
|
||||
private static final String SC_GROUP_LABEL = PREFIX + ".scGroup.label"; //$NON-NLS-1$
|
||||
private static final String SC_ENABLED_BUTTON = PREFIX + ".scGroup.enabled.button"; //$NON-NLS-1$
|
||||
private static final String SC_PROBLEM_REPORTING_ENABLED_BUTTON = PREFIX + ".scGroup.problemReporting.enabled.button"; //$NON-NLS-1$
|
||||
private static final String SC_SELECTED_PROFILE_COMBO = PREFIX + ".scGroup.selectedProfile.combo"; //$NON-NLS-1$
|
||||
private static final String NAMESPACE = "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
|
||||
private static final String POINT = "DiscoveryProfilePage"; //$NON-NLS-1$
|
||||
private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$
|
||||
private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$
|
||||
private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
|
||||
// private static final String MULTI_MSG = Messages.getString("DiscoveryTab.4"); //$NON-NLS-1$
|
||||
private static final int DEFAULT_HEIGHT = 110;
|
||||
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 20 };
|
||||
|
||||
private Table resTable;
|
||||
private Button scEnabledButton;
|
||||
private Button scProblemReportingEnabledButton;
|
||||
|
@ -187,17 +187,23 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
}
|
||||
|
||||
public void updateData(ICResourceDescription rcfg) {
|
||||
configPath = rcfg.getPath();
|
||||
IConfiguration cfg = getCfg(rcfg.getConfiguration());
|
||||
cbi = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
|
||||
if(!page.isForPrefs() && baseInfoMap == null){
|
||||
try {
|
||||
IScannerConfigBuilderInfo2Set baseCbi = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
|
||||
baseInfoMap = baseCbi.getInfoMap();
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (page.isMultiCfg()) {
|
||||
usercomp.setVisible(false);
|
||||
return;
|
||||
} else {
|
||||
usercomp.setVisible(true);
|
||||
configPath = rcfg.getPath();
|
||||
IConfiguration cfg = getCfg(rcfg.getConfiguration());
|
||||
cbi = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
|
||||
if(!page.isForPrefs() && baseInfoMap == null){
|
||||
try {
|
||||
IScannerConfigBuilderInfo2Set baseCbi = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
|
||||
baseInfoMap = baseCbi.getInfoMap();
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
updateData();
|
||||
}
|
||||
updateData();
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
|
@ -233,20 +239,26 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
}
|
||||
int len = resTable.getItemCount();
|
||||
if (len > 0) {
|
||||
scGroup.setVisible(true);
|
||||
profileComp.setVisible(true);
|
||||
resTable.setEnabled(true);
|
||||
setVisibility(null);
|
||||
resTable.select((pos < len && pos > -1) ? pos : 0);
|
||||
handleToolSelected();
|
||||
} else {
|
||||
scGroup.setVisible(false);
|
||||
profileComp.setVisible(false);
|
||||
TableItem ti = new TableItem(resTable, SWT.NONE);
|
||||
resTable.setEnabled(false);
|
||||
ti.setText(Messages.getString("DiscoveryTab.6")); //$NON-NLS-1$
|
||||
setVisibility(Messages.getString("DiscoveryTab.6")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private void setVisibility(String errMsg) {
|
||||
scGroup.setVisible(errMsg == null);
|
||||
profileComp.setVisible(errMsg == null);
|
||||
resTable.setEnabled(errMsg == null);
|
||||
if (errMsg != null) {
|
||||
String[] ss = errMsg.split("\n"); //$NON-NLS-1$
|
||||
for (int i=0; i<ss.length; i++)
|
||||
new TableItem(resTable, SWT.NONE).setText(ss[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getProfileName(String id) {
|
||||
int x = id.lastIndexOf("."); //$NON-NLS-1$
|
||||
return (x == -1) ? id : id.substring(x+1);
|
||||
|
@ -425,6 +437,8 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
}
|
||||
|
||||
public void performApply(ICResourceDescription src,ICResourceDescription dst) {
|
||||
if (page.isMultiCfg())
|
||||
return;
|
||||
ICfgScannerConfigBuilderInfo2Set cbi1 =
|
||||
CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(src.getConfiguration()));
|
||||
ICfgScannerConfigBuilderInfo2Set cbi2 =
|
||||
|
@ -456,7 +470,8 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
}
|
||||
|
||||
private void performOK(boolean ok) {
|
||||
|
||||
if (page.isMultiCfg())
|
||||
return;
|
||||
if (buildInfo == null)
|
||||
return;
|
||||
String savedId = buildInfo.getSelectedProfileId();
|
||||
|
@ -574,6 +589,8 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
public ICConfigurationDescription getConfiguration() { return getResDesc().getConfiguration(); }
|
||||
|
||||
protected void performDefaults() {
|
||||
if (page.isMultiCfg())
|
||||
return;
|
||||
cbi.setPerRcTypeDiscovery(true);
|
||||
Iterator it = cbi.getInfoMap().keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Comparator;
|
|||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacro;
|
||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacro;
|
||||
|
@ -152,7 +153,7 @@ public class NewVarDialog extends Dialog {
|
|||
}
|
||||
});
|
||||
|
||||
if (fEditedMacro == null && cfgd != null) {
|
||||
if (fEditedMacro == null && cfgd != null && !(cfgd instanceof ICMultiItemsHolder)) {
|
||||
Button c_all = new Button(comp, SWT.CHECK);
|
||||
c_all.setText(Messages.getString("NewVarDialog.1")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.BEGINNING);
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Collections;
|
|||
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildListComparator;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
|
@ -75,7 +76,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
|||
private Combo c_tool;
|
||||
private Button button_edit;
|
||||
private Group tools_group;
|
||||
|
||||
private Group single_tool_group;
|
||||
private Label st_builder;
|
||||
private Label st_toolchain;
|
||||
private Label st_tool;
|
||||
|
@ -124,8 +125,8 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
// make table for tools list
|
||||
if (page.isForFile()) {
|
||||
Group g = setupGroup(usercomp, Messages.getString("ToolChainEditTab.5"), 2, GridData.FILL_BOTH); //$NON-NLS-1$
|
||||
c_tool = new Combo(g, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER);
|
||||
single_tool_group = setupGroup(usercomp, Messages.getString("ToolChainEditTab.5"), 2, GridData.FILL_BOTH); //$NON-NLS-1$
|
||||
c_tool = new Combo(single_tool_group, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
c_tool.setLayoutData(gd);
|
||||
|
@ -134,7 +135,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
|||
saveToolSelected();
|
||||
}});
|
||||
|
||||
st_tool = setupLabel(g, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
|
||||
st_tool = setupLabel(single_tool_group, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
|
||||
st_tool.setForeground(red);
|
||||
} else { // Folder or Project
|
||||
tools_group = setupGroup(usercomp, Messages.getString("ToolChainEditTab.3"), 2, GridData.FILL_BOTH); //$NON-NLS-1$
|
||||
|
@ -169,6 +170,12 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
|||
}
|
||||
|
||||
protected void updateData(ICResourceDescription rcfg) {
|
||||
if (page.isMultiCfg()) {
|
||||
usercomp.setVisible(false);
|
||||
return;
|
||||
} else {
|
||||
usercomp.setVisible(true);
|
||||
}
|
||||
cfg = getCfg(rcfg.getConfiguration());
|
||||
ri = cfg.getResourceInfo(rcfg.getPath(), false);
|
||||
mod = getModification();
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildListComparator;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IModificationStatus;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
|
|
|
@ -592,9 +592,14 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
|
|||
}
|
||||
|
||||
public void updateData(ICResourceDescription cfgd) {
|
||||
fInfo = getResCfg(cfgd);
|
||||
setValues();
|
||||
handleOptionSelection();
|
||||
if (page.isMultiCfg()) {
|
||||
usercomp.setVisible(false);
|
||||
} else {
|
||||
usercomp.setVisible(true);
|
||||
fInfo = getResCfg(cfgd);
|
||||
setValues();
|
||||
handleOptionSelection();
|
||||
}
|
||||
}
|
||||
|
||||
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
|
||||
|
@ -621,6 +626,8 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
|
|||
public void updateTitle() {}
|
||||
|
||||
public boolean canBeVisible() {
|
||||
if (page.isMultiCfg())
|
||||
return false;
|
||||
return getCfg().getBuilder().isManagedBuildOn();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ DiscoveryTab.0=Discovery profiles scope
|
|||
DiscoveryTab.1=Per Language
|
||||
DiscoveryTab.2=Configuration-wide
|
||||
DiscoveryTab.3=Unknown
|
||||
DiscoveryTab.4=Not applicable\nin multi-cfg mode \!
|
||||
DiscoveryTab.6=No profiles found
|
||||
DiscoveryTab.7=InfoContexts are different \!
|
||||
ToolSelectionDialog.0=Select tools
|
||||
|
|
|
@ -19,10 +19,10 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyManager;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildListComparator;
|
||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.BuildListComparator;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
|
||||
|
|
|
@ -8,23 +8,19 @@
|
|||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.newui;
|
||||
package org.eclipse.cdt.core.model.util;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.ui.newui.AbstractExportTab.ExtData;
|
||||
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
|
||||
|
||||
public class CDTListComparator implements Comparator {
|
||||
private static CDTListComparator comparator = null;
|
||||
protected static Comparator comparator = null;
|
||||
|
||||
public static CDTListComparator getInstance() {
|
||||
public static Comparator getInstance() {
|
||||
if (comparator == null)
|
||||
comparator = new CDTListComparator();
|
||||
return comparator;
|
||||
|
@ -47,26 +43,11 @@ public class CDTListComparator implements Comparator {
|
|||
ICConfigurationDescription c2 = (ICConfigurationDescription)b;
|
||||
return c1.getName().compareToIgnoreCase(c2.getName());
|
||||
}
|
||||
if (a instanceof ExtData) {
|
||||
ExtData c1 = (ExtData)a;
|
||||
ExtData c2 = (ExtData)b;
|
||||
return c1.getName().compareToIgnoreCase(c2.getName());
|
||||
}
|
||||
if (a instanceof ICdtVariable) {
|
||||
ICdtVariable c1 = (ICdtVariable) a;
|
||||
ICdtVariable c2 = (ICdtVariable) b;
|
||||
return c1.getName().compareToIgnoreCase(c2.getName());
|
||||
}
|
||||
if (a instanceof IConfigurationElement) {
|
||||
IConfigurationElement e1 = (IConfigurationElement)a;
|
||||
IConfigurationElement e2 = (IConfigurationElement)b;
|
||||
return AbstractPage.getWeight(e1).compareTo(AbstractPage.getWeight(e2));
|
||||
}
|
||||
if (a instanceof EntryDescriptor) {
|
||||
EntryDescriptor c1 = (EntryDescriptor) a;
|
||||
EntryDescriptor c2 = (EntryDescriptor) b;
|
||||
return c1.getName().compareToIgnoreCase(c2.getName());
|
||||
}
|
||||
return a.toString().compareTo(b.toString());
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
public interface ICMultiConfigDescription extends ICConfigurationDescription, ICMultiItemsHolder {
|
||||
String[] getErrorParserIDs();
|
||||
void setErrorParserIDs(String[] s);
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Implementors of this interface are intended
|
||||
* to hold 1 or more items and perform
|
||||
* some simultaneous operations on them.
|
||||
*
|
||||
* There are no any restrictions for items
|
||||
* types to be held.
|
||||
*
|
||||
* As common rule, items are set in constructor
|
||||
* and their list cannot be changed in life time.
|
||||
*
|
||||
*/
|
||||
public interface ICMultiItemsHolder {
|
||||
/*
|
||||
* Constants for String list display mode
|
||||
*/
|
||||
// display conjunction of lists entries (common ones)
|
||||
public static final int DMODE_CONJUNCTION = 1;
|
||||
// display empty list if item's lists are different
|
||||
public static final int DMODE_EMPTY = 2;
|
||||
// display all items from all lists (except doubles)
|
||||
public static final int DMODE_ALL = 4;
|
||||
// display modes mask
|
||||
public static final int DMODES = DMODE_CONJUNCTION | DMODE_EMPTY | DMODE_ALL;
|
||||
/*
|
||||
* Constants for string list apply mode
|
||||
*/
|
||||
// write to all items the list presented now.
|
||||
public static final int WMODE_CURRENT = 8;
|
||||
// apply to all items all insertions/deletions made
|
||||
public static final int WMODE_DIFF = 16;
|
||||
// write modes mask
|
||||
public static final int WMODES = WMODE_CURRENT | WMODE_DIFF;
|
||||
|
||||
// default setting
|
||||
public static final int MODE_DEFAULT = DMODE_CONJUNCTION | WMODE_CURRENT;
|
||||
|
||||
/*
|
||||
* General purpose objects
|
||||
*/
|
||||
public static final String EMPTY_STR = "";
|
||||
public static final Object[] EMPTY_ARRAY = new Object[0];
|
||||
|
||||
|
||||
/**
|
||||
* Returns array of items which it holds
|
||||
* @return
|
||||
*/
|
||||
Object[] getItems();
|
||||
|
||||
/**
|
||||
* @see DMODE_CONJUNCTION
|
||||
* @see DMODE_EMPTY
|
||||
* @see DMODE_ALL
|
||||
* @see WMODE_DIFF
|
||||
* @see WMODE_CURRENT
|
||||
|
||||
* @return current string list mode (OR'ed display and write modes)
|
||||
*/
|
||||
int getStringListMode();
|
||||
|
||||
/**
|
||||
* @see DMODE_CONJUNCTION
|
||||
* @see DMODE_EMPTY
|
||||
* @see DMODE_ALL
|
||||
* @see WMODE_DIFF
|
||||
* @see WMODE_CURRENT
|
||||
*
|
||||
* @param mode: OR'ed display and write modes
|
||||
*/
|
||||
void setStringListMode(int mode);
|
||||
|
||||
/*
|
||||
* A set of methods which form an array of objects
|
||||
* on a basis of 2-dim array and DISPLAY MODE
|
||||
*/
|
||||
String[] getStrListForDisplay(String[][] input);
|
||||
String[] getStrListForDisplay(String[][] input, int mode);
|
||||
// Object[] getListForDisplay(Object[][] input);
|
||||
// Object[] getListForDisplay(Object[][] input, int mode);
|
||||
Object[] getListForDisplay(Object[][] input, Comparator cmp);
|
||||
// Object[] getListForDisplay(Object[][] input, int mode, Comparator cmp);
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICMultiResourceDescription extends ICResourceDescription, ICMultiItemsHolder {
|
||||
|
||||
void setSettingEntries(ICLanguageSetting lang, int kind, List incs, boolean toAll);
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.internal.core.settings.model.MultiConfigDescription;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class MultiItemsHolder implements ICMultiItemsHolder {
|
||||
protected int fListMode = MODE_DEFAULT;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#getItems()
|
||||
*/
|
||||
public abstract Object[] getItems();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#getStringListMode()
|
||||
*/
|
||||
public int getStringListMode() {
|
||||
return fListMode;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#setStringListMode(int)
|
||||
*/
|
||||
public void setStringListMode(int mode) {
|
||||
int a = mode & DMODES;
|
||||
int b = mode & WMODES;
|
||||
if (a == DMODES || b == WMODES) { // conflicting settings;
|
||||
CCorePlugin.log("Wrong string list mode: " + mode);
|
||||
return;
|
||||
}
|
||||
else if (a == 0) // display mode not set
|
||||
mode |= (fListMode & DMODES); // use existing
|
||||
else if (b == 0) // write mode not set
|
||||
mode |= (fListMode & WMODES); // use existing
|
||||
fListMode = mode & (DMODES | WMODES);
|
||||
}
|
||||
|
||||
public final String[] getStrListForDisplay(String[][] input) {
|
||||
return getStrListForDisplay(input, getStringListMode());
|
||||
}
|
||||
|
||||
public final String[] getStrListForDisplay(String[][] input, int mode) {
|
||||
Object[] ob = getListForDisplay(input, getStringListMode(), null);
|
||||
String[] ss = new String[ob.length];
|
||||
System.arraycopy(ob, 0, ss, 0, ob.length);
|
||||
return ss;
|
||||
}
|
||||
|
||||
public final Object[] getListForDisplay(Object[][] input, Comparator cmp) {
|
||||
return getListForDisplay(input, getStringListMode(), cmp);
|
||||
}
|
||||
/**
|
||||
* Utility method forms string list
|
||||
* according to current list display mode
|
||||
*
|
||||
* @param input - array of string arrays
|
||||
* @return
|
||||
*/
|
||||
private final Object[] getListForDisplay(Object[][] input, int mode, Comparator cmp) {
|
||||
if (input == null || input.length == 0)
|
||||
return EMPTY_ARRAY;
|
||||
if (input.length == 1) {
|
||||
return (input[0] == null) ?
|
||||
EMPTY_ARRAY :
|
||||
input[0];
|
||||
}
|
||||
|
||||
Object[] s1 = input[0];
|
||||
if (s1 == null ||
|
||||
s1.length == 0)
|
||||
return EMPTY_ARRAY;
|
||||
|
||||
if ((mode & DMODES) == DMODE_EMPTY) {
|
||||
Arrays.sort(s1, cmp);
|
||||
for (int i=1; i<input.length; i++) {
|
||||
Object[] s2 = input[i];
|
||||
if (s2 == null ||
|
||||
s2.length == 0 ||
|
||||
s1.length != s2.length)
|
||||
return EMPTY_ARRAY;
|
||||
Arrays.sort(s2, cmp);
|
||||
if (! Arrays.equals(s1, s2))
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
return s1; // returns sorted strings !
|
||||
}
|
||||
else if ((getStringListMode() & DMODES) == DMODE_CONJUNCTION)
|
||||
{
|
||||
ArrayList lst = new ArrayList();
|
||||
for (int i=0; i<s1.length; i++) {
|
||||
if (s1[i] == null)
|
||||
continue;
|
||||
boolean found = true;
|
||||
for (int k = 1; k<input.length; k++) {
|
||||
Object[] s2 = input[k];
|
||||
if (s2 == null || s2.length == 0)
|
||||
return EMPTY_ARRAY;
|
||||
if (i == 0)
|
||||
Arrays.sort(s2, cmp);
|
||||
if (Arrays.binarySearch(s2, s1[i], cmp) < 0) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
lst.add(s1[i]);
|
||||
}
|
||||
}
|
||||
return lst.toArray();
|
||||
}
|
||||
else // DMODE_ALL
|
||||
{
|
||||
HashSet lst = new HashSet(); // set, to avoid doubles
|
||||
for (int i=0; i<input.length; i++) {
|
||||
if (input[i] == null ||
|
||||
input[i].length == 0)
|
||||
continue;
|
||||
for (int j=0; j<input[i].length; j++)
|
||||
lst.add(input[i][j]);
|
||||
}
|
||||
s1 = lst.toArray();
|
||||
Arrays.sort(s1, cmp);
|
||||
return s1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is put here to prevent UI from
|
||||
* accessing constructors in "internal" dirs.
|
||||
*
|
||||
* Creates multiple configuration description.
|
||||
* If there's 1 cfg.desc in array,
|
||||
* it's returned itself.
|
||||
*
|
||||
* @param rds - array of cfg.descs
|
||||
*
|
||||
* @param mode - string list display and write mode
|
||||
* @see DMODE_CONJUNCTION
|
||||
* @see DMODE_EMPTY
|
||||
* @see DMODE_ALL
|
||||
* @see WMODE_DIFF
|
||||
* @see WMODE_CURRENT
|
||||
*
|
||||
* @return multiple cfg.description or single cfg.desc.
|
||||
*/
|
||||
public static ICConfigurationDescription createCDescription(ICConfigurationDescription[] rds, int mode) {
|
||||
if (rds == null || rds.length == 0)
|
||||
return null;
|
||||
else if (rds.length == 1)
|
||||
return rds[0];
|
||||
else
|
||||
return new MultiConfigDescription(rds, mode);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,523 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||
import org.eclipse.cdt.core.settings.model.CConfigurationStatus;
|
||||
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICExternalSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingObject;
|
||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
/**
|
||||
* This class represents multi-configuration description holder
|
||||
*/
|
||||
public class MultiConfigDescription extends MultiItemsHolder implements
|
||||
ICMultiConfigDescription {
|
||||
|
||||
ICConfigurationDescription[] fCfgs = null;
|
||||
|
||||
public MultiConfigDescription(ICConfigurationDescription[] des, int mode) {
|
||||
fCfgs = des;
|
||||
setStringListMode(mode);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.settings.model.MultiItemsHolder#getItems()
|
||||
*/
|
||||
public Object[] getItems() {
|
||||
return fCfgs;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#create(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public ICConfigExtensionReference create(String extensionPoint,
|
||||
String extension) throws CoreException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.create()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#createExternalSetting(java.lang.String[], java.lang.String[], java.lang.String[], org.eclipse.cdt.core.settings.model.ICSettingEntry[])
|
||||
*/
|
||||
public ICExternalSetting createExternalSetting(String[] languageIDs,
|
||||
String[] contentTypeIds, String[] extensions,
|
||||
ICSettingEntry[] entries) throws WriteAccessException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.createExtSett()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#createFileDescription(org.eclipse.core.runtime.IPath, org.eclipse.cdt.core.settings.model.ICResourceDescription)
|
||||
*/
|
||||
public ICFileDescription createFileDescription(IPath path,
|
||||
ICResourceDescription base) throws CoreException,
|
||||
WriteAccessException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.createFileDesc()");
|
||||
return null;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#createFolderDescription(org.eclipse.core.runtime.IPath, org.eclipse.cdt.core.settings.model.ICFolderDescription)
|
||||
*/
|
||||
public ICFolderDescription createFolderDescription(IPath path,
|
||||
ICFolderDescription base) throws CoreException,
|
||||
WriteAccessException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.createFolderDesc()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#get(java.lang.String)
|
||||
*/
|
||||
public ICConfigExtensionReference[] get(String extensionPointID) {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.get()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getBuildSetting()
|
||||
*/
|
||||
public ICBuildSetting getBuildSetting() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getBuildSetting()");
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getErrorParserIDs() {
|
||||
String[][] out = new String[fCfgs.length][];
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
out[i] = fCfgs[i].getBuildSetting().getErrorParserIDs();
|
||||
return getStrListForDisplay(out, ICMultiItemsHolder.DMODE_CONJUNCTION);
|
||||
}
|
||||
|
||||
public void setErrorParserIDs(String[] ids) {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].getBuildSetting().setErrorParserIDs(ids);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getBuildSystemId()
|
||||
*/
|
||||
public String getBuildSystemId() {
|
||||
return fCfgs[0].getBuildSystemId();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getBuildVariablesContributor()
|
||||
*/
|
||||
public ICdtVariablesContributor getBuildVariablesContributor() {
|
||||
return fCfgs[0].getBuildVariablesContributor();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getConfigurationData()
|
||||
*/
|
||||
public CConfigurationData getConfigurationData() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getCfgData()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getConfigurationStatus()
|
||||
*/
|
||||
public CConfigurationStatus getConfigurationStatus() {
|
||||
CConfigurationStatus st = null;
|
||||
for (int i=1; i<fCfgs.length; i++) {
|
||||
st = fCfgs[0].getConfigurationStatus();
|
||||
if (! st.isOK())
|
||||
return st; // report error in any cfg
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getDescription()
|
||||
*/
|
||||
public String getDescription() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getDescription()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getExternalSettings()
|
||||
*/
|
||||
public ICExternalSetting[] getExternalSettings() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getExtSettings()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getExternalSettingsProviderIds()
|
||||
*/
|
||||
public String[] getExternalSettingsProviderIds() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getExtSettProviderIds()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFileDescriptions()
|
||||
*/
|
||||
public ICFileDescription[] getFileDescriptions() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getFileDescriptions()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFolderDescriptions()
|
||||
*/
|
||||
public ICFolderDescription[] getFolderDescriptions() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getFolderDescription()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getLanguageSettingForFile(org.eclipse.core.runtime.IPath, boolean)
|
||||
*/
|
||||
public ICLanguageSetting getLanguageSettingForFile(IPath path,
|
||||
boolean ignoreExludeStatus) {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getLangSettForFile()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getProjectDescription()
|
||||
*/
|
||||
public ICProjectDescription getProjectDescription() {
|
||||
ICProjectDescription pd = fCfgs[0].getProjectDescription();
|
||||
if (pd == null)
|
||||
return null;
|
||||
for (int i=1; i<fCfgs.length; i++)
|
||||
if (! pd.equals(fCfgs[i].getProjectDescription()))
|
||||
return null; // Different projects !
|
||||
return pd;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getReferenceInfo()
|
||||
*/
|
||||
public Map getReferenceInfo() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getReferenceInfo()");
|
||||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResolvedSourceEntries()
|
||||
*/
|
||||
public ICSourceEntry[] getResolvedSourceEntries() {
|
||||
return new ICSourceEntry[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescription(org.eclipse.core.runtime.IPath, boolean)
|
||||
*/
|
||||
public ICResourceDescription getResourceDescription(IPath path,
|
||||
boolean exactPath) {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getResourceDescription()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescriptions()
|
||||
*/
|
||||
public ICResourceDescription[] getResourceDescriptions() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getResourceDescriptions()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getRootFolderDescription()
|
||||
*/
|
||||
public ICFolderDescription getRootFolderDescription() {
|
||||
ICFolderDescription[] rds = new ICFolderDescription[fCfgs.length];
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
rds[i] = fCfgs[i].getRootFolderDescription();
|
||||
return new MultiFolderDescription(rds, getStringListMode());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getSessionProperty(org.eclipse.core.runtime.QualifiedName)
|
||||
*/
|
||||
public Object getSessionProperty(QualifiedName name) {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getSessionProperty()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getSourceEntries()
|
||||
*/
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
return new ICSourceEntry[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getTargetPlatformSetting()
|
||||
*/
|
||||
public ICTargetPlatformSetting getTargetPlatformSetting() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getTargetPlatfSetting()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#isActive()
|
||||
*/
|
||||
public boolean isActive() {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
if (fCfgs[i].isActive())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#isModified()
|
||||
*/
|
||||
public boolean isModified() {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
if (fCfgs[i].isModified())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#isPreferenceConfiguration()
|
||||
*/
|
||||
public boolean isPreferenceConfiguration() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#remove(org.eclipse.cdt.core.settings.model.ICConfigExtensionReference)
|
||||
*/
|
||||
public void remove(ICConfigExtensionReference ext) throws CoreException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].remove(ext);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#remove(java.lang.String)
|
||||
*/
|
||||
public void remove(String extensionPoint) throws CoreException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].remove(extensionPoint);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#removeExternalSetting(org.eclipse.cdt.core.settings.model.ICExternalSetting)
|
||||
*/
|
||||
public void removeExternalSetting(ICExternalSetting setting)
|
||||
throws WriteAccessException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].removeExternalSetting(setting);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#removeExternalSettings()
|
||||
*/
|
||||
public void removeExternalSettings() throws WriteAccessException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].removeExternalSettings();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#removeResourceDescription(org.eclipse.cdt.core.settings.model.ICResourceDescription)
|
||||
*/
|
||||
public void removeResourceDescription(ICResourceDescription des)
|
||||
throws CoreException, WriteAccessException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setActive()
|
||||
*/
|
||||
public void setActive() throws WriteAccessException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].setActive();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setConfigurationData(java.lang.String, org.eclipse.cdt.core.settings.model.extension.CConfigurationData)
|
||||
*/
|
||||
public void setConfigurationData(String buildSystemId,
|
||||
CConfigurationData data) throws WriteAccessException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getConfigurationData()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setDescription(java.lang.String)
|
||||
*/
|
||||
public void setDescription(String des) throws WriteAccessException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.setDescription()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setExternalSettingsProviderIds(java.lang.String[])
|
||||
*/
|
||||
public void setExternalSettingsProviderIds(String[] ids) {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].setExternalSettingsProviderIds(ids);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setName(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) throws WriteAccessException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.setName()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setReferenceInfo(java.util.Map)
|
||||
*/
|
||||
public void setReferenceInfo(Map refs) throws WriteAccessException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].setReferenceInfo(refs);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setSessionProperty(org.eclipse.core.runtime.QualifiedName, java.lang.Object)
|
||||
*/
|
||||
public void setSessionProperty(QualifiedName name, Object value) {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].setSessionProperty(name, value);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setSourceEntries(org.eclipse.cdt.core.settings.model.ICSourceEntry[])
|
||||
*/
|
||||
public void setSourceEntries(ICSourceEntry[] entries) throws CoreException,
|
||||
WriteAccessException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].setSourceEntries(entries);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#updateExternalSettingsProviders(java.lang.String[])
|
||||
*/
|
||||
public void updateExternalSettingsProviders(String[] ids)
|
||||
throws WriteAccessException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].updateExternalSettingsProviders(ids);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingContainer#getChildSettings()
|
||||
*/
|
||||
public ICSettingObject[] getChildSettings() {
|
||||
return new ICSettingObject[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getConfiguration()
|
||||
*/
|
||||
public ICConfigurationDescription getConfiguration() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return fCfgs[0].getId() + "_etc";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return "Multiple Config Description";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getParent()
|
||||
*/
|
||||
public ICSettingContainer getParent() {
|
||||
ICSettingContainer p = fCfgs[0].getParent();
|
||||
if (p == null)
|
||||
return null;
|
||||
for (int i=1; i<fCfgs.length; i++)
|
||||
if (! p.equals(fCfgs[i].getParent()))
|
||||
return null;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getType()
|
||||
*/
|
||||
public int getType() {
|
||||
int t = fCfgs[0].getType();
|
||||
for (int i=1; i<fCfgs.length; i++)
|
||||
if (t != fCfgs[i].getType())
|
||||
return 0;
|
||||
return t;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#isReadOnly()
|
||||
*/
|
||||
public boolean isReadOnly() {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
if (! fCfgs[i].isReadOnly())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#isValid()
|
||||
*/
|
||||
public boolean isValid() {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
if (! fCfgs[i].isValid())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingsStorage#getStorage(java.lang.String, boolean)
|
||||
*/
|
||||
public ICStorageElement getStorage(String id, boolean create)
|
||||
throws CoreException {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getStorage()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingsStorage#removeStorage(java.lang.String)
|
||||
*/
|
||||
public void removeStorage(String id) throws CoreException {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
fCfgs[i].removeStorage(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MultiFileDescription extends MultiResourceDescription implements
|
||||
ICFileDescription {
|
||||
|
||||
public MultiFileDescription(ICFileDescription[] res, int mode) {
|
||||
super(res, mode);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFileDescription#getLanguageSetting()
|
||||
*/
|
||||
public ICLanguageSetting getLanguageSetting() {
|
||||
System.out.println("Bad multi access: MultiFileDescription.getLanguageSetting()");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MultiFolderDescription extends MultiResourceDescription implements
|
||||
ICFolderDescription {
|
||||
|
||||
private static final Comparator comp = CDTListComparator.getInstance();
|
||||
private ICLanguageSetting[] lsets = null;
|
||||
|
||||
public MultiFolderDescription(ICFolderDescription[] res, int mode) {
|
||||
super(res, mode);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#createLanguageSettingForContentTypes(java.lang.String, java.lang.String[])
|
||||
*/
|
||||
public ICLanguageSetting createLanguageSettingForContentTypes(
|
||||
String languageId, String[] typeIds) throws CoreException {
|
||||
System.out.println("Bad multi access: MultiFolderDescription.createLanguageSettingForContentType()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#createLanguageSettingForExtensions(java.lang.String, java.lang.String[])
|
||||
*/
|
||||
public ICLanguageSetting createLanguageSettingForExtensions(
|
||||
String languageId, String[] extensions) throws CoreException {
|
||||
System.out.println("Bad multi access: MultiFolderDescription.createLanguageSettingForExt()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#getLanguageSettingForFile(java.lang.String)
|
||||
*/
|
||||
public ICLanguageSetting getLanguageSettingForFile(String fileName) {
|
||||
ICLanguageSetting ls0 = ((ICFolderDescription)fRess[0]).getLanguageSettingForFile(fileName);
|
||||
if (ls0 == null || ls0.getName() == null)
|
||||
return null;
|
||||
for (int i=1; i<fRess.length; i++) {
|
||||
if (fRess[i] instanceof ICFolderDescription) {
|
||||
ICLanguageSetting ls1 = ((ICFolderDescription)fRess[i]).getLanguageSettingForFile(fileName);
|
||||
if (ls1 == null || ! ls0.getName().equals(ls1.getName()))
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return ls0;
|
||||
}
|
||||
|
||||
private ICLanguageSetting[] conv2LS(Object[] ob) {
|
||||
ICLanguageSetting[] se = new ICLanguageSetting[ob.length];
|
||||
System.arraycopy(ob, 0, se, 0, ob.length);
|
||||
return se;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#getLanguageSettings()
|
||||
*/
|
||||
public ICLanguageSetting[] getLanguageSettings() {
|
||||
if (lsets != null)
|
||||
return lsets;
|
||||
|
||||
ICLanguageSetting[][] ls = new ICLanguageSetting[fRess.length][];
|
||||
for (int i=0; i<fRess.length; i++) {
|
||||
if (fRess[i] instanceof ICFolderDescription) {
|
||||
ls[i] = ((ICFolderDescription)fRess[i]).getLanguageSettings();
|
||||
Arrays.sort(ls[i], comp);
|
||||
}
|
||||
}
|
||||
ICLanguageSetting[] fs = conv2LS(getListForDisplay(ls, comp));
|
||||
lsets = new ICLanguageSetting[fs.length];
|
||||
for (int i=0; i<fs.length; i++) {
|
||||
ArrayList list = new ArrayList(fRess.length);
|
||||
for (int j=0; j<ls.length; j++) {
|
||||
int x = Arrays.binarySearch(ls[j], fs[i], comp);
|
||||
if (x >= 0)
|
||||
list.add(ls[j][x]);
|
||||
}
|
||||
if (list.size() == 1)
|
||||
lsets[i] = (ICLanguageSetting)list.get(0);
|
||||
else if (list.size() > 1)
|
||||
lsets[i] = new MultiLanguageSetting(list, getConfiguration());
|
||||
}
|
||||
return lsets;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#getNestedResourceDescription(org.eclipse.core.runtime.IPath, boolean)
|
||||
*/
|
||||
public ICResourceDescription getNestedResourceDescription(IPath relPath,
|
||||
boolean exactPath) {
|
||||
System.out.println("Bad multi access: MultiFolderDescription.getNestedResourceDescription(path, exact)");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#getNestedResourceDescriptions(int)
|
||||
*/
|
||||
public ICResourceDescription[] getNestedResourceDescriptions(int kind) {
|
||||
System.out.println("Bad multi access: MultiFolderDescription.getNestedResourceDescriptions(kind)");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#getNestedResourceDescriptions()
|
||||
*/
|
||||
public ICResourceDescription[] getNestedResourceDescriptions() {
|
||||
System.out.println("Bad multi access: MultiFolderDescription.getNestedResourceDescriptions()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#isRoot()
|
||||
*/
|
||||
public boolean isRoot() {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
if (! ((ICFolderDescription)fRess[0]).isRoot())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||
|
||||
/**
|
||||
* This class is intended to hold "similar" Language Setting objects.
|
||||
* Normally, they should have the same name.
|
||||
*/
|
||||
public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguageSetting {
|
||||
private static final Comparator comp = CDTListComparator.getInstance();
|
||||
|
||||
ICLanguageSetting[] items = null;
|
||||
ICConfigurationDescription cfgd = null;
|
||||
|
||||
public MultiLanguageSetting(List data, ICConfigurationDescription cf) {
|
||||
items = (ICLanguageSetting[])data.toArray(new ICLanguageSetting[data.size()]);
|
||||
cfgd = cf;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getLanguageId()
|
||||
*/
|
||||
public String getLanguageId() {
|
||||
System.out.println("Bad multi access: MultiLanguageSetting.getLanguageId()");
|
||||
return null; // IDs are different.
|
||||
}
|
||||
|
||||
private ICLanguageSettingEntry[] conv2LSE(Object[] ob) {
|
||||
ICLanguageSettingEntry[] se = new ICLanguageSettingEntry[ob.length];
|
||||
System.arraycopy(ob, 0, se, 0, ob.length);
|
||||
return se;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getResolvedSettingEntries(int)
|
||||
*/
|
||||
public ICLanguageSettingEntry[] getResolvedSettingEntries(int kind) {
|
||||
ICLanguageSettingEntry[][] le = new ICLanguageSettingEntry[items.length][];
|
||||
for (int i=0; i<items.length; i++)
|
||||
le[i] = items[i].getResolvedSettingEntries(kind);
|
||||
return conv2LSE(getListForDisplay(le, comp));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSettingEntries(int)
|
||||
*/
|
||||
public ICLanguageSettingEntry[] getSettingEntries(int kind) {
|
||||
ICLanguageSettingEntry[][] le = new ICLanguageSettingEntry[items.length][];
|
||||
for (int i=0; i<items.length; i++)
|
||||
le[i] = items[i].getSettingEntries(kind);
|
||||
return conv2LSE(getListForDisplay(le, comp));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSettingEntriesList(int)
|
||||
*/
|
||||
public List getSettingEntriesList(int kind) {
|
||||
return Arrays.asList(getSettingEntries(kind));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSourceContentTypeIds()
|
||||
*/
|
||||
public String[] getSourceContentTypeIds() {
|
||||
String[][] ss = new String[items.length][];
|
||||
for (int i=0; i<items.length; i++)
|
||||
ss[i] = items[i].getSourceContentTypeIds();
|
||||
return this.getStrListForDisplay(ss);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSourceExtensions()
|
||||
*/
|
||||
public String[] getSourceExtensions() {
|
||||
String[][] ss = new String[items.length][];
|
||||
for (int i=0; i<items.length; i++)
|
||||
ss[i] = items[i].getSourceExtensions();
|
||||
return this.getStrListForDisplay(ss);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSupportedEntryKinds()
|
||||
*/
|
||||
public int getSupportedEntryKinds() {
|
||||
int res = 0;
|
||||
for (int i=0; i<items.length; i++)
|
||||
res |= items[i].getSupportedEntryKinds();
|
||||
return res;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setLanguageId(java.lang.String)
|
||||
*/
|
||||
public void setLanguageId(String id) { // Do nothing
|
||||
System.out.println("Bad multi access: MultiLanguageSetting.setLanguageId()");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setSettingEntries(int, org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry[])
|
||||
*/
|
||||
public void setSettingEntries(int kind, ICLanguageSettingEntry[] entries) {
|
||||
for (int i=0; i<items.length; i++)
|
||||
items[i].setSettingEntries(kind, entries);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setSettingEntries(int, java.util.List)
|
||||
*/
|
||||
public void setSettingEntries(int kind, List entriesList) {
|
||||
for (int i=0; i<items.length; i++)
|
||||
items[i].setSettingEntries(kind, entriesList);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setSourceContentTypeIds(java.lang.String[])
|
||||
*/
|
||||
public void setSourceContentTypeIds(String[] ids) {
|
||||
for (int i=0; i<items.length; i++)
|
||||
items[i].setSourceContentTypeIds(ids);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setSourceExtensions(java.lang.String[])
|
||||
*/
|
||||
public void setSourceExtensions(String[] exts) {
|
||||
for (int i=0; i<items.length; i++)
|
||||
items[i].setSourceExtensions(exts);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#supportsEntryKind(int)
|
||||
*/
|
||||
public boolean supportsEntryKind(int kind) {
|
||||
for (int i=0; i<items.length; i++)
|
||||
if (items[i].supportsEntryKind(kind))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getConfiguration()
|
||||
*/
|
||||
public ICConfigurationDescription getConfiguration() {
|
||||
System.out.println("Bad multi access: MultiLanguageSetting.getConfiguration()");
|
||||
return null; // CFGs are different
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getId()
|
||||
*/
|
||||
public String getId() { // IDs are different
|
||||
System.out.println("Bad multi access: MultiLanguageSetting.getId()");
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getName()
|
||||
*/
|
||||
public String getName() { // names are proposed to be equal
|
||||
return items[0].getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getParent()
|
||||
*/
|
||||
public ICSettingContainer getParent() {
|
||||
System.out.println("Bad multi access: MultiLanguageSetting.getParent()");
|
||||
return null; // Parents are different
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getType()
|
||||
*/
|
||||
public int getType() {
|
||||
int x = items[0].getType();
|
||||
for (int i=0; i<items.length; i++)
|
||||
if (x != items[i].getType())
|
||||
return 0;
|
||||
return x;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#isReadOnly()
|
||||
*/
|
||||
public boolean isReadOnly() {
|
||||
for (int i=0; i<items.length; i++)
|
||||
if (! items[i].isReadOnly())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#isValid()
|
||||
*/
|
||||
public boolean isValid() {
|
||||
for (int i=0; i<items.length; i++)
|
||||
if (! items[i].isValid())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object[] getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingObject;
|
||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
* This class represents multi-resource holder
|
||||
*/
|
||||
public class MultiResourceDescription extends MultiItemsHolder implements ICMultiResourceDescription {
|
||||
ICResourceDescription[] fRess = null;
|
||||
ICConfigurationDescription fCfg = null;
|
||||
|
||||
public MultiResourceDescription(ICResourceDescription[] res, int mode) {
|
||||
fRess = res;
|
||||
setStringListMode(mode);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICResourceDescription#canExclude(boolean)
|
||||
*
|
||||
* returns TRUE only if all res.configurations return true
|
||||
*/
|
||||
public boolean canExclude(boolean exclude) {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
if (! fRess[i].canExclude(exclude))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICResourceDescription#getParentFolderDescription()
|
||||
*/
|
||||
public ICFolderDescription getParentFolderDescription() {
|
||||
System.out.println("Bad multi access: MultiResourceDescription.getParentFolderDescription()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICResourceDescription#getPath()
|
||||
*/
|
||||
public IPath getPath() {
|
||||
System.out.println("Bad multi access: MultiResourceDescription.getPath()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICResourceDescription#isExcluded()
|
||||
*/
|
||||
public boolean isExcluded() {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
if (! fRess[i].isExcluded())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICResourceDescription#setExcluded(boolean)
|
||||
*/
|
||||
public void setExcluded(boolean excluded) throws WriteAccessException {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
fRess[i].setExcluded(excluded);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICResourceDescription#setPath(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public void setPath(IPath path) throws WriteAccessException {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
fRess[i].setPath(path);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingContainer#getChildSettings()
|
||||
*/
|
||||
public ICSettingObject[] getChildSettings() {
|
||||
System.out.println("Bad multi access: MultiResourceDescription.getChildSettings()");
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getConfiguration()
|
||||
*
|
||||
* returns multi-configuration object
|
||||
*/
|
||||
public ICConfigurationDescription getConfiguration() {
|
||||
if (fCfg == null) {
|
||||
ICConfigurationDescription[] cfgs = new ICConfigurationDescription[fRess.length];
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
cfgs[i] = fRess[i].getConfiguration();
|
||||
fCfg = new MultiConfigDescription(cfgs, getStringListMode());
|
||||
}
|
||||
return fCfg;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return fRess[0].getId() + "_etc";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return "Multiple Resource Description";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getParent()
|
||||
*
|
||||
* If there's the same parent for all res cfgs, return it.
|
||||
* Else return null;
|
||||
*/
|
||||
public ICSettingContainer getParent() {
|
||||
ICSettingContainer sc = fRess[0].getParent();
|
||||
if (sc == null)
|
||||
return null;
|
||||
for (int i=1; i<fRess.length; i++)
|
||||
if (!sc.equals(fRess[i].getParent()))
|
||||
return null;
|
||||
return sc;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#getType()
|
||||
*
|
||||
* If there's the same type for all res cfgs, return it.
|
||||
* Else return null;
|
||||
*/
|
||||
public int getType() {
|
||||
int t = fRess[0].getType();
|
||||
for (int i=1; i<fRess.length; i++)
|
||||
if (t != fRess[i].getType())
|
||||
return 0;
|
||||
return t;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#isReadOnly()
|
||||
*/
|
||||
public boolean isReadOnly() {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
if (! fRess[i].isReadOnly())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICSettingObject#isValid()
|
||||
*/
|
||||
public boolean isValid() {
|
||||
for (int i=0; i<fRess.length; i++)
|
||||
if (! fRess[i].isValid())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#getItems()
|
||||
*/
|
||||
public Object[] getItems() {
|
||||
return fRess;
|
||||
}
|
||||
|
||||
public void setSettingEntries(ICLanguageSetting lang, int kind, List incs, boolean toAll) {
|
||||
for (int i=0; i<fRess.length; i++) {
|
||||
if (fRess[i] instanceof ICFolderDescription) {
|
||||
String n = lang.getName();
|
||||
ICLanguageSetting[] l = ((ICFolderDescription)fRess[i]).getLanguageSettings();
|
||||
for (int j=0; j<l.length; j++) {
|
||||
if (toAll || n.equals(l[j].getName())) {
|
||||
l[j].setSettingEntries(kind, incs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (fRess[i] instanceof ICFileDescription) {
|
||||
ICLanguageSetting l = ((ICFileDescription)fRess[i]).getLanguageSetting();
|
||||
if (l.getName().equals(lang.getName()))
|
||||
l.setSettingEntries(kind, incs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -72,9 +72,6 @@ import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
|||
public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
||||
public static final int BUTTON_WIDTH = 120; // used as hint for all push buttons
|
||||
|
||||
// use 3-state buttons in property pages
|
||||
public static final boolean USE_TRI_STATE = false;
|
||||
|
||||
// commonly used button names
|
||||
public static final String EMPTY_STR = ""; //$NON-NLS-1$
|
||||
public static final String ADD_STR = UIMessages.getString("FileListControl.add"); //$NON-NLS-1$
|
||||
|
@ -94,6 +91,9 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
public static final String WORKSPACE_FILE_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.file.dlg.err"); //$NON-NLS-1$
|
||||
public static final String WORKSPACE_DIR_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.dir.dlg.err"); //$NON-NLS-1$
|
||||
|
||||
// use 3-state buttons in property pages
|
||||
protected final boolean USE_TRI_STATE = CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI) && CDTPrefUtil.getBool(CDTPrefUtil.KEY_3STATE);
|
||||
|
||||
protected Composite usercomp; // space where user can create widgets
|
||||
protected Composite buttoncomp; // space for buttons on the right
|
||||
private Button[] buttons; // buttons in buttoncomp
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.eclipse.swt.widgets.TableItem;
|
|||
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICExternalSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
|
@ -199,8 +200,17 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab {
|
|||
*/
|
||||
public void updateData(ICResourceDescription rcfg) {
|
||||
if (rcfg == null) return;
|
||||
cfg = rcfg.getConfiguration();
|
||||
update();
|
||||
if (page.isMultiCfg()) {
|
||||
usercomp.setVisible(false);
|
||||
buttoncomp.setVisible(false);
|
||||
} else {
|
||||
if (! usercomp.getVisible()) {
|
||||
usercomp.setVisible(true);
|
||||
buttoncomp.setVisible(true);
|
||||
}
|
||||
cfg = rcfg.getConfiguration();
|
||||
update();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Unified "Add/Edit/Delete" buttons handler
|
||||
|
|
|
@ -48,12 +48,14 @@ import org.eclipse.swt.widgets.TreeItem;
|
|||
|
||||
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICExternalSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
|
@ -69,8 +71,6 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
protected boolean toAllCfgs = false;
|
||||
protected boolean toAllLang = false;
|
||||
|
||||
// protected boolean showBI = false;
|
||||
// boolean savedShowBI = false;
|
||||
protected ICLanguageSetting lang;
|
||||
protected LinkedList incs;
|
||||
protected ArrayList exported;
|
||||
|
@ -261,7 +261,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
else x += shift; // used only for UP/DOWN
|
||||
|
||||
incs = new LinkedList();
|
||||
List lst = lang.getSettingEntriesList(getKind());
|
||||
List lst = getSettingEntriesList(getKind());
|
||||
if (lst != null) {
|
||||
Iterator it = lst.iterator();
|
||||
while (it.hasNext()) {
|
||||
|
@ -353,11 +353,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
toAllLang = false;
|
||||
ent = doAdd();
|
||||
if (ent != null) {
|
||||
if (toAllCfgs || toAllLang) {
|
||||
if ((toAllCfgs || toAllLang) && ! (getResDesc() instanceof ICMultiResourceDescription)) {
|
||||
addToAll(ent);
|
||||
} else {
|
||||
incs.add(ent);
|
||||
lang.setSettingEntries(getKind(), incs);
|
||||
setSettingEntries(getKind(), incs, toAllLang);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
int toModify = incs.indexOf(old);
|
||||
incs.remove(toModify);
|
||||
incs.add(toModify, ent);
|
||||
lang.setSettingEntries(getKind(), incs);
|
||||
setSettingEntries(getKind(), incs, false);
|
||||
update();
|
||||
}
|
||||
break;
|
||||
|
@ -380,7 +380,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
old = (ICLanguageSettingEntry)(table.getItem(n).getData());
|
||||
if (old.isReadOnly()) return;
|
||||
incs.remove(old);
|
||||
lang.setSettingEntries(getKind(), incs);
|
||||
setSettingEntries(getKind(), incs, false);
|
||||
update();
|
||||
break;
|
||||
case 3: // toggle export
|
||||
|
@ -407,7 +407,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
incs.remove(x - 1);
|
||||
incs.add(x - 1, old);
|
||||
incs.add(x, old2);
|
||||
lang.setSettingEntries(getKind(), incs);
|
||||
setSettingEntries(getKind(), incs, false);
|
||||
update(i == 5 ? -1 : 1);
|
||||
break;
|
||||
default:
|
||||
|
@ -561,4 +561,14 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setSettingEntries(int kind, List incs, boolean toAll) {
|
||||
if (page.isMultiCfg()) {
|
||||
((ICMultiResourceDescription)getResDesc()).setSettingEntries(lang, kind, incs, toAll);
|
||||
} else
|
||||
lang.setSettingEntries(kind, incs);
|
||||
}
|
||||
private List getSettingEntriesList(int kind) {
|
||||
return lang.getSettingEntriesList(kind);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,11 +68,14 @@ import org.eclipse.ui.dialogs.PropertyPage;
|
|||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.CConfigurationStatus;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
|
@ -83,7 +86,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
* It is a parent for all standard CDT property pages
|
||||
* in new CDT model.
|
||||
*
|
||||
* Although it is enougth for new page to implement
|
||||
* Although it is enough for new page to implement
|
||||
* "IWorkbenchPropertyPage" interface, it would be
|
||||
* better to extend it from "AbstractPage".
|
||||
*
|
||||
|
@ -109,7 +112,6 @@ implements
|
|||
{
|
||||
private static ICResourceDescription resd = null;
|
||||
private static ICConfigurationDescription[] cfgDescs = null;
|
||||
private static ICConfigurationDescription[] multiCfgs = null; // selected multi cfg
|
||||
private static int cfgIndex = -1;
|
||||
// tabs
|
||||
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.cPropertyTab"; //$NON-NLS-1$
|
||||
|
@ -148,7 +150,6 @@ implements
|
|||
protected boolean isProject = false;
|
||||
protected boolean isFolder = false;
|
||||
protected boolean isFile = false;
|
||||
protected boolean isMulti = false;
|
||||
|
||||
// tabs
|
||||
protected TabFolder folder;
|
||||
|
@ -372,7 +373,6 @@ implements
|
|||
* Event Handlers
|
||||
*/
|
||||
private void handleConfigSelection() {
|
||||
isMulti = false; // no multi config selection by default
|
||||
// If there is nothing in config selection widget just bail
|
||||
if (configSelector.getItemCount() == 0) return;
|
||||
int selectionIndex = configSelector.getSelectionIndex();
|
||||
|
@ -380,13 +380,15 @@ implements
|
|||
|
||||
// Check if the user has selected the "all / multiple" configuration
|
||||
if (selectionIndex >= cfgDescs.length) {
|
||||
if ((selectionIndex - cfgDescs.length) == 0) // all
|
||||
ICConfigurationDescription[] multiCfgs = null; // selected multi cfg
|
||||
if ((selectionIndex - cfgDescs.length) == 0) { // all
|
||||
multiCfgs = cfgDescs;
|
||||
else {
|
||||
cfgIndex = selectionIndex;
|
||||
} else {
|
||||
ICConfigurationDescription[] mcfgs = ConfigMultiSelectionDialog.select(cfgDescs);
|
||||
if (mcfgs == null || mcfgs.length == 0) {
|
||||
// return back to previous selection, but not to multi !
|
||||
if (cfgIndex >= cfgDescs.length) {
|
||||
// return back to previous selection
|
||||
if (cfgIndex > configSelector.getItemCount()) {
|
||||
cfgIndex = 0;
|
||||
configSelector.select(0);
|
||||
cfgChanged(cfgDescs[0]);
|
||||
|
@ -397,11 +399,9 @@ implements
|
|||
}
|
||||
multiCfgs = mcfgs;
|
||||
}
|
||||
|
||||
isMulti = true;
|
||||
// if tab does not support multi cfg,
|
||||
// it will show 1st cfg, at least.
|
||||
cfgChanged(multiCfgs[0]);
|
||||
// TODO: avoid repeated update like for single cfg
|
||||
cfgChanged(MultiItemsHolder.createCDescription(multiCfgs,
|
||||
ICMultiItemsHolder.MODE_DEFAULT));
|
||||
return;
|
||||
} else {
|
||||
String id1 = getResDesc() == null ? null : getResDesc().getId();
|
||||
|
@ -461,9 +461,19 @@ implements
|
|||
|
||||
final boolean needs = (mode != SAVE_MODE_OK);
|
||||
final ICProjectDescription local_prjd = needs ? CoreModel.getDefault().getProjectDescription(getProject()) : null;
|
||||
ICConfigurationDescription c = needs ? local_prjd.getConfigurationById(resd.getConfiguration().getId()) : null;
|
||||
final ICResourceDescription local_cfgd = needs ? getResDesc(c) : null;
|
||||
|
||||
|
||||
ICResourceDescription lc = null;
|
||||
|
||||
if (needs) {
|
||||
if (isMultiCfg()) {
|
||||
lc = resd;
|
||||
} else {
|
||||
ICConfigurationDescription c = needs ? local_prjd.getConfigurationById(resd.getConfiguration().getId()) : null;
|
||||
lc = getResDesc(c);
|
||||
}
|
||||
}
|
||||
final ICResourceDescription local_cfgd = lc;
|
||||
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
private void sendOK() {
|
||||
|
@ -749,7 +759,6 @@ implements
|
|||
if (CDTPropertyManager.getPagesCount() == 0) {
|
||||
resd = null;
|
||||
cfgDescs = null;
|
||||
multiCfgs = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -976,9 +985,7 @@ implements
|
|||
public boolean isForFolder() { return isFolder; }
|
||||
public boolean isForFile() { return isFile; }
|
||||
public boolean isForPrefs() { return false; }
|
||||
|
||||
public boolean isMultiCfg() { return isMulti; }
|
||||
public ICConfigurationDescription[] getMultiCfg() { return (isMulti) ? multiCfgs : null; }
|
||||
public boolean isMultiCfg() { return resd instanceof ICMultiItemsHolder; }
|
||||
|
||||
/**
|
||||
* Checks whether CDT property pages can be open for given object.
|
||||
|
|
|
@ -24,6 +24,7 @@ public class CDTPrefUtil {
|
|||
public static final String KEY_OTHERS = "wizard.group.others.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_NOMNG = "properties.manage.config.disable"; //$NON-NLS-1$
|
||||
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_3STATE = "properties.multi.3state.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_NOTOOLM = "properties.toolchain.modification.disable"; //$NON-NLS-1$
|
||||
public static final String KEY_EXPORT = "properties.export.page.enable"; //$NON-NLS-1$
|
||||
|
@ -42,6 +43,15 @@ public class CDTPrefUtil {
|
|||
public static final int DISC_NAMING_ALWAYS_IDS = 3;
|
||||
public static final int DISC_NAMING_DEFAULT = DISC_NAMING_UNIQUE_OR_BOTH;
|
||||
|
||||
public static final String KEY_DMODE = "properties.multi.displ.mode"; //$NON-NLS-1$
|
||||
public static final int DMODE_EMPTY = 1;
|
||||
public static final int DMODE_CONJUNCTION = 2;
|
||||
public static final int DMODE_DISJUNCTION = 4;
|
||||
|
||||
public static final String KEY_WMODE = "properties.multi.write.mode"; //$NON-NLS-1$
|
||||
public static final int WMODE_MODIFY = 8;
|
||||
public static final int WMODE_REPLACE = 16;
|
||||
|
||||
public static final String NULL = "NULL"; //$NON-NLS-1$
|
||||
private static final IPreferenceStore pref = CUIPlugin.getDefault().getPreferenceStore();
|
||||
private static final String DELIMITER = " "; //$NON-NLS-1$
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2007 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.ui.newui.AbstractExportTab.ExtData;
|
||||
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
|
||||
|
||||
public class CDTUIListComparator extends CDTListComparator implements Comparator {
|
||||
|
||||
public static Comparator getInstance() {
|
||||
if (comparator == null)
|
||||
comparator = new CDTUIListComparator();
|
||||
return comparator;
|
||||
}
|
||||
public int compare(Object a, Object b) {
|
||||
if (a == null || b == null)
|
||||
return 0;
|
||||
if (a instanceof ExtData) {
|
||||
ExtData c1 = (ExtData)a;
|
||||
ExtData c2 = (ExtData)b;
|
||||
return c1.getName().compareToIgnoreCase(c2.getName());
|
||||
}
|
||||
if (a instanceof IConfigurationElement) {
|
||||
IConfigurationElement e1 = (IConfigurationElement)a;
|
||||
IConfigurationElement e2 = (IConfigurationElement)b;
|
||||
return AbstractPage.getWeight(e1).compareTo(AbstractPage.getWeight(e2));
|
||||
}
|
||||
if (a instanceof EntryDescriptor) {
|
||||
EntryDescriptor c1 = (EntryDescriptor) a;
|
||||
EntryDescriptor c2 = (EntryDescriptor) b;
|
||||
return c1.getName().compareToIgnoreCase(c2.getName());
|
||||
}
|
||||
return super.compare(a, b);
|
||||
}
|
||||
|
||||
}
|
|
@ -43,6 +43,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
|
|||
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.settings.model.ICExclusionPatternPathEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
|
@ -231,6 +232,13 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
public void updateData(ICResourceDescription _cfgd) {
|
||||
if (page.isMultiCfg()) {
|
||||
usercomp.setVisible(false);
|
||||
return;
|
||||
}
|
||||
if ( !usercomp.getVisible())
|
||||
usercomp.setVisible(true);
|
||||
|
||||
cfgd = _cfgd;
|
||||
ICExclusionPatternPathEntry[] ent = getEntries(cfgd);
|
||||
src = new ArrayList(ent.length);
|
||||
|
@ -263,6 +271,9 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
|
||||
// This page can be displayed for project only
|
||||
public boolean canBeVisible() {
|
||||
if (page.getResDesc() instanceof ICMultiItemsHolder)
|
||||
return false; // cannot work with multi cfg
|
||||
|
||||
return page.isForProject();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,21 +34,23 @@ public class EnvDialog extends Dialog {
|
|||
Button b_add2all;
|
||||
private Text text1;
|
||||
private Text text2;
|
||||
boolean newAction;
|
||||
Shell shell;
|
||||
ICConfigurationDescription cfgd;
|
||||
private boolean newAction;
|
||||
private boolean multiCfg;
|
||||
private ICConfigurationDescription cfgd;
|
||||
public String t1 = AbstractCPropertyTab.EMPTY_STR;
|
||||
public String t2 = AbstractCPropertyTab.EMPTY_STR;
|
||||
public boolean toAll = false;
|
||||
|
||||
public EnvDialog(Shell parent,
|
||||
IEnvironmentVariable _var,
|
||||
String title, boolean _newAction,
|
||||
String title,
|
||||
boolean _newAction,
|
||||
boolean _multiCfg,
|
||||
ICConfigurationDescription _cfgd) {
|
||||
super(parent);
|
||||
shell = parent;
|
||||
var = _var;
|
||||
newAction = _newAction;
|
||||
multiCfg = _multiCfg;
|
||||
cfgd = _cfgd;
|
||||
}
|
||||
|
||||
|
@ -113,6 +115,9 @@ public class EnvDialog extends Dialog {
|
|||
toAll = b_add2all.getSelection();
|
||||
}});
|
||||
|
||||
if (multiCfg)
|
||||
b_add2all.setVisible(false);
|
||||
|
||||
if (!newAction) {
|
||||
gd.heightHint = 1;
|
||||
b_add2all.setVisible(false);
|
||||
|
|
|
@ -45,9 +45,8 @@ import org.eclipse.swt.widgets.Table;
|
|||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.ui.dialogs.ListSelectionDialog;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.envvar.IContributedEnvironment;
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.utils.envvar.StorableEnvironment;
|
||||
|
@ -66,13 +65,13 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
private static final String RBR = "]"; //$NON-NLS-1$
|
||||
private static final UserDefinedEnvironmentSupplier fUserSupplier = EnvironmentVariableManager.fUserSupplier;
|
||||
|
||||
private final MultiCfgContributedEnvironment ce = new MultiCfgContributedEnvironment();
|
||||
|
||||
private Table table;
|
||||
private TableViewer tv;
|
||||
private ArrayList data = new ArrayList();
|
||||
private Button b1, b2;
|
||||
|
||||
private static final IContributedEnvironment ce = CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment();
|
||||
private ICConfigurationDescription cfgd = null;
|
||||
private StorableEnvironment vars = null;
|
||||
|
||||
|
@ -218,7 +217,12 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
int[] idx;
|
||||
switch (i) {
|
||||
case 0:
|
||||
dlg = new EnvDialog(usercomp.getShell(), var, UIMessages.getString("EnvironmentTab.10"), true, cfgd); //$NON-NLS-1$
|
||||
dlg = new EnvDialog(usercomp.getShell(),
|
||||
var,
|
||||
UIMessages.getString("EnvironmentTab.10"), //$NON-NLS-1$
|
||||
true,
|
||||
page.isMultiCfg(),
|
||||
cfgd);
|
||||
if (dlg.open() == Window.OK) {
|
||||
if (dlg.t1.trim().length() > 0) {
|
||||
ICConfigurationDescription[] cfgs;
|
||||
|
@ -246,7 +250,12 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
case 2: // edit
|
||||
if (n == -1) return;
|
||||
var = ((TabData)tv.getElementAt(n)).var;
|
||||
dlg = new EnvDialog(usercomp.getShell(), var, UIMessages.getString("EnvironmentTab.11"), false, cfgd); //$NON-NLS-1$
|
||||
dlg = new EnvDialog(usercomp.getShell(),
|
||||
var,
|
||||
UIMessages.getString("EnvironmentTab.11"), //$NON-NLS-1$
|
||||
false,
|
||||
page.isMultiCfg(),
|
||||
cfgd);
|
||||
if (dlg.open() == Window.OK) {
|
||||
if (cfgd != null)
|
||||
ce.addVariable( dlg.t1.trim(), dlg.t2.trim(),
|
||||
|
@ -308,8 +317,11 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
cfgd = (_cfgd != null) ? _cfgd.getConfiguration() : null;
|
||||
if (cfgd == null && vars == null)
|
||||
vars = fUserSupplier.getWorkspaceEnvironmentCopy();
|
||||
else
|
||||
ce.setMulti(page.isMultiCfg());
|
||||
updateData();
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
IEnvironmentVariable[] _vars = null;
|
||||
if (cfgd != null) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Table;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
|
||||
|
||||
|
@ -141,7 +142,9 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
|||
public void updateData(ICResourceDescription _cfgd) {
|
||||
cfgd = _cfgd.getConfiguration();
|
||||
if (mapParsers == null) return;
|
||||
String[] ss = cfgd.getBuildSetting().getErrorParserIDs();
|
||||
String[] ss = (page.isMultiCfg()) ?
|
||||
((ICMultiConfigDescription)cfgd).getErrorParserIDs() :
|
||||
cfgd.getBuildSetting().getErrorParserIDs();
|
||||
|
||||
ArrayList data = new ArrayList(mapParsers.size());
|
||||
ArrayList checked = new ArrayList(ss.length);
|
||||
|
@ -176,10 +179,16 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
|||
buttonSetEnabled(4, cnt > 0);
|
||||
}
|
||||
|
||||
|
||||
public void performApply(ICResourceDescription src, ICResourceDescription dst) {
|
||||
String[] s1 = src.getConfiguration().getBuildSetting().getErrorParserIDs();
|
||||
dst.getConfiguration().getBuildSetting().setErrorParserIDs(s1);
|
||||
ICConfigurationDescription sd = src.getConfiguration();
|
||||
ICConfigurationDescription dd = dst.getConfiguration();
|
||||
String[] s = (sd instanceof ICMultiConfigDescription) ?
|
||||
((ICMultiConfigDescription)sd).getErrorParserIDs() :
|
||||
sd.getBuildSetting().getErrorParserIDs();
|
||||
if (dd instanceof ICMultiConfigDescription)
|
||||
((ICMultiConfigDescription)sd).setErrorParserIDs(s);
|
||||
else
|
||||
dd.getBuildSetting().setErrorParserIDs(s);
|
||||
}
|
||||
|
||||
private void saveChecked() {
|
||||
|
@ -189,7 +198,11 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
|||
for (int i=0; i<objs.length; i++)
|
||||
lst.add(((TableData)objs[i]).key);
|
||||
}
|
||||
cfgd.getBuildSetting().setErrorParserIDs((String[])lst.toArray(new String[lst.size()]));
|
||||
String[] s = (String[])lst.toArray(new String[lst.size()]);
|
||||
if (cfgd instanceof ICMultiConfigDescription)
|
||||
((ICMultiConfigDescription)cfgd).setErrorParserIDs(s);
|
||||
else
|
||||
cfgd.getBuildSetting().setErrorParserIDs(s);
|
||||
}
|
||||
// This page can be displayed for project only
|
||||
public boolean canBeVisible() {
|
||||
|
@ -197,7 +210,10 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
protected void performDefaults() {
|
||||
cfgd.getConfiguration().getBuildSetting().setErrorParserIDs(null);
|
||||
if (cfgd instanceof ICMultiConfigDescription)
|
||||
((ICMultiConfigDescription)cfgd).setErrorParserIDs(null);
|
||||
else
|
||||
cfgd.getBuildSetting().setErrorParserIDs(null);
|
||||
updateData(getResDesc());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,5 @@ public interface ICPropertyProvider extends ICOptionContainer {
|
|||
// Checks whether a project is new CDT model-style
|
||||
boolean isCDTProject(IProject p);
|
||||
boolean isMultiCfg();
|
||||
ICConfigurationDescription[] getMultiCfg();
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
|
||||
public class IncludeDialog extends AbstractPropertyDialog {
|
||||
|
@ -96,7 +97,8 @@ public class IncludeDialog extends AbstractPropertyDialog {
|
|||
b_add2confs = new Button(c1, SWT.CHECK);
|
||||
b_add2confs.setText(UIMessages.getString("IncludeDialog.2")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
if ((mode & OLD_MASK) == OLD_MASK) {
|
||||
if (((mode & OLD_MASK) == OLD_MASK) ||
|
||||
(cfgd instanceof ICMultiConfigDescription)) {
|
||||
gd.heightHint = 1;
|
||||
b_add2confs.setVisible(false);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Table;
|
|||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.envvar.IContributedEnvironment;
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MultiCfgContributedEnvironment implements IContributedEnvironment {
|
||||
private static final IContributedEnvironment ice = CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment();
|
||||
private boolean isMulti = false;
|
||||
private ICConfigurationDescription[] mono = new ICConfigurationDescription[1];
|
||||
private ICConfigurationDescription[] cfs;
|
||||
private static final EnvCmp comparator = new EnvCmp();
|
||||
|
||||
private static class EnvCmp implements Comparator {
|
||||
|
||||
public int compare(Object a0, Object a1) {
|
||||
if (a0 == null || a1 == null)
|
||||
return 0;
|
||||
if (a0 instanceof IEnvironmentVariable &&
|
||||
a1 instanceof IEnvironmentVariable) {
|
||||
IEnvironmentVariable x0 = (IEnvironmentVariable)a0;
|
||||
IEnvironmentVariable x1 = (IEnvironmentVariable)a1;
|
||||
String s0 = x0.getName();
|
||||
if (s0 == null)
|
||||
s0 = AbstractPage.EMPTY_STR;
|
||||
String s1 = x1.getName();
|
||||
if (s1 == null)
|
||||
s1 = AbstractPage.EMPTY_STR;
|
||||
return(s0.compareTo(s1));
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMulti(boolean val) {
|
||||
isMulti = val;
|
||||
}
|
||||
|
||||
public IEnvironmentVariable addVariable(String name, String value,
|
||||
int op, String delimiter, ICConfigurationDescription des) {
|
||||
cfs = getCfs(des);
|
||||
IEnvironmentVariable v = null;
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
v = ice.addVariable(name, value, op, delimiter, cfs[i]);
|
||||
return v;
|
||||
}
|
||||
|
||||
public boolean appendEnvironment(ICConfigurationDescription des) {
|
||||
cfs = getCfs(des);
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
if (! ice.appendEnvironment(cfs[i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnvironmentVariable getVariable(String name,
|
||||
ICConfigurationDescription des) {
|
||||
if (!isMulti)
|
||||
return ice.getVariable(name, des);
|
||||
// should we show ANY vars, even if they exist not in all cfgs ?
|
||||
boolean any = (getDispMode(des) == ICMultiItemsHolder.DMODE_ALL);
|
||||
cfs = getCfs(des);
|
||||
IEnvironmentVariable v = ice.getVariable(name, cfs[0]);
|
||||
// if ((any && v != null) || (! any && v == null))
|
||||
if (any ^ (v == null))
|
||||
return v;
|
||||
for (int i=1; i<cfs.length; i++) {
|
||||
IEnvironmentVariable w = ice.getVariable(name, cfs[i]);
|
||||
if (any && (w != null))
|
||||
return w;
|
||||
// if (! any && ! v==w)
|
||||
if (! (any || v.equals(w)))
|
||||
return null;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public IEnvironmentVariable[] getVariables(
|
||||
ICConfigurationDescription des) {
|
||||
if (!isMulti)
|
||||
return ice.getVariables(des);
|
||||
cfs = getCfs(des);
|
||||
IEnvironmentVariable[][] evs = new IEnvironmentVariable[cfs.length][];
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
evs[i] = ice.getVariables(cfs[i]);
|
||||
|
||||
Object[] obs = ((ICMultiItemsHolder)des).getListForDisplay(evs, comparator);
|
||||
IEnvironmentVariable[] ev = new IEnvironmentVariable[obs.length];
|
||||
System.arraycopy(obs, 0, ev, 0, obs.length);
|
||||
return ev;
|
||||
|
||||
}
|
||||
|
||||
public boolean isUserVariable(ICConfigurationDescription des,
|
||||
IEnvironmentVariable var) {
|
||||
cfs = getCfs(des);
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
if (! ice.isUserVariable(cfs[i], var))
|
||||
return false;
|
||||
return true; // only if for each cfg
|
||||
}
|
||||
|
||||
public IEnvironmentVariable removeVariable(String name,
|
||||
ICConfigurationDescription des) {
|
||||
IEnvironmentVariable res = null;
|
||||
cfs = getCfs(des);
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
res = ice.removeVariable(name, cfs[i]);
|
||||
return res;
|
||||
}
|
||||
|
||||
public void restoreDefaults(ICConfigurationDescription des) {
|
||||
cfs = getCfs(des);
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
ice.restoreDefaults(cfs[i]);
|
||||
}
|
||||
|
||||
public void setAppendEnvironment(boolean append,ICConfigurationDescription des) {
|
||||
cfs = getCfs(des);
|
||||
for (int i=0; i<cfs.length; i++)
|
||||
ice.setAppendEnvironment(append, cfs[i]);
|
||||
}
|
||||
|
||||
private ICConfigurationDescription[] getCfs(ICConfigurationDescription des) {
|
||||
if (isMulti && des instanceof ICMultiConfigDescription) {
|
||||
return (ICConfigurationDescription[])((ICMultiConfigDescription)des).getItems();
|
||||
} else {
|
||||
mono[0] = des;
|
||||
return mono;
|
||||
}
|
||||
}
|
||||
|
||||
private int getDispMode(ICConfigurationDescription des) {
|
||||
if (isMulti && des instanceof MultiItemsHolder)
|
||||
return ((MultiItemsHolder)des).getStringListMode() & ICMultiItemsHolder.DMODES;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -346,7 +346,6 @@ PropertyPageDefsTab.12=Save size and position
|
|||
PropertyPageDefsTab.13=Save size only
|
||||
PropertyPageDefsTab.14=Do not save at all
|
||||
PropertyPageDefsTab.15=Center dialogs on screen
|
||||
PropertyPageDefsTab.2=Enable multiple configurations setting
|
||||
PropertyPageDefsTab.4=Display "Tool chain editor" tab
|
||||
PropertyPageDefsTab.5=Discovery profiles naming rule
|
||||
PropertyPageDefsTab.6=Show disc. page names if they are unique. Else names + profile IDs.
|
||||
|
|
|
@ -116,7 +116,16 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
public void updateData(ICResourceDescription cfgd) {
|
||||
initData();
|
||||
if (page.isMultiCfg()) {
|
||||
usercomp.setVisible(false);
|
||||
buttoncomp.setVisible(false);
|
||||
} else {
|
||||
if ( !usercomp.getVisible()) {
|
||||
usercomp.setVisible(true);
|
||||
buttoncomp.setVisible(true);
|
||||
}
|
||||
initData();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveChecked() {
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.swt.accessibility.AccessibleAdapter;
|
|||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||
import org.eclipse.cdt.core.settings.model.CMacroEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
|
|
Loading…
Add table
Reference in a new issue