mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 15:55:47 +02:00
bug 274684: Indicators of string list modes for multi-configuration edits look like debug texts
This commit is contained in:
parent
b1132c434c
commit
4ec4353e88
5 changed files with 187 additions and 124 deletions
|
@ -20,11 +20,18 @@ public class Messages extends NLS {
|
||||||
public static String AbstractExportTab_1;
|
public static String AbstractExportTab_1;
|
||||||
public static String AbstractExportTab_2;
|
public static String AbstractExportTab_2;
|
||||||
public static String AbstractExportTab_3;
|
public static String AbstractExportTab_3;
|
||||||
public static String AbstractLangsListTab_0;
|
public static String AbstractLangsListTab_ShowBuiltin;
|
||||||
public static String AbstractLangsListTab_1;
|
public static String AbstractLangsListTab_Languages;
|
||||||
public static String AbstractLangsListTab_2;
|
public static String AbstractLangsListTab_Export;
|
||||||
public static String AbstractLangsListTab_3;
|
public static String AbstractLangsListTab_ExportIndicator;
|
||||||
public static String AbstractLangsListTab_4;
|
public static String AbstractLangsListTab_Unexport;
|
||||||
|
public static String AbstractLangsListTab_Conjunction;
|
||||||
|
public static String AbstractLangsListTab_Disjunction;
|
||||||
|
public static String AbstractLangsListTab_Modify;
|
||||||
|
public static String AbstractLangsListTab_MultiConfigStringListModeLinkHint;
|
||||||
|
public static String AbstractLangsListTab_Replace;
|
||||||
|
public static String AbstractLangsListTab_StringListMode;
|
||||||
|
public static String AbstractLangsListTab_UnknownMode;
|
||||||
public static String AbstractPage_0;
|
public static String AbstractPage_0;
|
||||||
public static String AbstractPage_10;
|
public static String AbstractPage_10;
|
||||||
public static String AbstractPage_11;
|
public static String AbstractPage_11;
|
||||||
|
|
|
@ -100,11 +100,18 @@ AbstractPage_8=Cannot apply
|
||||||
AbstractPage_9=Internal error
|
AbstractPage_9=Internal error
|
||||||
AbstractPage_rebuildIndex_question=Changes to the include search paths or defined symbols will not be reflected in the index until it is rebuilt. Do you wish to rebuild it now?
|
AbstractPage_rebuildIndex_question=Changes to the include search paths or defined symbols will not be reflected in the index until it is rebuilt. Do you wish to rebuild it now?
|
||||||
|
|
||||||
AbstractLangsListTab_0=Show built-in values
|
AbstractLangsListTab_ShowBuiltin=Show built-in values
|
||||||
AbstractLangsListTab_1=Languages
|
AbstractLangsListTab_Languages=Languages
|
||||||
AbstractLangsListTab_2=Export
|
AbstractLangsListTab_Export=Export
|
||||||
AbstractLangsListTab_3=\ [exp]
|
AbstractLangsListTab_ExportIndicator=\ [exp]
|
||||||
AbstractLangsListTab_4=Unexport
|
AbstractLangsListTab_Unexport=Unexport
|
||||||
|
AbstractLangsListTab_Conjunction=Conjunction
|
||||||
|
AbstractLangsListTab_Disjunction=Disjunction
|
||||||
|
AbstractLangsListTab_Modify=Modify
|
||||||
|
AbstractLangsListTab_MultiConfigStringListModeLinkHint=Multiple configurations string list mode. Click on link to change or for more info.
|
||||||
|
AbstractLangsListTab_Replace=Replace
|
||||||
|
AbstractLangsListTab_StringListMode=String List Mode:
|
||||||
|
AbstractLangsListTab_UnknownMode=Unknown
|
||||||
AbstractExportTab_0=[All]
|
AbstractExportTab_0=[All]
|
||||||
AbstractExportTab_1=[List]
|
AbstractExportTab_1=[List]
|
||||||
AbstractExportTab_2=Create...
|
AbstractExportTab_2=Create...
|
||||||
|
|
|
@ -67,7 +67,7 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
* It is a parent for all standard property tabs
|
* It is a parent for all standard property tabs
|
||||||
* in new CDT model.
|
* in new CDT model.
|
||||||
*
|
*
|
||||||
* Although it's enougth for new tabs to implement
|
* Although it's enough for new tabs to implement
|
||||||
* ICPropertyTab interface only, it would be better
|
* ICPropertyTab interface only, it would be better
|
||||||
* to extend them from this class.
|
* to extend them from this class.
|
||||||
*
|
*
|
||||||
|
@ -667,6 +667,14 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
||||||
background.setText(s == null ? BACKGROUND_TEXT_DEFAULT : s);
|
background.setText(s == null ? BACKGROUND_TEXT_DEFAULT : s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to display double-clickable buttons for multiple configurations
|
||||||
|
* string list mode (see Multiple Configurations Edit Preference page).
|
||||||
|
*
|
||||||
|
* @deprecated as of CDT 8.0. This functionality is presented as links
|
||||||
|
* to the preference page, see {@link AbstractLangsListTab#updateStringListModeControl()}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void updateLbs(Label lb1, Label lb2) {
|
protected void updateLbs(Label lb1, Label lb2) {
|
||||||
if (page.isMultiCfg()) {
|
if (page.isMultiCfg()) {
|
||||||
if (lb1 != null) {
|
if (lb1 != null) {
|
||||||
|
|
|
@ -25,12 +25,11 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.events.ControlEvent;
|
import org.eclipse.swt.events.ControlEvent;
|
||||||
import org.eclipse.swt.events.ControlListener;
|
import org.eclipse.swt.events.ControlListener;
|
||||||
import org.eclipse.swt.events.MouseAdapter;
|
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
import org.eclipse.swt.events.PaintListener;
|
import org.eclipse.swt.events.PaintListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -44,12 +43,14 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Link;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
import org.eclipse.swt.widgets.Tree;
|
||||||
import org.eclipse.swt.widgets.TreeColumn;
|
import org.eclipse.swt.widgets.TreeColumn;
|
||||||
import org.eclipse.swt.widgets.TreeItem;
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
|
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||||
import org.eclipse.cdt.core.model.LanguageManager;
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
|
@ -73,6 +74,8 @@ import org.eclipse.cdt.ui.CDTSharedImages;
|
||||||
import org.eclipse.cdt.internal.ui.newui.Messages;
|
import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
|
|
||||||
public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
|
private static final String STRING_LIST_MODE_PREFERENCE_PAGE = "org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_MultiConfig"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected Table table;
|
protected Table table;
|
||||||
protected TableViewer tv;
|
protected TableViewer tv;
|
||||||
protected Tree langTree;
|
protected Tree langTree;
|
||||||
|
@ -80,7 +83,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
protected Button showBIButton;
|
protected Button showBIButton;
|
||||||
protected boolean toAllCfgs = false;
|
protected boolean toAllCfgs = false;
|
||||||
protected boolean toAllLang = false;
|
protected boolean toAllLang = false;
|
||||||
|
/** @deprecated as of CDT 8.0. {@code linkStringListMode} is used instead. */
|
||||||
|
@Deprecated
|
||||||
protected Label lb1, lb2;
|
protected Label lb1, lb2;
|
||||||
|
|
||||||
|
private Link linkStringListMode;
|
||||||
protected TableColumn columnToFit = null;
|
protected TableColumn columnToFit = null;
|
||||||
|
|
||||||
protected ICLanguageSetting lang;
|
protected ICLanguageSetting lang;
|
||||||
|
@ -103,7 +110,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ADD_STR,
|
ADD_STR,
|
||||||
EDIT_STR,
|
EDIT_STR,
|
||||||
DEL_STR,
|
DEL_STR,
|
||||||
Messages.AbstractLangsListTab_2,
|
Messages.AbstractLangsListTab_Export,
|
||||||
null,
|
null,
|
||||||
MOVEUP_STR,
|
MOVEUP_STR,
|
||||||
MOVEDOWN_STR
|
MOVEDOWN_STR
|
||||||
|
@ -112,7 +119,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ADD_STR,
|
ADD_STR,
|
||||||
EDIT_STR,
|
EDIT_STR,
|
||||||
DEL_STR,
|
DEL_STR,
|
||||||
Messages.AbstractLangsListTab_2
|
Messages.AbstractLangsListTab_Export
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Comparator<Object> comp = CDTListComparator.getInstance();
|
private static final Comparator<Object> comp = CDTListComparator.getInstance();
|
||||||
|
@ -128,7 +135,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
@Override
|
@Override
|
||||||
public void createControls(Composite parent) {
|
public void createControls(Composite parent) {
|
||||||
super.createControls(parent);
|
super.createControls(parent);
|
||||||
usercomp.setLayout(new GridLayout(2, true));
|
usercomp.setLayout(new GridLayout(2, false));
|
||||||
GridData gd = (GridData) usercomp.getLayoutData();
|
GridData gd = (GridData) usercomp.getLayoutData();
|
||||||
// Discourage settings entry table from trying to show all its items at once, see bug 264330
|
// Discourage settings entry table from trying to show all its items at once, see bug 264330
|
||||||
gd.heightHint =1;
|
gd.heightHint =1;
|
||||||
|
@ -209,21 +216,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
setColumnToFit();
|
setColumnToFit();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
setupLabel(usercomp, EMPTY_STR, 1, 0);
|
showBIButton = setupCheck(usercomp, Messages.AbstractLangsListTab_ShowBuiltin, 1, GridData.GRAB_HORIZONTAL);
|
||||||
|
gd = (GridData) showBIButton.getLayoutData();
|
||||||
lb1 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
|
|
||||||
lb1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
|
||||||
lb1.setToolTipText(Messages.EnvironmentTab_15);
|
|
||||||
lb1.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseDoubleClick(MouseEvent e) {
|
|
||||||
CDTPrefUtil.spinDMode();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
showBIButton = setupCheck(usercomp,
|
|
||||||
Messages.AbstractLangsListTab_0, 1, GridData.FILL_HORIZONTAL);
|
|
||||||
showBIButton.addSelectionListener(new SelectionAdapter() {
|
showBIButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -231,22 +225,74 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
lb2 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
|
createLinkToPreferences(usercomp, 1);
|
||||||
lb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
|
||||||
lb2.setToolTipText(Messages.EnvironmentTab_23);
|
|
||||||
lb2.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseDoubleClick(MouseEvent e) {
|
|
||||||
CDTPrefUtil.spinWMode();
|
|
||||||
updateLbs(null, lb2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
additionalTableSet();
|
additionalTableSet();
|
||||||
initButtons((getKind() == ICSettingEntry.MACRO) ? BUTTSYM : BUTTONS);
|
initButtons((getKind() == ICSettingEntry.MACRO) ? BUTTSYM : BUTTONS);
|
||||||
updateData(getResDesc());
|
updateData(getResDesc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createLinkToPreferences(final Composite parent, int span) {
|
||||||
|
linkStringListMode = new Link(parent, SWT.NONE);
|
||||||
|
updateStringListModeLink(linkStringListMode);
|
||||||
|
linkStringListMode.setToolTipText(Messages.AbstractLangsListTab_MultiConfigStringListModeLinkHint);
|
||||||
|
|
||||||
|
linkStringListMode.addListener(SWT.Selection, new Listener() {
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
// Use event.text to tell which link was used
|
||||||
|
int result = PreferencesUtil.createPreferenceDialogOn(parent.getShell(), STRING_LIST_MODE_PREFERENCE_PAGE, null, null).open();
|
||||||
|
if (result!=Window.CANCEL) {
|
||||||
|
updateStringListModeControl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
GridData gridData = new GridData(SWT.RIGHT, SWT.NONE, true, false);
|
||||||
|
gridData.horizontalSpan = span;
|
||||||
|
linkStringListMode.setLayoutData(gridData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to display UI control for multiple configurations string list mode
|
||||||
|
* (see Multiple Configurations Edit Preference page).
|
||||||
|
*
|
||||||
|
* @since 5.3
|
||||||
|
*/
|
||||||
|
protected void updateStringListModeControl() {
|
||||||
|
updateStringListModeLink(linkStringListMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStringListModeLink(Link link) {
|
||||||
|
boolean isMultiCfg = page.isMultiCfg();
|
||||||
|
linkStringListMode.setVisible(isMultiCfg);
|
||||||
|
if (isMultiCfg) {
|
||||||
|
String modeUnknown = Messages.AbstractLangsListTab_UnknownMode;
|
||||||
|
String modeDisplay = modeUnknown;
|
||||||
|
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) {
|
||||||
|
case CDTPrefUtil.DMODE_CONJUNCTION:
|
||||||
|
modeDisplay = Messages.AbstractLangsListTab_Conjunction;
|
||||||
|
break;
|
||||||
|
case CDTPrefUtil.DMODE_DISJUNCTION:
|
||||||
|
modeDisplay = Messages.AbstractLangsListTab_Disjunction;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
String modeWrite = modeUnknown;
|
||||||
|
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE)) {
|
||||||
|
case CDTPrefUtil.WMODE_MODIFY:
|
||||||
|
modeWrite = Messages.AbstractLangsListTab_Modify;
|
||||||
|
break;
|
||||||
|
case CDTPrefUtil.WMODE_REPLACE:
|
||||||
|
modeWrite = Messages.AbstractLangsListTab_Replace;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
linkStringListMode.setText(Messages.AbstractLangsListTab_StringListMode +
|
||||||
|
" <a href=\"workspace-settings\">"+modeDisplay+"</a> + <a href=\"workspace-settings\">"+modeWrite+"</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
}
|
||||||
|
linkStringListMode.getParent().layout();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates state for all buttons
|
* Updates state for all buttons
|
||||||
* Called when table selection changes.
|
* Called when table selection changes.
|
||||||
|
@ -265,11 +311,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
if (ent.isReadOnly()) canEdit = false;
|
if (ent.isReadOnly()) canEdit = false;
|
||||||
if (ent.isReadOnly()) canDelete = false;
|
if (ent.isReadOnly()) canDelete = false;
|
||||||
if (exported.contains(resolve(ent)))
|
if (exported.contains(resolve(ent)))
|
||||||
buttonSetText(BUTTON_EXPORT_UNEXPORT, Messages.AbstractLangsListTab_4);
|
buttonSetText(BUTTON_EXPORT_UNEXPORT, Messages.AbstractLangsListTab_Unexport);
|
||||||
else
|
else
|
||||||
buttonSetText(BUTTON_EXPORT_UNEXPORT, Messages.AbstractLangsListTab_2);
|
buttonSetText(BUTTON_EXPORT_UNEXPORT, Messages.AbstractLangsListTab_Export);
|
||||||
} else {
|
} else {
|
||||||
buttonSetText(BUTTON_EXPORT_UNEXPORT, Messages.AbstractLangsListTab_2);
|
buttonSetText(BUTTON_EXPORT_UNEXPORT, Messages.AbstractLangsListTab_Export);
|
||||||
}
|
}
|
||||||
boolean canMoveUp = false;
|
boolean canMoveUp = false;
|
||||||
boolean canMoveDown = false;
|
boolean canMoveDown = false;
|
||||||
|
@ -316,16 +362,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
});
|
});
|
||||||
|
|
||||||
langCol = new TreeColumn(langTree, SWT.NONE);
|
langCol = new TreeColumn(langTree, SWT.NONE);
|
||||||
langCol.setText(Messages.AbstractLangsListTab_1);
|
langCol.setText(Messages.AbstractLangsListTab_Languages);
|
||||||
langCol.setWidth(200);
|
langCol.setWidth(200);
|
||||||
langCol.setResizable(false);
|
langCol.setResizable(false);
|
||||||
langCol.setToolTipText(Messages.AbstractLangsListTab_1);
|
langCol.setToolTipText(Messages.AbstractLangsListTab_Languages);
|
||||||
// langTree.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
|
||||||
// @Override
|
|
||||||
// public void getName(AccessibleEvent e) {
|
|
||||||
// e.result = UIMessages.AbstractLangsListTab_1; //$NON-NLS-1$
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
return langTree;
|
return langTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +398,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
else if (table.getItemCount() > 0) table.setSelection(0);
|
else if (table.getItemCount() > 0) table.setSelection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLbs(lb1, lb2);
|
updateStringListModeControl();
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +780,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
if (columnIndex == 0) {
|
if (columnIndex == 0) {
|
||||||
String s = le.getName();
|
String s = le.getName();
|
||||||
if (exported.contains(resolve(le)))
|
if (exported.contains(resolve(le)))
|
||||||
s = s + Messages.AbstractLangsListTab_3;
|
s = s + Messages.AbstractLangsListTab_ExportIndicator;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
if (le.getKind() == ICSettingEntry.MACRO) {
|
if (le.getKind() == ICSettingEntry.MACRO) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class SymbolTab extends AbstractLangsListTab {
|
||||||
else if (table.getItemCount() > 0)
|
else if (table.getItemCount() > 0)
|
||||||
table.setSelection(0);
|
table.setSelection(0);
|
||||||
}
|
}
|
||||||
updateLbs(lb1, lb2);
|
updateStringListModeControl();
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue