mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
- extern strings
- fixed tab folder visiblity problem
This commit is contained in:
parent
46c06a4a71
commit
c96aeb760e
4 changed files with 45 additions and 32 deletions
|
@ -16,6 +16,7 @@ import java.util.Iterator;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICDescriptor;
|
||||
import org.eclipse.cdt.core.ICExtensionReference;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
|
@ -34,23 +35,26 @@ import org.eclipse.swt.widgets.Label;
|
|||
|
||||
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;
|
||||
private HashMap idMap = new HashMap();
|
||||
private String initial;
|
||||
private Preferences fPrefs;
|
||||
|
||||
|
||||
public BinaryParserBlock(Preferences prefs) {
|
||||
super("Binary Parser");
|
||||
setDescription("Set required binary parser for this project");
|
||||
super(CUIPlugin.getResourceString(LABEL));
|
||||
setDescription(CUIPlugin.getResourceString(DESC));
|
||||
fPrefs = prefs;
|
||||
}
|
||||
|
||||
public void createControl(Composite parent) {
|
||||
public void createControl(Composite parent) {
|
||||
Composite control = ControlFactory.createComposite(parent, 2);
|
||||
((GridLayout)control.getLayout()).makeColumnsEqualWidth = false;
|
||||
((GridLayout)control.getLayout()).marginWidth = 5;
|
||||
((GridLayout) control.getLayout()).makeColumnsEqualWidth = false;
|
||||
((GridLayout) control.getLayout()).marginWidth = 5;
|
||||
|
||||
ControlFactory.createEmptySpace(control, 2);
|
||||
|
||||
|
@ -65,9 +69,9 @@ public class BinaryParserBlock extends AbstractCOptionPage {
|
|||
getContainer().updateContainer();
|
||||
}
|
||||
});
|
||||
Iterator items = idMap.keySet().iterator();
|
||||
while( items.hasNext()) {
|
||||
comboBox.add((String)items.next());
|
||||
Iterator items = idMap.keySet().iterator();
|
||||
while (items.hasNext()) {
|
||||
comboBox.add((String) items.next());
|
||||
}
|
||||
|
||||
if (initial != null) {
|
||||
|
@ -87,13 +91,13 @@ public class BinaryParserBlock extends AbstractCOptionPage {
|
|||
if (selected != null) {
|
||||
if (initial == null || !selected.equals(initial)) {
|
||||
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());
|
||||
initial = selected;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fPrefs.setDefault(CCorePlugin.PREF_BINARY_PARSER, (String)idMap.get(initial));
|
||||
fPrefs.setDefault(CCorePlugin.PREF_BINARY_PARSER, (String) idMap.get(initial));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.index.IndexModel;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -23,13 +24,17 @@ import org.eclipse.swt.widgets.Button;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
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 indexerSwitch2;
|
||||
private Button dTreeSwitch;
|
||||
|
||||
public IndexerBlock() {
|
||||
super("Indexer");
|
||||
setDescription("Project Indexer option");
|
||||
super(CUIPlugin.getResourceString(LABEL));
|
||||
setDescription(CUIPlugin.getResourceString(DESC));
|
||||
}
|
||||
|
||||
public void createControl(Composite parent) {
|
||||
|
@ -41,11 +46,11 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT);
|
||||
indexerSwitch.setAlignment(SWT.LEFT);
|
||||
indexerSwitch.setText("Enable CTAGS indexing service for this project");
|
||||
|
||||
|
||||
indexerSwitch2 = new Button(composite, SWT.CHECK | SWT.RIGHT);
|
||||
indexerSwitch2.setAlignment(SWT.LEFT);
|
||||
indexerSwitch2.setText("Enable NEW indexing service for this project");
|
||||
|
||||
|
||||
dTreeSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT);
|
||||
dTreeSwitch.setAlignment(SWT.LEFT);
|
||||
dTreeSwitch.setText("Enable dependency tree service for this project");
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
|
|||
|
||||
private CheckboxTableViewer referenceProjectsViewer;
|
||||
|
||||
private static final int PROJECT_LIST_MULTIPLIER = 30;
|
||||
private static final int PROJECT_LIST_MULTIPLIER = 10;
|
||||
|
||||
public ReferenceBlock() {
|
||||
super(CUIPlugin.getResourceString(LABEL));
|
||||
|
|
|
@ -49,7 +49,7 @@ public abstract class TabFolderOptionBlock {
|
|||
fParent = parent;
|
||||
bShowMessageArea = showMessageArea;
|
||||
}
|
||||
|
||||
|
||||
public TabFolderOptionBlock(ICOptionContainer parent) {
|
||||
this(parent, true);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public abstract class TabFolderOptionBlock {
|
|||
protected List getOptionPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
public Control createContents(Composite parent) {
|
||||
|
||||
composite = new Composite(parent, SWT.NONE);
|
||||
|
@ -80,12 +80,12 @@ public abstract class TabFolderOptionBlock {
|
|||
Label separator = new Label(composite, SWT.HORIZONTAL);
|
||||
separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
}
|
||||
|
||||
|
||||
createFolder(composite);
|
||||
|
||||
addTabs();
|
||||
setCurrentPage((ICOptionPage) pages.get(0));
|
||||
initializingTabs = false;
|
||||
initializingTabs = false;
|
||||
String desc = ((ICOptionPage) pages.get(0)).getDescription();
|
||||
if (desc != null) {
|
||||
messageLabel.setText(desc);
|
||||
|
@ -100,8 +100,10 @@ public abstract class TabFolderOptionBlock {
|
|||
|
||||
fFolder.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
setCurrentPage((ICOptionPage) ((TabItem) e.item).getData());
|
||||
fParent.updateContainer();
|
||||
if (!initializingTabs) {
|
||||
setCurrentPage((ICOptionPage) ((TabItem) e.item).getData());
|
||||
fParent.updateContainer();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -122,7 +124,7 @@ public abstract class TabFolderOptionBlock {
|
|||
abstract protected void addTabs();
|
||||
|
||||
public boolean performApply(IProgressMonitor monitor) {
|
||||
if ( initializingTabs )
|
||||
if (initializingTabs)
|
||||
return false;
|
||||
Iterator iter = pages.iterator();
|
||||
while (iter.hasNext()) {
|
||||
|
@ -141,18 +143,16 @@ public abstract class TabFolderOptionBlock {
|
|||
* @see DialogPage#setVisible(boolean)
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
if ( initializingTabs )
|
||||
if (initializingTabs)
|
||||
return;
|
||||
Iterator iter = pages.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ICOptionPage tab = (ICOptionPage) iter.next();
|
||||
tab.setVisible(visible);
|
||||
if (fCurrentPage != null) {
|
||||
fCurrentPage.setVisible(visible);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if ( initializingTabs )
|
||||
if (initializingTabs)
|
||||
return;
|
||||
boolean ok = true;
|
||||
Iterator iter = pages.iterator();
|
||||
|
@ -190,7 +190,7 @@ public abstract class TabFolderOptionBlock {
|
|||
}
|
||||
|
||||
public void performDefaults() {
|
||||
if ( initializingTabs )
|
||||
if (initializingTabs)
|
||||
return;
|
||||
getCurrentPage().performDefaults();
|
||||
}
|
||||
|
@ -200,7 +200,11 @@ public abstract class TabFolderOptionBlock {
|
|||
}
|
||||
|
||||
public void setCurrentPage(ICOptionPage page) {
|
||||
//Make the new page visible
|
||||
ICOptionPage oldPage = fCurrentPage;
|
||||
fCurrentPage = page;
|
||||
fCurrentPage.setVisible(true);
|
||||
if (oldPage != null)
|
||||
oldPage.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue