Search in sources :

Example 81 with DirectoryDialog

use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.

the class ContainerDataVolumeDialog method onHostDirectoryPath.

private SelectionListener onHostDirectoryPath() {
    return SelectionListener.widgetSelectedAdapter(e -> {
        final DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
        final String selectedPath = directoryDialog.open();
        if (selectedPath != null) {
            model.setHostPathMount(selectedPath);
        }
    });
}
Also used : DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 82 with DirectoryDialog

use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.

the class EditDockerConnectionPage method onBrowseTcpCertPath.

private SelectionListener onBrowseTcpCertPath() {
    return SelectionListener.widgetSelectedAdapter(e -> {
        final DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
        directoryDialog.setFilterPath(model.getTcpCertPath());
        final String selectedPath = directoryDialog.open();
        if (selectedPath != null) {
            model.setTcpCertPath(selectedPath);
        }
    });
}
Also used : DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 83 with DirectoryDialog

use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.

the class ImageBuildPage method createControl.

@Override
public void createControl(Composite parent) {
    final Composite container = new Composite(parent, SWT.NULL);
    FormLayout layout = new FormLayout();
    layout.marginHeight = 5;
    layout.marginWidth = 5;
    container.setLayout(layout);
    Label label = new Label(container, SWT.NULL);
    Label nameLabel = new Label(container, SWT.NULL);
    nameLabel.setText(WizardMessages.getString(NAME_LABEL));
    nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
    nameText.addModifyListener(Listener);
    nameText.setToolTipText(WizardMessages.getString(NAME_TOOLTIP));
    Label dirLabel = new Label(container, SWT.NULL);
    dirLabel.setText(WizardMessages.getString(DIRECTORY_LABEL));
    directoryText = new Text(container, SWT.BORDER | SWT.SINGLE);
    directoryText.addModifyListener(Listener);
    directoryText.setToolTipText(WizardMessages.getString(DIRECTORY_TOOLTIP));
    Button browse = new Button(container, SWT.NULL);
    browse.setText(WizardMessages.getString(BROWSE_LABEL));
    browse.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        DirectoryDialog d = new DirectoryDialog(container.getShell());
        String k = d.open();
        if (k != null)
            directoryText.setText(k);
    }));
    editButton = new Button(container, SWT.NULL);
    editButton.setText(WizardMessages.getString(EDIT_LABEL));
    editButton.setEnabled(false);
    editButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        String dir = directoryText.getText();
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(// $NON-NLS-1$
        new Path(dir).append("Dockerfile"));
        // $NON-NLS-1$
        java.nio.file.Path filePath = Paths.get(dir, "Dockerfile");
        if (!Files.exists(filePath)) {
            try {
                Files.createFile(filePath);
            } catch (IOException e1) {
            // File won't exist, and directory should be
            // writable
            }
        }
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        try {
            IEditorPart dockerFileEditor = IDE.openEditorOnFileStore(page, fileStore);
            IWorkbenchPartSite site = page.getActivePart().getSite();
            EModelService s = site.getService(EModelService.class);
            MPartSashContainerElement p = site.getService(MPart.class);
            s.detach(p, 100, 100, 500, 375);
            dockerFileEditor.getEditorSite().getShell().setText(WizardMessages.getString(// $NON-NLS-1$
            "ImageBuild.editor.name"));
            editors.add(dockerFileEditor);
        } catch (PartInitException e1) {
            Activator.log(e1);
        }
        validate();
    }));
    Point p1 = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Point p2 = directoryText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Point p3 = browse.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    int centering = (p2.y - p1.y + 1) / 2;
    int centering2 = (p3.y - p2.y + 1) / 2;
    FormData f = new FormData();
    f.top = new FormAttachment(0);
    label.setLayoutData(f);
    f = new FormData();
    f.top = new FormAttachment(label, 11 + centering + centering2);
    f.left = new FormAttachment(0, 0);
    nameLabel.setLayoutData(f);
    f = new FormData();
    f.top = new FormAttachment(label, 11 + centering2);
    f.left = new FormAttachment(nameLabel, 5);
    f.right = new FormAttachment(browse, -10);
    nameText.setLayoutData(f);
    f = new FormData();
    f.top = new FormAttachment(nameLabel, 11 + centering + centering2);
    f.left = new FormAttachment(0, 0);
    dirLabel.setLayoutData(f);
    f = new FormData();
    f.top = new FormAttachment(nameLabel, 11);
    f.right = new FormAttachment(100);
    editButton.setLayoutData(f);
    f = new FormData();
    f.top = new FormAttachment(nameLabel, 11);
    f.right = new FormAttachment(editButton, -10);
    browse.setLayoutData(f);
    f = new FormData();
    f.top = new FormAttachment(nameLabel, 11 + centering2);
    f.left = new FormAttachment(nameLabel, 5);
    f.right = new FormAttachment(browse, -10);
    directoryText.setLayoutData(f);
    if (lastDirectoryPath != null) {
        directoryText.setText(lastDirectoryPath);
    }
    setControl(container);
    setPageComplete(false);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) IDE(org.eclipse.ui.ide.IDE) IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) Activator(org.eclipse.linuxtools.docker.ui.Activator) Point(org.eclipse.swt.graphics.Point) HashSet(java.util.HashSet) IMessageProvider(org.eclipse.jface.dialogs.IMessageProvider) MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) Composite(org.eclipse.swt.widgets.Composite) PartInitException(org.eclipse.ui.PartInitException) WizardPage(org.eclipse.jface.wizard.WizardPage) EFS(org.eclipse.core.filesystem.EFS) IEditorPart(org.eclipse.ui.IEditorPart) IFileStore(org.eclipse.core.filesystem.IFileStore) Text(org.eclipse.swt.widgets.Text) Button(org.eclipse.swt.widgets.Button) Files(java.nio.file.Files) FormLayout(org.eclipse.swt.layout.FormLayout) PlatformUI(org.eclipse.ui.PlatformUI) IFileInfo(org.eclipse.core.filesystem.IFileInfo) FormData(org.eclipse.swt.layout.FormData) MPartSashContainerElement(org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement) Set(java.util.Set) IOException(java.io.IOException) FormAttachment(org.eclipse.swt.layout.FormAttachment) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) SWTImagesFactory(org.eclipse.linuxtools.internal.docker.ui.SWTImagesFactory) Paths(java.nio.file.Paths) ModifyListener(org.eclipse.swt.events.ModifyListener) Path(org.eclipse.core.runtime.Path) SWT(org.eclipse.swt.SWT) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener) Path(org.eclipse.core.runtime.Path) FormData(org.eclipse.swt.layout.FormData) MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) Composite(org.eclipse.swt.widgets.Composite) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) IOException(java.io.IOException) IEditorPart(org.eclipse.ui.IEditorPart) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) Button(org.eclipse.swt.widgets.Button) MPartSashContainerElement(org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement) IFileStore(org.eclipse.core.filesystem.IFileStore) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) FormAttachment(org.eclipse.swt.layout.FormAttachment) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 84 with DirectoryDialog

