mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug #182290 : add CDT vars/symbols to all languages
This commit is contained in:
parent
68c120a672
commit
45581a740c
9 changed files with 83 additions and 42 deletions
|
@ -63,7 +63,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
protected Tree langTree;
|
||||
protected TreeColumn langCol;
|
||||
protected Button showBIButton;
|
||||
protected boolean toAll = false;
|
||||
protected boolean toAllCfgs = false;
|
||||
protected boolean toAllLang = false;
|
||||
|
||||
// protected boolean showBI = false;
|
||||
// boolean savedShowBI = false;
|
||||
|
@ -332,10 +333,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
|
||||
switch (i) {
|
||||
case 0: // add
|
||||
toAll = false;
|
||||
toAllCfgs = false;
|
||||
toAllLang = false;
|
||||
ent = doAdd();
|
||||
if (ent != null) {
|
||||
if (toAll) {
|
||||
if (toAllCfgs || toAllLang) {
|
||||
addToAll(ent);
|
||||
} else {
|
||||
incs.add(ent);
|
||||
|
@ -399,13 +401,17 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
*/
|
||||
private void addToAll(ICLanguageSettingEntry ent) {
|
||||
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
|
||||
ICResourceDescription cur_cfg = page.getResDesc();
|
||||
String id = lang.getName(); // getLanguageId() sometimes returns null.
|
||||
for (int i = 0; i < cfgs.length; i++) {
|
||||
ICResourceDescription rcfg = page.getResDesc(cfgs[i]);
|
||||
if (rcfg == null) continue;
|
||||
if (rcfg == null)
|
||||
continue;
|
||||
if (!toAllCfgs && !(cur_cfg.equals(rcfg)))
|
||||
continue;
|
||||
ICLanguageSetting [] ls = getLangSetting(rcfg);
|
||||
for (int j = 0; j < ls.length; j++ ) {
|
||||
if (id == ls[j].getName()) {
|
||||
if (id == ls[j].getName() || toAllLang) {
|
||||
List lst = ls[j].getSettingEntriesList(getKind());
|
||||
lst.add(ent);
|
||||
ls[j].setSettingEntries(getKind(), lst);
|
||||
|
|
|
@ -34,6 +34,7 @@ public abstract class AbstractPropertyDialog extends Dialog {
|
|||
public Object data = null;
|
||||
public boolean check1 = false;
|
||||
public boolean check2 = false;
|
||||
public boolean check3 = false;
|
||||
public String text1;
|
||||
public String text2;
|
||||
private Shell parent;
|
||||
|
|
|
@ -31,7 +31,8 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
|||
|
||||
public class IncludeDialog extends AbstractPropertyDialog {
|
||||
public String sdata;
|
||||
public Button b_add2all;
|
||||
private Button b_add2confs;
|
||||
private Button b_add2langs;
|
||||
public Text text;
|
||||
private Button b_work;
|
||||
private Button b_file;
|
||||
|
@ -62,7 +63,7 @@ public class IncludeDialog extends AbstractPropertyDialog {
|
|||
}
|
||||
|
||||
protected Control createDialogArea(Composite c) {
|
||||
c.setLayout(new GridLayout(5, true));
|
||||
c.setLayout(new GridLayout(3, true));
|
||||
GridData gd;
|
||||
|
||||
Label l1 = new Label(c, SWT.NONE);
|
||||
|
@ -71,40 +72,48 @@ public class IncludeDialog extends AbstractPropertyDialog {
|
|||
else
|
||||
l1.setText(UIMessages.getString("IncludeDialog.1")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.BEGINNING);
|
||||
gd.horizontalSpan = 5;
|
||||
gd.horizontalSpan = 3;
|
||||
l1.setLayoutData(gd);
|
||||
|
||||
text = new Text(c, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 5;
|
||||
gd.widthHint = 400;
|
||||
gd.horizontalSpan = 3;
|
||||
gd.widthHint = 450;
|
||||
text.setLayoutData(gd);
|
||||
if ((mode & OLD_MASK) == OLD_MASK) { text.setText(sdata); }
|
||||
text.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
setButtons();
|
||||
}});
|
||||
b_add2all = new Button(c, SWT.CHECK);
|
||||
b_add2all.setText(UIMessages.getString("IncludeDialog.2")); //$NON-NLS-1$
|
||||
|
||||
b_add2confs = new Button(c, SWT.CHECK);
|
||||
b_add2confs.setText(UIMessages.getString("IncludeDialog.2")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 4;
|
||||
gd.horizontalSpan = 2;
|
||||
if ((mode & OLD_MASK) == OLD_MASK) {
|
||||
gd.heightHint = 1;
|
||||
b_add2all.setVisible(false);
|
||||
b_add2confs.setVisible(false);
|
||||
}
|
||||
b_add2all.setLayoutData(gd);
|
||||
|
||||
b_vars = setupButton(c, AbstractCPropertyTab.VARIABLESBUTTON_NAME);
|
||||
new Label(c, 0).setLayoutData(new GridData()); // placeholder
|
||||
b_ok = setupButton(c, IDialogConstants.OK_LABEL);
|
||||
b_ko = setupButton(c, IDialogConstants.CANCEL_LABEL);
|
||||
b_work = setupButton(c, AbstractCPropertyTab.WORKSPACEBUTTON_NAME);
|
||||
b_file = setupButton(c, AbstractCPropertyTab.FILESYSTEMBUTTON_NAME);
|
||||
b_add2confs.setLayoutData(gd);
|
||||
|
||||
b_vars = setupButton(c, AbstractCPropertyTab.VARIABLESBUTTON_NAME);
|
||||
|
||||
b_add2langs = new Button(c, SWT.CHECK);
|
||||
b_add2langs.setText(UIMessages.getString("IncludeDialog.3")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
if ((mode & OLD_MASK) == OLD_MASK) {
|
||||
gd.heightHint = 1;
|
||||
b_add2langs.setVisible(false);
|
||||
}
|
||||
b_add2langs.setLayoutData(gd);
|
||||
|
||||
b_work = setupButton(c, AbstractCPropertyTab.WORKSPACEBUTTON_NAME);
|
||||
|
||||
c_wsp = new Button(c, SWT.CHECK);
|
||||
c_wsp.setText(UIMessages.getString("ExpDialog.4")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.BEGINNING);
|
||||
gd.horizontalSpan = 5;
|
||||
gd.horizontalSpan = 2;
|
||||
c_wsp.setLayoutData(gd);
|
||||
c_wsp.setSelection(isWsp);
|
||||
c_wsp.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -113,6 +122,12 @@ public class IncludeDialog extends AbstractPropertyDialog {
|
|||
}});
|
||||
|
||||
c_wsp.setImage(AbstractExportTab.getWspImage(isWsp));
|
||||
|
||||
b_file = setupButton(c, AbstractCPropertyTab.FILESYSTEMBUTTON_NAME);
|
||||
|
||||
new Label(c, 0).setLayoutData(new GridData()); // placeholder
|
||||
b_ok = setupButton(c, IDialogConstants.OK_LABEL);
|
||||
b_ko = setupButton(c, IDialogConstants.CANCEL_LABEL);
|
||||
|
||||
c.getShell().setDefaultButton(b_ok);
|
||||
c.pack();
|
||||
|
@ -128,8 +143,9 @@ public class IncludeDialog extends AbstractPropertyDialog {
|
|||
String s;
|
||||
if (e.widget.equals(b_ok)) {
|
||||
text1 = text.getText();
|
||||
check1 = b_add2all.getSelection();
|
||||
check1 = b_add2confs.getSelection();
|
||||
check2 = c_wsp.getSelection();
|
||||
check3 = b_add2langs.getSelection();
|
||||
result = true;
|
||||
shell.dispose();
|
||||
} else if (e.widget.equals(b_ko)) {
|
||||
|
|
|
@ -32,7 +32,8 @@ public class IncludeTab extends AbstractLangsListTab {
|
|||
UIMessages.getString("IncludeTab.1"), //$NON-NLS-1$
|
||||
EMPTY_STR, getResDesc().getConfiguration(), 0);
|
||||
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
||||
toAll = dlg.check1;
|
||||
toAllCfgs = dlg.check1;
|
||||
toAllLang = dlg.check3;
|
||||
int flags = 0;
|
||||
if (dlg.check2) { // isWsp
|
||||
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||
|
|
|
@ -48,6 +48,8 @@ public class LibraryPathTab extends AbstractLangsListTab implements IPathEntrySt
|
|||
UIMessages.getString("LibraryPathTab.1"), //$NON-NLS-1$
|
||||
EMPTY_STR, getResDesc().getConfiguration(), 0);
|
||||
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
||||
toAllCfgs = dlg.check1;
|
||||
toAllLang = dlg.check3;
|
||||
int flags = 0;
|
||||
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||
return new CLibraryPathEntry(dlg.text1, flags);
|
||||
|
|
|
@ -48,6 +48,8 @@ public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreL
|
|||
UIMessages.getString("LibraryTab.1"), //$NON-NLS-1$
|
||||
EMPTY_STR, getResDesc().getConfiguration(), 0);
|
||||
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
||||
toAllCfgs = dlg.check1;
|
||||
toAllLang = dlg.check3;
|
||||
int flags = 0;
|
||||
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||
return new CLibraryFileEntry(dlg.text1, flags);
|
||||
|
|
|
@ -446,6 +446,7 @@ IncludeTab.2=Change directory path
|
|||
IncludeDialog.0=Directory :
|
||||
IncludeDialog.1=File :
|
||||
IncludeDialog.2=Add to all configurations
|
||||
IncludeDialog.3=Add to all languages
|
||||
LanguagesTab.0=Content type
|
||||
LanguagesTab.1=Language
|
||||
LibraryPathTab.0=Library paths
|
||||
|
@ -475,7 +476,6 @@ ConfigMultiSelectionDialog.0=Select configurations
|
|||
ConfigMultiSelectionDialog.1=At least 2 configurations should be selected
|
||||
SymbolDialog.0=Name:
|
||||
SymbolDialog.1=Value:
|
||||
SymbolDialog.2=Add to all configurations
|
||||
ConfigDescriptionTab.0=Project Description
|
||||
ConfigDescriptionTab.1=Configuration Description
|
||||
ConfigDescriptionTab.2=Resource Description
|
||||
|
|
|
@ -28,16 +28,17 @@ import org.eclipse.swt.widgets.Text;
|
|||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
|
||||
public class SymbolDialog extends AbstractPropertyDialog {
|
||||
String data1;
|
||||
String data2;
|
||||
Button b_add2all;
|
||||
Text txt1;
|
||||
Text txt2;
|
||||
Button b_vars;
|
||||
Button b_ok;
|
||||
Button b_ko;
|
||||
boolean newAction;
|
||||
ICResourceDescription cfgd;
|
||||
private String data1;
|
||||
private String data2;
|
||||
private Button b_add2conf;
|
||||
private Button b_add2lang;
|
||||
private Text txt1;
|
||||
private Text txt2;
|
||||
private Button b_vars;
|
||||
private Button b_ok;
|
||||
private Button b_ko;
|
||||
private boolean newAction;
|
||||
private ICResourceDescription cfgd;
|
||||
|
||||
public SymbolDialog(Shell parent, boolean _newAction,
|
||||
String title, String _data1, String _data2,
|
||||
|
@ -83,13 +84,23 @@ public class SymbolDialog extends AbstractPropertyDialog {
|
|||
|
||||
b_vars = setupButton(c, AbstractCPropertyTab.VARIABLESBUTTON_NAME);
|
||||
|
||||
b_add2all = new Button(c, SWT.CHECK);
|
||||
b_add2all.setText(UIMessages.getString("SymbolDialog.2")); //$NON-NLS-1$
|
||||
b_add2conf = new Button(c, SWT.CHECK);
|
||||
b_add2conf.setText(UIMessages.getString("IncludeDialog.2")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 4;
|
||||
b_add2all.setLayoutData(gd);
|
||||
b_add2conf.setLayoutData(gd);
|
||||
if (!newAction) {
|
||||
b_add2all.setVisible(false);
|
||||
b_add2conf.setVisible(false);
|
||||
txt1.setEnabled(false); // don't change name
|
||||
}
|
||||
|
||||
b_add2lang = new Button(c, SWT.CHECK);
|
||||
b_add2lang.setText(UIMessages.getString("IncludeDialog.3")); //$NON-NLS-1$
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 4;
|
||||
b_add2lang.setLayoutData(gd);
|
||||
if (!newAction) {
|
||||
b_add2lang.setVisible(false);
|
||||
txt1.setEnabled(false); // don't change name
|
||||
}
|
||||
|
||||
|
@ -118,7 +129,8 @@ public class SymbolDialog extends AbstractPropertyDialog {
|
|||
if (e.widget.equals(b_ok)) {
|
||||
super.text1 = txt1.getText();
|
||||
super.text2 = txt2.getText();
|
||||
check1 = b_add2all.getSelection();
|
||||
check1 = b_add2conf.getSelection();
|
||||
check3 = b_add2lang.getSelection();
|
||||
result = true;
|
||||
shell.dispose();
|
||||
} else if (e.widget.equals(b_ko)) {
|
||||
|
|
|
@ -37,7 +37,8 @@ public class SymbolTab extends AbstractLangsListTab {
|
|||
usercomp.getShell(), true,
|
||||
UIMessages.getString("SymbolTab.2"), EMPTY_STR, EMPTY_STR, getResDesc()); //$NON-NLS-1$
|
||||
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
||||
toAll = dlg.check1;
|
||||
toAllCfgs = dlg.check1;
|
||||
toAllLang = dlg.check3;
|
||||
return new CMacroEntry(dlg.text1, dlg.text2, 0);
|
||||
} else
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue