mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Some new index constants
Patch for Dave - IndexerView refactoring
This commit is contained in:
parent
dade6639b1
commit
bdb7bbaf87
5 changed files with 96 additions and 143 deletions
|
@ -52,7 +52,7 @@ public interface ICIndexStorageConstants {
|
||||||
};
|
};
|
||||||
|
|
||||||
final static char [][] encodingTypes = {
|
final static char [][] encodingTypes = {
|
||||||
"".toCharArray(), //$NON-NLS-1$
|
"".toCharArray(), // not used //$NON-NLS-1$
|
||||||
"Decl/".toCharArray(), // DECLARATIONS //$NON-NLS-1$
|
"Decl/".toCharArray(), // DECLARATIONS //$NON-NLS-1$
|
||||||
"Ref/".toCharArray(), // REFERENCES //$NON-NLS-1$
|
"Ref/".toCharArray(), // REFERENCES //$NON-NLS-1$
|
||||||
"Defn/".toCharArray() // DEFINTIONS //$NON-NLS-1$
|
"Defn/".toCharArray() // DEFINTIONS //$NON-NLS-1$
|
||||||
|
@ -71,4 +71,35 @@ public interface ICIndexStorageConstants {
|
||||||
'H', // FWD_STRUCT
|
'H', // FWD_STRUCT
|
||||||
'I' // FWD_UNION
|
'I' // FWD_UNION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
final static char [][] accessSpecifiers = {
|
||||||
|
"".toCharArray(), // not used //$NON-NLS-1$
|
||||||
|
"private".toCharArray(), // private //$NON-NLS-1$
|
||||||
|
"protected".toCharArray(), // protected //$NON-NLS-1$
|
||||||
|
"public".toCharArray() // public //$NON-NLS-1$
|
||||||
|
};
|
||||||
|
|
||||||
|
final static char [][] cvQualifiers = {
|
||||||
|
"".toCharArray(), // not used //$NON-NLS-1$
|
||||||
|
"const".toCharArray(), // const //$NON-NLS-1$
|
||||||
|
"volatile".toCharArray(), // volatile //$NON-NLS-1$
|
||||||
|
};
|
||||||
|
|
||||||
|
final static char [][] storageClassSpecifiers = {
|
||||||
|
"".toCharArray(), // not used //$NON-NLS-1$
|
||||||
|
"auto".toCharArray(), // auto //$NON-NLS-1$
|
||||||
|
"register".toCharArray(), // register //$NON-NLS-1$
|
||||||
|
"static".toCharArray(), // static //$NON-NLS-1$
|
||||||
|
"extern".toCharArray(), // extern //$NON-NLS-1$
|
||||||
|
"mutable".toCharArray(), // mutable //$NON-NLS-1$
|
||||||
|
};
|
||||||
|
|
||||||
|
final static char [][] functionSpecifiers = {
|
||||||
|
"".toCharArray(), // not used //$NON-NLS-1$
|
||||||
|
"inline".toCharArray(), // inline //$NON-NLS-1$
|
||||||
|
"virtual".toCharArray(), // virtual //$NON-NLS-1$
|
||||||
|
"explicit".toCharArray(), // explicit //$NON-NLS-1$
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,6 @@
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.IndexerView;
|
package org.eclipse.cdt.ui.tests.IndexerView;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||||
|
@ -46,10 +41,10 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
private static String getStringDescription(int meta, int kind, int ref) {
|
private static String getStringDescription(int meta, int kind, int ref) {
|
||||||
return Index.getDescriptionOf(meta, kind, ref);
|
return Index.getDescriptionOf(meta, kind, ref);
|
||||||
}
|
}
|
||||||
private static final int DECL_BUTTON_ID = 4;
|
private static final int DECL_BUTTON_ID = 3;
|
||||||
private static final int REF_BUTTON_ID = 3;
|
private static final int REF_BUTTON_ID = 2;
|
||||||
private static final int TYPE_BUTTON_ID = 2;
|
private static final int TYPE_BUTTON_ID = 1;
|
||||||
private static final int ALL_BUTTON_ID = 1;
|
private static final int ALL_BUTTON_ID = 0;
|
||||||
private static final String GROUPED_SELECTIONS_LABEL = "Grouped Selections:"; //$NON-NLS-1$
|
private static final String GROUPED_SELECTIONS_LABEL = "Grouped Selections:"; //$NON-NLS-1$
|
||||||
private static final String ALL_BUTTON = "All"; //$NON-NLS-1$
|
private static final String ALL_BUTTON = "All"; //$NON-NLS-1$
|
||||||
private static final String TYPE_BUTTON = "type"; //$NON-NLS-1$
|
private static final String TYPE_BUTTON = "type"; //$NON-NLS-1$
|
||||||
|
@ -65,8 +60,8 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
Text filterText = null;
|
Text filterText = null;
|
||||||
private String pageSize = BLANK_STRING; //$NON-NLS-1$
|
private String pageSize = BLANK_STRING; //$NON-NLS-1$
|
||||||
Text pageSizeText = null;
|
Text pageSizeText = null;
|
||||||
protected Collection fFilterMatcher = new HashSet();
|
protected boolean [] fFilterMatcher = new boolean [iAllTypes.length];
|
||||||
protected Collection groupedButtonSelections = new HashSet();
|
protected boolean[] groupedButtonSelections;
|
||||||
|
|
||||||
private String message = "Filter Indexer Results (. = any character, .* = any string):"; //$NON-NLS-1$
|
private String message = "Filter Indexer Results (. = any character, .* = any string):"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -138,8 +133,6 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
{IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE}
|
{IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Set fKnownTypes = new HashSet(iAllTypes.length);
|
|
||||||
|
|
||||||
// keep track of the buttons to programmatically change their state
|
// keep track of the buttons to programmatically change their state
|
||||||
protected Button[] buttons = new Button[iAllTypes.length];
|
protected Button[] buttons = new Button[iAllTypes.length];
|
||||||
protected Button allButton = null;
|
protected Button allButton = null;
|
||||||
|
@ -153,7 +146,13 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
this.root = root;
|
this.root = root;
|
||||||
this.projName = projName;
|
this.projName = projName;
|
||||||
|
|
||||||
setVisibleTypes(iAllTypes.length);
|
for (int i = 0; i < iAllTypes.length; i++)
|
||||||
|
fFilterMatcher[i] = false;
|
||||||
|
|
||||||
|
groupedButtonSelections = new boolean[DECL_BUTTON_ID + 1];
|
||||||
|
for (int j = ALL_BUTTON_ID; j <= DECL_BUTTON_ID; j++)
|
||||||
|
groupedButtonSelections[j] = false;
|
||||||
|
|
||||||
setDialogSettings(DIALOG_SETTINGS);
|
setDialogSettings(DIALOG_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,19 +221,6 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets which CElement types are visible in the dialog.
|
|
||||||
*
|
|
||||||
* @param types
|
|
||||||
* Array of CElement types.
|
|
||||||
*/
|
|
||||||
public void setVisibleTypes(int len) {
|
|
||||||
fKnownTypes.clear();
|
|
||||||
for (int i = 0; i < len; ++i) {
|
|
||||||
fKnownTypes.add(new Integer(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a type filter checkbox.
|
* Creates a type filter checkbox.
|
||||||
*/
|
*/
|
||||||
|
@ -247,20 +233,20 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
layout.marginHeight = 0;
|
layout.marginHeight = 0;
|
||||||
composite.setLayout(layout);
|
composite.setLayout(layout);
|
||||||
|
|
||||||
final Integer fTypeObject = new Integer(type);
|
final int type1 = type;
|
||||||
Button checkbox = new Button(composite, SWT.CHECK);
|
Button checkbox = new Button(composite, SWT.CHECK);
|
||||||
checkbox.setFont(composite.getFont());
|
checkbox.setFont(composite.getFont());
|
||||||
checkbox.setText(name);
|
checkbox.setText(name);
|
||||||
checkbox.setImage(icon);
|
checkbox.setImage(icon);
|
||||||
checkbox.setSelection(fFilterMatcher.contains(fTypeObject));
|
checkbox.setSelection(fFilterMatcher[type]);
|
||||||
checkbox.addSelectionListener(new SelectionAdapter() {
|
checkbox.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (e.widget instanceof Button) {
|
if (e.widget instanceof Button) {
|
||||||
Button aCheckbox = (Button) e.widget;
|
Button aCheckbox = (Button) e.widget;
|
||||||
if (aCheckbox.getSelection())
|
if (aCheckbox.getSelection())
|
||||||
fFilterMatcher.add(fTypeObject);
|
fFilterMatcher[type1] = true;
|
||||||
else
|
else
|
||||||
fFilterMatcher.remove(fTypeObject);
|
fFilterMatcher[type1] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -311,7 +297,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
allButton.setFont(upperRow.getFont());
|
allButton.setFont(upperRow.getFont());
|
||||||
allButton.setText(ALL_BUTTON);
|
allButton.setText(ALL_BUTTON);
|
||||||
allButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_ALL));
|
allButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_ALL));
|
||||||
allButton.setSelection(groupedButtonSelections.contains(new Integer(ALL_BUTTON_ID)));
|
allButton.setSelection(groupedButtonSelections[ALL_BUTTON_ID]);
|
||||||
allButton.addSelectionListener(new SelectionAdapter() {
|
allButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (e.widget instanceof Button) {
|
if (e.widget instanceof Button) {
|
||||||
|
@ -331,24 +317,14 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
// select/deselect the type, decl, ref buttons
|
// select/deselect the type, decl, ref buttons
|
||||||
if (isChecked) {
|
typeButton.setSelection(isChecked);
|
||||||
typeButton.setSelection(true);
|
groupedButtonSelections[TYPE_BUTTON_ID] = isChecked;
|
||||||
groupedButtonSelections.add(new Integer(TYPE_BUTTON_ID));
|
declButton.setSelection(isChecked);
|
||||||
declButton.setSelection(true);
|
groupedButtonSelections[DECL_BUTTON_ID] = isChecked;
|
||||||
groupedButtonSelections.add(new Integer(DECL_BUTTON_ID));
|
refButton.setSelection(isChecked);
|
||||||
refButton.setSelection(true);
|
groupedButtonSelections[REF_BUTTON_ID] = isChecked;
|
||||||
groupedButtonSelections.add(new Integer(REF_BUTTON_ID));
|
groupedButtonSelections[ALL_BUTTON_ID] = isChecked;
|
||||||
groupedButtonSelections.add(new Integer(ALL_BUTTON_ID));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
typeButton.setSelection(false);
|
|
||||||
groupedButtonSelections.remove(new Integer(TYPE_BUTTON_ID));
|
|
||||||
declButton.setSelection(false);
|
|
||||||
groupedButtonSelections.remove(new Integer(DECL_BUTTON_ID));
|
|
||||||
refButton.setSelection(false);
|
|
||||||
groupedButtonSelections.remove(new Integer(REF_BUTTON_ID));
|
|
||||||
groupedButtonSelections.remove(new Integer(ALL_BUTTON_ID));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -361,7 +337,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
typeButton.setFont(upperRow.getFont());
|
typeButton.setFont(upperRow.getFont());
|
||||||
typeButton.setText(TYPE_BUTTON);
|
typeButton.setText(TYPE_BUTTON);
|
||||||
typeButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_TYPE));
|
typeButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_TYPE));
|
||||||
typeButton.setSelection(groupedButtonSelections.contains(new Integer(TYPE_BUTTON_ID)));
|
typeButton.setSelection(groupedButtonSelections[TYPE_BUTTON_ID]);
|
||||||
typeButton.addSelectionListener(new SelectionAdapter() {
|
typeButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (e.widget instanceof Button) {
|
if (e.widget instanceof Button) {
|
||||||
|
@ -382,9 +358,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChecked) groupedButtonSelections.add(new Integer(TYPE_BUTTON_ID));
|
groupedButtonSelections[TYPE_BUTTON_ID] = isChecked;
|
||||||
else groupedButtonSelections.remove(new Integer(TYPE_BUTTON_ID));
|
|
||||||
|
|
||||||
checkAllButton();
|
checkAllButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,7 +372,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
declButton.setFont(upperRow.getFont());
|
declButton.setFont(upperRow.getFont());
|
||||||
declButton.setText(DECL_BUTTON);
|
declButton.setText(DECL_BUTTON);
|
||||||
declButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_DECL));
|
declButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_DECL));
|
||||||
declButton.setSelection(groupedButtonSelections.contains(new Integer(DECL_BUTTON_ID)));
|
declButton.setSelection(groupedButtonSelections[DECL_BUTTON_ID]);
|
||||||
declButton.addSelectionListener(new SelectionAdapter() {
|
declButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (e.widget instanceof Button) {
|
if (e.widget instanceof Button) {
|
||||||
|
@ -419,9 +393,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChecked) groupedButtonSelections.add(new Integer(DECL_BUTTON_ID));
|
groupedButtonSelections[DECL_BUTTON_ID] = isChecked;
|
||||||
else groupedButtonSelections.remove(new Integer(DECL_BUTTON_ID));
|
|
||||||
|
|
||||||
checkAllButton();
|
checkAllButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,7 +407,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
refButton.setFont(upperRow.getFont());
|
refButton.setFont(upperRow.getFont());
|
||||||
refButton.setText(REF_BUTTON);
|
refButton.setText(REF_BUTTON);
|
||||||
refButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_REF));
|
refButton.setImage(IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_GROUPED_REF));
|
||||||
refButton.setSelection(groupedButtonSelections.contains(new Integer(REF_BUTTON_ID)));
|
refButton.setSelection(groupedButtonSelections[REF_BUTTON_ID]);
|
||||||
refButton.addSelectionListener(new SelectionAdapter() {
|
refButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (e.widget instanceof Button) {
|
if (e.widget instanceof Button) {
|
||||||
|
@ -456,9 +428,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChecked) groupedButtonSelections.add(new Integer(REF_BUTTON_ID));
|
groupedButtonSelections[REF_BUTTON_ID] = isChecked;
|
||||||
else groupedButtonSelections.remove(new Integer(REF_BUTTON_ID));
|
|
||||||
|
|
||||||
checkAllButton();
|
checkAllButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,14 +449,8 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChecked) {
|
allButton.setSelection(isChecked);
|
||||||
allButton.setSelection(true);
|
groupedButtonSelections[ALL_BUTTON_ID] = isChecked;
|
||||||
groupedButtonSelections.add(new Integer(ALL_BUTTON_ID));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
allButton.setSelection(false);
|
|
||||||
groupedButtonSelections.remove(new Integer(ALL_BUTTON_ID));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -586,13 +550,13 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
for(int i = 0; i < iAllTypes.length; i++) {
|
for(int i = 0; i < iAllTypes.length; i++) {
|
||||||
section.put(
|
section.put(
|
||||||
getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]),
|
getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]),
|
||||||
fFilterMatcher.contains(new Integer(i)) );
|
fFilterMatcher[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
section.put(ALL_BUTTON, groupedButtonSelections.contains(new Integer(ALL_BUTTON_ID)));
|
section.put(ALL_BUTTON, groupedButtonSelections[ALL_BUTTON_ID]);
|
||||||
section.put(TYPE_BUTTON, groupedButtonSelections.contains(new Integer(TYPE_BUTTON_ID)));
|
section.put(TYPE_BUTTON, groupedButtonSelections[TYPE_BUTTON_ID]);
|
||||||
section.put(REF_BUTTON, groupedButtonSelections.contains(new Integer(REF_BUTTON_ID)));
|
section.put(REF_BUTTON, groupedButtonSelections[REF_BUTTON_ID]);
|
||||||
section.put(DECL_BUTTON, groupedButtonSelections.contains(new Integer(DECL_BUTTON_ID)));
|
section.put(DECL_BUTTON, groupedButtonSelections[DECL_BUTTON_ID]);
|
||||||
|
|
||||||
section.put(PAGE_SIZE, pageSize);
|
section.put(PAGE_SIZE, pageSize);
|
||||||
}
|
}
|
||||||
|
@ -659,30 +623,14 @@ public class FilterIndexerViewDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < iAllTypes.length; i++) {
|
for(int i = 0; i < iAllTypes.length; i++) {
|
||||||
if (section.getBoolean(getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]))) {
|
fFilterMatcher[i] = section.getBoolean(getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]));
|
||||||
Integer typeObject = new Integer(i);
|
|
||||||
if (fKnownTypes.contains(typeObject))
|
|
||||||
fFilterMatcher.add(typeObject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the grouped button selection status
|
// get the grouped button selection status
|
||||||
if (section.getBoolean(ALL_BUTTON)) {
|
groupedButtonSelections[ALL_BUTTON_ID] = section.getBoolean(ALL_BUTTON);
|
||||||
Integer typeObject = new Integer(ALL_BUTTON_ID);
|
groupedButtonSelections[TYPE_BUTTON_ID] = section.getBoolean(TYPE_BUTTON);
|
||||||
groupedButtonSelections.add(typeObject);
|
groupedButtonSelections[REF_BUTTON_ID] = section.getBoolean(REF_BUTTON);
|
||||||
}
|
groupedButtonSelections[DECL_BUTTON_ID] = section.getBoolean(DECL_BUTTON);
|
||||||
if (section.getBoolean(TYPE_BUTTON)) {
|
|
||||||
Integer typeObject = new Integer(TYPE_BUTTON_ID);
|
|
||||||
groupedButtonSelections.add(typeObject);
|
|
||||||
}
|
|
||||||
if (section.getBoolean(REF_BUTTON)) {
|
|
||||||
Integer typeObject = new Integer(REF_BUTTON_ID);
|
|
||||||
groupedButtonSelections.add(typeObject);
|
|
||||||
}
|
|
||||||
if (section.getBoolean(DECL_BUTTON)) {
|
|
||||||
Integer typeObject = new Integer(DECL_BUTTON_ID);
|
|
||||||
groupedButtonSelections.add(typeObject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerFilterManager createFilterManager() {
|
public IndexerFilterManager createFilterManager() {
|
||||||
|
|
|
@ -10,42 +10,35 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.IndexerView;
|
package org.eclipse.cdt.ui.tests.IndexerView;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dsteffle
|
* @author dsteffle
|
||||||
*/
|
*/
|
||||||
public class IndexerFilterManager {
|
public class IndexerFilterManager {
|
||||||
private static final String BLANK_STRING = ""; //$NON-NLS-1$
|
private static final String BLANK_STRING = ""; //$NON-NLS-1$
|
||||||
private static final String COMMA_SEPARATOR = ","; //$NON-NLS-1$
|
private static final String COMMA_SEPARATOR = ","; //$NON-NLS-1$
|
||||||
Collection filters = null;
|
boolean [] filters = null;
|
||||||
String nameFilter = null;
|
String nameFilter = null;
|
||||||
|
String [] nameFilters;
|
||||||
|
|
||||||
public IndexerFilterManager(Collection filters, String nameFilter) {
|
public IndexerFilterManager(boolean [] filters, String nameFilter) {
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
this.nameFilter = nameFilter;
|
this.nameFilter = nameFilter;
|
||||||
}
|
nameFilters = nameFilter.split(COMMA_SEPARATOR);
|
||||||
|
|
||||||
public boolean isFiltered(IndexerNodeLeaf leaf) {
|
|
||||||
String[] nameFilters = nameFilter.split(COMMA_SEPARATOR);
|
|
||||||
for(int i=0; i<nameFilters.length; i++) {
|
for(int i=0; i<nameFilters.length; i++) {
|
||||||
if (nameFilters != null) nameFilters[i] = nameFilters[i].trim();
|
if (nameFilters != null) nameFilters[i] = nameFilters[i].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filters.contains(new Integer(leaf.getFiltersType()))) return false;
|
}
|
||||||
|
|
||||||
|
public boolean isFiltered(IndexerNodeLeaf leaf) {
|
||||||
|
if (!filters[leaf.getFiltersType()])
|
||||||
|
return false;
|
||||||
if (leaf.getName() != null && nameFilters != null && nameFilters.length > 0) {
|
if (leaf.getName() != null && nameFilters != null && nameFilters.length > 0) {
|
||||||
boolean matchesPattern=false;
|
for(int l=0; l<nameFilters.length; l++)
|
||||||
for(int l=0; l<nameFilters.length; l++) {
|
if (nameFilters[l].equals(BLANK_STRING) || leaf.getShortName().matches(nameFilters[l]))
|
||||||
if (nameFilters[l].equals(BLANK_STRING) || leaf.getShortName().matches(nameFilters[l])) {
|
return true;
|
||||||
matchesPattern=true;
|
return false;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!matchesPattern)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.io.IOException;
|
||||||
import org.eclipse.cdt.core.browser.PathUtil;
|
import org.eclipse.cdt.core.browser.PathUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
|
import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
|
||||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||||
|
@ -33,24 +32,15 @@ public class IndexerNodeLeaf implements IAdaptable {
|
||||||
private int filtersType=0;
|
private int filtersType=0;
|
||||||
|
|
||||||
IEntryResult result = null;
|
IEntryResult result = null;
|
||||||
String name = null;
|
|
||||||
File indexFile = null;
|
File indexFile = null;
|
||||||
char type = EMPTY_SPACE;
|
|
||||||
|
|
||||||
private IndexerNodeParent parent = null;
|
private IndexerNodeParent parent = null;
|
||||||
|
|
||||||
public IndexerNodeLeaf(IEntryResult result, File indexFile) {
|
public IndexerNodeLeaf(IEntryResult result, File indexFile) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.indexFile = indexFile;
|
this.indexFile = indexFile;
|
||||||
|
if (result != null)
|
||||||
setNameAndFiltersFlag();
|
this.filtersType = IndexerView.getKey(result.getMetaKind(), result.getKind(), result.getRefKind());
|
||||||
}
|
|
||||||
|
|
||||||
private void setNameAndFiltersFlag() {
|
|
||||||
if (result == null) return;
|
|
||||||
|
|
||||||
filtersType = IndexerView.getKey(result.getMetaKind(), result.getKind(), result.getRefKind());
|
|
||||||
name = result.getName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerNodeParent getParent() {
|
public IndexerNodeParent getParent() {
|
||||||
|
@ -191,28 +181,21 @@ public class IndexerNodeLeaf implements IAdaptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (!parent.isDisplayFullName() && name.indexOf(ICIndexStorageConstants.SEPARATOR) > 0)
|
if (!parent.isDisplayFullName())
|
||||||
return getShortName();
|
return getShortName();
|
||||||
|
|
||||||
return name;
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFiltersType() {
|
public int getFiltersType() {
|
||||||
return filtersType;
|
return filtersType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return result.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShortName() {
|
public String getShortName() {
|
||||||
if (name.indexOf(ICIndexStorageConstants.SEPARATOR) > 0)
|
return result.extractSimpleName();
|
||||||
return name.substring(0, name.indexOf(ICIndexStorageConstants.SEPARATOR));
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
package org.eclipse.cdt.ui.tests.IndexerView;
|
package org.eclipse.cdt.ui.tests.IndexerView;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||||
import org.eclipse.cdt.ui.testplugin.CTestPlugin;
|
import org.eclipse.cdt.ui.testplugin.CTestPlugin;
|
||||||
|
@ -225,7 +223,7 @@ public class IndexerNodeParent extends IndexerNodeLeaf {
|
||||||
isForward = direction;
|
isForward = direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFilterManager(Collection filters, String filterName) {
|
public void setFilterManager(boolean [] filters, String filterName) {
|
||||||
this.filterManager = new IndexerFilterManager(filters, filterName);
|
this.filterManager = new IndexerFilterManager(filters, filterName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue