You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BrowserOptionsPanel.java 6.7KB

21 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
17 years ago
21 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* *******************************************************************
  2. * Copyright (c) 1999-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v 2.0
  7. * which accompanies this distribution and is available at
  8. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * Helen Hawkins Converted to new interface (bug 148190)
  13. * ******************************************************************/
  14. package org.aspectj.tools.ajbrowser.ui.swing;
  15. import java.io.*;
  16. import javax.swing.*;
  17. import java.awt.*;
  18. import javax.swing.border.*;
  19. import org.aspectj.ajde.ui.swing.*;
  20. import org.aspectj.tools.ajbrowser.BrowserManager;
  21. import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants;
  22. /**
  23. * Panel the displays both ajc and runtime options
  24. *
  25. * @author Mik Kersten
  26. */
  27. public class BrowserOptionsPanel extends OptionsPanel {
  28. private static final long serialVersionUID = 4491319302490183151L;
  29. private JPanel runOptions_panel = new JPanel();
  30. private JPanel build_panel = new JPanel();
  31. private FlowLayout flowLayout1 = new FlowLayout();
  32. private JTextField classToRun_field = new JTextField();
  33. private JLabel jLabel4 = new JLabel();
  34. private BorderLayout borderLayout4 = new BorderLayout();
  35. private JPanel buildPaths_panel = new JPanel();
  36. private Box compileOptions_box2 = Box.createVerticalBox();
  37. private JTextField classpath_field = new JTextField();
  38. private JTextField outputPath_field = new JTextField();
  39. private JTextField nonStandardOptions_field = new JTextField();
  40. private JLabel jLabel16 = new JLabel();
  41. private JLabel jLabel15 = new JLabel();
  42. private JLabel nonStandardOptions_label = new JLabel();
  43. private Box compileOptions_box3 = Box.createVerticalBox();
  44. private BorderLayout borderLayout1 = new BorderLayout();
  45. private Border border1;
  46. private TitledBorder titledBorder1;
  47. private Border border2;
  48. private Border border3;
  49. private TitledBorder titledBorder2;
  50. private Border border4;
  51. public BrowserOptionsPanel() {
  52. try {
  53. jbInit();
  54. this.setName("AJBrowser Options");
  55. } catch (Exception e) {
  56. e.printStackTrace();
  57. }
  58. }
  59. public void loadOptions() throws IOException {
  60. outputPath_field.setText(
  61. BrowserManager.getDefault().getPreferencesAdapter().
  62. getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH)
  63. );
  64. nonStandardOptions_field.setText(
  65. BrowserManager.getDefault().getPreferencesAdapter().
  66. getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS)
  67. );
  68. classpath_field.setText(
  69. BrowserManager.getDefault().getPreferencesAdapter().
  70. getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH)
  71. );
  72. classToRun_field.setText(
  73. BrowserManager.getDefault().getPreferencesAdapter().
  74. getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS)
  75. );
  76. }
  77. public void saveOptions() throws IOException {
  78. BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
  79. PreferenceStoreConstants.BUILD_OUTPUTPATH, outputPath_field.getText());
  80. BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
  81. PreferenceStoreConstants.NONSTANDARD_OPTIONS, nonStandardOptions_field.getText());
  82. BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
  83. PreferenceStoreConstants.BUILD_CLASSPATH, classpath_field.getText());
  84. BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
  85. PreferenceStoreConstants.RUNTIME_MAINCLASS, classToRun_field.getText());
  86. }
  87. private void jbInit() throws Exception {
  88. border1 =
  89. BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
  90. titledBorder1 = new TitledBorder(border1, "Ajc Options");
  91. border2 =
  92. BorderFactory.createCompoundBorder(
  93. titledBorder1,
  94. BorderFactory.createEmptyBorder(5, 5, 5, 5));
  95. border3 =
  96. BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
  97. titledBorder2 = new TitledBorder(border3, "Run Options");
  98. border4 =
  99. BorderFactory.createCompoundBorder(
  100. titledBorder2,
  101. BorderFactory.createEmptyBorder(5, 5, 5, 5));
  102. this.setLayout(borderLayout1);
  103. build_panel.setLayout(borderLayout4);
  104. classToRun_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  105. classToRun_field.setMinimumSize(new Dimension(200, 21));
  106. classToRun_field.setPreferredSize(new Dimension(250, 21));
  107. jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));
  108. jLabel4.setText("Fully qualified name for main class to run: ");
  109. buildPaths_panel.setLayout(flowLayout1);
  110. runOptions_panel.setBorder(border4);
  111. buildPaths_panel.setBorder(border2);
  112. classpath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  113. classpath_field.setMinimumSize(new Dimension(100, 21));
  114. classpath_field.setPreferredSize(new Dimension(150, 21));
  115. outputPath_field.setPreferredSize(new Dimension(225, 21));
  116. outputPath_field.setMinimumSize(new Dimension(100, 21));
  117. outputPath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  118. nonStandardOptions_field.setPreferredSize(new Dimension(225, 21));
  119. nonStandardOptions_field.setMinimumSize(new Dimension(100, 21));
  120. nonStandardOptions_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  121. jLabel16.setText("Classpath (defaults to current directory): ");
  122. jLabel16.setPreferredSize(new Dimension(200, 25));
  123. jLabel16.setMaximumSize(new Dimension(400, 25));
  124. jLabel16.setFont(new java.awt.Font("Dialog", 0, 11));
  125. jLabel15.setMaximumSize(new Dimension(400, 25));
  126. jLabel15.setFont(new java.awt.Font("Dialog", 0, 11));
  127. jLabel15.setPreferredSize(new Dimension(230, 25));
  128. jLabel15.setText("Output path (defaults to current directory): ");
  129. nonStandardOptions_label.setMaximumSize(new Dimension(400, 25));
  130. nonStandardOptions_label.setFont(new java.awt.Font("Dialog", 0, 11));
  131. nonStandardOptions_label.setPreferredSize(new Dimension(230, 25));
  132. nonStandardOptions_label.setText("Non-standard compiler options: ");
  133. titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11));
  134. titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11));
  135. runOptions_panel.add(jLabel4, null);
  136. runOptions_panel.add(classToRun_field, null);
  137. build_panel.add(buildPaths_panel, BorderLayout.CENTER);
  138. build_panel.add(runOptions_panel, BorderLayout.SOUTH);
  139. compileOptions_box2.add(outputPath_field, null);
  140. compileOptions_box2.add(nonStandardOptions_field, null);
  141. compileOptions_box2.add(classpath_field, null);
  142. compileOptions_box3.add(jLabel15, null);
  143. compileOptions_box3.add(nonStandardOptions_label, null);
  144. compileOptions_box3.add(jLabel16, null);
  145. buildPaths_panel.add(compileOptions_box3, null);
  146. buildPaths_panel.add(compileOptions_box2, null);
  147. this.add(build_panel, BorderLayout.NORTH);
  148. }
  149. }