X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Factions%2Fstyle%2FAWTStyleDialog.java;h=22a61e2a19fbada135c1849532c07042543181c3;hp=5245089190e8434b118021f2d0f783a39d9eec59;hb=47269fe0acb894f346810417d950a1ab59cdc0ea;hpb=11309f6516278203264b680235cbbe1dc2bde98e diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java index 524508919..22a61e2a1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/AWTStyleDialog.java @@ -16,6 +16,7 @@ import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JTabbedPane; +import org.eclipse.jface.dialogs.IDialogConstants; import org.simantics.utils.strings.format.MetricsFormat; public class AWTStyleDialog extends JDialog { @@ -33,7 +34,7 @@ public class AWTStyleDialog extends JDialog { private boolean useFormat = true; public AWTStyleDialog(Frame owner,boolean useFont, boolean useColor, boolean useFormat) { - super(owner,"Style",true); + super(owner,Messages.AWTStyleDialog_Style,true); this.useFont = useFont; this.useColor = useColor; this.useFormat = useFormat; @@ -42,7 +43,7 @@ public class AWTStyleDialog extends JDialog { public AWTStyleDialog(boolean useFont, boolean useColor, boolean useFormat) { super(); - setTitle("Style"); + setTitle(Messages.AWTStyleDialog_Style); setModal(true); this.useFont = useFont; this.useColor = useColor; @@ -52,41 +53,42 @@ public class AWTStyleDialog extends JDialog { public void setStartFont(Font font) { if (!useFont) - throw new RuntimeException("Dialog is not configured with font support"); + throw new RuntimeException("Dialog is not configured with font support"); //$NON-NLS-1$ fontChooser.setCurrentFont(font); } public void setStartColor(Color color) { if (!useColor) - throw new RuntimeException("Dialog is not configured with color support"); + throw new RuntimeException("Dialog is not configured with color support"); //$NON-NLS-1$ colorChooser.setColor(color); } public void setStartFormat(MetricsFormat format) { if (!useFormat) - throw new RuntimeException("Dialog is not configured with format support"); + throw new RuntimeException("Dialog is not configured with format support"); //$NON-NLS-1$ metricsEditor.setMetricsFormat(format); } private void createContents() { - + JTabbedPane tabbedPane = new JTabbedPane(); - getContentPane().add(tabbedPane,BorderLayout.CENTER); + getContentPane().add(tabbedPane, BorderLayout.CENTER); if (useFont) - tabbedPane.addTab("Font", fontChooser = new FontChooser("Sample text")); + tabbedPane.addTab(Messages.AWTStyleDialog_Font, + fontChooser = new FontChooser(Messages.AWTStyleDialog_SampleText)); if (useColor) - tabbedPane.addTab("Color",colorChooser = new JColorChooser(new Color(0, 0, 0))); + tabbedPane.addTab(Messages.AWTStyleDialog_Color, colorChooser = new JColorChooser(new Color(0, 0, 0))); if (useFormat) - tabbedPane.addTab("Metrics",metricsEditor = new MetricsEditor()); - + tabbedPane.addTab(Messages.AWTStyleDialog_Metrics, metricsEditor = new MetricsEditor()); + JPanel controlPanel = new JPanel(); - getContentPane().add(controlPanel,BorderLayout.SOUTH); + getContentPane().add(controlPanel, BorderLayout.SOUTH); controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - - JButton okButton = new JButton("OK"); + + JButton okButton = new JButton(IDialogConstants.OK_LABEL); controlPanel.add(okButton); okButton.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { cancelled = false; @@ -94,42 +96,41 @@ public class AWTStyleDialog extends JDialog { AWTStyleDialog.this.dispose(); } }); - - JButton cancelButton = new JButton("Cancel"); + + JButton cancelButton = new JButton(IDialogConstants.CANCEL_LABEL); controlPanel.add(cancelButton); cancelButton.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent e) { AWTStyleDialog.this.setVisible(false); AWTStyleDialog.this.dispose(); } }); - - + this.addWindowListener(new WindowListener() { - + @Override public void windowOpened(WindowEvent arg0) {} - + @Override public void windowIconified(WindowEvent arg0) {} - + @Override public void windowDeiconified(WindowEvent arg0) {} - + @Override public void windowDeactivated(WindowEvent arg0) {} - + @Override public void windowClosing(WindowEvent arg0) { if (metricsEditor != null) metricsEditor.dispose(); } - + @Override public void windowClosed(WindowEvent arg0) {} - + @Override public void windowActivated(WindowEvent arg0) {} });