mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 01:35:39 +02:00
Include Browser: Add filter for inactive includes
This commit is contained in:
parent
4255c51b5c
commit
8d344a4f6a
1 changed files with 31 additions and 34 deletions
|
@ -99,7 +99,7 @@ public class IBViewPart extends ViewPart
|
||||||
private static final String TRUE = String.valueOf(true);
|
private static final String TRUE = String.valueOf(true);
|
||||||
private static final String KEY_WORKING_SET_FILTER = "workingSetFilter"; //$NON-NLS-1$
|
private static final String KEY_WORKING_SET_FILTER = "workingSetFilter"; //$NON-NLS-1$
|
||||||
private static final String KEY_FILTER_SYSTEM = "systemFilter"; //$NON-NLS-1$
|
private static final String KEY_FILTER_SYSTEM = "systemFilter"; //$NON-NLS-1$
|
||||||
// private static final String KEY_FILTER_INACTIVE = "inactiveFilter"; //$NON-NLS-1$
|
private static final String KEY_FILTER_INACTIVE = "inactiveFilter"; //$NON-NLS-1$
|
||||||
private static final String KEY_INPUT_PATH= "inputPath"; //$NON-NLS-1$
|
private static final String KEY_INPUT_PATH= "inputPath"; //$NON-NLS-1$
|
||||||
|
|
||||||
private IMemento fMemento;
|
private IMemento fMemento;
|
||||||
|
@ -120,7 +120,7 @@ public class IBViewPart extends ViewPart
|
||||||
|
|
||||||
// filters, sorter
|
// filters, sorter
|
||||||
private IBWorkingSetFilter fWorkingSetFilter;
|
private IBWorkingSetFilter fWorkingSetFilter;
|
||||||
// private ViewerFilter fInactiveFilter;
|
private ViewerFilter fInactiveFilter;
|
||||||
private ViewerFilter fSystemFilter;
|
private ViewerFilter fSystemFilter;
|
||||||
private ViewerComparator fSorterAlphaNumeric;
|
private ViewerComparator fSorterAlphaNumeric;
|
||||||
private ViewerComparator fSorterReferencePosition;
|
private ViewerComparator fSorterReferencePosition;
|
||||||
|
@ -128,7 +128,7 @@ public class IBViewPart extends ViewPart
|
||||||
// actions
|
// actions
|
||||||
private Action fIncludedByAction;
|
private Action fIncludedByAction;
|
||||||
private Action fIncludesToAction;
|
private Action fIncludesToAction;
|
||||||
// private Action fFilterInactiveAction;
|
private Action fFilterInactiveAction;
|
||||||
private Action fFilterSystemAction;
|
private Action fFilterSystemAction;
|
||||||
private Action fShowFolderInLabelsAction;
|
private Action fShowFolderInLabelsAction;
|
||||||
private Action fNextAction;
|
private Action fNextAction;
|
||||||
|
@ -241,19 +241,19 @@ public class IBViewPart extends ViewPart
|
||||||
private void initializeActionStates() {
|
private void initializeActionStates() {
|
||||||
boolean includedBy= true;
|
boolean includedBy= true;
|
||||||
boolean filterSystem= false;
|
boolean filterSystem= false;
|
||||||
// boolean filterInactive= false;
|
boolean filterInactive= false;
|
||||||
|
|
||||||
if (fMemento != null) {
|
if (fMemento != null) {
|
||||||
filterSystem= TRUE.equals(fMemento.getString(KEY_FILTER_SYSTEM));
|
filterSystem= TRUE.equals(fMemento.getString(KEY_FILTER_SYSTEM));
|
||||||
// filterInactive= TRUE.equals(fMemento.getString(KEY_FILTER_INACTIVE));
|
filterInactive= TRUE.equals(fMemento.getString(KEY_FILTER_INACTIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
fIncludedByAction.setChecked(includedBy);
|
fIncludedByAction.setChecked(includedBy);
|
||||||
fIncludesToAction.setChecked(!includedBy);
|
fIncludesToAction.setChecked(!includedBy);
|
||||||
fContentProvider.setComputeIncludedBy(includedBy);
|
fContentProvider.setComputeIncludedBy(includedBy);
|
||||||
|
|
||||||
// fFilterInactiveAction.setChecked(filterInactive);
|
fFilterInactiveAction.setChecked(filterInactive);
|
||||||
// fFilterInactiveAction.run();
|
fFilterInactiveAction.run();
|
||||||
fFilterSystemAction.setChecked(filterSystem);
|
fFilterSystemAction.setChecked(filterSystem);
|
||||||
fFilterSystemAction.run();
|
fFilterSystemAction.run();
|
||||||
updateSorter();
|
updateSorter();
|
||||||
|
@ -294,7 +294,7 @@ public class IBViewPart extends ViewPart
|
||||||
if (fWorkingSetFilter != null) {
|
if (fWorkingSetFilter != null) {
|
||||||
fWorkingSetFilter.getUI().saveState(memento, KEY_WORKING_SET_FILTER);
|
fWorkingSetFilter.getUI().saveState(memento, KEY_WORKING_SET_FILTER);
|
||||||
}
|
}
|
||||||
// memento.putString(KEY_FILTER_INACTIVE, String.valueOf(fFilterInactiveAction.isChecked()));
|
memento.putString(KEY_FILTER_INACTIVE, String.valueOf(fFilterInactiveAction.isChecked()));
|
||||||
memento.putString(KEY_FILTER_SYSTEM, String.valueOf(fFilterSystemAction.isChecked()));
|
memento.putString(KEY_FILTER_SYSTEM, String.valueOf(fFilterSystemAction.isChecked()));
|
||||||
ITranslationUnit input= getInput();
|
ITranslationUnit input= getInput();
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
|
@ -400,27 +400,27 @@ public class IBViewPart extends ViewPart
|
||||||
fIncludesToAction.setToolTipText(IBMessages.IBViewPart_showIncludesTo_tooltip);
|
fIncludesToAction.setToolTipText(IBMessages.IBViewPart_showIncludesTo_tooltip);
|
||||||
CPluginImages.setImageDescriptors(fIncludesToAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_RELATES_TO);
|
CPluginImages.setImageDescriptors(fIncludesToAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_RELATES_TO);
|
||||||
|
|
||||||
// fInactiveFilter= new ViewerFilter() {
|
fInactiveFilter= new ViewerFilter() {
|
||||||
// public boolean select(Viewer viewer, Object parentElement, Object element) {
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
// if (element instanceof IBNode) {
|
if (element instanceof IBNode) {
|
||||||
// IBNode node= (IBNode) element;
|
IBNode node= (IBNode) element;
|
||||||
// return node.isActiveCode();
|
return node.isActiveCode();
|
||||||
// }
|
}
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
// fFilterInactiveAction= new Action(IBMessages.IBViewPart_hideInactive_label, IAction.AS_CHECK_BOX) {
|
fFilterInactiveAction= new Action(IBMessages.IBViewPart_hideInactive_label, IAction.AS_CHECK_BOX) {
|
||||||
// public void run() {
|
public void run() {
|
||||||
// if (isChecked()) {
|
if (isChecked()) {
|
||||||
// fTreeViewer.addFilter(fInactiveFilter);
|
fTreeViewer.addFilter(fInactiveFilter);
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// fTreeViewer.removeFilter(fInactiveFilter);
|
fTreeViewer.removeFilter(fInactiveFilter);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
// fFilterInactiveAction.setToolTipText(IBMessages.IBViewPart_hideInactive_tooltip);
|
fFilterInactiveAction.setToolTipText(IBMessages.IBViewPart_hideInactive_tooltip);
|
||||||
// CPluginImages.setImageDescriptors(fFilterInactiveAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_INACTIVE);
|
CPluginImages.setImageDescriptors(fFilterInactiveAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_INACTIVE);
|
||||||
|
|
||||||
fSystemFilter= new ViewerFilter() {
|
fSystemFilter= new ViewerFilter() {
|
||||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
@ -514,7 +514,7 @@ public class IBViewPart extends ViewPart
|
||||||
tm.add(fPreviousAction);
|
tm.add(fPreviousAction);
|
||||||
tm.add(new Separator());
|
tm.add(new Separator());
|
||||||
tm.add(fFilterSystemAction);
|
tm.add(fFilterSystemAction);
|
||||||
// tm.add(fFilterInactiveAction);
|
tm.add(fFilterInactiveAction);
|
||||||
tm.add(new Separator());
|
tm.add(new Separator());
|
||||||
tm.add(fIncludedByAction);
|
tm.add(fIncludedByAction);
|
||||||
tm.add(fIncludesToAction);
|
tm.add(fIncludesToAction);
|
||||||
|
@ -524,9 +524,6 @@ public class IBViewPart extends ViewPart
|
||||||
// local menu
|
// local menu
|
||||||
IMenuManager mm = actionBars.getMenuManager();
|
IMenuManager mm = actionBars.getMenuManager();
|
||||||
|
|
||||||
// tm.add(fNext);
|
|
||||||
// tm.add(fPrevious);
|
|
||||||
// tm.add(new Separator());
|
|
||||||
fWorkingSetFilterUI.fillActionBars(actionBars);
|
fWorkingSetFilterUI.fillActionBars(actionBars);
|
||||||
mm.add(fIncludedByAction);
|
mm.add(fIncludedByAction);
|
||||||
mm.add(fIncludesToAction);
|
mm.add(fIncludesToAction);
|
||||||
|
@ -534,7 +531,7 @@ public class IBViewPart extends ViewPart
|
||||||
mm.add(fShowFolderInLabelsAction);
|
mm.add(fShowFolderInLabelsAction);
|
||||||
mm.add(new Separator());
|
mm.add(new Separator());
|
||||||
mm.add(fFilterSystemAction);
|
mm.add(fFilterSystemAction);
|
||||||
// mm.add(fFilterInactiveAction);
|
mm.add(fFilterInactiveAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBNode getNextNode(boolean forward) {
|
private IBNode getNextNode(boolean forward) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue