本文整理汇总了Java中com.intellij.ide.util.PropertiesComponent.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesComponent.getInstance方法的具体用法?Java PropertiesComponent.getInstance怎么用?Java PropertiesComponent.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.util.PropertiesComponent
的用法示例。
在下文中一共展示了PropertiesComponent.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void init(ToolWindow window) {
builds = BuildsModel.getInstance();
rootNode = new DefaultMutableTreeNode("CircleCI");
TreeModel treeModel = new DefaultTreeModel(rootNode);
tree1.setModel(treeModel);
tree1.setShowsRootHandles(true);
tree1.setCellRenderer(new RecentBuildTreeCellRenderer());
PropertiesComponent component = PropertiesComponent.getInstance();
Integer refreshInterval;
try {
refreshInterval = new Integer(component.getValue("com.bkv.intellij.icons.refresh_interval"));
} catch (Exception e) {
refreshInterval = new Integer(99999999);
}
enableAutoRefresh(refreshInterval);
refresh();
}
开发者ID:waarneembemiddeling,项目名称:intellij-circleci-integration,代码行数:19,代码来源:RecentBuildsToolWindowFactory.java
示例2: actionPerformed
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent evt) {
try {
PropertiesComponent prop = PropertiesComponent.getInstance();
RandomBackgroundTask task = RandomBackgroundTask.Builder.createTask().withProp(prop).build();
int timeExecution = getTimeExecution(prop);
if (timeExecution != -1) {
ScheduledExecutorServiceHandler scheduler = ScheduledExecutorServiceHandler.
Builder.
createScheduler().withTask(task).
withInitialDelay(0).
withPeriod(timeExecution).
withTimeUnit(TimeUnit.SECONDS).
build();
scheduler.scheduleAtFixedRate();
} else {
task.run();
}
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:allandequeiroz,项目名称:random_image_background_any_jetbrains_plugin,代码行数:25,代码来源:RandomBackground.java
示例3: isModified
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
public boolean isModified() {
PropertiesComponent prop = PropertiesComponent.getInstance();
String storedFolder = prop.getValue(FOLDER);
String storedTimeExecution = prop.getValue(TIME_EXECUTION);
int storedOpacity = getStoredOpacity(prop);
boolean storedDisabledOption = prop.getBoolean(DISABLED);
String uiFolder = imageFolder.getText();
String uiTimeExecution = timeExecution.getText();
int uiOpacity = opacity.getValue();
boolean isDisabled = disabled.isSelected();
if (storedFolder == null) {
storedFolder = "";
}
if (storedTimeExecution == null) {
storedTimeExecution = "";
}
return !storedFolder.equals(uiFolder) || !storedTimeExecution.equals(uiTimeExecution) || storedOpacity != uiOpacity || storedDisabledOption != isDisabled;
}
示例4: apply
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void apply() throws ConfigurationException {
PropertiesComponent prop = PropertiesComponent.getInstance();
prop.setValue(FOLDER, imageFolder.getText());
String timeExecutionValue = timeExecution.getText();
prop.setValue(TIME_EXECUTION, timeExecutionValue);
int opcity = opacity.getValue();
prop.setValue(OPACITY, String.valueOf(opcity));
boolean isDisabled = disabled.isSelected();
prop.setValue(DISABLED, isDisabled);
ScheduledExecutorServiceHandler.shutdownExecution();
if(isDisabled) {
ActionManager.getInstance().getAction("clearBackgroundImage").actionPerformed(null);
}else {
ActionManager.getInstance().getAction("randomBackgroundImage").actionPerformed(null);
}
}
示例5: showDiscountOffer
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
private void showDiscountOffer(final Project project) {
final PropertiesComponent properties = PropertiesComponent.getInstance();
final long lastNotificationTime = properties.getOrInitLong(LAST_DISCOUNT_OFFER_TIME_PROPERTY, 0);
final long currentTime = System.currentTimeMillis();
if (currentTime - lastNotificationTime >= DateFormatUtil.MONTH) {
properties.setValue(LAST_DISCOUNT_OFFER_TIME_PROPERTY, String.valueOf(currentTime));
final Notification notification = notificationGroup.createNotification(
HybrisI18NBundleUtils.message("evaluation.license.discount.offer.bubble.title"),
HybrisI18NBundleUtils.message("evaluation.license.discount.offer.bubble.text"),
NotificationType.INFORMATION,
(myNotification, myHyperlinkEvent) -> goToDiscountOffer(myHyperlinkEvent)
);
notification.setImportant(true);
Notifications.Bus.notify(notification, project);
ApplicationManager.getApplication().invokeLater(() -> {
if (!notificationClosingAlarm.isDisposed()) {
notificationClosingAlarm.addRequest(notification::hideBalloon, 3000);
}
});
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:HybrisProjectManagerListener.java
示例6: CustomFrameTitleBuilder
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
public CustomFrameTitleBuilder() {
PropertiesComponent prop = PropertiesComponent.getInstance();
projectPattern = prop.getValue(Settings.TEMPLATE_PATTERN_PROJECT, DEFAULT_TEMPLATE_PATTERN_PROJECT);
filePattern = prop.getValue(Settings.TEMPLATE_PATTERN_FILE, DEFAULT_TEMPLATE_PATTERN_FILE);
engine = new ScriptEngineManager().getEngineByName("nashorn");
try {
// evaluate JavaScript Underscore library
engine.eval(new InputStreamReader(getClass().getResourceAsStream("/underscore-min.js")));
// create new JavaScript methods references for templates
engine.eval("var projectTemplate;");
engine.eval("var fileTemplate;");
prepareTemplateSettings();
} catch (Exception e) {
// we took precaution below
}
TitleComponent.addSettingChangeListener(this);
}
示例7: initComponent
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
private void initComponent() {
PropertiesComponent pc = PropertiesComponent.getInstance();
mInsertSpaceCheckBox.setSelected(pc.getBoolean(PC_KEY_SPACE_BETWEEN_PREFIX, true));
// Snake Case
mInputCaseBox.setSelectedIndex(pc.getInt(PC_KEY_INPUT_CASE, 0));
mPrefixSpacePositionBox.setSelectedIndex(pc.getInt(PC_KEY_PREFIX_SPACE_POS, 0));
mInsertXmlInfoCheckBox.setSelected(pc.getBoolean(PC_KEY_INSERT_XML_INFO, true));
mDeleteCommentCheckBox.setSelected(pc.getBoolean(PC_KEY_DELETE_COMMENT, false));
// indent 4
mCodeIndentBox.setSelectedIndex(pc.getInt(PC_KEY_CODE_INDENT, 1));
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
mInputCaseBox.setEnabled(mInsertSpaceCheckBox.isSelected());
mPrefixSpacePositionLabel.setEnabled(mInsertSpaceCheckBox.isSelected());
mPrefixSpacePositionBox.setEnabled(mInsertSpaceCheckBox.isSelected());
}
};
mInsertSpaceCheckBox.addActionListener(actionListener);
// initial invoke
actionListener.actionPerformed(null);
}
示例8: save
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
public void save(@NotNull Element e, boolean isProjectLevel) {
List<FileColorConfiguration> configurations = isProjectLevel ? myProjectLevelConfigurations : myApplicationLevelConfigurations;
for (FileColorConfiguration configuration : configurations) {
String scopeName = configuration.getScopeName();
String propertyKey = isProjectLevel ? null : predefinedScopeNameToPropertyKey.get(scopeName);
if (propertyKey == null) {
configuration.save(e);
}
else {
PropertiesComponent propertyComponent = PropertiesComponent.getInstance();
propertyComponent.setValue(propertyKey, configuration.getColorName(), predefinedScopeNameToColor.get(scopeName));
// previously it was saved incorrectly as scope name instead of specified property key
PropertiesComponent.getInstance().setValue(scopeName, null);
}
}
}
示例9: actionPerformed
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
final Project project = getEventProject(event);
final Editor editor = event.getData(PlatformDataKeys.EDITOR);
XmlSorterDialog dialog = new XmlSorterDialog(project);
PropertiesComponent pc = PropertiesComponent.getInstance();
execute(project,
editor,
pc.getInt(PC_KEY_INPUT_CASE, 0) == 0,
dialog.getPrefixSpacePositionValueAt(pc.getInt(PC_KEY_PREFIX_SPACE_POS, 0)),
pc.getBoolean(PC_KEY_SPACE_BETWEEN_PREFIX, true),
pc.getBoolean(PC_KEY_INSERT_XML_INFO, true),
pc.getBoolean(PC_KEY_DELETE_COMMENT, false),
dialog.getCodeIndentValueAt(pc.getInt(PC_KEY_CODE_INDENT, 1)));
}
示例10: removeSelected
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
public void removeSelected() {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
if (!propertiesComponent.isTrueValue("run.configuration.delete.ad")) {
propertiesComponent.setValue("run.configuration.delete.ad", Boolean.toString(true));
}
final int index = getSelectedIndex();
if (index == -1) {
return;
}
final Object o = getListModel().get(index);
if (o != null && o instanceof ItemWrapper && ((ItemWrapper)o).canBeDeleted()) {
deleteConfiguration(myProject, (RunnerAndConfigurationSettings)((ItemWrapper)o).getValue());
getListModel().deleteItem(o);
final List<Object> values = getListStep().getValues();
values.remove(o);
if (index < values.size()) {
onChildSelectedFor(values.get(index));
}
else if (index - 1 >= 0) {
onChildSelectedFor(values.get(index - 1));
}
}
}
示例11: setConfigurations
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
public void setConfigurations(@NotNull List<FileColorConfiguration> configurations, boolean isProjectLevel) {
if (isProjectLevel) {
myProjectLevelConfigurations.clear();
myProjectLevelConfigurations.addAll(configurations);
}
else {
myApplicationLevelConfigurations.clear();
Map<String, String> predefinedScopeNameToPropertyKey = new THashMap<String, String>(FileColorsModel.predefinedScopeNameToPropertyKey);
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
for (FileColorConfiguration configuration : configurations) {
myApplicationLevelConfigurations.add(configuration);
String propertyKey = predefinedScopeNameToPropertyKey.remove(configuration.getScopeName());
if (propertyKey != null) {
propertiesComponent.setValue(propertyKey, configuration.getColorName());
}
}
for (String scopeName : predefinedScopeNameToPropertyKey.keySet()) {
// empty string means that value deleted
propertiesComponent.setValue(predefinedScopeNameToPropertyKey.get(scopeName), "");
// previously it was saved incorrectly as scope name instead of specified property key
propertiesComponent.setValue(scopeName, null);
}
}
}
示例12: doOKAction
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected void doOKAction() {
final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
final IDevice selectedDevice = getSelectedDevice();
if (selectedDevice == null) {
return;
}
final Client selectedClient = getSelectedClient();
if (selectedClient == null) {
return;
}
super.doOKAction();
properties.setValue(DEBUGGABLE_DEVICE_PROPERTY, selectedDevice.getName());
properties.setValue(DEBUGGABLE_PROCESS_PROPERTY, selectedClient.getClientData().getClientDescription());
properties.setValue(SHOW_ALL_PROCESSES_PROPERTY, Boolean.toString(myShowAllProcessesCheckBox.isSelected()));
final String debugPort = Integer.toString(selectedClient.getDebuggerListenPort());
closeOldSessionAndRun(debugPort);
}
示例13: setupPlatform
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
private static void setupPlatform(@NotNull Module module) {
String targetHashString = getTargetHashStringFromPropertyFile(module);
if (targetHashString != null && findAndSetSdkWithHashString(module, targetHashString)) {
return;
}
PropertiesComponent component = PropertiesComponent.getInstance();
if (component.isValueSet(DEFAULT_PLATFORM_NAME_PROPERTY)) {
String defaultPlatformName = component.getValue(DEFAULT_PLATFORM_NAME_PROPERTY);
Sdk defaultLib = ProjectJdkTable.getInstance().findJdk(defaultPlatformName, AndroidSdkType.getInstance().getName());
if (defaultLib != null && tryToSetAndroidPlatform(module, defaultLib)) {
return;
}
}
for (Sdk sdk : getAllAndroidSdks()) {
AndroidPlatform platform = AndroidPlatform.getInstance(sdk);
if (platform != null &&
checkSdkRoots(sdk, platform.getTarget(), false) &&
tryToSetAndroidPlatform(module, sdk)) {
component.setValue(DEFAULT_PLATFORM_NAME_PROPERTY, sdk.getName());
return;
}
}
}
示例14: getInstance
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
public static BuildsModel getInstance()
{
if (instance == null) {
PropertiesComponent component = PropertiesComponent.getInstance();
String token = component.getValue("com.bkv.intellij.icons.api_key", "api_key");
instance = new BuildsModel(new CircleCiHttpClient(new HttpClient(), "https://circleci.com/api/v1.1/", token));
}
return instance;
}
示例15: apply
import com.intellij.ide.util.PropertiesComponent; //导入方法依赖的package包/类
public void apply() throws ConfigurationException {
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
propertiesComponent.setValue("com.bkv.intellij.icons.api_key", txtApiKey.getText());
propertiesComponent.setValue("com.bkv.intellij.icons.refresh_interval", txtRefreshInterval.getText());
changed = false;
BuildsModel.resetInstance();
}