mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Fixes for the Include Browser
This commit is contained in:
parent
2bea707eb5
commit
4e4d3f592a
2 changed files with 43 additions and 25 deletions
|
@ -130,9 +130,10 @@ public class IBViewPart extends ViewPart
|
||||||
private Action fFilterInactiveAction;
|
private Action fFilterInactiveAction;
|
||||||
private Action fFilterSystemAction;
|
private Action fFilterSystemAction;
|
||||||
private Action fShowFolderInLabelsAction;
|
private Action fShowFolderInLabelsAction;
|
||||||
private Action fNext;
|
private Action fNextAction;
|
||||||
private Action fPrevious;
|
private Action fPreviousAction;
|
||||||
private Action fRefresh;
|
private Action fRefreshAction;
|
||||||
|
private Action fHistoryAction;
|
||||||
|
|
||||||
|
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
|
@ -143,10 +144,16 @@ public class IBViewPart extends ViewPart
|
||||||
fInfoText.setText(msg);
|
fInfoText.setText(msg);
|
||||||
fPagebook.showPage(fInfoPage);
|
fPagebook.showPage(fInfoPage);
|
||||||
fShowsMessage= true;
|
fShowsMessage= true;
|
||||||
|
updateActionEnablement();
|
||||||
updateDescription();
|
updateDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInput(ITranslationUnit input) {
|
public void setInput(ITranslationUnit input) {
|
||||||
|
if (input == null) {
|
||||||
|
setMessage(IBMessages.IBViewPart_instructionMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fShowsMessage= false;
|
fShowsMessage= false;
|
||||||
boolean isHeader= false;
|
boolean isHeader= false;
|
||||||
String contentType= input.getContentTypeId();
|
String contentType= input.getContentTypeId();
|
||||||
|
@ -163,10 +170,19 @@ public class IBViewPart extends ViewPart
|
||||||
}
|
}
|
||||||
fTreeViewer.setInput(input);
|
fTreeViewer.setInput(input);
|
||||||
fPagebook.showPage(fViewerPage);
|
fPagebook.showPage(fViewerPage);
|
||||||
updateDescription();
|
|
||||||
updateHistory(input);
|
updateHistory(input);
|
||||||
|
|
||||||
|
updateActionEnablement();
|
||||||
|
updateDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateActionEnablement() {
|
||||||
|
fHistoryAction.setEnabled(!fHistoryEntries.isEmpty());
|
||||||
|
fNextAction.setEnabled(!fShowsMessage);
|
||||||
|
fPreviousAction.setEnabled(!fShowsMessage);
|
||||||
|
fRefreshAction.setEnabled(!fShowsMessage);
|
||||||
|
}
|
||||||
|
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
fPagebook = new PageBook(parent, SWT.NULL);
|
fPagebook = new PageBook(parent, SWT.NULL);
|
||||||
fPagebook.setLayoutData(new GridData(GridData.FILL_BOTH));
|
fPagebook.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
@ -420,50 +436,52 @@ public class IBViewPart extends ViewPart
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fShowFolderInLabelsAction.setToolTipText(IBMessages.IBViewPart_showFolders_tooltip);
|
fShowFolderInLabelsAction.setToolTipText(IBMessages.IBViewPart_showFolders_tooltip);
|
||||||
fNext = new Action(IBMessages.IBViewPart_nextMatch_label) {
|
fNextAction = new Action(IBMessages.IBViewPart_nextMatch_label) {
|
||||||
public void run() {
|
public void run() {
|
||||||
onNextOrPrevious(true);
|
onNextOrPrevious(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fNext.setToolTipText(IBMessages.IBViewPart_nextMatch_tooltip);
|
fNextAction.setToolTipText(IBMessages.IBViewPart_nextMatch_tooltip);
|
||||||
CPluginImages.setImageDescriptors(fNext, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_NEXT);
|
CPluginImages.setImageDescriptors(fNextAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_NEXT);
|
||||||
|
|
||||||
fPrevious = new Action(IBMessages.IBViewPart_previousMatch_label) {
|
fPreviousAction = new Action(IBMessages.IBViewPart_previousMatch_label) {
|
||||||
public void run() {
|
public void run() {
|
||||||
onNextOrPrevious(false);
|
onNextOrPrevious(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fPrevious.setToolTipText(IBMessages.IBViewPart_previousMatch_tooltip);
|
fPreviousAction.setToolTipText(IBMessages.IBViewPart_previousMatch_tooltip);
|
||||||
CPluginImages.setImageDescriptors(fPrevious, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_PREV);
|
CPluginImages.setImageDescriptors(fPreviousAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_PREV);
|
||||||
|
|
||||||
fRefresh = new Action(IBMessages.IBViewPart_refresh_label) {
|
fRefreshAction = new Action(IBMessages.IBViewPart_refresh_label) {
|
||||||
public void run() {
|
public void run() {
|
||||||
onRefresh();
|
onRefresh();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fRefresh.setToolTipText(IBMessages.IBViewPart_refresh_tooltip);
|
fRefreshAction.setToolTipText(IBMessages.IBViewPart_refresh_tooltip);
|
||||||
CPluginImages.setImageDescriptors(fRefresh, CPluginImages.T_LCL, CPluginImages.IMG_REFRESH);
|
CPluginImages.setImageDescriptors(fRefreshAction, CPluginImages.T_LCL, CPluginImages.IMG_REFRESH);
|
||||||
|
|
||||||
|
fHistoryAction= new IBHistoryDropDownAction(this);
|
||||||
|
|
||||||
// setup action bar
|
// setup action bar
|
||||||
// global action hooks
|
// global action hooks
|
||||||
IActionBars actionBars = getViewSite().getActionBars();
|
IActionBars actionBars = getViewSite().getActionBars();
|
||||||
actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNext);
|
actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNextAction);
|
||||||
actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPrevious);
|
actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPreviousAction);
|
||||||
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefresh);
|
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefreshAction);
|
||||||
actionBars.updateActionBars();
|
actionBars.updateActionBars();
|
||||||
|
|
||||||
// local toolbar
|
// local toolbar
|
||||||
IToolBarManager tm = actionBars.getToolBarManager();
|
IToolBarManager tm = actionBars.getToolBarManager();
|
||||||
tm.add(fNext);
|
tm.add(fNextAction);
|
||||||
tm.add(fPrevious);
|
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);
|
||||||
tm.add(new IBHistoryDropDownAction(this));
|
tm.add(fHistoryAction);
|
||||||
tm.add(fRefresh);
|
tm.add(fRefreshAction);
|
||||||
|
|
||||||
// local menu
|
// local menu
|
||||||
IMenuManager mm = actionBars.getMenuManager();
|
IMenuManager mm = actionBars.getMenuManager();
|
||||||
|
@ -513,7 +531,7 @@ public class IBViewPart extends ViewPart
|
||||||
fTreeViewer.refresh();
|
fTreeViewer.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateHistory(ITranslationUnit input) {
|
private void updateHistory(ITranslationUnit input) {
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
fHistoryEntries.remove(input);
|
fHistoryEntries.remove(input);
|
||||||
fHistoryEntries.add(0, input);
|
fHistoryEntries.add(0, input);
|
||||||
|
@ -523,7 +541,7 @@ public class IBViewPart extends ViewPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateSorter() {
|
private void updateSorter() {
|
||||||
if (fIncludedByAction.isChecked()) {
|
if (fIncludedByAction.isChecked()) {
|
||||||
fTreeViewer.setComparator(fSorterAlphaNumeric);
|
fTreeViewer.setComparator(fSorterAlphaNumeric);
|
||||||
}
|
}
|
||||||
|
@ -532,7 +550,7 @@ public class IBViewPart extends ViewPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateDescription() {
|
private void updateDescription() {
|
||||||
String message= ""; //$NON-NLS-1$
|
String message= ""; //$NON-NLS-1$
|
||||||
if (!fShowsMessage) {
|
if (!fShowsMessage) {
|
||||||
ITranslationUnit tu= getInput();
|
ITranslationUnit tu= getInput();
|
||||||
|
@ -563,7 +581,7 @@ public class IBViewPart extends ViewPart
|
||||||
setContentDescription(message);
|
setContentDescription(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
private void updateWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
||||||
if (filterUI.getWorkingSet() == null) {
|
if (filterUI.getWorkingSet() == null) {
|
||||||
if (fWorkingSetFilter != null) {
|
if (fWorkingSetFilter != null) {
|
||||||
fTreeViewer.removeFilter(fWorkingSetFilter);
|
fTreeViewer.removeFilter(fWorkingSetFilter);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TreeNavigator {
|
||||||
|
|
||||||
private TreeItem getItemOfClass(TreeItem[] items, boolean fwd) {
|
private TreeItem getItemOfClass(TreeItem[] items, boolean fwd) {
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
TreeItem item = items[i];
|
TreeItem item = items[fwd ? i : items.length-1-i];
|
||||||
if (fDataClass==null || fDataClass.isInstance(item.getData())) {
|
if (fDataClass==null || fDataClass.isInstance(item.getData())) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue