Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI minor bugs #1101

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public class DroidMainFrame extends JFrame {
private JFileChooser filterFileChooser;
private ResourceSelectorDialog resourceFileChooser;
private ButtonManager buttonManager;
private ConfigDialog configDialog;
private GlobalContext globalContext;
private JFileChooser exportFileChooser;
private SignatureInstallDialog signatureInstallDialog;
Expand Down Expand Up @@ -320,7 +319,6 @@ public void windowClosing(WindowEvent e) {

globalContext = new SpringGuiContext();
profileManager = globalContext.getProfileManager();
configDialog = new ConfigDialog(this, globalContext);
droidContext = new DroidUIContext(jProfilesTabbedPane, profileManager);
exportFileChooser = new ExportFileChooser();
filterFileChooser = new FilterFileChooser(globalContext.getGlobalConfig().getFilterDir().toFile());
Expand Down Expand Up @@ -1172,25 +1170,29 @@ private void jMenuItemCopyFilterToAllActionPerformed(java.awt.event.ActionEvent
}// GEN-LAST:event_jMenuItemCopyFIlterToAllActionPerformed

private void settingsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_settingsMenuItemActionPerformed
// initialise the dialog's values
// create the dialog and initialise the dialog's values
Map<String, Object> settings = globalContext.getGlobalConfig().getPropertiesMap();
configDialog.init(settings);

configDialog.setVisible(true);
if (configDialog.getResponse() == ConfigDialog.OK) {
try {
globalContext.getGlobalConfig().update(configDialog.getGlobalConfig());
} catch (ConfigurationException e) {
log.error("Error updating properties: " + e.getMessage(), e);
JOptionPane.showMessageDialog(configDialog, NbBundle.getMessage(ConfigDialog.class,
"ConfigDialog.error.text"),
NbBundle.getMessage(ConfigDialog.class, "ConfigDialog.error.title"), JOptionPane.ERROR_MESSAGE);

ConfigDialog configDialog = new ConfigDialog(this, globalContext);
try {
configDialog.init(settings);
configDialog.setVisible(true);
if (configDialog.getResponse() == ConfigDialog.OK) {
try {
globalContext.getGlobalConfig().update(configDialog.getGlobalConfig());
} catch (ConfigurationException e) {
log.error("Error updating properties: " + e.getMessage(), e);
JOptionPane.showMessageDialog(configDialog, NbBundle.getMessage(ConfigDialog.class,
"ConfigDialog.error.text"),
NbBundle.getMessage(ConfigDialog.class, "ConfigDialog.error.title"), JOptionPane.ERROR_MESSAGE);
}
}
}

if (configDialog.getCreateNewProfile()) {
createAndInitNewProfile();
if (configDialog.getCreateNewProfile()) {
createAndInitNewProfile();
}
} finally {
configDialog.dispose();
}
}// GEN-LAST:event_settingsMenuItemActionPerformed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public ConfigDialog(Frame owner, GlobalContext context) {

private void populatePropertyListNeedingNewProfile() {
propertiesAffectingNewProfile.addAll(
Arrays.asList(DroidGlobalProperty.BINARY_UPDATE_URL.getName(), DroidGlobalProperty.CONTAINER_UPDATE_URL.getName(),
Arrays.asList(DroidGlobalProperty.DEFAULT_BINARY_SIG_FILE_VERSION.getName(), DroidGlobalProperty.DEFAULT_CONTAINER_SIG_FILE_VERSION.getName(),
DroidGlobalProperty.PROCESS_ZIP.getName(), DroidGlobalProperty.PROCESS_TAR.getName(),
DroidGlobalProperty.PROCESS_GZIP.getName(), DroidGlobalProperty.PROCESS_RAR.getName(),
DroidGlobalProperty.PROCESS_7ZIP.getName(), DroidGlobalProperty.PROCESS_ISO.getName(),
Expand Down Expand Up @@ -907,7 +907,6 @@ private void initComponents() {
}// </editor-fold>//GEN-END:initComponents

private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
response = OK;
if (isDirtyForNewProfile()) {
int optionResponse = JOptionPane.showOptionDialog(
this,
Expand All @@ -921,9 +920,11 @@ private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButto
);
switch (optionResponse) {
case JOptionPane.YES_OPTION:
response = OK;
automaticallyCreateNewProfile = true;
break;
case JOptionPane.NO_OPTION:
response = OK;
automaticallyCreateNewProfile = false;
break;
case JOptionPane.CANCEL_OPTION:
Expand All @@ -943,6 +944,7 @@ private boolean isDirtyForNewProfile() {
}

private void cancelButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
response = CANCEL;
dispose();
}//GEN-LAST:event_cancelButtonActionPerformed

Expand Down
Loading