1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

2005-01-24 Alain Magloire

PR 83514 patch form Przemek
	* src/org/eclipse/cdt/internal/ui/actions/ActionMessages.properties
	* src/org/eclipse/cdt/internal/ui/text/CoutlineInformaionControl.java
	* NEWS
This commit is contained in:
Alain Magloire 2005-01-24 17:24:14 +00:00
parent abd661fca1
commit 11c4afb8ab
4 changed files with 49 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-01-24 Alain Magloire
PR 83514 patch form Przemek
* src/org/eclipse/cdt/internal/ui/actions/ActionMessages.properties
* src/org/eclipse/cdt/internal/ui/text/CoutlineInformaionControl.java
* NEWS
2005-01-22 Alain Magloire 2005-01-22 Alain Magloire
PR 38958 PR 38958
* src/org/eclipse/cdt/internal/ui/viewsupport/CElementImageProvider.java * src/org/eclipse/cdt/internal/ui/viewsupport/CElementImageProvider.java

View file

@ -3,7 +3,7 @@ Release CDT-3.0
* C/C++ Editor: * C/C++ Editor:
- coloring of operators, braces and numbers, - coloring of operators, braces and numbers,
- outline in selectable dialog (Ctrl O) with search input. - outline in selectable dialog (Ctrl O) with search input.
PR #80631 * sorting action
* Template Preference Page for C/C++ Editor * Template Preference Page for C/C++ Editor

View file

@ -283,3 +283,4 @@ IncludesGroupingAction.description=Group includes statements
COutlineInformationControl.viewMenu.remember.label=Remember size and position COutlineInformationControl.viewMenu.remember.label=Remember size and position
COutlineInformationControl.viewMenu.move.label=Move outline COutlineInformationControl.viewMenu.move.label=Move outline
COutlineInformationControl.viewMenu.sort.label=Sort

View file

@ -1,7 +1,7 @@
/* /*
* COutlineInformationControl.java 2004-12-14 / 08:17:41 * COutlineInformationControl.java 2004-12-14 / 08:17:41
* $Revision: 1.2 $ $Date: 2004/12/23 19:38:20 $ * $Revision: 1.3 $ $Date: 2005/01/20 22:10:45 $
* *
* @author P.Tomaszewski * @author P.Tomaszewski
*/ */
@ -21,6 +21,7 @@ import org.eclipse.cdt.ui.IWorkingCopyManager;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControl;
@ -90,6 +91,8 @@ public class COutlineInformationControl implements IInformationControl,
private static final String STORE_RESTORE_SIZE= "ENABLE_RESTORE_SIZE"; //$NON-NLS-1$ private static final String STORE_RESTORE_SIZE= "ENABLE_RESTORE_SIZE"; //$NON-NLS-1$
/** If this option is set, size is not restore. */ /** If this option is set, size is not restore. */
private static final String STORE_RESTORE_LOCATION= "ENABLE_RESTORE_LOCATION"; //$NON-NLS-1$ private static final String STORE_RESTORE_LOCATION= "ENABLE_RESTORE_LOCATION"; //$NON-NLS-1$
/** If this option is set, sort is done. */
private static final String STORE_SORT_ENABLED = "ENABLE_SORT"; //$NON-NLS-1$
/** Border thickness in pixels. */ /** Border thickness in pixels. */
private static final int BORDER = 1; private static final int BORDER = 1;
@ -112,7 +115,7 @@ public class COutlineInformationControl implements IInformationControl,
IContentProvider fTreeContentProvider; IContentProvider fTreeContentProvider;
/** Sorter for tree viewer. */ /** Sorter for tree viewer. */
private OutlineSorter fSorter; OutlineSorter fSorter;
/** Control bounds. */ /** Control bounds. */
Rectangle fBounds; Rectangle fBounds;
@ -355,6 +358,8 @@ public class COutlineInformationControl implements IInformationControl,
MenuManager getViewMenuManager() { MenuManager getViewMenuManager() {
if (fViewMenuManager == null) { if (fViewMenuManager == null) {
fViewMenuManager= new MenuManager(); fViewMenuManager= new MenuManager();
fViewMenuManager.add(new SortAction());
fViewMenuManager.add(new Separator());
fViewMenuManager.add(new RememberBoundsAction()); fViewMenuManager.add(new RememberBoundsAction());
fViewMenuManager.add(new MoveAction()); fViewMenuManager.add(new MoveAction());
} }
@ -408,7 +413,9 @@ public class COutlineInformationControl implements IInformationControl,
fTreeContentProvider = new CContentOutlinerProvider(fTreeViewer); fTreeContentProvider = new CContentOutlinerProvider(fTreeViewer);
fSorter = new OutlineSorter(); fSorter = new OutlineSorter();
fTreeViewer.setContentProvider(fTreeContentProvider); fTreeViewer.setContentProvider(fTreeContentProvider);
fTreeViewer.setSorter(fSorter); if (getSettings().getBoolean(STORE_SORT_ENABLED)) {
fTreeViewer.setSorter(fSorter);
}
fTreeViewer.setLabelProvider(new DecoratingCLabelProvider( fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(
new StandardCElementLabelProvider(), true)); new StandardCElementLabelProvider(), true));
fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
@ -969,5 +976,36 @@ public class COutlineInformationControl implements IInformationControl,
} }
} }
} }
/**
*
* The view menu's Sort action.
*
* @author P.Tomaszewski
*/
private class SortAction extends Action {
/**
* Creates new action.
*/
SortAction() {
super(ActionMessages.getString("COutlineInformationControl.viewMenu.sort.label"), IAction.AS_CHECK_BOX); //$NON-NLS-1$
setChecked(getSettings().getBoolean(STORE_SORT_ENABLED));
}
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
final boolean newValue = isChecked();
if (newValue) {
fTreeViewer.setSorter(fSorter);
} else {
fTreeViewer.setSorter(null);
}
getSettings().put(STORE_SORT_ENABLED, newValue);
fIsDeactivationActive = true;
}
}
} }