use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.

the class LocalResourceSelectorProxy method selectDirectory.

@Override
public URI selectDirectory(String scheme, String initialPath, String prompt, Shell shell) {
    DirectoryDialog dialog = new DirectoryDialog(shell, SWT.SHEET);
    dialog.setText(prompt);
    dialog.setFilterPath(initialPath);
    try {
        String path = dialog.open();
        if (path != null)
            return new URI(path);
        else
            return null;
    } catch (URISyntaxException e) {
        return null;
    }
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 85 with DirectoryDialog

use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.

the class ValgrindExportWizardPage method createDestinationGroup.

private void createDestinationGroup(Composite top) {
    Group destGroup = new Group(top, SWT.SHADOW_OUT);
    // $NON-NLS-1$
    destGroup.setText(Messages.getString("ValgrindExportWizardPage.Destination_group"));
    destGroup.setLayout(new GridLayout(2, false));
    destGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    destText = new Text(destGroup, SWT.BORDER);
    destText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    destText.addModifyListener(e -> setPageComplete(isValid()));
    Button browseButton = new Button(destGroup, SWT.PUSH);
    // $NON-NLS-1$
    browseButton.setText(Messages.getString("ValgrindExportWizardPage.Browse"));
    browseButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        // Prompt for output directory
        Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        DirectoryDialog dialog = new DirectoryDialog(parent);
        // $NON-NLS-1$
        dialog.setText(Messages.getString("ValgrindLaunchConfigurationDelegate.Select_Destination"));
        String strpath = dialog.open();
        if (strpath != null) {
            destText.setText(strpath);
        }
    }));
}
Also used : CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) Image(org.eclipse.swt.graphics.Image) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IPath(org.eclipse.core.runtime.IPath) Composite(org.eclipse.swt.widgets.Composite) WizardPage(org.eclipse.jface.wizard.WizardPage) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) NLS(org.eclipse.osgi.util.NLS) PlatformUI(org.eclipse.ui.PlatformUI) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) Group(org.eclipse.swt.widgets.Group) File(java.io.File) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) ISharedImages(org.eclipse.ui.ISharedImages) FileFilter(java.io.FileFilter) Path(org.eclipse.core.runtime.Path) SWT(org.eclipse.swt.SWT) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) Label(org.eclipse.swt.widgets.Label) LabelProvider(org.eclipse.jface.viewers.LabelProvider) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Aggregations

DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)88 SelectionEvent (org.eclipse.swt.events.SelectionEvent)51 Button (org.eclipse.swt.widgets.Button)49 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)48 GridData (org.eclipse.swt.layout.GridData)48 GridLayout (org.eclipse.swt.layout.GridLayout)47 Text (org.eclipse.swt.widgets.Text)47 Composite (org.eclipse.swt.widgets.Composite)42 Label (org.eclipse.swt.widgets.Label)40 Group (org.eclipse.swt.widgets.Group)27 File (java.io.File)25 ModifyListener (org.eclipse.swt.events.ModifyListener)22 ModifyEvent (org.eclipse.swt.events.ModifyEvent)21 Combo (org.eclipse.swt.widgets.Combo)21 FileDialog (org.eclipse.swt.widgets.FileDialog)11 TableViewer (org.eclipse.jface.viewers.TableViewer)8 Table (org.eclipse.swt.widgets.Table)8 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)7 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7