()
| 131 | } |
| 132 | |
| 133 | public boolean showDialog() { |
| 134 | String title; |
| 135 | String widthUnit, heightUnit; |
| 136 | int width, height; |
| 137 | if (type==TABLE) { |
| 138 | title = "New Table"; |
| 139 | name = "Table"; |
| 140 | width = tableWidth; |
| 141 | height = tableHeight; |
| 142 | widthUnit = "pixels"; |
| 143 | heightUnit = "pixels"; |
| 144 | } else { |
| 145 | title = "New Text Window"; |
| 146 | name = "Untitled"; |
| 147 | width = columns; |
| 148 | height = rows; |
| 149 | widthUnit = "characters"; |
| 150 | heightUnit = "lines"; |
| 151 | } |
| 152 | GenericDialog gd = new GenericDialog(title); |
| 153 | gd.addStringField("Name:", name, 16); |
| 154 | gd.addMessage(""); |
| 155 | gd.addNumericField("Width:", width, 0, 3, widthUnit); |
| 156 | gd.addNumericField("Height:", height, 0, 3, heightUnit); |
| 157 | if (type!=TABLE) { |
| 158 | gd.setInsets(5, 30, 0); |
| 159 | gd.addCheckbox("Menu Bar", true); |
| 160 | gd.setInsets(0, 30, 0); |
| 161 | gd.addCheckbox("Monospaced Font", monospaced); |
| 162 | } |
| 163 | gd.showDialog(); |
| 164 | if (gd.wasCanceled()) |
| 165 | return false; |
| 166 | name = gd.getNextString(); |
| 167 | width = (int)gd.getNextNumber(); |
| 168 | height = (int)gd.getNextNumber(); |
| 169 | if (width<1) width = 1; |
| 170 | if (height<1) height = 1; |
| 171 | if (type!=TABLE) { |
| 172 | menuBar = gd.getNextBoolean(); |
| 173 | monospaced = gd.getNextBoolean(); |
| 174 | columns = width; |
| 175 | rows = height; |
| 176 | if (rows>100) rows = 100; |
| 177 | if (columns>200) columns = 200; |
| 178 | } else { |
| 179 | tableWidth = width; |
| 180 | tableHeight = height; |
| 181 | if (tableWidth<128) tableWidth = 128; |
| 182 | if (tableHeight<75) tableHeight = 75; |
| 183 | } |
| 184 | return true; |
| 185 | } |
| 186 | |
| 187 | /** Returns the Editor the newly created macro or plugin was opened in. */ |
| 188 | public Editor getEditor() { |
no test coverage detected