mirror of
https://github.com/eclipse-cdt/cdt
synced 2024-10-28 12:09:40 +01:00
bug 189220 - provide more information on preferred tool chains for accessibility
This commit is contained in:
parent
a3f8615631
commit
44ef37f350
4 changed files with 67 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* Copyright (c) 2007, 2008 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,9 +7,13 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.ui.preferences;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
|
||||
|
@ -44,6 +48,8 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
private Button pref1;
|
||||
private Button pref0;
|
||||
|
||||
private Label preferredTCsLabel;
|
||||
|
||||
public void createControls(Composite parent) {
|
||||
super.createControls(parent);
|
||||
|
@ -69,6 +75,7 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
|||
TreeItem[] tis = tree.getSelection();
|
||||
if (tis == null || tis.length == 0) return;
|
||||
switchTo((CWizardHandler)tis[0].getData(), (EntryDescriptor)tis[0].getData(CDTMainWizardPage.DESC));
|
||||
updatePreferredTCsLabel();
|
||||
}});
|
||||
|
||||
right = new Composite(c, SWT.NONE);
|
||||
|
@ -95,6 +102,15 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
|||
pref0.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) { setPref(false); }} );
|
||||
|
||||
//bug 189220 - provide more information for accessibility
|
||||
preferredTCsLabel = new Label(c, SWT.LEFT);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
preferredTCsLabel.setLayoutData(gd);
|
||||
|
||||
//space
|
||||
new Label(c, 0).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
show_sup = new Button(c, SWT.CHECK);
|
||||
show_sup.setSelection(true);
|
||||
show_sup.setText(Messages.getString("CMainWizardPage.1")); //$NON-NLS-1$
|
||||
|
@ -111,6 +127,8 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
|||
CDTPrefUtil.readPreferredTCs();
|
||||
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null),
|
||||
CDTMainWizardPage.getDescriptor(tree));
|
||||
|
||||
updatePreferredTCsLabel();
|
||||
}
|
||||
|
||||
private void setPref(boolean set) {
|
||||
|
@ -125,6 +143,27 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
|||
}
|
||||
}
|
||||
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
|
||||
|
||||
updatePreferredTCsLabel();
|
||||
}
|
||||
|
||||
//bug 189220 - provide more information for accessibility
|
||||
private void updatePreferredTCsLabel() {
|
||||
if (h_selected instanceof MBSWizardHandler) {
|
||||
List<String> tcs = ((MBSWizardHandler)h_selected).getPreferredTCNames();
|
||||
if (tcs.size() == 0) {
|
||||
preferredTCsLabel.setText(""); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<String> iterator = tcs.iterator();
|
||||
String temp = iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
temp = temp + ", " + iterator.next(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
preferredTCsLabel.setText(Messages.getString("PreferredToolchainsTab.3") + temp); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
// private void switchTo(CWizardHandler h) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2005, 2007 Intel Corporation and others
|
||||
# Copyright (c) 2005, 2008 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
|
||||
|
@ -102,6 +102,7 @@ WizardDefaultsTab.1=Group old-style toolchains to <Others> folder
|
|||
PreferredToolchainsTab.0=Preferred toolchain will be selected by default in Wizard
|
||||
PreferredToolchainsTab.1=Make toolchain(s) preferred
|
||||
PreferredToolchainsTab.2=Make toolchain(s) not preferred
|
||||
PreferredToolchainsTab.3=Preferred toolchain(s):
|
||||
StdProjectTypeHandler.0=-- Other Toolchain --
|
||||
StdProjectTypeHandler.2=Default
|
||||
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -103,6 +104,11 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
protected CfgHolder[] cfgs = null;
|
||||
protected IWizardPage[] customPages;
|
||||
|
||||
/**
|
||||
* Current list of preferred toolchains
|
||||
*/
|
||||
private List<String> preferredTCs = new ArrayList<String>();
|
||||
|
||||
protected static final class EntryInfo {
|
||||
private SortedMap<String, IToolChain> tcs;
|
||||
private EntryDescriptor entryDescriptor;
|
||||
|
@ -339,7 +345,8 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
table.getAccessible().addAccessibleListener(
|
||||
new AccessibleAdapter() {
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = head;
|
||||
if (e.result == null)
|
||||
e.result = head;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -576,14 +583,25 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
*/
|
||||
|
||||
public void updatePreferred(List<String> prefs) {
|
||||
preferredTCs.clear();
|
||||
int x = table.getItemCount();
|
||||
for (int i=0; i<x; i++) {
|
||||
TableItem ti = table.getItem(i);
|
||||
IToolChain tc = (IToolChain)ti.getData();
|
||||
String id = (tc == null) ? CDTPrefUtil.NULL : tc.getId();
|
||||
ti.setImage( prefs.contains(id) ? IMG1 : IMG0);
|
||||
if (prefs.contains(id)) {
|
||||
ti.setImage(IMG1);
|
||||
preferredTCs.add(tc.getName());
|
||||
}
|
||||
else
|
||||
ti.setImage(IMG0);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getPreferredTCNames() {
|
||||
return preferredTCs;
|
||||
}
|
||||
|
||||
public String getHeader() { return head; }
|
||||
public boolean isDummy() { return false; }
|
||||
public boolean supportsPreferred() { return true; }
|
||||
|
|
|
@ -125,7 +125,11 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
new AccessibleAdapter() {
|
||||
@Override
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = UIMessages.getString("CMainWizardPage.0"); //$NON-NLS-1$
|
||||
for (int i = 0; i < tree.getItemCount(); i++) {
|
||||
if (tree.getItem(i).getText().compareTo(e.result) == 0)
|
||||
return;
|
||||
}
|
||||
e.result = UIMessages.getString("CMainWizardPage.0"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue