Skip to content

Commit

Permalink
Prepared fix for issue #429.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Apr 13, 2017
1 parent 41ecb7d commit 46972f5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/org/nschmidt/ldparteditor/dialogs/edger2/EdgerDesign.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

import java.math.BigDecimal;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
Expand All @@ -30,6 +30,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
import org.eclipse.swt.widgets.Shell;
import org.nschmidt.ldparteditor.helpers.composite3d.Edger2Settings;
import org.nschmidt.ldparteditor.i18n.I18n;
import org.nschmidt.ldparteditor.logger.NLogger;
import org.nschmidt.ldparteditor.widgets.BigDecimalSpinner;

/**
Expand All @@ -41,7 +42,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
* @author nils
*
*/
class EdgerDesign extends Dialog {
class EdgerDesign extends TrayDialog {

final Edger2Settings es;

Expand Down Expand Up @@ -98,7 +99,7 @@ protected Control createDialogArea(Composite parent) {
cmb_b.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
cmb_b.setText(es.isExtendedRange() ? cmb_b.getItem(1) : cmb_b.getItem(0));
cmb_b.select(es.isExtendedRange() ? 1 : 0);

Combo cmb_c = new Combo(cmp_container, SWT.READ_ONLY);
this.cmb_c[0] = cmb_c;
cmb_c.setItems(new String[] { I18n.EDGER_CondlineOnQuadOff, I18n.EDGER_CondlineOnQuadOn });
Expand Down Expand Up @@ -172,6 +173,9 @@ protected Control createDialogArea(Composite parent) {
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, I18n.DIALOG_OK, true);
createButton(parent, IDialogConstants.CANCEL_ID, I18n.DIALOG_Cancel, false);
if (NLogger.DEBUG) {
createHelpControl(parent);
}
}

/**
Expand Down
27 changes: 27 additions & 0 deletions src/org/nschmidt/ldparteditor/dialogs/edger2/EdgerDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package org.nschmidt.ldparteditor.dialogs.edger2;

import org.eclipse.jface.dialogs.DialogTray;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.HelpEvent;
import org.eclipse.swt.events.HelpListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.nschmidt.ldparteditor.helpers.composite3d.Edger2Settings;
import org.nschmidt.ldparteditor.logger.NLogger;
import org.nschmidt.ldparteditor.widgets.BigDecimalSpinner;
import org.nschmidt.ldparteditor.widgets.ValueChangeAdapter;

Expand Down Expand Up @@ -49,6 +56,26 @@ public EdgerDialog(Shell parentShell, Edger2Settings es) {
public int open() {
super.create();

if (NLogger.DEBUG) {
getShell().addHelpListener(new HelpListener() {
@Override
public void helpRequested(HelpEvent e) {
try {
closeTray();
} catch (IllegalStateException ise) {
openTray(new DialogTray() {
@Override
protected Control createContents(Composite parent) {
Browser br = new Browser(parent, SWT.NONE);
return br;
}

});
}
}
});
}

// MARK All final listeners will be configured here..
spn_ac[0].addValueChangeListener(new ValueChangeAdapter() {
@Override
Expand Down

0 comments on commit 46972f5

Please sign in to comment.