1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 05:45:58 +02:00

- extern strings

- fixed tab folder visiblity problem
This commit is contained in:
David Inglis 2003-09-04 17:38:46 +00:00
parent 46c06a4a71
commit c96aeb760e
4 changed files with 45 additions and 32 deletions

View file

@ -16,6 +16,7 @@ import java.util.Iterator;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor; import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
@ -34,23 +35,26 @@ import org.eclipse.swt.widgets.Label;
public class BinaryParserBlock extends AbstractCOptionPage { public class BinaryParserBlock extends AbstractCOptionPage {
private static String[][] radios; private static final String PREFIX = "BinaryParserBlock"; // $NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; // $NON-NLS-1$
private static final String DESC = PREFIX + ".desc"; // $NON-NLS-1$
private static String[][] radios;
protected Combo comboBox; protected Combo comboBox;
private HashMap idMap = new HashMap(); private HashMap idMap = new HashMap();
private String initial; private String initial;
private Preferences fPrefs; private Preferences fPrefs;
public BinaryParserBlock(Preferences prefs) { public BinaryParserBlock(Preferences prefs) {
super("Binary Parser"); super(CUIPlugin.getResourceString(LABEL));
setDescription("Set required binary parser for this project"); setDescription(CUIPlugin.getResourceString(DESC));
fPrefs = prefs; fPrefs = prefs;
} }
public void createControl(Composite parent) { public void createControl(Composite parent) {
Composite control = ControlFactory.createComposite(parent, 2); Composite control = ControlFactory.createComposite(parent, 2);
((GridLayout)control.getLayout()).makeColumnsEqualWidth = false; ((GridLayout) control.getLayout()).makeColumnsEqualWidth = false;
((GridLayout)control.getLayout()).marginWidth = 5; ((GridLayout) control.getLayout()).marginWidth = 5;
ControlFactory.createEmptySpace(control, 2); ControlFactory.createEmptySpace(control, 2);
@ -65,9 +69,9 @@ public class BinaryParserBlock extends AbstractCOptionPage {
getContainer().updateContainer(); getContainer().updateContainer();
} }
}); });
Iterator items = idMap.keySet().iterator(); Iterator items = idMap.keySet().iterator();
while( items.hasNext()) { while (items.hasNext()) {
comboBox.add((String)items.next()); comboBox.add((String) items.next());
} }
if (initial != null) { if (initial != null) {
@ -87,13 +91,13 @@ public class BinaryParserBlock extends AbstractCOptionPage {
if (selected != null) { if (selected != null) {
if (initial == null || !selected.equals(initial)) { if (initial == null || !selected.equals(initial)) {
desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, (String)idMap.get(initial)); desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, (String) idMap.get(initial));
CCorePlugin.getDefault().getCoreModel().resetBinaryParser(getContainer().getProject()); CCorePlugin.getDefault().getCoreModel().resetBinaryParser(getContainer().getProject());
initial = selected; initial = selected;
} }
} }
} else { } else {
fPrefs.setDefault(CCorePlugin.PREF_BINARY_PARSER, (String)idMap.get(initial)); fPrefs.setDefault(CCorePlugin.PREF_BINARY_PARSER, (String) idMap.get(initial));
} }
} }

View file

