blob: bf53fdbaf95fc695bc1dbbe644189e85f483dd2a (
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.debug.ui.actions;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
import org.eclipse.jdt.internal.debug.ui.launcher.IClasspathViewer;
import org.eclipse.jface.dialogs.IDialogSettings;
/**
* Abstract action that opens a dialog. Contains a prefix for dialog preference
* settings.
*/
public abstract class OpenDialogAction extends RuntimeClasspathAction {
/**
* Attribute name for the last path used to open a file/directory chooser
* dialog.
*/
protected static final String LAST_PATH_SETTING = "LAST_PATH_SETTING"; //$NON-NLS-1$
/**
* Dialog settings prefix/qualifier
*/
private String fPrefix = null;
/**
* Constructs an action that opens a dialog.
*/
public OpenDialogAction(String label, IClasspathViewer viewer, String dialogSettingsPrefix) {
super(label, viewer);
fPrefix = dialogSettingsPrefix;
}
/**
* Returns the prefix of the identifier used to store dialog settings for
* this action.
*/
protected String getDialogSettingsPrefix() {
return fPrefix;
}
/**
* Returns the value of the dialog setting, associated with the given
* settingName, resolved by the dialog setting prefix associated with this
* action.
*
* @param settingName unqualified setting name
* @return value or <code>null</code> if none
*/
protected String getDialogSetting(String settingName) {
return getDialogSettings().get(getDialogSettingsPrefix() + "." + settingName); //$NON-NLS-1$
}
/**
* Sets the value of the dialog setting, associated with the given
* settingName, resolved by the dialog setting prefix associated with this
* action.
*
* @param settingName unqualified setting name
* @return value or <code>null</code> if none
*/
protected void setDialogSetting(String settingName, String value) {
getDialogSettings().put(getDialogSettingsPrefix() + "." + settingName, value); //$NON-NLS-1$
}
/**
* Returns this plug-in's dialog settings.
*
* @return IDialogSettings
*/
protected IDialogSettings getDialogSettings() {
IDialogSettings settings = JDIDebugUIPlugin.getDefault().getDialogSettings();
return settings;
}
protected int getActionType() {
return ADD;
}
}
|