use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class NotificationDetailsDialog method createButtons.
/**
* Creates the buttons.
*
* @param composite The parent composite
*/
private void createButtons(Composite composite) {
composite.setLayout(new GridLayout(1, false));
prevButton = new Button(composite, SWT.PUSH);
prevButton.setImage(getPrevImage());
prevButton.setToolTipText(Messages.prevButtonToolTip);
prevButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tree.selectPrevItem();
refreshWidgets();
}
});
nextButton = new Button(composite, SWT.PUSH);
nextButton.setImage(getNextImage());
nextButton.setToolTipText(Messages.nextButtonToolTip);
nextButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tree.selectNextItem();
refreshWidgets();
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class InvokeDialog method createButtonsForButtonBar.
/*
* @see Dialog#createButtonsForButtonBar(Composite)
*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
Button invokeButton = createButton(parent, IDialogConstants.CLIENT_ID, Messages.invokeButtonLabel, true);
invokeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
invoke();
}
});
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false);
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class NotificationFilteredTree method configureTree.
/**
* Configure the tree adding columns.
*/
private void configureTree() {
Tree tree = getViewer().getTree();
for (TreeColumn column : tree.getColumns()) {
column.dispose();
}
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
for (Entry<String, Boolean> entry : columns.entrySet()) {
NotificationColumn column = NotificationColumn.getColumn(entry.getKey());
if (!columns.get(column.label)) {
continue;
}
TreeColumn treeColumn = new TreeColumn(getViewer().getTree(), SWT.NONE);
treeColumn.setText(column.label);
treeColumn.setWidth(column.defalutWidth);
treeColumn.setAlignment(column.initialAlignment);
treeColumn.setToolTipText(column.toolTip);
treeColumn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (e.widget instanceof TreeColumn) {
sortColumn((TreeColumn) e.widget);
}
}
});
}
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class LoginProjectPage method addListeners.
@Override
protected void addListeners() {
super.addListeners();
connectionsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
try {
resetProjectOperationSelectionWithBusyCursor(false);
final ConnectionBean connection = getConnection();
if (connection == null) {
checkErrors();
return;
}
// }
if (connection == loginHelper.getCurrentSelectedConnBean()) {
return;
} else {
loginHelper.setCurrentSelectedConnBean(connection);
}
cancelAndClearFetchJobs();
errorManager.clearAllMessages();
// beforeConnBean = connection;
updateServerFields();
// Validate data
if (validateFields()) {
fillUIProjectListWithBusyCursor();
validateProject();
}
checkErrors();
validateUpdate();
} catch (PersistenceException e) {
CommonExceptionHandler.process(e);
} catch (JSONException e) {
CommonExceptionHandler.process(e);
}
}
});
selectExistingProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (selectExistingProject.getSelection()) {
// refreshProjectListAreaEnable(true);
finishButtonAction = FINISH_ACTION_OPEN_PROJECT;
// changeFinishButtonAction(finishButtonAction);
try {
checkErrors();
} catch (PersistenceException e1) {
CommonExceptionHandler.process(e1);
}
} else {
refreshProjectListAreaEnable(false);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
createSandBoxProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (createSandBoxProject.getSelection()) {
finishButtonAction = FINISH_ACTION_CREATE_SANDBOX;
// changeFinishButtonAction(finishButtonAction);
refreshUIFinishButtonEnable(false);
executeCreateSandBoxProject.setVisible(true);
executeCreateSandBoxProject.forceFocus();
} else {
executeCreateSandBoxProject.setVisible(false);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
importDemoProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (importDemoProject.getSelection()) {
finishButtonAction = FINISH_ACTION_IMPORT_DEMO_PROJECT;
// changeFinishButtonAction(finishButtonAction);
refreshUIFinishButtonEnable(false);
executeImportDemoProject.setVisible(true);
executeImportDemoProject.forceFocus();
} else {
executeImportDemoProject.setVisible(false);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
importLocalProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (importLocalProject.getSelection()) {
finishButtonAction = FINISH_ACTION_IMPORT_LOCAL_PROJECT;
// changeFinishButtonAction(finishButtonAction);
refreshUIFinishButtonEnable(false);
executeImportLocalProject.setVisible(true);
executeImportLocalProject.forceFocus();
} else {
executeImportLocalProject.setVisible(false);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
createNewProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (createNewProject.getSelection()) {
//$NON-NLS-1$
createNewProject.setText(Messages.getString("LoginProjectPage.createNewProject.beginCreate"));
createNewProject.pack();
FormData formData = (FormData) newProjectName.getLayoutData();
formData.left = new FormAttachment(createNewProject, createNewProject.getSize().x + TAB_HORIZONTAL_PADDING_LEVEL_2, SWT.LEFT);
newProjectName.setVisible(true);
newProjectName.forceFocus();
executeCreateNewProject.setVisible(true);
finishButtonAction = FINISH_ACTION_CREATE_NEW_PROJECT;
// changeFinishButtonAction(finishButtonAction);
refreshUIFinishButtonEnable(false);
validateNewProjectName();
} else {
//$NON-NLS-1$
createNewProject.setText(Messages.getString("LoginProjectPage.createNewProject"));
newProjectName.setVisible(false);
executeCreateNewProject.setVisible(false);
getErrorManager().clearCreateNewProjectError();
// refreshUIFinishButtonEnable();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
projectViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
finishButton.setEnabled(false);
Project project = getProject();
if (project != null) {
// last used project will be saved when click finish
// loginHelper.getPrefManipulator().setLastProject(project.getLabel());
fetchLicenseIfNeeded(project);
try {
fillUIBranches(project, false);
} catch (JSONException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
}
setRepositoryContextInContext();
}
finishButton.setEnabled(true);
}
});
branchesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
// last used branch of project will be saved when click finish
// String branch = getBranch();
// if (branch == null) {
// branch = SVNConstant.EMPTY;
// }
// Project project = getProject();
// try {
// loginHelper.getPrefManipulator().setLastSVNBranch(
// new JSONObject(project.getEmfProject().getUrl()).getString("location"), project.getTechnicalLabel(),
// branch);
// } catch (JSONException e) {
// // TODO Auto-generated catch block
// ExceptionHandler.process(e);
// }
}
});
manageButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
ConnectionsDialog connectionsDialog = new ConnectionsDialog(getShell());
int open = connectionsDialog.open();
if (open == Window.OK) {
List<ConnectionBean> storedConnections = connectionsDialog.getConnections();
loginHelper.setStoredConnections(storedConnections);
loginHelper.saveConnections();
fillUIContentsWithBusyCursor();
final ConnectionBean connection = getConnection();
if (connection == null) {
checkErrors();
return;
}
// beforeConnBean = connection;
updateServerFields();
// Validate data
if (validateFields()) {
fillUIProjectListWithBusyCursor();
validateProject();
}
checkErrors();
validateUpdate();
} else if (!LoginHelper.isRemoteConnection(getConnection())) {
fillUIProjectListWithBusyCursor();
validateProject();
checkErrors();
}
// setStatusArea();
} catch (PersistenceException e1) {
CommonExceptionHandler.process(e1);
} catch (JSONException e2) {
CommonExceptionHandler.process(e2);
}
}
});
refreshProjectButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
cancelAndClearFetchJobs();
LoginProjectPage.this.selectedProjectBeforeRefresh = getProject() == null ? null : getProject().getLabel();
// Validate data
if (validateFields()) {
fillUIProjectListWithBusyCursor();
validateProject();
}
try {
checkErrors();
validateUpdate();
} catch (PersistenceException e1) {
CommonExceptionHandler.process(e1);
} catch (JSONException e1) {
CommonExceptionHandler.process(e1);
}
setRepositoryContextInContext();
LoginProjectPage.this.selectedProjectBeforeRefresh = null;
}
});
newProjectName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validateNewProjectName();
}
});
executeCreateNewProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
createNewProjectWithBusyCursor();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
executeCreateSandBoxProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
createSandboxProject();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
executeImportDemoProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
importDemoProject();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
executeImportLocalProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
importProjects();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
finishButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (FINISH_ACTION_OPEN_PROJECT.equals(finishButtonAction)) {
setRepositoryContextInContext();
finishPressed();
} else if (FINISH_ACTION_RESTART.equals(finishButtonAction)) {
restartStudio();
} else if (FINISH_ACTION_UPDATE.equals(finishButtonAction) || FINISH_ACTION_UPDATE_DETAILS.equals(finishButtonAction)) {
updateStudio();
} else if (FINISH_ACTION_CREATE_SANDBOX.equals(finishButtonAction)) {
createSandboxProject();
} else if (FINISH_ACTION_IMPORT_DEMO_PROJECT.equals(finishButtonAction)) {
importDemoProject();
} else if (FINISH_ACTION_IMPORT_LOCAL_PROJECT.equals(finishButtonAction)) {
importProjects();
} else if (FINISH_ACTION_CREATE_NEW_PROJECT.equals(finishButtonAction)) {
createNewProjectWithBusyCursor();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class ConfigureConnParamDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite parentComposite = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 0;
parentComposite.setLayout(gridLayout);
IContext defaultContext = createContextComposite(parentComposite);
// Label hLabel = new Label(parentComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
//
// hLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ScrolledComposite scrolledComposite = new ScrolledComposite(parentComposite, SWT.V_SCROLL | SWT.BORDER);
mainComposite = new Composite(scrolledComposite, SWT.NONE);
gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 0;
mainComposite.setLayout(gridLayout);
addComponents(defaultContext);
GridData gridData = new GridData(GridData.FILL_BOTH);
scrolledComposite.setLayoutData(gridData);
scrolledComposite.setContent(mainComposite);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setMinSize(mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
contextCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Text text : allParamText) {
if (text != null && !text.isDisposed()) {
Object data = text.getData(TEXT_CONTROL);
if (data != null && data instanceof Text) {
resetValues(text, (Text) data);
}
}
}
}
});
return parentComposite;
}
Aggregations