package name.abuchen.portfolio.ui.preferences;

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Link;

import name.abuchen.portfolio.ui.UIConstants;
import name.abuchen.portfolio.ui.util.DesktopAPI;

public class PortfolioReportPreferencePage extends FieldEditorPreferencePage
{

    public PortfolioReportPreferencePage()
    {
        super(GRID);

        setTitle("Portfolio Report");
        setDescription("Sync data with server portfolio");
    }

    @Override
    public void createFieldEditors()
    {
        Link link = new Link(getFieldEditorParent(), SWT.NONE);
        link.setText("<a>https://api.portfolio-report.net/doc/</a>"); //$NON-NLS-1$
        link.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 3, 1));
        link.addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetSelected(final SelectionEvent event)
            {
                DesktopAPI.browse("https://api.portfolio-report.net/doc/"); //$NON-NLS-1$
            }
        });

        addField(new StringFieldEditor(UIConstants.Preferences.PORTFOLIO_REPORT_API_KEY, //
                        "Portfolio Report Session Token", getFieldEditorParent()));
    }
}

@@ -1204,33 +1204,33 @@
 owse(%22https://ap
-i
+p
 .portfolio-repor
@@ -1235,20 +1235,16 @@
 ort.net/
-doc/
 %22); //$N
@@ -1426,13 +1426,11 @@
 ion 
-Token
+Key
 %22, g

Change URL of Portfolio Report in PortfolioReportPreferencePage