use of org.eclipse.swt.widgets.DirectoryDialog in project sling by apache.
the class ChooseArchetypeWizardPage method createControl.
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
useDefaultWorkspaceLocationButton = new Button(container, SWT.CHECK);
GridData useDefaultWorkspaceLocationButtonData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
useDefaultWorkspaceLocationButton.setLayoutData(useDefaultWorkspaceLocationButtonData);
useDefaultWorkspaceLocationButton.setText("Use default Workspace location");
useDefaultWorkspaceLocationButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean inWorkspace = useDefaultWorkspaceLocationButton.getSelection();
locationLabel.setEnabled(!inWorkspace);
locationCombo.setEnabled(!inWorkspace);
dialogChanged();
}
});
useDefaultWorkspaceLocationButton.setSelection(true);
locationLabel = new Label(container, SWT.NONE);
GridData locationLabelData = new GridData();
locationLabelData.horizontalIndent = 10;
locationLabel.setLayoutData(locationLabelData);
locationLabel.setText("Location:");
locationLabel.setEnabled(false);
locationCombo = new Combo(container, SWT.NONE);
GridData locationComboData = new GridData(SWT.FILL, SWT.CENTER, true, false);
locationCombo.setLayoutData(locationComboData);
locationCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
});
locationCombo.setEnabled(false);
Button locationBrowseButton = new Button(container, SWT.NONE);
GridData locationBrowseButtonData = new GridData(SWT.FILL, SWT.CENTER, false, false);
locationBrowseButton.setLayoutData(locationBrowseButtonData);
locationBrowseButton.setText("Browse...");
locationBrowseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setText("Select Location");
String path = locationCombo.getText();
if (path.length() == 0) {
path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toPortableString();
}
dialog.setFilterPath(path);
String selectedDir = dialog.open();
if (selectedDir != null) {
locationCombo.setText(selectedDir);
useDefaultWorkspaceLocationButton.setSelection(false);
dialogChanged();
}
}
});
Label label = new Label(container, SWT.NULL);
label.setText("&Archetype:");
knownArchetypes = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
knownArchetypes.setLayoutData(gd);
knownArchetypes.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
dialogChanged();
}
});
knownArchetypes.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
getContainer().showPage(getNextPage());
}
});
setPageComplete(false);
MavenPlugin.getIndexManager().addIndexListener(this);
setControl(container);
}
use of org.eclipse.swt.widgets.DirectoryDialog in project bndtools by bndtools.
the class ImportBndWorkspaceWizardPageOne method createControl.
@Override
public void createControl(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
Label lblFolder = new Label(container, SWT.NONE);
lblFolder.setText("Root Directory:");
txtFolder = new Text(container, SWT.BORDER | SWT.SINGLE);
txtFolder.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent event) {
getWizard().getContainer().updateButtons();
}
});
//Adding the decorator
txtFolderErrorDecorator = new ControlDecoration(txtFolder, SWT.TOP | SWT.RIGHT);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
Image img = fieldDecoration.getImage();
txtFolderErrorDecorator.setImage(img);
txtFolderErrorDecorator.setDescriptionText("Selected folder must contain valid Bnd Workspace configuration project.");
// hiding it initially
txtFolderErrorDecorator.hide();
Button btnOpenDialog = new Button(container, SWT.PUSH);
btnOpenDialog.setText("Browse...");
btnOpenDialog.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dirDialog = new DirectoryDialog(container.getShell());
dirDialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
dirDialog.setText("Select the folder containing the project.");
txtFolder.setText(dirDialog.open());
getWizard().getContainer().updateButtons();
}
});
Label lblProjects = new Label(container, SWT.NONE);
lblProjects.setText("Projects:");
tableViewer = new TableViewer(container, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
tableViewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
// configuration project always first
if (e1 instanceof File && e2 instanceof Project) {
return -1;
} else if (e1 instanceof Project && e2 instanceof File) {
return 1;
}
Project p1 = (Project) e1;
Project p2 = (Project) e2;
return super.compare(viewer, p1.getName(), p2.getName());
}
});
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
// Disable selection since the tableviewer should be readonly, but not disabled
if (!event.getSelection().isEmpty()) {
tableViewer.setSelection(StructuredSelection.EMPTY);
}
}
});
TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
column.setLabelProvider(new ProjectsColumnLabelProvider());
Button refreshButton = new Button(container, SWT.PUSH);
refreshButton.setText("Refresh");
refreshButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
getWizard().getContainer().updateButtons();
}
});
deleteButton = new Button(container, SWT.CHECK);
deleteButton.setText("Delete existing settings");
inferExecutionEnvironmentButton = new Button(container, SWT.CHECK);
inferExecutionEnvironmentButton.setSelection(true);
inferExecutionEnvironmentButton.setText("Infer execution-environment (J2SE and JavaSE).");
inferExecutionEnvironmentButton.setToolTipText("Uses the 'javac.target' from the Bnd Workspace to infer a Execution Environment to the JRE container. If nothing matches, the default JRE will be used.\nExisting containers will be removed.");
FormLayout layout = new FormLayout();
container.setLayout(layout);
FormData fd_lblFolder = new FormData();
fd_lblFolder.top = new FormAttachment(0, 10);
fd_lblFolder.left = new FormAttachment(0, 10);
lblFolder.setLayoutData(fd_lblFolder);
FormData fd_txtFolder = new FormData();
fd_txtFolder.top = new FormAttachment(lblFolder, 0, SWT.CENTER);
fd_txtFolder.left = new FormAttachment(lblFolder, 10);
fd_txtFolder.right = new FormAttachment(100, -100);
txtFolder.setLayoutData(fd_txtFolder);
FormData fd_btnDialog = new FormData();
fd_btnDialog.top = new FormAttachment(lblFolder, 0, SWT.CENTER);
fd_btnDialog.left = new FormAttachment(txtFolder, 10);
fd_btnDialog.right = new FormAttachment(100, -10);
btnOpenDialog.setLayoutData(fd_btnDialog);
FormData fd_lblProjects = new FormData();
fd_lblProjects.top = new FormAttachment(lblFolder, 20);
fd_lblProjects.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
lblProjects.setLayoutData(fd_lblProjects);
FormData fd_table = new FormData();
fd_table.top = new FormAttachment(lblProjects, 5);
fd_table.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
fd_table.right = new FormAttachment(100, -100);
fd_table.bottom = new FormAttachment(100, -55);
tableViewer.getTable().setLayoutData(fd_table);
FormData fd_btnRefresh = new FormData();
fd_btnRefresh.top = new FormAttachment(tableViewer.getTable(), 0, SWT.TOP);
fd_btnRefresh.left = new FormAttachment(btnOpenDialog, 0, SWT.LEFT);
fd_btnRefresh.right = new FormAttachment(100, -10);
refreshButton.setLayoutData(fd_btnRefresh);
FormData fd_btnDelete = new FormData();
fd_btnDelete.top = new FormAttachment(tableViewer.getTable(), 10);
fd_btnDelete.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
deleteButton.setLayoutData(fd_btnDelete);
FormData fd_btnInfer = new FormData();
fd_btnInfer.top = new FormAttachment(deleteButton, 10);
fd_btnInfer.left = new FormAttachment(lblFolder, 0, SWT.LEFT);
inferExecutionEnvironmentButton.setLayoutData(fd_btnInfer);
getShell().setMinimumSize(470, 450);
// required to avoid an error in the system
setControl(parent);
setPageComplete(false);
txtFolder.setText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
}
use of org.eclipse.swt.widgets.DirectoryDialog in project azure-tools-for-java by Microsoft.
the class SrvPriSettingsDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
setTitle("Create Authentication Files");
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayout(new GridLayout(1, false));
container.setLayoutData(new GridData(GridData.FILL_BOTH));
Label lblInfo = new Label(container, SWT.WRAP);
GridData gd_lblInfo = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_lblInfo.heightHint = 82;
lblInfo.setLayoutData(gd_lblInfo);
lblInfo.setText("A new Active Directory service principal representing this IDE will be created as needed and as allowed by your access permissions.\nThe service principal will be granted Contributor-level access to each selected subscription.");
Label lblNewLabel = new Label(container, SWT.NONE);
lblNewLabel.setEnabled(true);
lblNewLabel.setText("Select the subscriptions to create credentials for:");
table = new Table(container, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION);
table.setEnabled(true);
GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd_table.heightHint = 300;
table.setLayoutData(gd_table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn tblclmnSubscriptionName = new TableColumn(table, SWT.NONE);
tblclmnSubscriptionName.setWidth(250);
tblclmnSubscriptionName.setText("Subscription Name");
TableColumn tblclmnSubscriptionId = new TableColumn(table, SWT.NONE);
tblclmnSubscriptionId.setWidth(300);
tblclmnSubscriptionId.setText("Subscription ID");
for (SubscriptionDetail sd : sdl) {
TableItem item = new TableItem(table, SWT.NULL);
item.setText(new String[] { sd.getSubscriptionName(), sd.getSubscriptionId() });
item.setChecked(sd.isSelected());
}
Group grpDestinationFolder = new Group(container, SWT.NONE);
grpDestinationFolder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
grpDestinationFolder.setText("Destination folder:");
grpDestinationFolder.setLayout(new GridLayout(2, false));
textDestinationFolderPath = new Text(grpDestinationFolder, SWT.BORDER | SWT.READ_ONLY);
textDestinationFolderPath.setEditable(false);
textDestinationFolderPath.setEnabled(true);
textDestinationFolderPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
String initDirPath = System.getProperty("user.home");
textDestinationFolderPath.setText(initDirPath);
dirDialog = new DirectoryDialog(this.getShell());
dirDialog.setFilterPath(initDirPath);
dirDialog.setText("Select Destination Folder");
Button btnBrowse = new Button(grpDestinationFolder, SWT.NONE);
btnBrowse.setEnabled(true);
btnBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String path = dirDialog.open();
if (path == null)
return;
textDestinationFolderPath.setText(path);
}
});
btnBrowse.setText("...");
return area;
}
use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.
the class BuildDockerImageLaunchConfigurationMainTab method onBrowseFileSystemForDirectory.
/**
* Opens a dialog to browse the file system and select a directory
*
* @return
*/
private SelectionListener onBrowseFileSystemForDirectory(final Text pathText) {
return SelectionListener.widgetSelectedAdapter(e -> {
final DirectoryDialog dialog = new DirectoryDialog(getShell());
final String selection = dialog.open();
if (selection != null) {
pathText.setText(selection);
buildContextPathWorkspaceRelative = false;
}
});
}
use of org.eclipse.swt.widgets.DirectoryDialog in project linuxtools by eclipse.
the class NewDockerConnectionPage 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);
}
});
}
Aggregations