revert button for doi element because it produces NPE
authorKatja Luther <k.luther@bgbm.org>
Wed, 27 May 2020 20:16:03 +0000 (22:16 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 27 May 2020 20:16:51 +0000 (22:16 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DoiWithLabelElement.java

index 7a2c027bb2b1b1d09b12e371fe4c684bc9a53cb1..a21d13ae9d882663b772c62dbd3da104f2f58c08 100755 (executable)
@@ -8,15 +8,8 @@
 */
 package eu.etaxonomy.taxeditor.ui.element;
 
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
@@ -24,10 +17,6 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 import eu.etaxonomy.cdm.common.DOI;
 import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
 
 /**
  * @author k.luther
@@ -83,36 +72,36 @@ public class DoiWithLabelElement extends AbstractUriWithExceptionLabelElement<DO
         //uri text
         initText(formFactory, null, textHeight, null, false, style, getLayoutComposite());
 
-        Composite textAndButton = formFactory.createComposite(getLayoutComposite(), style);
-        addControl(textAndButton);
-        textAndButton.setLayout(LayoutConstants.LAYOUT(2, false));
-        textAndButton.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
-      //button
-        btnOpenBrowser = formFactory.createButton(textAndButton, "", SWT.NONE); //$NON-NLS-1$
-        btnOpenBrowser.setImage(ImageResources.getImage(ImageResources.WEB));
-        btnOpenBrowser.setToolTipText(Messages.UriWithLabelElement_OPEN_EXTERNAL_BROWSER);
-        btnOpenBrowser.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                String errorTitle = Messages.UriWithLabelElement_INVALID_URL;
-                String errorText = Messages.UriWithLabelElement_COULD_NOT_OPEN_BROWSER;
-
-                DOI doi= parseText();
-                if(doi!=null){
-                    try {
-                        WorkbenchUtility.openWebpage(new URL(doi.asURI()));
-                    } catch (IOException pie) {
-                        MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, pie));
-                    } catch (IllegalArgumentException iae) {
-                        MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, iae));
-                    }
-                }
-                else{
-                    MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, null));
-                }
-            }
-        });
-        btnOpenBrowser.setLayoutData(LayoutConstants.RIGHT());
+//        Composite textAndButton = formFactory.createComposite(getLayoutComposite(), style);
+//        addControl(textAndButton);
+//        textAndButton.setLayout(LayoutConstants.LAYOUT(2, false));
+//        textAndButton.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+//      //button
+//        btnOpenBrowser = formFactory.createButton(textAndButton, "", SWT.NONE); //$NON-NLS-1$
+//        btnOpenBrowser.setImage(ImageResources.getImage(ImageResources.WEB));
+//        btnOpenBrowser.setToolTipText(Messages.UriWithLabelElement_OPEN_EXTERNAL_BROWSER);
+//        btnOpenBrowser.addSelectionListener(new SelectionAdapter() {
+//            @Override
+//            public void widgetSelected(SelectionEvent e) {
+//                String errorTitle = Messages.UriWithLabelElement_INVALID_URL;
+//                String errorText = Messages.UriWithLabelElement_COULD_NOT_OPEN_BROWSER;
+//
+//                DOI doi= parseText();
+//                if(doi!=null){
+//                    try {
+//                        WorkbenchUtility.openWebpage(new URL(doi.asURI()));
+//                    } catch (IOException pie) {
+//                        MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, pie));
+//                    } catch (IllegalArgumentException iae) {
+//                        MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, iae));
+//                    }
+//                }
+//                else{
+//                    MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, null));
+//                }
+//            }
+//        });
+//        btnOpenBrowser.setLayoutData(LayoutConstants.RIGHT());
         initExceptionLabel(getLayoutComposite(), formFactory, initialObject);
     }