functionality for exporting current userplatforms as default external tools setting
This commit is contained in:
parent
7f25afcfe4
commit
9be473e4b9
1 changed files with 71 additions and 22 deletions
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ProjectDirectoriesDialog.java,v 1.3 2007/04/11 14:00:27 fros4943 Exp $
|
* $Id: ProjectDirectoriesDialog.java,v 1.4 2007/08/21 14:18:04 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.dialogs;
|
package se.sics.cooja.dialogs;
|
||||||
|
@ -39,6 +39,7 @@ import java.io.IOException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.GUI;
|
||||||
|
@ -160,16 +161,57 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
|
|
||||||
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
|
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||||
|
|
||||||
|
if (fixedProjects == null) {
|
||||||
|
button = new JButton("Set default");
|
||||||
|
button.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
Object[] options = { "Ok", "Cancel" };
|
||||||
|
|
||||||
|
String newDefaultProjectDirs = "";
|
||||||
|
for (String directory : changableProjectsList.getItems()) {
|
||||||
|
if (newDefaultProjectDirs != "") {
|
||||||
|
newDefaultProjectDirs += ";";
|
||||||
|
}
|
||||||
|
|
||||||
|
newDefaultProjectDirs += directory;
|
||||||
|
}
|
||||||
|
newDefaultProjectDirs = newDefaultProjectDirs.replace('\\', '/');
|
||||||
|
|
||||||
|
String question = "External tools setting DEFAULT_PROJECTDIRS will change from:\n"
|
||||||
|
+ GUI.getExternalToolsSetting("DEFAULT_PROJECTDIRS")
|
||||||
|
+ "\n to:\n"
|
||||||
|
+ newDefaultProjectDirs + "\n\nAre you sure?";
|
||||||
|
String title = "Change external tools settings?";
|
||||||
|
int answer = JOptionPane.showOptionDialog(myDialog, question, title,
|
||||||
|
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null,
|
||||||
|
options, options[0]);
|
||||||
|
|
||||||
|
if (answer != JOptionPane.YES_OPTION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.setExternalToolsSetting("DEFAULT_PROJECTDIRS",
|
||||||
|
newDefaultProjectDirs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonPane.add(button);
|
||||||
|
|
||||||
|
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
button = new JButton("OK");
|
button = new JButton("OK");
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changableProjects = new Vector<File>();
|
changableProjects = new Vector<File>();
|
||||||
for (String directory : changableProjectsList.getItems()) {
|
for (String directory : changableProjectsList.getItems()) {
|
||||||
File projectDir = new File(directory);
|
File projectDir = new File(directory);
|
||||||
if (projectDir.exists() && projectDir.isDirectory())
|
if (projectDir.exists() && projectDir.isDirectory()) {
|
||||||
changableProjects.add(projectDir);
|
changableProjects.add(projectDir);
|
||||||
else
|
} else {
|
||||||
logger.fatal("Can't find project directory: " + projectDir);
|
logger.fatal("Can't find project directory: " + projectDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
@ -204,8 +246,9 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
int selectedIndex = changableProjectsList.getSelectedIndex();
|
int selectedIndex = changableProjectsList.getSelectedIndex();
|
||||||
if (selectedIndex <= 0)
|
if (selectedIndex <= 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
File file = new File(changableProjectsList.getItem(selectedIndex));
|
File file = new File(changableProjectsList.getItem(selectedIndex));
|
||||||
|
|
||||||
|
@ -220,10 +263,12 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
int selectedIndex = changableProjectsList.getSelectedIndex();
|
int selectedIndex = changableProjectsList.getSelectedIndex();
|
||||||
if (selectedIndex < 0)
|
if (selectedIndex < 0) {
|
||||||
return;
|
return;
|
||||||
if (selectedIndex >= changableProjectsList.getItemCount() - 1)
|
}
|
||||||
|
if (selectedIndex >= changableProjectsList.getItemCount() - 1) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
File file = new File(changableProjectsList.getItem(selectedIndex));
|
File file = new File(changableProjectsList.getItem(selectedIndex));
|
||||||
removeProjectDir(selectedIndex);
|
removeProjectDir(selectedIndex);
|
||||||
|
@ -238,8 +283,9 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
button = new JButton("Remove");
|
button = new JButton("Remove");
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (changableProjectsList.getSelectedIndex() < 0)
|
if (changableProjectsList.getSelectedIndex() < 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
removeProjectDir(changableProjectsList.getSelectedIndex());
|
removeProjectDir(changableProjectsList.getSelectedIndex());
|
||||||
}
|
}
|
||||||
|
@ -293,10 +339,11 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show merged configuration
|
// Show merged configuration
|
||||||
if (myParentFrame != null)
|
if (myParentFrame != null) {
|
||||||
ConfigViewer.showDialog(myParentFrame, config);
|
ConfigViewer.showDialog(myParentFrame, config);
|
||||||
else
|
} else {
|
||||||
ConfigViewer.showDialog(myParentDialog, config);
|
ConfigViewer.showDialog(myParentDialog, config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addRemovePane.add(button);
|
addRemovePane.add(button);
|
||||||
|
@ -390,8 +437,9 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
JOptionPane.QUESTION_MESSAGE,
|
||||||
null, options, options[1]);
|
null, options, options[1]);
|
||||||
|
|
||||||
if (n == JOptionPane.NO_OPTION)
|
if (n == JOptionPane.NO_OPTION) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
projectConfigFile.createNewFile();
|
projectConfigFile.createNewFile();
|
||||||
|
@ -502,10 +550,11 @@ class ConfigViewer extends JDialog {
|
||||||
String propertyName = allPropertyNames.nextElement();
|
String propertyName = allPropertyNames.nextElement();
|
||||||
|
|
||||||
keyPane.add(new JLabel(propertyName));
|
keyPane.add(new JLabel(propertyName));
|
||||||
if (config.getStringValue(propertyName).equals(""))
|
if (config.getStringValue(propertyName).equals("")) {
|
||||||
valuePane.add(new JLabel(" "));
|
valuePane.add(new JLabel(" "));
|
||||||
else
|
} else {
|
||||||
valuePane.add(new JLabel(config.getStringValue(propertyName)));
|
valuePane.add(new JLabel(config.getStringValue(propertyName)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add components
|
// Add components
|
||||||
|
|
Loading…
Reference in a new issue