Search in sources :

Example 6 with Credentials

use of org.knime.core.node.workflow.Credentials in project knime-core by knime.

the class CredentialVariableTable method createViewer.

private TableViewer createViewer(final Composite parent) {
    TableViewer viewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    TableViewerColumn nameCol = new TableViewerColumn(viewer, SWT.NONE);
    nameCol.getColumn().setText(VAR_NAME);
    nameCol.getColumn().setWidth(100);
    TableViewerColumn loginCol = new TableViewerColumn(viewer, SWT.NONE);
    loginCol.getColumn().setText(VAR_LOGIN);
    loginCol.getColumn().setWidth(100);
    TableViewerColumn typeCol = new TableViewerColumn(viewer, SWT.NONE);
    typeCol.getColumn().setText(VAR_PASSWORD);
    typeCol.getColumn().setWidth(100);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);
    viewer.setContentProvider(new IStructuredContentProvider() {

        @Override
        public Object[] getElements(final Object arg) {
            return ((List<Credentials>) arg).toArray();
        }

        @Override
        public void dispose() {
        // do nothing -> images are static
        }

        @Override
        public void inputChanged(final Viewer arg0, final Object arg1, final Object arg2) {
        // do nothing
        }
    });
    viewer.setLabelProvider(new WorkflowVariableLabelProvider());
    viewer.setInput(m_params);
    return viewer;
}
Also used : IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) Credentials(org.knime.core.node.workflow.Credentials)

Example 7 with Credentials

use of org.knime.core.node.workflow.Credentials in project knime-core by knime.

the class CredentialVariablesEditDialog method okPressed.

/**
 * {@inheritDoc}
 */
@Override
protected void okPressed() {
    String varName = m_name.getText().trim();
    if (varName.isEmpty()) {
        String msg = "Credential identifier must not be empty!";
        showError(msg);
        throw new OperationCanceledException(msg);
    }
    String name = m_name.getText();
    String login = m_login.getText();
    String pass = m_pass.getText();
    m_credential = new Credentials(name, login, pass);
    super.okPressed();
}
Also used : OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) Credentials(org.knime.core.node.workflow.Credentials)

Aggregations

Credentials (org.knime.core.node.workflow.Credentials)7 List (java.util.List)2 Display (org.eclipse.swt.widgets.Display)2 CredentialVariablesDialog (org.knime.workbench.ui.masterkey.CredentialVariablesDialog)2 File (java.io.File)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 StringUtils (org.apache.commons.lang3.StringUtils)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 IDialogConstants (org.eclipse.jface.dialogs.IDialogConstants)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 MessageDialogWithToggle (org.eclipse.jface.dialogs.MessageDialogWithToggle)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1