[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] C View collapse all action
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.83
diff -u -r1.83 ChangeLog
--- ChangeLog 5 Apr 2003 06:33:48 -0000 1.83
+++ ChangeLog 5 Apr 2003 19:49:30 -0000
@@ -1,5 +1,22 @@
2003-04-05 Alain Magloire
+ Implement the new CollapseAll button to be consistent with the
+ JDT package explorer.
+
+ * icons/full/clcl16/collapseall.gif:
+ * icons/full/dlcl16/collapseall.gif:
+ * icons/full/elcl16/collapseall.gif:
+ * src/org/eclipse/cdt/internal/ui/CPluginImages.java:
+ New icon.
+
+ * src/org/eclipse/cdt/internal/ui/cview/CollapseAllAction.java:
+ * src/org/eclipse/cdt/internal/ui/cview/CView.java:
+ * src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java:
+ * src/org/eclipse/cdt/internal/ui/cview/CViewMessages.properties:
+ * src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java:
+
+2003-04-05 Alain Magloire
+
The way the working copy was implemented, the outline could not
work with file outside of the C Model, for example a c file in
a non C project. Also some other extended the CEditor to reuse
Index: icons/full/clcl16/collapseall.gif
===================================================================
RCS file: icons/full/clcl16/collapseall.gif
diff -N icons/full/clcl16/collapseall.gif
Binary files /dev/null and collapseall.gif differ
Index: icons/full/dlcl16/collapseall.gif
===================================================================
RCS file: icons/full/dlcl16/collapseall.gif
diff -N icons/full/dlcl16/collapseall.gif
Binary files /dev/null and collapseall.gif differ
Index: icons/full/elcl16/collapseall.gif
===================================================================
RCS file: icons/full/elcl16/collapseall.gif
diff -N icons/full/elcl16/collapseall.gif
Binary files /dev/null and collapseall.gif differ
Index: src/org/eclipse/cdt/internal/ui/CPluginImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java,v
retrieving revision 1.10
diff -u -r1.10 CPluginImages.java
--- src/org/eclipse/cdt/internal/ui/CPluginImages.java 5 Apr 2003 02:03:42 -0000 1.10
+++ src/org/eclipse/cdt/internal/ui/CPluginImages.java 5 Apr 2003 19:49:32 -0000
@@ -113,6 +113,7 @@
public static final String IMG_MENU_SHIFT_LEFT= NAME_PREFIX + "shift_l_edit.gif";
public static final String IMG_MENU_OPEN_INCLUDE= NAME_PREFIX + "open_incl.gif";
public static final String IMG_MENU_SEGMENT_EDIT= NAME_PREFIX + "segment_edit.gif";
+ public static final String IMG_MENU_COLLAPSE_ALL= NAME_PREFIX + "collapseall.gif";
public static final String IMG_CLEAR_CONSOLE= NAME_PREFIX + "clear_co.gif";
public static final String IMG_ALPHA_SORTING= NAME_PREFIX + "alphab_sort_co.gif";
public static final String IMG_TOOL_GOTO_PREV_ERROR= NAME_PREFIX + "prev_error_nav.gif";
Index: src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java,v
retrieving revision 1.3
diff -u -r1.3 ICHelpContextIds.java
--- src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java 5 Apr 2003 02:05:00 -0000 1.3
+++ src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java 5 Apr 2003 19:49:33 -0000
@@ -39,4 +39,6 @@
public static final String TOGGLE_PRESENTATION_ACTION= PREFIX + "toggle_presentation_action_context"; //$NON-NLS-1$
public static final String TOGGLE_TEXTHOVER_ACTION= PREFIX + "toggle_texthover_action_context"; //$NON-NLS-1$
+ public static final String COLLAPSE_ALL_ACTION= PREFIX + "collapse_all_action"; //$NON-NLS-1$
+
}
Index: src/org/eclipse/cdt/internal/ui/cview/CView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java,v
retrieving revision 1.20
diff -u -r1.20 CView.java
--- src/org/eclipse/cdt/internal/ui/cview/CView.java 5 Apr 2003 02:04:24 -0000 1.20
+++ src/org/eclipse/cdt/internal/ui/cview/CView.java 5 Apr 2003 19:49:36 -0000
@@ -168,6 +168,9 @@
CWorkingSetFilter workingSetFilter = new CWorkingSetFilter ();
ActionContributionItem adjustWorkingSetContributions [] = new ActionContributionItem[5];
+ // Collapsing
+ CollapseAllAction collapseAllAction;
+
// Persistance tags.
static final String TAG_SELECTION= "selection"; //$NON-NLS-1$
static final String TAG_EXPANDED= "expanded"; //$NON-NLS-1$
@@ -566,8 +569,7 @@
openFileAction = new OpenFileAction(getSite().getPage());
openSystemEditorAction = new OpenSystemEditorAction(getSite().getPage());
refreshAction = new RefreshAction(shell);
- buildAction =
- new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
+ buildAction = new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
rebuildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
makeTargetAction = new MakeTargetAction(shell);
moveResourceAction = new MoveResourceAction (shell);
@@ -616,22 +618,13 @@
IActionBars actionBars = getViewSite().getActionBars();
actionBars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, deleteResourceAction);
actionBars.setGlobalActionHandler(IWorkbenchActionConstants.BOOKMARK, addBookmarkAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.REFRESH,
- refreshAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.BUILD_PROJECT,
- buildAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.REBUILD_PROJECT,
- rebuildAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.OPEN_PROJECT,
- openProjectAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.CLOSE_PROJECT,
- closeProjectAction);
+ actionBars.setGlobalActionHandler(IWorkbenchActionConstants.REFRESH, refreshAction);
+ actionBars.setGlobalActionHandler(IWorkbenchActionConstants.BUILD_PROJECT, buildAction);
+ actionBars.setGlobalActionHandler(IWorkbenchActionConstants.REBUILD_PROJECT, rebuildAction);
+ actionBars.setGlobalActionHandler(IWorkbenchActionConstants.OPEN_PROJECT, openProjectAction);
+ actionBars.setGlobalActionHandler(IWorkbenchActionConstants.CLOSE_PROJECT, closeProjectAction);
+ collapseAllAction = new CollapseAllAction(this);
}
/**
@@ -1027,6 +1020,8 @@
toolBar.add(backAction);
toolBar.add(forwardAction);
toolBar.add(upAction);
+ toolBar.add(new Separator());
+ toolBar.add(collapseAllAction);
actionBars.updateActionBars();
IMenuManager menu = actionBars.getMenuManager();
@@ -1145,6 +1140,22 @@
private boolean isActivePart() {
return this == getSite().getPage().getActivePart();
+ }
+
+ /* (non-Javadoc)
+ * @see IViewPartInputProvider#getViewPartInput()
+ */
+ public Object getViewPartInput() {
+ if (viewer != null) {
+ return viewer.getInput();
+ }
+ return null;
+ }
+
+ public void collapseAll() {
+ viewer.getControl().setRedraw(false);
+ viewer.collapseToLevel(getViewPartInput(), TreeViewer.ALL_LEVELS);
+ viewer.getControl().setRedraw(true);
}
void restoreFilters() {
Index: src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java
diff -N src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java 5 Apr 2003 19:49:37 -0000
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.cview;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class CViewMessages {
+
+ private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.cview.CViewMessages";//$NON-NLS-1$
+
+ private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ private CViewMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle and formats it with the argument
+ *
+ * @param key the string used to get the bundle value, must not be null
+ */
+ public static String getFormattedString(String key, Object arg) {
+ String format= null;
+ try {
+ format= fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ if (arg == null)
+ arg= ""; //$NON-NLS-1$
+ return MessageFormat.format(format, new Object[] { arg });
+ }
+
+ /**
+ * Gets a string from the resource bundle and formats it with arguments
+ */
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(fgResourceBundle.getString(key), args);
+ }
+
+}
Index: src/org/eclipse/cdt/internal/ui/cview/CViewMessages.properties
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/cview/CViewMessages.properties
diff -N src/org/eclipse/cdt/internal/ui/cview/CViewMessages.properties
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/cview/CViewMessages.properties 5 Apr 2003 19:49:37 -0000
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2000, 2003 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+
+CollapseAllAction.label=Collapse All
+CollapseAllAction.tooltip=Collapse All
+CollapseAllAction.description=Collapse All
+
Index: src/org/eclipse/cdt/internal/ui/cview/CollapseAllAction.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/cview/CollapseAllAction.java
diff -N src/org/eclipse/cdt/internal/ui/cview/CollapseAllAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/cview/CollapseAllAction.java 5 Apr 2003 19:49:37 -0000
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.cview;
+
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.help.WorkbenchHelp;
+
+/**
+ * Collapse all nodes.
+ */
+class CollapseAllAction extends Action {
+
+ private CView cview;
+
+ CollapseAllAction(CView part) {
+ super(CViewMessages.getString("CollapseAllAction.label")); //$NON-NLS-1$
+ setDescription(CViewMessages.getString("CollapseAllAction.description")); //$NON-NLS-1$
+ setToolTipText(CViewMessages.getString("CollapseAllAction.tooltip")); //$NON-NLS-1$
+ CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_MENU_COLLAPSE_ALL);
+ cview = part;
+ WorkbenchHelp.setHelp(this, ICHelpContextIds.COLLAPSE_ALL_ACTION);
+ }
+
+ public void run() {
+ cview.collapseAll();
+ }
+}