本文整理汇总了Java中edu.umd.cs.findbugs.config.UserPreferences.getUserPreferences方法的典型用法代码示例。如果您正苦于以下问题:Java UserPreferences.getUserPreferences方法的具体用法?Java UserPreferences.getUserPreferences怎么用?Java UserPreferences.getUserPreferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.config.UserPreferences
的用法示例。
在下文中一共展示了UserPreferences.getUserPreferences方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FindBugsFrame
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Creates new form FindBugsFrame.
*/
public FindBugsFrame() {
String dirProp = System.getProperty("user.dir");
if (dirProp != null) {
currentDirectory = new File(dirProp);
}
UserPreferences prefs = UserPreferences.getUserPreferences();
prefs.read();
prefs.loadUserDetectorPreferences();
initComponents();
postInitComponents();
}
示例2: rebuildRecentProjectsMenu
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
private void rebuildRecentProjectsMenu() {
UserPreferences prefs = UserPreferences.getUserPreferences();
final List<String> recentProjects = prefs.getRecentProjects();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
recentProjectsMenu.removeAll();
java.awt.Font ft = new java.awt.Font("Dialog", 0, 12);
if (recentProjects.size() == 0) {
JMenuItem emptyItem = new JMenuItem(L10N.getLocalString("menu.empty_item", "Empty"));
emptyItem.setFont(ft);
emptyItem.setEnabled(false);
recentProjectsMenu.add(emptyItem);
} else {
for (int i = 0; i < recentProjects.size(); i++) {
JMenuItem projectItem = new JMenuItem(recentProjects.get(i));
projectItem.setFont(ft);
projectItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
openRecentProjectItemActionPerformed(evt);
}
});
recentProjectsMenu.add(projectItem);
}
}
}
});
}
示例3: FindBugsFrame
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Creates new form FindBugsFrame.
*/
public FindBugsFrame() {
UserPreferences prefs = UserPreferences.getUserPreferences();
prefs.read();
String dirProp = SystemProperties.getProperty("user.dir");
if (dirProp != null) {
currentDirectory = new File(dirProp);
}
initComponents();
postInitComponents();
}
示例4: rebuildRecentProjectsMenu
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
private void rebuildRecentProjectsMenu() {
UserPreferences prefs = UserPreferences.getUserPreferences();
final List<String> recentProjects = prefs.getRecentProjects();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
recentProjectsMenu.removeAll();
java.awt.Font ft = BUTTON_FONT;
if (recentProjects.size() == 0) {
JMenuItem emptyItem = new JMenuItem(L10N.getLocalString("menu.empty_item", "Empty"));
emptyItem.setFont(ft);
emptyItem.setEnabled(false);
recentProjectsMenu.add(emptyItem);
} else {
for (String recentProject : recentProjects) {
JMenuItem projectItem = new JMenuItem(recentProject);
projectItem.setFont(ft);
projectItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
openRecentProjectItemActionPerformed(evt);
}
});
recentProjectsMenu.add(projectItem);
}
}
}
});
}
示例5: saveProject
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Offer to save the current Project to a file.
*
* @param project the Project to save
* @param dialogTitle the title for the save dialog (if needed)
* @param chooseFilename if true, force a dialog to prompt the user
* for a filename
* @return true if the project is saved successfully, false if the user
* cancels or an error occurs
*/
private boolean saveProject(Project project, String dialogTitle, boolean chooseFilename) {
boolean useRelativePaths;
try {
if (project == null)
return true;
File file;
String fileName = project.getProjectFileName();
if (!fileName.startsWith("<") && !chooseFilename) {
file = new File(fileName);
useRelativePaths = project.getOption( Project.RELATIVE_PATHS );
} else {
JRadioButton relativePaths = new JRadioButton(L10N.getLocalString("msg.userelativepaths_txt", "Use Relative Paths"));
relativePaths.setSelected(project.getOption(Project.RELATIVE_PATHS));
JFileChooser chooser = createFileChooser(relativePaths);
chooser.setFileFilter(projectFileFilter);
int result = chooseFile(chooser, dialogTitle);
if (result == JFileChooser.CANCEL_OPTION)
return false;
file = chooser.getSelectedFile();
fileName = Project.transformFilename(file.getPath());
file = new File(fileName);
useRelativePaths = relativePaths.isSelected();
}
project.write(file.getPath(), useRelativePaths, file.getParent());
logger.logMessage(ConsoleLogger.INFO, "Project saved");
project.setProjectFileName(file.getPath());
UserPreferences prefs = UserPreferences.getUserPreferences();
prefs.useProject(file.getPath());
prefs.read();
rebuildRecentProjectsMenu();
updateTitle(project);
return true;
} catch (IOException e) {
logger.logMessage(ConsoleLogger.ERROR, "Could not save project: " + e.toString());
JOptionPane.showMessageDialog(this, "Error saving project: " + e.toString(),
"Error", JOptionPane.ERROR_MESSAGE);
return false;
}
}
示例6: saveProject
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Offer to save the current Project to a file.
*
* @param project the Project to save
* @param dialogTitle the title for the save dialog (if needed)
* @param chooseFilename if true, force a dialog to prompt the user
* for a filename
* @return true if the project is saved successfully, false if the user
* cancels or an error occurs
*/
private boolean saveProject(Project project, String dialogTitle, boolean chooseFilename) {
boolean useRelativePaths;
try {
if (project == null)
return true;
File file;
String fileName = project.getProjectFileName();
if (!fileName.startsWith("<") && !chooseFilename) {
file = new File(fileName);
useRelativePaths = project.getOption( Project.RELATIVE_PATHS );
} else {
JRadioButton relativePaths = new JRadioButton(L10N.getLocalString("msg.userelativepaths_txt", "Use Relative Paths"));
relativePaths.setSelected(project.getOption(Project.RELATIVE_PATHS));
JFileChooser chooser = createFileChooser(relativePaths);
chooser.setFileFilter(projectFileFilter);
int result = chooseFile(chooser, dialogTitle);
if (result == JFileChooser.CANCEL_OPTION)
return false;
file = chooser.getSelectedFile();
fileName = Project.transformFilename(file.getPath());
file = new File(fileName);
useRelativePaths = relativePaths.isSelected();
}
project.write(file.getPath(), useRelativePaths, file.getParent());
logger.logMessage(Logger.INFO, "Project saved");
project.setProjectFileName(file.getPath());
UserPreferences prefs = UserPreferences.getUserPreferences();
prefs.useProject(file.getPath());
prefs.read();
rebuildRecentProjectsMenu();
updateTitle(project);
return true;
} catch (IOException e) {
logger.logMessage(Logger.ERROR, "Could not save project: " + e.toString());
JOptionPane.showMessageDialog(this, "Error saving project: " + e.toString(),
"Error", JOptionPane.ERROR_MESSAGE);
return false;
}
}