use of com.intellij.ide.util.PropertiesComponent in project liferay-ide by liferay.
the class LiferayProjectTypeStep method projectTypeChanged.
public void projectTypeChanged() {
TemplatesGroup group = _getSelectedGroup();
if ((group == null) || (group == _lastSelectedGroup)) {
return;
}
_lastSelectedGroup = group;
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
propertiesComponent.setValue(_PROJECT_WIZARD_GROUP, group.getId());
ModuleBuilder groupModuleBuilder = group.getModuleBuilder();
_settingsStep = null;
_headerPanel.removeAll();
if ((groupModuleBuilder != null) && (groupModuleBuilder.getModuleType() != null)) {
_settingsStep = groupModuleBuilder.modifyProjectTypeStep(this);
}
if ((groupModuleBuilder == null) || groupModuleBuilder.isTemplateBased()) {
_showTemplates(group);
} else if (!_showCustomOptions(groupModuleBuilder)) {
List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getProviders(groupModuleBuilder);
ProjectCategory category = group.getProjectCategory();
if (category != null) {
List<FrameworkSupportInModuleProvider> filtered = ContainerUtil.filter(providers, provider -> _matchFramework(category, provider));
Map<String, FrameworkSupportInModuleProvider> map = ContainerUtil.newMapFromValues(providers.iterator(), PROVIDER_STRING_CONVERTOR);
Stream<FrameworkSupportInModuleProvider> stream = filtered.stream();
Set<FrameworkSupportInModuleProvider> set = stream.flatMap(provider -> provider.getDependenciesFrameworkIds().stream()).map(depId -> map.get(depId.getFrameworkId())).filter(dependency -> dependency != null).collect(Collectors.toSet());
_frameworksPanel.setProviders(new ArrayList<>(set), new HashSet<>(Arrays.asList(category.getAssociatedFrameworkIds())), new HashSet<>(Arrays.asList(category.getPreselectedFrameworkIds())));
} else {
_frameworksPanel.setProviders(providers);
}
_getSelectedBuilder().addModuleConfigurationUpdater(_configurationUpdater);
_showCard(_FRAMEWORKS_CARD);
}
_headerPanel.setVisible(_headerPanel.getComponentCount() > 0);
List<JLabel> labels = UIUtil.findComponentsOfType(_headerPanel, JLabel.class);
int width = 0;
for (JLabel label : labels) {
int width1 = label.getPreferredSize().width;
width = Math.max(width, width1);
}
for (JLabel label : labels) {
label.setPreferredSize(new Dimension(width, label.getPreferredSize().height));
}
_headerPanel.revalidate();
_headerPanel.repaint();
_updateSelection();
}
use of com.intellij.ide.util.PropertiesComponent in project ballerina by ballerina-lang.
the class BallerinaModuleLibrariesInitializer method showNotification.
private static void showNotification(@NotNull Project project) {
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
PropertiesComponent projectPropertiesComponent = PropertiesComponent.getInstance(project);
boolean shownAlready;
// noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (propertiesComponent) {
shownAlready = propertiesComponent.getBoolean(BALLERINA_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false) || projectPropertiesComponent.getBoolean(BALLERINA_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false);
if (!shownAlready) {
propertiesComponent.setValue(BALLERINA_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, String.valueOf(true));
}
}
if (!shownAlready) {
NotificationListener.Adapter notificationListener = new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && "configure".equals(event.getDescription())) {
BallerinaLibrariesConfigurableProvider.showModulesConfigurable(project);
}
}
};
Notification notification = BallerinaConstants.BALLERINA_NOTIFICATION_GROUP.createNotification("BALLERINA_REPOSITORY was detected", "We've detected some packages from your BALLERINA_REPOSITORY.\n" + "You may want to add extra packages in <a href='configure'>Ballerina Packages " + "configuration</a>.", NotificationType.INFORMATION, notificationListener);
Notifications.Bus.notify(notification, project);
}
}
use of com.intellij.ide.util.PropertiesComponent in project evosuite by EvoSuite.
the class EvoParameters method load.
public void load(Project project) {
PropertiesComponent p = PropertiesComponent.getInstance(project);
cores = p.getInt(CORES_EVOSUITE_PARAM, 1);
memory = p.getInt(MEMORY_EVOSUITE_PARAM, 2000);
time = p.getInt(TIME_EVOSUITE_PARAM, 3);
folder = p.getValue(TARGET_FOLDER_EVOSUITE_PARAM, "src/evo");
String envJavaHome = System.getenv("JAVA_HOME");
javaHome = p.getValue(JAVA_HOME, envJavaHome != null ? envJavaHome : "");
mvnLocation = p.getValue(MVN_LOCATION, "");
evosuiteJarLocation = p.getValue(EVOSUITE_JAR_LOCATION, "");
executionMode = p.getValue(EXECUTION_MODE, EXECUTION_MODE_MVN);
guiWidth = p.getInt(GUI_DIALOG_WIDTH, 570);
guiHeight = p.getInt(GUI_DIALOG_HEIGHT, 300);
}
use of com.intellij.ide.util.PropertiesComponent in project azure-tools-for-java by Microsoft.
the class FunctionCoreToolsCombobox method saveHistory.
private void saveHistory() {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
final List<String> subList = funcCoreToolsPathList.stream().skip(Math.max(funcCoreToolsPathList.size() - MAX_HISTORY_SIZE, 0)).collect(Collectors.toList());
propertiesComponent.setValue(AZURE_TOOLKIT_FUNCTION_CORE_TOOLS_HISTORY, StringUtils.join(subList.toArray(), "\n"));
}
use of com.intellij.ide.util.PropertiesComponent in project azure-tools-for-java by Microsoft.
the class FunctionCoreToolsCombobox method loadHistory.
private List<String> loadHistory() {
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
final String history = propertiesComponent.getValue(AZURE_TOOLKIT_FUNCTION_CORE_TOOLS_HISTORY);
if (history != null) {
final String[] items = history.split("\n");
List<String> result = new ArrayList<>();
for (String item : items) {
if (StringUtils.isNotBlank(item) && new File(item).exists()) {
try {
result.add(Paths.get(item).toRealPath().toString());
} catch (Exception ignore) {
// ignore since the history data is not important
}
}
}
return result;
}
return Collections.emptyList();
}
Aggregations