Skip to content
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 @@ -151,7 +151,7 @@ protected void configure() {
makeCloseableOnEscape();

view.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
view.setModal(true);
view.setModalityType(Dialog.ModalityType.MODELESS);
}

protected void registerPanel(final String name, final CayenneController panelController) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
Expand All @@ -37,7 +37,7 @@ public class FileTemplateSaver {

private static final Logger logger = LoggerFactory.getLogger(FileTemplateSaver.class);

public void save(String templateText, File dest, JDialog view) {
public void save(String templateText, File dest, JFrame view) {
try {
Files.write(dest.toPath(), templateText.getBytes());
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.StringResourceLoader;

import java.io.StringWriter;
import java.io.Writer;
import java.util.Properties;

Expand All @@ -34,7 +35,7 @@
*/
public class PreviewGenerationAction extends ClassGenerationAction {

private Writer writer;
private StringWriter writer;

public PreviewGenerationAction(CgenConfiguration cgenConfig) {
super(cgenConfig);
Expand All @@ -45,12 +46,14 @@ protected void validateAttributes() {
//Mock
}

public void setWriter(Writer writer) {
public void setWriter(StringWriter writer) {
this.writer = writer;
}

@Override
protected Writer openWriter(TemplateType templateType) {
// clear and return
writer.getBuffer().setLength(0);
return writer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,8 @@ public TemplateEditorController(TemplatePreferences preferences) {
}

public void startupAction() {
this.view.setModal(true);
this.view.getEditingTemplatePane().setText(loadSelectedTemplateText());
this.view.editingTemplatePane.setCaretPosition(0);
this.view.pack();
makeCloseableOnEscape();
centerView();
this.view.setVisible(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JToolBar;
Expand All @@ -45,7 +45,7 @@
/**
* since 4.3
*/
public class TemplateEditorView extends JDialog {
public class TemplateEditorView extends JFrame {

protected RSyntaxTextArea editingTemplatePane;
protected RSyntaxTextArea classPreviewPane;
Expand All @@ -61,7 +61,7 @@ public class TemplateEditorView extends JDialog {
static final String VELOCITY_KEY = "text/velocity";


public TemplateEditorView( List<String> entityNames) {
public TemplateEditorView(List<String> entityNames) {
this.setTitle("Template editor");
this.editingTemplatePane = new TextEditorPane();
this.classPreviewPane = new RSyntaxTextArea();
Expand Down