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 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 Common Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/cpl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * ******************************************************************/
  13. package org.aspectj.tools.ajbrowser;
  14. import java.io.*;
  15. import javax.swing.*;
  16. import java.awt.*;
  17. import javax.swing.border.*;
  18. import org.aspectj.ajde.ui.swing.*;
  19. /**
  20. * @author Mik Kersten
  21. */
  22. public class BrowserOptionsPanel extends OptionsPanel {
  23. private JPanel runOptions_panel = new JPanel();
  24. private JPanel build_panel = new JPanel();
  25. private FlowLayout flowLayout1 = new FlowLayout();
  26. private JTextField classToRun_field = new JTextField();
  27. private JLabel jLabel4 = new JLabel();
  28. private BorderLayout borderLayout4 = new BorderLayout();
  29. private JPanel buildPaths_panel = new JPanel();
  30. private Box compileOptions_box2 = Box.createVerticalBox();
  31. private JTextField classpath_field = new JTextField();
  32. private JTextField outputPath_field = new JTextField();
  33. private JLabel jLabel16 = new JLabel();
  34. private JLabel jLabel15 = new JLabel();
  35. private Box compileOptions_box3 = Box.createVerticalBox();
  36. private BorderLayout borderLayout1 = new BorderLayout();
  37. private Border border1;
  38. private TitledBorder titledBorder1;
  39. private Border border2;
  40. private Border border3;
  41. private TitledBorder titledBorder2;
  42. private Border border4;
  43. public BrowserOptionsPanel() {
  44. try {
  45. jbInit();
  46. this.setName("AJBrowser Options");
  47. } catch (Exception e) {
  48. e.printStackTrace();
  49. }
  50. }
  51. public void loadOptions() throws IOException {
  52. outputPath_field.setText(
  53. BrowserManager.getDefault().getBrowserProjectProperties().getOutputPath()
  54. );
  55. classpath_field.setText(
  56. BrowserManager.getDefault().getBrowserProjectProperties().getClasspath()
  57. );
  58. classToRun_field.setText(
  59. BrowserManager.getDefault().getBrowserProjectProperties().getClassToExecute()
  60. );
  61. }
  62. public void saveOptions() throws IOException {
  63. BrowserManager.getDefault().getBrowserProjectProperties().setOutputPath(
  64. outputPath_field.getText()
  65. );
  66. BrowserManager.getDefault().getBrowserProjectProperties().setClasspath(
  67. classpath_field.getText()
  68. );
  69. BrowserManager.getDefault().getBrowserProjectProperties().setClassToExecute(
  70. classToRun_field.getText()
  71. );
  72. }
  73. private void jbInit() throws Exception {
  74. border1 =
  75. BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
  76. titledBorder1 = new TitledBorder(border1, "ajc Build Paths");
  77. border2 =
  78. BorderFactory.createCompoundBorder(
  79. titledBorder1,
  80. BorderFactory.createEmptyBorder(5, 5, 5, 5));
  81. border3 =
  82. BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
  83. titledBorder2 = new TitledBorder(border3, "Run Options");
  84. border4 =
  85. BorderFactory.createCompoundBorder(
  86. titledBorder2,
  87. BorderFactory.createEmptyBorder(5, 5, 5, 5));
  88. this.setLayout(borderLayout1);
  89. build_panel.setLayout(borderLayout4);
  90. classToRun_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  91. classToRun_field.setMinimumSize(new Dimension(200, 21));
  92. classToRun_field.setPreferredSize(new Dimension(250, 21));
  93. jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));
  94. jLabel4.setText("Fully qualified name for main class to run: ");
  95. buildPaths_panel.setLayout(flowLayout1);
  96. runOptions_panel.setBorder(border4);
  97. buildPaths_panel.setBorder(border2);
  98. classpath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  99. classpath_field.setMinimumSize(new Dimension(100, 21));
  100. classpath_field.setPreferredSize(new Dimension(150, 21));
  101. outputPath_field.setPreferredSize(new Dimension(225, 21));
  102. outputPath_field.setMinimumSize(new Dimension(100, 21));
  103. outputPath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
  104. jLabel16.setText("Classpath (defaults to current directory): ");
  105. jLabel16.setPreferredSize(new Dimension(200, 25));
  106. jLabel16.setMaximumSize(new Dimension(400, 25));
  107. jLabel16.setFont(new java.awt.Font("Dialog", 0, 11));
  108. jLabel15.setMaximumSize(new Dimension(400, 25));
  109. jLabel15.setFont(new java.awt.Font("Dialog", 0, 11));
  110. jLabel15.setPreferredSize(new Dimension(230, 25));
  111. jLabel15.setText("Output path (defaults to current directory): ");
  112. titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11));
  113. titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11));
  114. runOptions_panel.add(jLabel4, null);
  115. runOptions_panel.add(classToRun_field, null);
  116. build_panel.add(buildPaths_panel, BorderLayout.CENTER);
  117. build_panel.add(runOptions_panel, BorderLayout.SOUTH);
  118. compileOptions_box2.add(outputPath_field, null);
  119. compileOptions_box2.add(classpath_field, null);
  120. compileOptions_box3.add(jLabel15, null);
  121. compileOptions_box3.add(jLabel16, null);
  122. buildPaths_panel.add(compileOptions_box3, null);
  123. buildPaths_panel.add(compileOptions_box2, null);
  124. this.add(build_panel, BorderLayout.NORTH);
  125. }
  126. }