本文整理匯總了Java中org.eclipse.jface.dialogs.IDialogSettings.getInt方法的典型用法代碼示例。如果您正苦於以下問題:Java IDialogSettings.getInt方法的具體用法?Java IDialogSettings.getInt怎麽用?Java IDialogSettings.getInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.dialogs.IDialogSettings
的用法示例。
在下文中一共展示了IDialogSettings.getInt方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPersistedLocation
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private Point getPersistedLocation() {
if (shell==null || shell.isDisposed()){
return null;
}
Point result = null;
IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings == null) {
return null;
}
try {
int x = dialogSettings.getInt(getClass().getName() + DIALOG_ORIGIN_X);
int y = dialogSettings.getInt(getClass().getName() + DIALOG_ORIGIN_Y);
result = new Point(x, y);
// The coordinates were stored relative to the parent shell.
// Convert to display coordinates.
Shell parentShell = getParent();
if (parentShell != null) {
Point parentLocation = parentShell.getLocation();
result.x += parentLocation.x;
result.y += parentLocation.y;
}
} catch (NumberFormatException e) {
}
return result;
}
示例2: recordDialogOpened
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
public static void recordDialogOpened(final String dialogSettingsKey) {
final IDialogSettings settings = getDialogSettings(dialogSettingsKey);
int views = 0;
try {
views = settings.getInt(VIEWS);
} catch (final NumberFormatException ex) {
// ignore, leave views set to 0
}
settings.put(VIEWS, views + 1);
}
示例3: getInitialSize
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
public static Point getInitialSize(
final String dialogSettingsKey,
final Point initialSize,
final boolean enforceMinimum) {
final IDialogSettings settings = getDialogSettings(dialogSettingsKey);
try {
int x, y;
x = settings.getInt(DIALOG_WIDTH);
y = settings.getInt(DIALOG_HEIGHT);
if (log.isTraceEnabled()) {
log.trace("using saved initial size for [" + dialogSettingsKey + "]: " + x + "," + y); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/*
* If we wanted the computed initial size to always be a minimum
* size (overriding the persisted size if the persisted size is
* smaller), we return the maximum of persisted or initial.
*/
if (enforceMinimum) {
return new Point(Math.max(x, initialSize.x), Math.max(y, initialSize.y));
} else {
return new Point(x, y);
}
} catch (final NumberFormatException e) {
}
if (log.isTraceEnabled()) {
log.trace("no saved initial size for [" //$NON-NLS-1$
+ dialogSettingsKey
+ "] - using default initial size of: " //$NON-NLS-1$
+ initialSize.x
+ "," //$NON-NLS-1$
+ initialSize.y);
}
return initialSize;
}
示例4: getInitialLocation
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
public static Point getInitialLocation(final String dialogSettingsKey, final Point initialLocation) {
final IDialogSettings settings = getDialogSettings(dialogSettingsKey);
try {
final int x = settings.getInt(DIALOG_ORIGIN_X);
final int y = settings.getInt(DIALOG_ORIGIN_Y);
return new Point(x, y);
} catch (final NumberFormatException e) {
}
return initialLocation;
}
示例5: restoreRadio
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
/**
* Restores the selection state of a radio group. If no value was persisted
* the first button is selected.
*
* @param settings
* dialog setting used to persist the status
* @param key
* key used for this radio group
* @param radios
* buttons of the radio group
*/
public static void restoreRadio(IDialogSettings settings, String key,
Button... radios) {
int idx;
try {
idx = settings.getInt(key);
} catch (NumberFormatException e) {
idx = 0;
}
if (idx < 0 || idx >= radios.length) {
idx = 0;
}
radios[idx].setSelection(true);
}
示例6: alreadyInList
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private boolean alreadyInList(String name) {
IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
int count = 0;
try {
count = settings.getInt("config_count");
}
catch (NumberFormatException e){
}
for (int i = 1; i <= count; i++){
if (settings.get("soot_run_config_"+i).equals(name)){
return true;
}
}
return false;
}
示例7: add
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private void add(String name, ArrayList val){
IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
int count = 0;
try {
count = settings.getInt("config_count");
}
catch(NumberFormatException e) {
}
count++;
settings.put("config_count", count);
settings.put("soot_run_config_"+count, name);
update(name, val);
}
示例8: getInitialInput
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private SootConfiguration getInitialInput() {
IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
int numConfig = 0;
try {
numConfig = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$
}
catch(NumberFormatException e) {
}
SootConfiguration root = new SootConfiguration(""); //$NON-NLS-1$
if (numConfig != 0) {
String [] configNames = new String[numConfig];
for (int i = 0; i < numConfig; i++) {
configNames[i] = settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+(i+1)); //$NON-NLS-1$
root.addChild(new SootConfiguration(configNames[i]));
}
}
setTreeRoot(root);
return root;
}
示例9: renamePressed
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private void renamePressed(){
if (getSelected() == null) return;
String result = this.getSelected();
IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
// gets current number of configurations
int config_count = 0;
int oldNameCount = 0;
try {
config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$
}
catch (NumberFormatException e) {
}
ArrayList currentNames = new ArrayList();
for (int i = 1; i <= config_count; i++) {
currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$
if (((String)currentNames.get(i-1)).equals(result)){
oldNameCount = i;
}
}
// sets validator to know about already used names
SootConfigNameInputValidator validator = new SootConfigNameInputValidator();
validator.setAlreadyUsed(currentNames);
InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Rename_Saved_Configuration"), Messages.getString("SootConfigManagerDialog.Enter_new_name"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
nameDialog.open();
if (nameDialog.getReturnCode() == Dialog.OK){
settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config")+oldNameCount, nameDialog.getValue()); //$NON-NLS-1$
settings.put(nameDialog.getValue(), settings.getArray(result));
getTreeRoot().renameChild(result, nameDialog.getValue());
saveMainClass(nameDialog.getValue(), settings.get(result+"_mainClass"));
}
refreshTree();
}
示例10: clonePressed
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private void clonePressed(){
if (getSelected() == null) return;
String result = this.getSelected();
IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
// gets current number of configurations
int config_count = 0;
try {
config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$
}
catch (NumberFormatException e) {
}
ArrayList currentNames = new ArrayList();
for (int i = 1; i <= config_count; i++) {
currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$
}
// sets validator to know about already used names
SootConfigNameInputValidator validator = new SootConfigNameInputValidator();
validator.setAlreadyUsed(currentNames);
InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Clone_Saved_Configuration"), Messages.getString("SootConfigManagerDialog.Enter_new_name"), result, validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
nameDialog.open();
if (nameDialog.getReturnCode() == Dialog.OK){
config_count++;
settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config")+config_count, nameDialog.getValue()); //$NON-NLS-1$
settings.put(nameDialog.getValue(), settings.getArray(result));
settings.put(Messages.getString("SootConfigManagerDialog.config_count"), config_count); //$NON-NLS-1$
getTreeRoot().addChild(new SootConfiguration(nameDialog.getValue()));
saveMainClass(nameDialog.getValue(), settings.get(result+"_mainClass"));
}
refreshTree();
}
示例11: getDebugInfo
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
public static String getDebugInfo(final String dialogSettingsKey) {
final IDialogSettings settings = getDialogSettings(dialogSettingsKey);
long averageOpenTime = -1;
long timeCounts = 0;
try {
timeCounts = settings.getInt(TIME_COUNTS);
averageOpenTime = settings.getLong(ACCUMULATED_OPEN_TIME) / timeCounts;
} catch (final NumberFormatException ex) {
averageOpenTime = -1;
}
return
"stored origin (" //$NON-NLS-1$
+ settings.get(DIALOG_ORIGIN_X)
+ "," //$NON-NLS-1$
+ settings.get(DIALOG_ORIGIN_Y)
+ ")" //$NON-NLS-1$
+ NEWLINE
+ "stored size (" //$NON-NLS-1$
+ settings.get(DIALOG_WIDTH)
+ "," //$NON-NLS-1$
+ settings.get(DIALOG_HEIGHT)
+ ")" //$NON-NLS-1$
+ NEWLINE
+ "views: " //$NON-NLS-1$
+ settings.get(VIEWS)
+ NEWLINE
+
((averageOpenTime != -1) ? "average display time: " //$NON-NLS-1$
+ averageOpenTime
+ " ms (" //$NON-NLS-1$
+ timeCounts
+ " records)" //$NON-NLS-1$
+ NEWLINE : "") //$NON-NLS-1$
+ "since " //$NON-NLS-1$
+ settings.get(SINCE);
}
示例12: newPressed
import org.eclipse.jface.dialogs.IDialogSettings; //導入方法依賴的package包/類
private void newPressed() {
IDialogSettings settings = SootPlugin.getDefault().getDialogSettings();
// gets current number of configurations before adding any
int config_count = 0;
try {
config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$
}
catch (NumberFormatException e) {
}
ArrayList currentNames = new ArrayList();
for (int i = 1; i <= config_count; i++) {
currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$
}
// sets validator to know about already used names - but it doesn't use
// them because then editing a file cannot use same file name
SootConfigNameInputValidator validator = new SootConfigNameInputValidator();
validator.setAlreadyUsed(currentNames);
// create dialog to get name
InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Saving_Configuration_Name"), Messages.getString("SootConfigManagerDialog.Enter_name_to_save_configuration_with"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
nameDialog.open();
if (nameDialog.getReturnCode() == Dialog.OK) {
setEditDefs(null);
int returnCode = displayOptions(nameDialog.getValue(), "soot.Main");
//handle selection of main class here
if (returnCode != Dialog.CANCEL) {
getTreeRoot().addChild(new SootConfiguration(nameDialog.getValue()));
refreshTree();
}
}
else {
// cancel and do nothing
}
}