aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-08-15 05:41:57 (EDT)
committerzzhongwei2012-08-15 05:41:57 (EDT)
commit6b376b5b1060c2f83ead60f4295a04bb015a8bfa (patch)
treef8870fb666e891a6eb29fa5dd8be70a075516aa8
parent9c70dc1d16da89e55a5307152799f5d6112cd496 (diff)
downloadorg.eclipse.pdt-6b376b5b1060c2f83ead60f4295a04bb015a8bfa.zip
org.eclipse.pdt-6b376b5b1060c2f83ead60f4295a04bb015a8bfa.tar.gz
org.eclipse.pdt-6b376b5b1060c2f83ead60f4295a04bb015a8bfa.tar.bz2
387266: [Emanuel] Show variables in debugger view by name (sorting by
name). https://bugs.eclipse.org/bugs/show_bug.cgi?id=387266
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/Messages.java16
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/SortByNameAction.java61
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/messages.properties2
3 files changed, 79 insertions, 0 deletions
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/Messages.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/Messages.java
new file mode 100644
index 0000000..6b50f2e
--- /dev/null
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/Messages.java
@@ -0,0 +1,16 @@
+package org.eclipse.php.internal.debug.ui.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.php.internal.debug.ui.actions.messages"; //$NON-NLS-1$
+ public static String SortByNameAction_1;
+ public static String SortByNameAction_2;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/SortByNameAction.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/SortByNameAction.java
new file mode 100644
index 0000000..47a0ae3
--- /dev/null
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/SortByNameAction.java
@@ -0,0 +1,61 @@
+package org.eclipse.php.internal.debug.ui.actions;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.internal.ui.actions.AbstractDebugActionDelegate;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.php.internal.debug.core.preferences.PHPProjectPreferences;
+import org.eclipse.swt.custom.BusyIndicator;
+
+public class SortByNameAction extends AbstractDebugActionDelegate {
+ private static final String ID = "org.eclipse.php.debug.ui.SortByName"; //$NON-NLS-1$
+
+ public SortByNameAction() {
+ }
+
+ @Override
+ public void init(IAction action) {
+ super.init(action);
+ initLabel();
+ }
+
+ @Override
+ protected void setAction(IAction action) {
+ super.setAction(action);
+ initLabel();
+ }
+
+ protected String getActionId() {
+ return ID;
+ }
+
+ @Override
+ protected void doAction(Object element) throws DebugException {
+ PHPProjectPreferences.changeSortByNameStatus();
+ initLabel();
+ if (getView() instanceof IDebugView) {
+ final Viewer viewer = ((IDebugView) getView()).getViewer();
+ if (viewer.getControl().isDisposed()) {
+ return;
+ }
+
+ BusyIndicator.showWhile(viewer.getControl().getDisplay(),
+ new Runnable() {
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+
+ }
+
+ private void initLabel() {
+ if (!PHPProjectPreferences.isSortByName()) {
+ getAction().setText(Messages.SortByNameAction_1);
+ } else {
+ getAction().setText(Messages.SortByNameAction_2);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/messages.properties b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/messages.properties
new file mode 100644
index 0000000..87bfce2
--- /dev/null
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/messages.properties
@@ -0,0 +1,2 @@
+SortByNameAction_1=Sort by name
+SortByNameAction_2=Unsort