blob: 646ffd733abd38c517e24c917037a836ed835c56 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*******************************************************************************
* Copyright (c) 2012 Tensilica Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Abeer Bagul (Tensilica Inc) - initial API and implementation (Bug 372181)
*******************************************************************************/
package org.eclipse.debug.internal.ui.expression.workingset;
import org.eclipse.debug.internal.ui.views.expression.ExpressionView;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
/**
* Opens the Working set wizard where user can define expression working sets.
* @since 3.9
*/
public class ExpressionWorkingSetsAction implements IViewActionDelegate,
IActionDelegate2 {
private ExpressionView fView;
public void run(IAction action) {
IWorkingSetSelectionDialog selectionDialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
true,
new String[] {IExpressionWorkingSetConstants.EXPRESSION_WORKINGSET_ID});
selectionDialog.setSelection(ExpressionWorkingSetFilterManager.getWorkingSets(fView));
if (selectionDialog.open() != Window.OK)
return;
IWorkingSet[] selectedWorkingSets = selectionDialog.getSelection();
if (selectedWorkingSets == null)
return;
ExpressionWorkingSetFilterManager.applyWorkingSets(fView, selectedWorkingSets);
}
public void selectionChanged(IAction action, ISelection selection) {
}
public void init(IAction action) {
}
public void dispose() {
fView = null;
}
public void runWithEvent(IAction action, Event event) {
run(action);
}
public void init(IViewPart view) {
fView = (ExpressionView) view;
}
}
|