@ -14,6 +14,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IndexModel; import org.eclipse.cdt.core.index.IndexModel;
import org.eclipse.cdt.internal.core.search.indexing.IndexManager; import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager; import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -23,13 +24,17 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
public class IndexerBlock extends AbstractCOptionPage { public class IndexerBlock extends AbstractCOptionPage {
private static final String PREFIX = "IndexerBlock"; // $NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; // $NON-NLS-1$
private static final String DESC = PREFIX + ".desc"; // $NON-NLS-1$
private Button indexerSwitch; private Button indexerSwitch;
private Button indexerSwitch2; private Button indexerSwitch2;
private Button dTreeSwitch; private Button dTreeSwitch;
public IndexerBlock() { public IndexerBlock() {
super("Indexer"); super(CUIPlugin.getResourceString(LABEL));
setDescription("Project Indexer option"); setDescription(CUIPlugin.getResourceString(DESC));
} }
public void createControl(Composite parent) { public void createControl(Composite parent) {
@ -41,11 +46,11 @@ public class IndexerBlock extends AbstractCOptionPage {
indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT); indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT);
indexerSwitch.setAlignment(SWT.LEFT); indexerSwitch.setAlignment(SWT.LEFT);
indexerSwitch.setText("Enable CTAGS indexing service for this project"); indexerSwitch.setText("Enable CTAGS indexing service for this project");
indexerSwitch2 = new Button(composite, SWT.CHECK | SWT.RIGHT); indexerSwitch2 = new Button(composite, SWT.CHECK | SWT.RIGHT);
indexerSwitch2.setAlignment(SWT.LEFT); indexerSwitch2.setAlignment(SWT.LEFT);
indexerSwitch2.setText("Enable NEW indexing service for this project"); indexerSwitch2.setText("Enable NEW indexing service for this project");
dTreeSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT); dTreeSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT);
dTreeSwitch.setAlignment(SWT.LEFT); dTreeSwitch.setAlignment(SWT.LEFT);
dTreeSwitch.setText("Enable dependency tree service for this project"); dTreeSwitch.setText("Enable dependency tree service for this project");

View file

@ -44,7 +44,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
private CheckboxTableViewer referenceProjectsViewer; private CheckboxTableViewer referenceProjectsViewer;
private static final int PROJECT_LIST_MULTIPLIER = 30; private static final int PROJECT_LIST_MULTIPLIER = 10;
public ReferenceBlock() { public ReferenceBlock() {
super(CUIPlugin.getResourceString(LABEL)); super(CUIPlugin.getResourceString(LABEL));

View file

@ -49,7 +49,7 @@ public abstract class TabFolderOptionBlock {
fParent = parent; fParent = parent;
bShowMessageArea = showMessageArea; bShowMessageArea = showMessageArea;
} }
public TabFolderOptionBlock(ICOptionContainer parent) { public TabFolderOptionBlock(ICOptionContainer parent) {
this(parent, true); this(parent, true);
} }
@ -66,7 +66,7 @@ public abstract class TabFolderOptionBlock {
protected List getOptionPages() { protected List getOptionPages() {
return pages; return pages;
} }
public Control createContents(Composite parent) { public Control createContents(Composite parent) {
composite = new Composite(parent, SWT.NONE); composite = new Composite(parent, SWT.NONE);
@ -80,12 +80,12 @@ public abstract class TabFolderOptionBlock {
Label separator = new Label(composite, SWT.HORIZONTAL); Label separator = new Label(composite, SWT.HORIZONTAL);
separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
} }
createFolder(composite); createFolder(composite);
addTabs(); addTabs();
setCurrentPage((ICOptionPage) pages.get(0)); setCurrentPage((ICOptionPage) pages.get(0));
initializingTabs = false; initializingTabs = false;
String desc = ((ICOptionPage) pages.get(0)).getDescription(); String desc = ((ICOptionPage) pages.get(0)).getDescription();
if (desc != null) { if (desc != null) {
messageLabel.setText(desc); messageLabel.setText(desc);
@ -100,8 +100,10 @@ public abstract class TabFolderOptionBlock {
fFolder.addSelectionListener(new SelectionAdapter() { fFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
setCurrentPage((ICOptionPage) ((TabItem) e.item).getData()); if (!initializingTabs) {
fParent.updateContainer(); setCurrentPage((ICOptionPage) ((TabItem) e.item).getData());
fParent.updateContainer();
}
} }
}); });
} }
@ -122,7 +124,7 @@ public abstract class TabFolderOptionBlock {
abstract protected void addTabs(); abstract protected void addTabs();
public boolean performApply(IProgressMonitor monitor) { public boolean performApply(IProgressMonitor monitor) {
if ( initializingTabs ) if (initializingTabs)
return false; return false;
Iterator iter = pages.iterator(); Iterator iter = pages.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -141,18 +143,16 @@ public abstract class TabFolderOptionBlock {
* @see DialogPage#setVisible(boolean) * @see DialogPage#setVisible(boolean)
*/ */
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
if ( initializingTabs ) if (initializingTabs)
return; return;
Iterator iter = pages.iterator(); if (fCurrentPage != null) {
while (iter.hasNext()) { fCurrentPage.setVisible(visible);
ICOptionPage tab = (ICOptionPage) iter.next();
tab.setVisible(visible);
} }
update(); update();
} }
public void update() { public void update() {
if ( initializingTabs ) if (initializingTabs)
return; return;
boolean ok = true; boolean ok = true;
Iterator iter = pages.iterator(); Iterator iter = pages.iterator();
@ -190,7 +190,7 @@ public abstract class TabFolderOptionBlock {
} }
public void performDefaults() { public void performDefaults() {
if ( initializingTabs ) if (initializingTabs)
return; return;
getCurrentPage().performDefaults(); getCurrentPage().performDefaults();
} }
@ -200,7 +200,11 @@ public abstract class TabFolderOptionBlock {
} }
public void setCurrentPage(ICOptionPage page) { public void setCurrentPage(ICOptionPage page) {
//Make the new page visible
ICOptionPage oldPage = fCurrentPage;
fCurrentPage = page; fCurrentPage = page;
fCurrentPage.setVisible(true);
if (oldPage != null)
oldPage.setVisible(false);
} }
} }