use of org.eclipse.swt.events.SelectionListener in project tdi-studio-se by Talend.
the class JobScriptsExportWizardPage method createJobVersionGroup.
/**
* ftang Comment method "createJobVersionGroup".
*
* @param composite
*/
protected void createJobVersionGroup(Composite parent) {
Group versionGroup = new Group(parent, SWT.NONE);
GridLayout layout = new GridLayout();
versionGroup.setLayout(layout);
versionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//$NON-NLS-1$
versionGroup.setText(Messages.getString("JobScriptsExportWSWizardPage.newJobVersion", getProcessType()));
versionGroup.setFont(parent.getFont());
versionGroup.setLayout(new GridLayout(1, true));
Composite left = new Composite(versionGroup, SWT.NONE);
left.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
left.setLayout(new GridLayout(3, false));
Label label = new Label(left, SWT.NONE);
//$NON-NLS-1$
label.setText(Messages.getString("JobScriptsExportWSWizardPage.newJobVersion.Label", getProcessType()));
final Combo versionCombo = new Combo(left, SWT.PUSH);
GridData gd = new GridData();
gd.horizontalSpan = 1;
versionCombo.setLayoutData(gd);
String[] allVersions = JobVersionUtils.getAllVersions(nodes[0]);
Arrays.sort(allVersions);
String currentVersion = JobVersionUtils.getCurrentVersion(nodes[0]);
versionCombo.setItems(allVersions);
if (allVersions.length > 1) {
versionCombo.add(RelationshipItemBuilder.LATEST_VERSION);
}
versionCombo.setText(currentVersion);
selectedJobVersion = currentVersion;
versionCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedJobVersion = versionCombo.getText();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
}
use of org.eclipse.swt.events.SelectionListener in project tdi-studio-se by Talend.
the class SpagicPreferencePage method createFieldEditors.
/*
* @Override protected IPreferenceStore doGetPreferenceStore() { // SpagoPreferenceStore preferenceStore = new
* SpagoPreferenceStore(ProxyRepositoryFactory.getInstance()); // try { // preferenceStore.load(); // } catch
* (PersistenceException e) { // String detailError = e.getMessage(); // new ErrorDialogWidthDetailArea(new Shell(),
* RepositoryPlugin.PLUGIN_ID, Messages // .getString("CommonWizard.persistenceException"), detailError);
* //$NON-NLS-1$ // log.error(Messages.getString("CommonWizard.persistenceException") + "\n" + detailError);
* //$NON-NLS-1$ // //$NON-NLS-2$ // } // return preferenceStore; return
* Activator.getDefault().getPreferenceStore(); }
*/
@Override
protected void createFieldEditors() {
parent = getFieldEditorParent();
spagicCheckButton = new CheckBoxFieldEditor(SpagicPreferenceInitializer.SPAGIC_STATUS, "Enable/Disable Deploy on Spagic", //$NON-NLS-1$
parent);
//$NON-NLS-1$
editor = new SpagicServerEditor(SpagoBiServer.SPAGOBI_SERVER, "Spagic server", parent);
addField(editor);
updateEnableStateFromPreferences();
SelectionListener listener = new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
IPreferenceStore preferenceStore = getPreferenceStore();
preferenceStore.setValue(SpagicPreferenceInitializer.SPAGIC_STATUS, ((Button) e.getSource()).getSelection());
updateEnableStateFromDisplay();
}
};
spagicCheckButton.getButton().addSelectionListener(listener);
// disable the spagic feature
// spagicCheckButton.setEnabled(false, parent);
}
use of org.eclipse.swt.events.SelectionListener in project tdi-studio-se by Talend.
the class FindDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(3, false);
container.setLayout(layout);
Label label = new Label(container, SWT.CENTER);
final Text text = new Text(container, SWT.BORDER);
final Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
group.setText("Direction");
group.setLayout(new RowLayout(SWT.VERTICAL));
final Button forwardButton = new Button(group, SWT.RADIO);
forwardButton.setText("Forward");
forwardButton.setSelection(true);
final Button backwardButton = new Button(group, SWT.RADIO);
backwardButton.setText("Backward");
final Label tempLabel = new Label(container, SWT.NONE);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
selectionLoaction = 0;
tempLabel.setText("");
locationRecord.clear();
firstSearch = true;
}
});
forwardButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
tempLabel.setText("");
}
});
backwardButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
tempLabel.setText("");
}
});
Button findButton = new Button(container, SWT.NONE);
findButton.setText("Find");
findButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (consoleText.getText().length() > 0) {
this.searchString(text.getText());
} else
tempLabel.setText("String not found");
}
private void searchString(String parameter) {
if (!parameter.equals("")) {
if (firstSearch == true) {
findAll(parameter);
firstSearch = false;
}
selectionLoaction = consoleText.getSelection().x;
boolean selected = false;
if (backwardButton.getSelection() == true) {
if (locationRecord.size() > 0) {
for (int i = locationRecord.size() - 1; i >= 0; i--) {
if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() < selectionLoaction) {
selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
selected = true;
break;
}
selected = false;
}
if (selected == false)
tempLabel.setText("String not found");
} else
tempLabel.setText("String not found");
} else {
if (locationRecord.size() > 0) {
for (int i = 0; i < locationRecord.size(); i++) {
if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() > selectionLoaction) {
selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
selected = true;
break;
}
selected = false;
}
if (selected == false)
tempLabel.setText("String not found");
} else
tempLabel.setText("String not found");
}
}
}
private void findAll(String parameter) {
if (!parameter.equals("")) {
int location = -1;
do {
location = consoleText.getText().substring(selectionLoaction).indexOf(parameter);
if (location > -1) {
selectionLoaction = selectionLoaction + location + parameter.length();
locationRecord.add(selectionLoaction);
} else
break;
} while ((selectionLoaction + parameter.length()) <= consoleText.getText().length());
}
}
});
GridData data = new GridData(GridData.CENTER);
data.horizontalSpan = 1;
label.setText("Find: ");
label.setLayoutData(data);
GridData data1 = new GridData(GridData.CENTER);
data1.horizontalSpan = 2;
data1.widthHint = 180;
data1.grabExcessVerticalSpace = true;
text.setLayoutData(data1);
GridData data2 = new GridData(GridData.CENTER);
data2.horizontalSpan = 3;
data2.widthHint = 215;
data2.grabExcessVerticalSpace = true;
group.setLayoutData(data2);
GridData data3 = new GridData(GridData.CENTER);
data3.horizontalSpan = 2;
data3.widthHint = 150;
tempLabel.setLayoutData(data3);
GridData data4 = new GridData(GridData.CENTER);
data4.horizontalSpan = 1;
data4.widthHint = 65;
findButton.setLayoutData(data4);
return container;
}
use of org.eclipse.swt.events.SelectionListener in project tdi-studio-se by Talend.
the class LoginFirstTimeStartupActionPage method addListeners.
@Override
protected void addListeners() {
super.addListeners();
finishButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (FINISH_BUTTON_ACTION_CREATE_NEW_PROJECT.equals(finishButtonAction)) {
createNewProject();
} else if (FINISH_BUTTON_ACTION_IMPORT_DEMO_PROJECT.equals(finishButtonAction)) {
importDemoProject();
} else if (FINISH_BUTTON_ACTION_IMPORT_EXISTING_PROJECT.equals(finishButtonAction)) {
importExistingProject();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
createNewProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (createNewProject.getSelection()) {
selectNewProjectName();
validateNewProjectName();
finishButtonAction = FINISH_BUTTON_ACTION_CREATE_NEW_PROJECT;
} else {
//$NON-NLS-1$
createNewProject.setText(Messages.getString("LoginFirstTimeStartupActionPage.createNewProject"));
getErrorManager().clearCreateNewProjectError();
newProjectName.setVisible(false);
newProjectName.setBackground(null);
finishButton.setEnabled(true);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
newProjectName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validateNewProjectName();
}
});
importDemoProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
finishButtonAction = FINISH_BUTTON_ACTION_IMPORT_DEMO_PROJECT;
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
importExistingProject.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
finishButtonAction = FINISH_BUTTON_ACTION_IMPORT_EXISTING_PROJECT;
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
manageConnections.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
ConnectionsDialog connectionsDialog = new ConnectionsDialog(getShell());
int open = connectionsDialog.open();
if (open == Window.OK) {
LoginFirstTimeStartupActionPageErrorManager iErrorManager = getErrorManager();
iErrorManager.clearManageConnectionsError();
iErrorManager.clearManageConnectionsWarn();
refreshOperationAreaEnable(true);
List<ConnectionBean> storedConnections = connectionsDialog.getConnections();
if (storedConnections == null || storedConnections.isEmpty()) {
defaultConnectionBean = LoginHelper.createDefaultLocalConnection();
storedConnections = new ArrayList<ConnectionBean>();
storedConnections.add(defaultConnectionBean);
LoginHelper.getInstance().setStoredConnections(storedConnections);
LoginHelper.getInstance().saveConnections(storedConnections);
setRepositoryContextInContext();
} else if (storedConnections.size() == 1) {
defaultConnectionBean = storedConnections.get(0);
if (defaultConnectionBean.isComplete()) {
LoginHelper.getInstance().setStoredConnections(storedConnections);
LoginHelper.getInstance().saveConnections(storedConnections);
boolean shouldGotoNextPage = false;
if (LoginHelper.isRemoteConnection(defaultConnectionBean)) {
shouldGotoNextPage = true;
} else if (!LoginHelper.isWorkspaceSame(defaultConnectionBean)) {
shouldGotoNextPage = true;
} else {
shouldGotoNextPage = false;
}
if (shouldGotoNextPage) {
try {
gotoNextPage();
return;
} catch (Throwable e1) {
CommonExceptionHandler.process(e1);
}
} else {
setRepositoryContextInContext();
}
} else {
iErrorManager.setManageConnectionsError(Messages.getString(//$NON-NLS-1$
"LoginFirstTimeStartupActionPage.manageConnection.incomplete"));
refreshOperationAreaEnable(false);
}
} else {
try {
LoginHelper.getInstance().setStoredConnections(storedConnections);
LoginHelper.getInstance().saveConnections(storedConnections);
gotoNextPage();
return;
} catch (Throwable e1) {
CommonExceptionHandler.process(e1);
}
}
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing need to do
}
});
}
use of org.eclipse.swt.events.SelectionListener 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
}
});
}
Aggregations